agentleFS
iammrduncaniammrduncan/fxbot/packages/AGENTS.md

fxbot / packages

AGENTS.md17 starsChanged 3 days agoApache-2.0View on GitHub

Applies to everything under packages/. Follow the repository's AGENTS.md and CONVENTIONS.md. Three npm workspaces. The SDK has two public entry points: @fxbot/sdk for backends and @fxbot/sdk/client for HTTP consumers. They are exports of one package.

  • 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 32,671 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 repository6 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:

    Use @fxbot/sdk when backend code needs to run fxbot directly in its process.

    line 74
  2. Distinctive:

    Keep bot behavior out of route handlers and React hooks.

    line 92
  3. Distinctive:

    Keep the three-package layout.

    line 94
  4. Very specific:

    Run commands from the repository root with Node 22.18 or newer, after npm install:

    line 98

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

Package guide

Applies to everything under packages/. Follow the repository's AGENTS.md and CONVENTIONS.md.

What lives where

Three npm workspaces. The SDK has two public entry points: @fxbot/sdk for backends and @fxbot/sdk/client for HTTP consumers. They are exports of one package.

packages/
├── sdk/                         @fxbot/sdk — bot behavior and persistence
│   └── src/
│       ├── index.ts             createFxbot: input checks, profiles, settings,
│       │                        prompts, session resume, uploads, SDK streams,
│       │                        provider switches
│       ├── store.ts             the Postgres schema; profiles, settings,
│       │                        providers, attachment records
│       ├── library.ts           every bot's files, one copy each: saves and tags,
│       │                        search and listing, file reads, the library tools
│       ├── providers.ts         one libfx agent per provider, key checks,
│       │                        device code sign-ins, the refresh lock
│       ├── models.ts            each provider's models and what fxbot knows of them
│       ├── secrets.ts           sealing keys and tokens; the secrets table
│       ├── vercel.ts            Vercel account sign-in and its request fetch
│       ├── history.ts           messages, the chat_history tool, switch summaries
│       ├── types.ts             shared data contracts and the kinds table;
│       │                        no runtime imports
│       └── client.ts            @fxbot/sdk/client: fetch calls, stream parsing,
│                                reconnect cursors, applyLine turn reducer
├── server/                      @fxbot/server — HTTP adapter and process startup
│   └── src/
│       ├── index.ts             environment, routes, body limits, status codes,
│       │                        stream piping, static UI files, shutdown
│       └── rotate-key.ts        npm run rotate-key
└── ui/                          @fxbot/ui — Vite/React/shadcn PWA
    ├── vite.config.ts           the dev API process and proxy, PWA manifest and
    │                            offline shell
    ├── public/                  app icons
    └── src/
        ├── main.tsx             React entry point
        ├── app.tsx              routes, sidebar, forms, chat and composer
        ├── nav.ts               in-app navigation for links
        ├── library.tsx          the Library page and the item preview
        ├── bot-panel.tsx        the panel beside a chat: Details and Library tabs
        ├── providers.tsx        Settings' providers, sign-in dialog, key form
        ├── blob.tsx             a bot's look on the page, and its motion
        ├── blob-draw.ts         a look as SVG: eyes, what's worn. The site has a copy
        ├── blob-data.ts         shapes and color tones, from scripts/blob-data.mjs
        ├── look-picker.tsx      the look's tabs, and Surprise me
        ├── client.ts            the page's HTTP client instance
        ├── use-turn-stream.ts   React state and subscription lifecycle
        ├── attachments.ts       browser file reading, previews, image resizing
        ├── index.css            Tailwind and theme
        └── components/ui/,      shadcn components and their helpers
            lib/, hooks/

Choose the owner

