agentleFS
puppyone-aipuppyone-ai/puppyone-cloud/AGENTS.md

puppyone-cloud

AGENTS.md1.3k starsChanged 2 months agoApache-2.0View on GitHub

AI assistants working on this codebase: the canonical Version Engine architecture is in docs/architecture/01-version-engine.md. PuppyOne is Git-native at the version layer: stock git talks to a credential-free /git/{project_id}.git or /git/{project_id}/scopes/{scope_id}.git locator and supplies its separate Git credential through HTTP auth, while Web/API/puppyone fs writes converge through the Product Operation Adapter. Do not introduce the removed legacy wire protocol, construct the bounded legacy /git/ap/<access_key>.git URL in new code, introduce an external version package, or restore old source naming. The normative Git…

  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Dependency injection: Use FastAPI Depends to inject Service and Repository

    line 148
  2. Very specific:

    Fully async: All I/O operations use async/await

    line 149
  3. Distinctive:

    Pydantic models: All request/response defined with Pydantic schemas

    line 150
  4. Distinctive:

    Do not rename physical tables or serialized job names as part of a source move.

    line 445

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

PuppyOne (ContextBase)

AI assistants working on this codebase: the canonical Version Engine architecture is in docs/architecture/01-version-engine.md. PuppyOne is Git-native at the version layer: stock git talks to a credential-free /git/{project_id}.git or /git/{project_id}/scopes/{scope_id}.git locator and supplies its separate Git credential through HTTP auth, while Web/API/puppyone fs writes converge through the Product Operation Adapter. Do not introduce the removed legacy wire protocol, construct the bounded legacy /git/ap/<access_key>.git URL in new code, introduce an external version package, or restore old source naming. The normative Git contract is docs/architecture/05-git-remote-accesspoint.md.

The canonical database release architecture is docs/architecture/13-database-release-governance.md. Schema changes use supabase/migrations; non-transactional/application-code data changes use immutable supabase/data_migrations artifacts through the portable runner. Never hide an external script between schema migrations.

Overview

PuppyOne is a cloud file system built for AI Agents, centered around two core pillars: Connect and Collaborate.

It aggregates information scattered across various sources into a unified Context Space, while providing a complete infrastructure for multi-party collaboration between humans and agents — authentication, access control, version history, audit logging, and backup/rollback. Through the file system, bash, and the MCP protocol, any agent can read and write this ContextBase just like a local file system.

Connect

  • Multi-source data connectors — OAuth connectors for 15+ platforms including Notion, GitHub, Gmail, Google Drive, Linear, Airtable, and more; also supports URL scraping, database connections, and custom scripts
  • Bidirectional local folder sync — Real-time sync between local directories and the cloud Context Space via Git Remote and Puppyone CLI entry points
  • MCP protocol exposure — Generates standard MCP interfaces for each agent or endpoint; any MCP-compatible client (Claude Desktop, Cursor, etc.) can connect directly
  • Code sandbox — Securely execute code in isolated Docker/E2B containers; agents can invoke sandbox endpoints remotely

Collaborate

  • Authentication & access control — JWT for human users + Access Key for machine authentication; agent-level node access permissions
  • Version history & rollback — File-level version management, arbitrary version diff comparison, one-click rollback; folder-level snapshots
  • Audit logging — Records all operations (who did what to which node, and when), fully traceable
  • Collaborative editing — Checkout/commit workflow, locking mechanism, conflict detection and resolution
  • Structured data management — Cloud file system (folders/JSON/Markdown/files), JSON Pointer table operations

Authorization boundary

  • Human access is resolved only by backend/src/platform/authorization/ as Organization context -> ProjectGrant -> optional child restriction.
  • project_members is the sole explicit Human Project role source. Organization membership supplies tenant context; an org-visible Project supplies only the Viewer baseline. Never use a Runtime key, Git remote, scope, or Agent visibility to create Human Project access.
  • Machine entry points resolve a RuntimeGrant bounded by an explicit Project-root or Scope target, its resolved view, mode, policy, and credential status. A RuntimeGrant cannot enter Team, Billing, Project settings, members, sharing, or credential-management control planes.
  • The canonical PuppyOne Git remote is the only local-to-Cloud locator. Desktop parses its Project-root or Scope target locally, then the current JWT must authorize that exact Project target before Cloud UI is shown. A Git URL is a locator, never authority. The Cloud does not register devices, folders, or checkouts, and legacy secret-bearing remotes never identify Cloud UI context.

