agentleFS
QredenceQredence/fleet-pi/AGENTS.md

fleet-pi

AGENTS.md9 starsChanged 7 months agoApache-2.0View on GitHub

Fleet Pi is a web workspace for the Pi coding agent: a TanStack Start app on Cloudflare Workers, a shadcn-style UI package, and a repo-local agent home in agent-workspace/. This file holds the rules agents must follow. Background and reference detail live in the linked docs. Start with docs/README.md, CONTEXT.md, and DESIGN.md. Run everything from the repository root with pnpm. Use pnpm --filter <workspace> <script> when only one package is affected. CI runs every backticked pnpm command in this file…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,040 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 repositoryOne other file it gives its agents.

The file

Show its rules and text

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

16 rules. About 0 are common, 3 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

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

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

    Run everything from the repository root with pnpm.

    line 11
  2. Very specific:

    Put new tests in a __tests__/ directory next to the code.

    line 63
  3. Very specific:

    Never commit defaultProvider, defaultModel, or enabledModels in .pi/settings.json.

    line 66
  4. Distinctive:

    When executing an attached plan, do not edit the plan file.

    line 70
  5. Very specific:

    Keep security and isolation audit notes gitignored (.cursor/hooks/state/), never under tracked agent-workspace/artifacts/.

    line 86
  6. Very specific:

    All UI lives in packages/hax-design.

    line 93
  7. Very specific:

    No inline style props. Use Tailwind, cva, co-located CSS, or the semantic tokens in fleet-pi/styles/tokens.ts.

    line 99
  8. Very specific:

    Prefer export-map hygiene over new shell or page-controller layers (for example FleetPiChatShell) until protocol types settle.

    line 102
  9. Distinctive:

    Avoid generic AI SaaS looks (cream backgrounds, gradient heroes, card grids) and dense IDE toolbars unless asked.

    line 121
  10. Very specific:

    Run pnpm chat:migrate after schema, ownership, or grant changes.

    line 188
  11. Distinctive:

    Never block a chat stream on cold sandbox creation.

    line 212
  12. Very specific:

    Keep each vendored extension's UPSTREAM.md current when refreshing it.

    line 229
  13. Very specific:

    Keep CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, and issue templates aligned with the real maintainer workflow.

    line 237
  14. Very specific:

    Use autoctx capabilities to inspect supported commands and project state.

    line 245
  15. Very specific:

    Use autoctx whoami to confirm provider credentials before running evaluations.

    line 246
  16. Very specific:

    Run autoctx run from this directory to use the defaults stored in .autoctx.json.

    line 247

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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

AGENTS.md

Fleet Pi is a web workspace for the Pi coding agent: a TanStack Start app on Cloudflare Workers, a shadcn-style UI package, and a repo-local agent home in agent-workspace/. This file holds the rules agents must follow. Background and reference detail live in the linked docs. Start with docs/README.md, CONTEXT.md, and DESIGN.md.

Commands

Run everything from the repository root with pnpm. Use pnpm --filter <workspace> <script> when only one package is affected. CI runs every backticked pnpm command in this file through pnpm validate-agents-md, so only add commands that are safe to execute.

  • Setup: pnpm install. Devcontainer: .devcontainer/devcontainer.json (port 3000, runs pnpm install on create).
  • Daily: pnpm typecheck, pnpm lint, pnpm test, pnpm build, pnpm e2e.
  • Format: pnpm format (write) and pnpm format:check (CI gate). Both are Oxfmt through Vite+; import order and Tailwind class order are part of it.
  • Quality: pnpm syncpack (fix drift with pnpm syncpack:fix), pnpm knip, pnpm jscpd, pnpm tech-debt, pnpm guard:no-eslint-prettier.
  • Docs: pnpm generate:docs after doc-generator sources change; pnpm generate:openapi after pi-protocol schemas or route contracts change (pnpm generate:openapi -- --check in CI); pnpm generate:openui-signatures after OpenUI component signatures change; pnpm validate-agents-md after editing this file.
  • Bundle size: pnpm build --filter web, then open apps/web/bundle-report/stats.html.
  • Cloudflare: pnpm build:cloudflare when Worker routing changes; pnpm verify-deployment-readiness before promotion.
  • Neon (needs credentials): pnpm neon:deploy, pnpm neon:env-pull, pnpm neon:verify, pnpm auth:migrate, pnpm chat:migrate (needs FLEET_PI_CHAT_MIGRATION_DATABASE_URL). neon deploy provisions services only; run both migrations separately.
  • Data repair (owner URL; dry-run first, --purge only after approval): pnpm quarantine-orphan-sessions, pnpm remap-auth-user-ids -- --file=remap.csv.