If the change concerns…Put it in…Why
Bot rules, accepted inputs, model selection, prompts, session recoverysdk/src/index.tsThe same behavior must work without HTTP.
Saving profiles, settings, providers or attachment recordssdk/src/store.tsThe SDK owns application storage in Postgres; libfx owns durable session storage.
Files bots keep: uploads, saved documents, search, the library toolssdk/src/library.tsOne copy of each file by its SHA-256, tagged with every bot and chat that saved it.
Providers, their agents, key checks, sign-ins, or model listssdk/src/providers.ts, models.ts, vercel.tsOne libfx agent per provider; libfx's sign-in for plans, fxbot's own for Vercel.
Keys and tokenssdk/src/secrets.tsSealed before Postgres sees them. Never returned by any call.
Messages, chat_history, or the summary on a provider switchsdk/src/history.tsA bot's searchable record of its chats.
A data shape shared by backend and clientsdk/src/types.tsBoth SDK entry points re-export these types. Keep this file free of runtime dependencies.
HTTP client methods, NDJSON parsing, reconnects, or folding stream lines into turnssdk/src/client.tsAny UI or script calling the server needs this behavior; it has no React dependency.
URLs, HTTP methods, JSON decoding, request size limits, headers, status codes or serving the buildserver/src/index.tsThese are transport and process concerns. Delegate bot operations to the SDK.
Screens, interactions, rendering, React state or preparing browser filesui/src/These depend on the browser and presentation. UI checks provide feedback; the SDK still validates submitted data.
Installability, shell caching, the development proxy, or how npm run dev runs the APIui/vite.config.tsThese belong to the page's build and delivery. Keep /api on the network.

Use @fxbot/sdk when backend code needs to run fxbot directly in its process. Use @fxbot/sdk/client when a page or script talks to an already running fxbot server. See the SDK examples.

How the pieces connect

Browser:  @fxbot/ui → @fxbot/sdk/client
                            │
                     HTTP /api (JSON + NDJSON)
                            ↓
Node:                 @fxbot/server → @fxbot/sdk → libfx → model API
                                          │
                                Postgres + libfx session files

client.send() posts a message; it resolves when the prompt is accepted, not when the reply finishes. A separate client.stream() reads the reply and replayed history. The client parses lines and applyLine() builds turns; useTurnStream() holds those turns in React state.

  • The UI imports only @fxbot/sdk/client, including for types. Never import the SDK runtime, its internal source files, Node storage or libfx into the UI.
  • Keys and tokens stay on the server, sealed in Postgres by the SDK. The server passes the sealing key to createFxbot(). The page sends a key once; neither the browser nor the client entry point ever receives one.
  • Keep bot behavior out of route handlers and React hooks. Keep HTTP wiring out of the SDK runtime, and React state out of the SDK client.
  • For an API change, update the SDK behavior and shared types, the server route, the client method and the consuming UI as needed. A layout change normally stays in ui/.
  • Keep the three-package layout. A new package needs a second real consumer; do not add a layer for a hypothetical future use.

Working on a package

Run commands from the repository root with Node 22.18 or newer, after npm install:

CommandPurpose
npm run typecheckTypecheck all three workspaces using their own configs.
npm run buildBuild the UI and service worker into packages/ui/dist/; does not typecheck.
npm run serverRun the API and serve the built UI on port 8787. Requires Postgres, FXBOT_DATABASE_URL, and FXBOT_SECRET_KEY_FILE (see the README); use a disposable database, FXBOT_DATA, and FXBOT_PORT for manual checks.
npm run rotate-key -- <file>Seal every stored secret under a new key, with the server stopped.
npm run devRun Vite on port 5173 and the API beside it on 8787 (or FXBOT_PORT), proxying /api. A change to the UI reloads the page; a change to the SDK reloads the page and restarts the API; a change to the server restarts the API. Stop any separate npm run server first.

The SDK and server run TypeScript source directly; only the UI has a build step. There is no automated test suite or CI. Check affected behavior manually and run git diff --check; inspect new files separately. Add shadcn components from packages/ui with npx shadcn@latest add <name>.

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.