Platform

  • Agent management — Create agents, bind tools, control access scope, SSE streaming chat
  • Full CLI coverage — Every operation available via command line, enabling AI coding tools like Claude Code to drive the platform directly
  • Unified access management — All access surface types (Git remote/CLI/agent/MCP/sandbox) are served through a single /api/v1/access entry point. access_surfaces targets Project root with scope_id = NULL or one real repository_scopes row; external source relationships live in connections.

Active Development Directories

  • backend/ — Python (FastAPI) backend service
  • frontend/ — Next.js frontend application
  • cli/ — Node.js command-line tool (Commander.js)
  • sandbox/ — Docker sandbox environment (JSON editing / code execution)

Deprecated Directories (do not modify)

  • PuppyEngine, PuppyFlow, PuppyStorage, tools

Backend

  • Language: Python 3.12+
  • Framework: FastAPI + Uvicorn (ASGI)
  • Package manager: uv (pyproject.toml)
  • Database: Supabase (PostgreSQL)
  • Storage: AWS S3 / LocalStack
  • LLM gateway: LiteLLM
  • Task queue: ARQ (Redis)
  • Logging: Loguru

Directory Structure

backend/
├── src/
│   ├── main.py                # App entrypoint & lifespan
│   ├── config.py              # Global config (Pydantic Settings)
│   │
│   ├── version_engine/        # Git-native Version Engine (core write funnel)
│   │   ├── adapters/
│   │   │   ├── git/           #   Git smart-HTTP protocol boundary
│   │   │   └── operations/    #   ProductOperationAdapter for Web/API/CLI
│   │   ├── application/       #   transaction engine, merge policy, Git objects
│   │   ├── domain/            #   write/conflict intents
│   │   ├── routers/           #   content, history, conflict, AP-FS, websocket
│   │   ├── server/            #   repo manager, Supabase/S3 adapters, auth
│   │   └── services/          #   tree reader/splice, hooks, outbox, GC
│   │
│   ├── content/               # Content node tree (folder/JSON/MD/file)
│   │   └── table/             #     Structured data tables (JSON Pointer)
│   ├── tool/                  # Tool registration & search index
│   │
│   ├── provider/              # External-source adapters, OAuth, database capabilities
│   │
│   ├── platform/              # Platform services
│   │   ├── auth/              #   JWT auth (Supabase Auth)
│   │   ├── organization/      #   Org management & member invitations
│   │   ├── project/           #   Project CRUD & members & dashboard
│   │   ├── profile/           #   User profile & onboarding status
│   │   ├── workspace/         #   Workspace management
│   │   └── analytics/         #   Usage analytics
│   │
│   ├── infra/                 # Infrastructure services
│   │   ├── supabase/          #   Supabase client & repository facade
│   │   ├── s3/                #   S3 storage service
│   │   ├── llm/               #   LLM service (generation + embedding)
│   │   ├── search/            #   Vector search (Turbopuffer + RRF)
│   │   ├── chunking/          #   Text chunking
│   │   ├── security/          #   Security module (AES-256-GCM)
│   │   ├── scheduler/         #   Scheduled tasks (APScheduler)
│   │   ├── sandbox/           #   Sandbox runtime (Docker/E2B execution engine)
│   │   ├── turbopuffer/       #   Turbopuffer vector DB client
│   │   └── mcp_health.py      #   Remote MCP transport health probe only
│   ├── ingest/                # File ingestion ETL (MineRU + LLM)
│   ├── context_publish/       # Public JSON publishing (short links)
│   ├── internal/              # Internal API (X-Internal-Secret)
│   └── utils/                 # Utilities (logging/middleware)
├── mcp_service/               # Standalone MCP Server service (FastMCP)
├── sql/                       # Database DDL & migrations
├── tests/                     # Tests
├── scripts/                   # Scripts
└── docs/                      # Feature documentation

Development Conventions

  • Layered architecture: Router → Service → Repository (Supabase) three-tier separation
  • Dependency injection: Use FastAPI Depends to inject Service and Repository
  • Fully async: All I/O operations use async/await
  • Pydantic models: All request/response defined with Pydantic schemas
  • Naming conventions: Files snake_case.py, classes PascalCase, functions/variables snake_case
  • DB table naming: New tables use plural snake_case (e.g. projects, access_surfaces, version_transactions). Deferred physical legacy names may appear only through backend/src/version_engine/server/db_names.py.
  • Route prefix: Business APIs under /api/v1, internal APIs under /internal
  • Module structure: Each module typically contains router.py, service.py, repository.py, schemas.py