Deploy steps: docs/wiki/deployment.md and docs/runbooks/deployment-release-gate.md.

Repository map

  • apps/web: TanStack Start app. Routes in src/routes/; src/routeTree.gen.ts is generated, never edit it. /api/chat is src/routes/api/chat.ts.
  • apps/web/src/lib/pi/: server-side Pi integration. runtime/ holds the session factory, settings bridge, catalogs, and hot reload. durable/ holds the hosted UserPiDurable path. server.ts is the route-facing barrel.
  • packages/hax-design: the only UI source (primitives, agent-elements/, components/openui/, components/fleet-pi/).
  • packages/pi-protocol: browser-safe chat wire layer (types, Zod schemas, chat-types, provider catalog, OpenUI prompt). No React.
  • .pi/: Pi compatibility bridge (settings, skills, extensions, vendored extensions with UPSTREAM.md).
  • agent-workspace/: the agent's durable home (skills, memory, plans, evals, artifacts). See docs/agent-workspace.md.

General rules

  • One lockfile: root pnpm-lock.yaml. Never create nested lockfiles.
  • Put new tests in a __tests__/ directory next to the code. Write E2E artifacts to Playwright testInfo.outputPath(), never machine paths.
  • AGENTS.md is the only agent instruction file; do not recreate CLAUDE.md.
  • Never commit defaultProvider, defaultModel, or enabledModels in .pi/settings.json. Users choose models in Settings. The file stays gitignored, and apps/web/src/lib/pi/__tests__/resource-expectations.test.ts fails if it is ever tracked again.
  • When executing an attached plan, do not edit the plan file; finish its todos.
  • The pre-commit hook (Husky + lint-staged) runs vp fmt and vp lint --fix on staged files in apps, packages, and .pi/extensions. git config core.hooksPath must point at .husky. Fix lint errors; do not bypass the hook.
  • Oxfmt and Oxlint are configured only in the fmt and lint blocks of the root vite.config.ts. Never add .prettierrc, .prettierignore, or an eslint.config.*; pnpm guard:no-eslint-prettier fails CI's lint job if they reappear, and .syncpackrc bans the packages themselves.
  • Naming is review policy, not a lint rule: camelCase for variables, functions, and object keys; PascalCase for types and components (and for component-shaped functions or factory results such as const Badge = ...); SCREAMING_SNAKE_CASE only for true module constants. Prefix booleans with is/has/should/can where the name would otherwise be ambiguous. Use _ only for a deliberately unused parameter; that case is exempt from no-underscore-dangle.
  • Keep security and isolation audit notes gitignored (.cursor/hooks/state/), never under tracked agent-workspace/artifacts/.

UI rules