Database Tables

All tables use plural snake_case names. The "unified access" architecture serves agents, MCP endpoints, sandbox endpoints, and Git-remote/CLI credentials through access_surfaces, differentiated by kind and targeted by (project_id, nullable scope_id). NULL means the Project-owned root; a non-NULL value references a true non-empty-path row in repository_scopes. Every machine secret lives hash-only in access_surface_credentials and is revealed only on issuance. Provider config must never contain credentials. External source relationships live in connections, and executions in sync_runs.

TableRepositoryDescription
projectssupabase/projects/repository.pyProjects
project_membersplatform/authorization/repository.pySole explicit Human Project membership/role fact
organizationsorganization/repository.pyOrganizations
org_membersorganization/repository.pyOrganization membership
org_invitationsorganization/repository.pyOrganization invitations
profilesprofile/repository.pyUser profiles
access_surfacesplatform/access/router.py, platform/access/surface_repository.pyUnified access surfaces keyed by kind, targeting Project root or one Scope through nullable scope_id
repository_scopesrepo/scope_repository.py, repo/scope_service.pyNon-root subtree geometry (path, exclude, max_mode); never a repository or credential owner
connections / sync_runsplatform/synchronize/repository.py, platform/synchronize/run_repository.pyExternal source relationships and their executions
access_permissionsplatform/access/adapters/agent/config/repository.pyAccess surface ↔ content node permissions
access_toolsplatform/access/adapters/agent/config/repository.py, tool/service.pyAccess surface ↔ tool bindings
content_nodes(dropped — replaced by Version Engine Git trees in object storage)Legacy content tree
toolssupabase/tools/repository.pyRegistered tools
access_surface_credentialsrepo/access_credentials.pyHash-only runtime credentials, including independently revocable user Git credentials; never stores a device, folder, or checkout identity
chunkschunking/repository.pyText chunks for search
uploadsupload/file/tasks/repository.pyFile upload/ingest tasks
etl_rulesupload/file/rules/repository_supabase.pyETL transformation rules
context_publishessupabase/context_publish/repository.pyPublic JSON short links
oauth_connectionsprovider/oauth/repository.pyOAuth integrations
chat_sessionsagent/chat/repository.pyAgent chat sessions
chat_messagesagent/chat/repository.pyAgent chat messages
agent_execution_logsagent/config/repository.py, scheduler/jobs/agent_job.pyScheduled agent execution logs
file_versions(deprecated — no longer used in code)Legacy file version history
folder_snapshots(deprecated — no longer used in code)Legacy folder snapshots
deferred version tablesversion_engine/server/db_names.pyPhysical compatibility names for commit/scope/outbox/object-location storage
audit_logsversion_engine/server/audit_repository.pyAudit trail
search_index_tasksproject/dashboard_router.pySearch indexing tasks
ingest_tasksproject/dashboard_router.pyIngestion tasks
agent_logsanalytics/service.pyAgent usage analytics
access_logsanalytics/service.py, analytics/router.pyAPI access analytics

API Routes

Route PrefixModuleDescription
/api/v1/organizationsorganizationOrg CRUD & members & invitations
/api/v1/projectsprojectProject CRUD & members & dashboard
/api/v1/content/{project_id}version_engine/routers/content_routerVersioned content tree, write, history, diff, rollback
/api/v1/tablestableData tables & JSON Pointer operations
/api/v1/toolstoolTool registration & search index
/api/v1/agentsplatform/access/adapters/agentAgent SSE streaming chat
/api/v1/agent-configplatform/access/adapters/agent/configAgent CRUD & access permissions
/api/v1/mcpplatform/access/adapters/agent/mcpMCP v3 tool binding & proxy
/api/v1/mcp-endpointsplatform/access/adapters/mcp_endpointMCP endpoint CRUD & API key
/api/v1/sandbox-endpointsplatform/access/adapters/sandbox_endpointSandbox endpoint CRUD & exec
/api/v1/accessplatform/accessUnified access management (all types)
/api/v1/integrationsplatform/synchronizeData source sync
/api/v1/filesystemconnectors/filesystemFilesystem access lifecycle
/api/v1/ingestuploadFile/URL ingestion ETL
/api/v1/ap-fsversion_engine/routers/access_point_fsPuppyone CLI scoped filesystem API
/git/{project_id}.git, /git/{project_id}/scopes/{scope_id}.gitversion_engine/entrypoints/git/routerCanonical Git smart-HTTP clone/fetch/push; credential is HTTP auth, not URL data
/git/ap/{access_key}.gitversion_engine/entrypoints/git/routerBounded, instrumented legacy compatibility only; never construct for new clients
/api/v1/workspaceworkspaceWorkspace management
/api/v1/db-connectordb_connectorExternal database access
/api/v1/publishescontext_publishPublic JSON short links
/api/v1/oauthprovider/oauthOAuth authorization (9+ platforms)
/api/v1/authauthAuthentication (login/refresh)
/api/v1/analyticsanalyticsUsage statistics
/api/v1/profileprofileUser profile & onboarding
/api/v1/s3s3File upload/download/presigned URLs
/internalinternalInternal service API
/p/{key}context_publishPublic JSON access (no auth required)
/healthmainHealth check

Common Commands

# Install dependencies
uv sync

# Start dev server
uv run uvicorn src.main:app --host 0.0.0.0 --port 9090 --reload --log-level info --no-access-log

# Run tests
uv run pytest
uv run pytest -m "not e2e"      # Exclude e2e tests

# Start file worker (ETL / OCR)
uv run arq src.upload.file.jobs.worker.WorkerSettings

Deployment

Railway multi-service deployment (shared codebase, differentiated by SERVICE_ROLE):

  • api (default): Main API service
  • file_worker: File ETL Worker (ARQ)
  • mcp_server: MCP protocol service (FastMCP)

Frontend

Workspace navigation and lifetime ownership are documented in docs/frontend/2026-09-20-workspace-refactor-design.md. Route entries compose domain features; features must not import app route implementations. Workspace navigation uses features/workspace/navigation so links and command actions share leave protection. Next owns project/view/path identity; do not reintroduce a page-local history router. Files DOM lifetime belongs to its layout, editor drafts/writes to editor sessions, and pane geometry to the layout store. Preserve the existing desktop appearance during responsive changes.

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • UI: React 18 + Tailwind CSS
  • Auth: Supabase Auth
  • State management: Zustand + React Context
  • Data fetching: SWR

Directory Structure

frontend/
├── app/                          # Next.js App Router pages
│   ├── (main)/                   # Route group (shared AppSidebar layout)
│   │   ├── projects/             # Projects module
│   │   │   └── [projectId]/      # Project detail pages
│   │   │       ├── data/         # Data explorer
│   │   │       ├── access/       # Access management
│   │   │       ├── toolkit/      # Agent toolkit
│   │   │       ├── monitor/      # Monitoring
│   │   │       └── settings/     # Project settings
│   │   ├── settings/             # Global settings
│   │   ├── tools-and-server/     # Tools & MCP server management
│   │   ├── home/                 # Home / dashboard
│   │   ├── billing/              # Billing
│   │   └── team/                 # Team management
│   ├── api/                      # API routes (agent, sandbox)
│   ├── auth/                     # Auth callbacks
│   ├── login/                    # Login page
│   ├── onboarding/               # Onboarding flow
│   └── oauth/                    # OAuth callbacks (multi-platform)
├── components/                    # React components
│   ├── agent/                    # Agent components
│   ├── chat/                     # Chat interface
│   ├── dashboard/                # Dashboard components
│   ├── editors/                  # Editors (JSON/Markdown/Code)
│   │   ├── code/                 # Monaco / CodeMirror
│   │   ├── markdown/             # Milkdown Markdown editor
│   │   ├── table/                # Tabular JSON editor
│   │   ├── tree/                 # Tree JSON editor
│   │   └── vanilla/              # Vanilla JSON editor
│   ├── sidebar/                  # Sidebar
│   ├── views/                    # Shared view components
│   ├── onboarding/               # Onboarding components
│   └── RightAuxiliaryPanel/      # Right auxiliary panel
├── lib/                          # Utilities & API clients
│   ├── hooks/                    # Custom React hooks
│   ├── apiClient.ts              # Base API client
│   ├── chatApi.ts                # Chat API
│   ├── contentTreeApi.ts         # Content tree API
│   ├── mcpApi.ts                 # MCP API
│   ├── mcpEndpointsApi.ts        # MCP endpoints API
│   ├── sandboxEndpointsApi.ts    # Sandbox endpoints API
│   ├── projectsApi.ts            # Projects API
│   ├── organizationsApi.ts       # Organizations API
│   ├── oauthApi.ts               # OAuth API
│   ├── ingestApi.ts              # Ingestion API
│   ├── dbConnectorApi.ts         # Database connector API
│   └── profileApi.ts             # User profile API
├── contexts/                     # React Context
│   ├── AgentContext.tsx           # Agent state management
│   └── WorkspaceContext.tsx       # Workspace state management
├── middleware.ts                  # Next.js middleware (auth & routing)
└── next.config.ts                # Next.js config