Design context: DESIGN.md, PRODUCT.md, packages/hax-design/ARCHITECTURE.md.

  • All UI lives in packages/hax-design; routes only compose its exports. Never add components under apps/web/src/components/. Add registry components with pnpm dlx shadcn@latest add <name> -c packages/hax-design.
  • Inside hax-design use relative imports; apps import @workspace/hax-design/*.
  • OpenUI library and registry code lives in components/openui/. Deepen it instead of adopting @openuidev/react-ui unless asked.
  • No inline style props. Use Tailwind, cva, co-located CSS, or the semantic tokens in fleet-pi/styles/tokens.ts. Prefer fleet-pi/primitives/ (ItemRow variants) over nested cards or repeated class strings.
  • Prefer export-map hygiene over new shell or page-controller layers (for example FleetPiChatShell) until protocol types settle.
  • Header chrome stays floating pills (bg-sidebar when inactive, rounded-full). Panel tabs use TabsSubtle (Active Label and pill variants) inline when panels are open, and the header stacks above the content row (CHAT_HEADER_LAYER_CLASS).
  • The chat column is one transcript plus the InputBar. The right panel holds Workspace, Pi Resources, and Artifacts only, all scoped to agent-workspace/. Settings (providers, models, skills, appearance, sandbox) live in the Settings dialog.
  • The Settings dialog follows shadcn sidebar-13: icon+label nav, flat ItemRow lists, an inline drill-down for Add provider (no nested Dialogs), and auto-save via PATCH /api/chat/settings.
  • Slash suggestions come from /api/chat/commands, scroll, and are arrow-key navigable. Pi builtins open UI (/model opens the picker; /models, /settings, /config open Settings); skill and prompt commands go to the agent.
  • Settings › Providers lists only configured providers. LLM Models curates models discovered from them, grouped by provider with an All/Enabled filter.
  • Avoid generic AI SaaS looks (cream backgrounds, gradient heroes, card grids) and dense IDE toolbars unless asked.

Chat runtime

Reference: docs/wiki/apps/web/pi-integration.md, docs/wiki/apps/web/plan-mode.md, docs/wiki/api/endpoints.md.

  • Protocol types come from @workspace/pi-protocol (UI message types from @workspace/pi-protocol/chat-types). Server code never imports agent-elements or openui components.
  • handleChatTurn (apps/web/src/lib/pi/handle-chat-turn.ts) owns turn logic. The /api/chat route only authenticates, parses, and pipes NDJSON.
  • Local and legacy sessions are Pi JSONL files. An invalid, outside, or missing session file starts a fresh project-scoped session; never surface an error. Hosted Agent sessions use durable: ids, and their transcript is the Durable Object.
  • File tools and bash cwd stay inside the active project or workspace root.
  • Modes: Agent has the coding tools plus approved external tools. Plan is read-only: never give it mutating, file-change, subagent, or fetch_content tools. Harness allows evaluation writes. Allowlists live in plan-mode.ts.
  • Model choices come from Pi ModelRegistry/SettingsManager, never a hard-coded UI list. enabledModels: [] means deny-all.

Hosted deployment (Cloudflare)

Reference: docs/wiki/deployment.md, docs/adr/0004-user-controlled-transcript-deletion.md.

  • Hosted transcripts live in each user's UserPiDurable Durable Object. Neon holds auth, settings, and an optional projection that must never fail a hosted turn. The Daytona volume holds harness files and artifacts. Do not add an R2 binding. Neon Object Storage is limited to the private fleet-pi-spike proof bucket in neon.ts (preview.buckets) — not for transcripts or agent-workspace. Productizing more buckets needs an ADR.
  • DELETE /api/chat/account erases the Durable Object as well as Neon rows. Deleting one hosted session is only a tombstone (Pi Durable has no per-conversation delete).
  • Without a Daytona key, hosted turns use the Durable Object workspace store (durable/do-workspace-store.ts): allowlisted text files, no shell. It syncs to the volume on the first sandbox turn and never overwrites a file that differs there (.fleet/do-import/ instead).
  • Worker code must not import from .pi/; colocate helpers under apps/web/src/lib/pi/. Existing exceptions are tracked in agent-workspace/memory/project/known-issues.md.
  • Per-user Pi settings persist in Neon pi_user_settings; .pi/settings.json is not writable on Workers. Fleet base defaults merge from code (fleet-default-project-settings.ts) and ship no provider or model. Settings paths must be portable (no /Users/…).
  • Org LLM keys (GEMINI_API_KEY, OPENROUTER_API_KEY, …) never back chat on Workers. They are scrubbed from the process. Chat uses signed-in user BYOK or the platform Neon AI Gateway.

Auth and data isolation

Reference: docs/wiki/security.md, docs/runbooks/deployment-release-gate.md.

  • Deploys use Neon Managed Auth (NEON_AUTH_BASE_URL / VITE_NEON_AUTH_URL). Local anonymous or SQLite Better Auth applies only when neither is set. BETTER_AUTH_SECRET is still required for BYOK encryption.
  • Session-scoped chat and workspace APIs require auth on Workers through withAuthenticatedChatRequest. auth-mode.ts stays client-safe; server auth lives in chat-api-auth.ts.
  • Runtime FLEET_PI_CHAT_DATABASE_URL must be the non-owner fleet_pi_app role. pi_* tables keep FORCE ROW LEVEL SECURITY. Mirror ownership probes fail closed.
  • Neon Data API stays off (dataApi: false). Never grant authenticated or anonymous on pi_*, and never expose neon_auth.*.
  • Run pnpm chat:migrate after schema, ownership, or grant changes.

Providers and models

Reference: docs/wiki/apps/web/pi-integration.md.

  • Provider ids live in packages/pi-protocol/src/provider-catalog.ts. The Google id is google (GEMINI_API_KEY); GOOGLE_CLIENT_* are OAuth only.
  • The composer picker lists only models the user added. The full catalog is Settings-only (scope=all).
  • OpenAI Chat Completions (openai-chat-completions) registers only the configured model id, never a remote /models catalog. Without OCC BYOK, authenticated deploys back it with Neon AI Gateway (max_tokens ≤ 25,000).
  • Custom providers register as native Pi providers (custom+<slug>) and reuse pi_user_providers; there is no migration.

Daytona

Reference: docs/daytona.md.

  • On Workers, sandboxes use only each user's BYOK Daytona key. Org keys and DAYTONA_API_KEY never back user sandboxes (local dev may use them).
  • Volume fleet-pi-ws-{userId} mounts only at /home/daytona/agent-workspace. Seeding never overwrites user files.
  • Never block a chat stream on cold sandbox creation; use the cached sandbox or a background warm-up.
  • The web adapter is .pi/extensions/daytona-sandbox.ts. Stock npm:@daytona/pi is CLI-only; never list it in .pi/settings.json.

agent-workspace and memory

  • Durable project memory lives in agent-workspace/memory/project/{architecture,decisions,preferences,open-questions,known-issues}.md. "Remember this" updates the narrowest file; do not create ad hoc memory files.
  • apps/web/src/lib/workspace/server.ts owns the layout. Seeding creates missing Markdown stubs and never overwrites existing files.
  • Chat-driven Pi resource installs use resource_install and land under agent-workspace/pi/{skills,prompts,extensions,packages}. Skills and prompts apply after reload. Extensions and packages stay staged unless the user asks to activate them. "Plugins" means Pi resource packages, not Codex or Claude plugin bundles.
  • Keep each vendored extension's UPSTREAM.md current when refreshing it.

Docs upkeep

  • README.md is the public landing page; keep it short. docs/README.md is the docs hub, and docs/quickstart.md is onboarding.
  • docs/api.md, docs/architecture.md, and docs/project-structure.md are generated. Fix the generator or its sources, never the output.
  • Keep CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, and issue templates aligned with the real maintainer workflow.
  • Manual chat checks before release: docs/wiki/how-to-contribute/testing.md.
<!-- AUTOCTX_GUIDE_START -->

AutoContext

  • Use autoctx capabilities to inspect supported commands and project state.
  • Use autoctx whoami to confirm provider credentials before running evaluations.
  • Run autoctx run from this directory to use the defaults stored in .autoctx.json.
<!-- AUTOCTX_GUIDE_END -->

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.