Common Commands

# Install dependencies
npm install

# Start dev server
npm run dev

# Production build
npm run build

Environment Variables

NEXT_PUBLIC_SUPABASE_URL        # Supabase URL
NEXT_PUBLIC_SUPABASE_ANON_KEY   # Supabase anon key
NEXT_PUBLIC_API_URL             # Backend API URL (default http://localhost:9090)
NEXT_PUBLIC_DEV_MODE            # Dev mode flag

CLI

  • Language: JavaScript (ESM)
  • Framework: Commander.js
  • Install: npm install -g puppyone

Directory Structure

cli/
├── bin/puppyone.js             # Entrypoint & command registration
├── src/
│   ├── commands/               # Command implementations
│   │   ├── auth.js             # Auth (login/logout/whoami/targets)
│   │   ├── org.js              # Organization management
│   │   ├── project.js          # Project management
│   │   ├── access.js           # Unified Access Point management (all access types)
│   │   ├── ap/                 # Access Point profile command domain
│   │   │   ├── index.js        # ap command registration
│   │   │   └── profiles.js     # login/use/list/current/logout/clear
│   │   ├── fs/                 # Access Point scoped filesystem command domain
│   │   │   ├── index.js        # fs command registration
│   │   │   ├── commands/       # ls/tree/find/cat/head/tail/stat/write/mkdir/touch/cp/mv/rm/upload/download
│   │   │   └── lib/            # shared FS context/http/path/render/read/transfer helpers
│   │   ├── ap.js               # Compatibility re-export only
│   │   ├── chat.js             # Agent chat (SSE streaming)
│   │   ├── config-cmd.js       # CLI configuration
│   │   ├── global.js           # Global commands (status/ps)
│   │   └── _daemon.js          # Filesystem sync daemon (internal, legacy)
│   ├── api.js                  # HTTP client
│   ├── config.js               # Config file read/write
│   ├── daemon.js               # Background daemon management
│   ├── registry.js             # Local access registry
│   ├── output.js               # Output formatting (human/JSON)
│   ├── helpers.js              # Shared utilities
│   └── state.js                # Sync state management

Key Commands

puppyone auth login                    # Sign in
puppyone project use "My Project"      # Set active project
puppyone access add notion <url>       # Connect a SaaS data source
puppyone access add agent "Bot"        # Create an AI agent
puppyone access add mcp "Data API"     # Create MCP endpoint
puppyone access add filesystem /docs   # Mount local folder sync
puppyone access ls                     # List all access points
puppyone status                        # Project dashboard
puppyone chat                          # Chat with an agent
puppyone fs semantics                  # Unix compatibility notes + resource limits for agents
puppyone fs rmdir empty-dir            # Remove an empty scoped directory through AP-FS

See docs/architecture/03-cli.md for full reference.


Sandbox

Lightweight Docker sandbox environment for securely executing CLI commands (e.g. jq for JSON editing) in isolated containers.

sandbox/
├── README.md          # Usage docs
├── Dockerfile         # Alpine + jq/bash/coreutils
└── test-data.json     # Sample test data

Both the frontend (app/api/sandbox/route.ts) and backend (src/infra/sandbox/) integrate with sandboxes; the backend also supports E2B cloud sandboxes.


Other Directories

DirectoryDescription
docs/Project-level documentation
assert/Static assets
scripts/Utility scripts
todo/Todo items
.github/GitHub Actions & CI

Four entrypoint ownership rules (ISSUE-048)

  • platform/upload: local uploads; platform/imports: external snapshots.
  • platform/synchronize: durable source bindings and runs, including github/.
  • platform/access: AccessSurface (kind, surface_id), Git/CLI/Agent/MCP/Sandbox access.
  • Shared provider/ supplies adapters to Import and Synchronize; it never imports these entrypoint lifecycles or publishes Version Engine writes.
  • Old HTTP names are wire contracts. Do not restore old Python business modules.
  • Do not rename physical tables or serialized job names as part of a source move. Database/internal compatibility cleanup is separately tracked by ISSUE-049.
  • Run uv run pytest -q -m 'not e2e and not integration and not network' from backend/; this includes dependency, OpenAPI and ARQ compatibility gates.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.