agents
CLAUDE.md1 starsChanged 6 days agoMITView on GitHub
Monorepo (pnpm workspaces + Nx) of three published packages, one private test package, five private apps and private examples (with their shared package): - packages/agent — @dudko.dev/agent, the Node / server agent. - packages/agent-web — @dudko.dev/agent-web, the in-browser agent (the core of the next two). - packages/agent-web-react — @dudko.dev/agent-web-react, React bindings; its e2e/ drives the demo. - packages/test-servers — @dudko.dev/test-servers (private, never published): the test enterprise IdP, MCP authorization server and MCP server the packages' tests run against, as functions…
- Reads credentials
- Installs packages
In this repositoryOne other file it gives its agents.
- ai-sdkSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 118
Run from the repo root. Nx orders tasks by the dependency graph and caches them.
- Very specific: line 136
After any change to .ts / .tsx, run the four checks for the packages you touched and everything that depends on them (pnpm affected, or …
- Distinctive: line 175
Never commit secrets, API keys or customer data, in tests or fixtures either.
- Distinctive: line 179
Do not push to main directly.
- Very specific: line 216
When the checks are red it dispatches claude.yml, which fixes the branch (up to 3 attempts).
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.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.
Files
agents — instructions for Claude
Monorepo (pnpm workspaces + Nx) of three published packages, one private test package, five private apps and private examples (with their shared package):
packages/agent—@dudko.dev/agent, the Node / server agent.packages/agent-web—@dudko.dev/agent-web, the in-browser agent (the core of the next two).packages/agent-web-react—@dudko.dev/agent-web-react, React bindings; itse2e/drives the demo.packages/test-servers—@dudko.dev/test-servers(private, never published): the test enterprise IdP, MCP authorization server and MCP server the packages' tests run against, as functions and as a CLI. TypeScript run directly by Node (type stripping), no build. Loopback only. Not in.github/scripts/release-plan.mjs's list, and must stay out of it.apps/demo— the Vite demo of the React package (private, never published). One project, two pages: the demo (/demo/) and the pipeline editor (/pipeline/).apps/app—app(private, never published): the everyday agent at https://agent.dudko.dev/app/, a Vite + React PWA on the React package and the core. Bring-your-own-key (Google, Anthropic, OpenAI, OpenRouter, DeepSeek, Qwen on Alibaba Cloud Model Studio, Kimi on Moonshot AI - the last two with a region choice), every call straight from the browser - no relay or proxy of any kind; keys in the core's encrypted vault; three model tiers picked from the provider's own listing - each role any model of any connected provider, "Auto across providers" picking each from all of them, helpers on other providers' models (ask_model), every call to its own provider with its own key;run_jsand read-only SQLite (run_sql) for computing; a workspace of files in the browser (attachments, PDF → Markdown and raster → SVG in Web Workers, CSV / JSON into SQL), images read by the chat model and made by an image model (generate_image); the person's own skills (a.md, a.zipor Anthropic's.skill, read by the app's own ZIP reader; text only, nothing executed) and MCP servers (Streamable HTTP: no authorization, headers kept in the vault, or OAuth) - for which/app/*'sconnect-srcis any https host; a model menu in the composer (Auto, Auto across providers, or one model of any provider for everything); 33 UI languages. Its ownCLAUDE.mdhas the rules (storage namespace, tiers, guards).apps/site— https://agent.dudko.dev: the landing page and the docs (Astro + Starlight), with the built demo mounted under/demo/, the pipeline editor under/pipeline/and the app under/app/(scripts/assemble.mjscopies them fromapps/demo/distandapps/app/distand adds/pipeline/and/app/to the sitemap). The docs pages are generated from the packages' READMEs anddocs/*.md, and the Deploy section fromexamples/README.mdand the swarm examples' READMEs (scripts/sync-docs.mjs): edit the source file, never the copy. A new docs file needs an entry in that script'sPAGESand in the sidebar (astro.config.mjs). Dark theme only; colours, type and motion come fromsrc/styles/tokens.css. The link-preview cards (public/og.png,public/og/demo.png,public/og/pipeline.png) are rendered fromscripts/og-card.htmlbypnpm nx build site && pnpm --filter site og-cards(Chromium and the Inter font; not part of the Cloudflare build) - run it after a visible change to the demo or the editor and commit the PNGs. Files for machines (llms.txt,robots.txt, the sitemap, the manifest) are never linked from the interface - no footer or menu entry: crawlers find them by their well-known paths. Check every page at phone width for sideways scroll before pushing.apps/worker— the Cloudflare Worker of the site, for/mcp/*only: the public demo MCP server at/mcp/demo(the demo's "Try the demo server"). Stateless, both protocol revisions, abuse limits in code; bundled toapps/worker/dist/index.js. The demo'svite dev/vite previewserve the same handler on Node (apps/worker/src/node.ts), which is what the browser tests talk to.apps/app-sandbox— a SECOND Cloudflare Worker, NOT the site's: https://agent-demo-apps.dudko.workers.dev, the MCP Apps sandbox page (/sandbox/v1/<policy>, 404 elsewhere) the demo frames so that an app runs on an origin of its own. A thin deployment of the React package's./mcp-app-sandboxentry (the page, its headers and guards live and are tested there); its ownwrangler.jsonc(workers.dev only - never a host under dudko.dev, where an app could set cookies for all of dudko.dev; the allowed hosts invars), its own Workers Builds project.pnpm nx build sitenever builds it (site/demodo not depend on it; its test pins that). Locally the demo'svite dev/vite previewserve the same page under the other loopback name.examples/swarm—swarm(private, NEVER published; not inrelease-plan.mjs, and must stay out of it): a reference deployment of the Node agent as a horizontally scaled swarm on self-hosted Temporal + Postgres - a session workflow per conversation, oneagent.runper turn as an activity, the agent's scale-out hooks (persistencewith the call journal,runLease,sharedLimits, events) on Temporal and Postgres, turns that park on a person's answer, static subagents and pipelines (the core's graph engine in a workflow) as child workflows, a stateless gateway with SSE (swarm-shared's fetch handler onnode:http), one image (Dockerfile, distroless, rolesgateway|worker|migrate),compose.yamland a Helm chart (deploy/helm/agent-swarm). TypeScript run directly by Node;buildonly bundles the workflow code.testneeds nothing external;test:integrationneeds a Postgres (DATABASE_URL) and starts a Temporal dev server (@temporalio/testing, downloaded) - CI runs it inswarm.yml, not inci.yml. It uses only the agent's public API: a change it would need in the core is a change topackages/agent, made there. Its ownCLAUDE.mdhas the rules.examples/swarm-cloudflare—swarm-cloudflare(private, NEVER published; not inrelease-plan.mjs, and must stay out of it): the same swarm -swarm-shared's HTTP API and session semantics - on Cloudflare: a Durable Object per session (the reducer's single writer: its state, event log, runs, call journal, lease, parked items, children and an outbox of effects), a Workflow instance per turn, per static subagent call, per pipeline call and per node visit, the Node core in workerd (nodejs_compat).buildiswrangler deploy --dry-run(offline);testruns in Node (the objects' logic overnode:sqlite);test:e2erunswrangler dev- CI runs it inswarm-cloudflare.yml. Nothing here deploys or logs in to Cloudflare; the owner does (its README's "Deploying"). Its ownCLAUDE.mdhas the rules.examples/swarm-gcp—swarm-gcp(private, NEVER published; not inrelease-plan.mjs, and must stay out of it): the same swarm -swarm-shared's HTTP API and session semantics - on Google Cloud: Firestore (Native) for everything of a session, a Firestore transaction on the session's document as its single writer (with an outbox of effects), Cloud Tasks to drive the work (a task per turn attempt, child attempt, pipeline replay and timer) against a worker that takes only Cloud Tasks' OIDC-signed requests, the gateway's event streams from Firestore listeners; one image for two Cloud Run services, the same handlers as Firebase Functions, Terraform underdeploy/.buildbundles the functions (offline);testandtest:e2estart the Firestore emulator themselves (a pinned jar,pnpm --filter swarm-gcp emulator:install, Java 21) - without it the unit tests that need Firestore skip, saying so; CI runs them all inswarm-gcp.yml. Nothing here deploys or authenticates to Google Cloud; the owner does (its README's "Deploying"). Its ownCLAUDE.mdhas the rules.examples/swarm-aws—swarm-aws(private, NEVER published; not inrelease-plan.mjs, and must stay out of it): the same swarm -swarm-shared's HTTP API and session semantics - on AWS: one DynamoDB table for everything of a session, an optimistic transaction locked on the session's item as its single writer (with an outbox of effects), two SQS standard queues to drive the work (a message per turn attempt, child attempt, pipeline replay and near timer; a sweep every minute for far deadlines and lost effects) into a worker that has no HTTP surface at all, the gateway's event streams by polling the table; the same handlers as Lambda functions (the default) or as one image on ECS Fargate, Terraform underdeploy/.buildbundles the functions (offline);testandtest:e2estart DynamoDB Local themselves (a pinned archive,pnpm --filter swarm-aws dynamodb:install, Java 21) - without it the unit tests that need DynamoDB skip, saying so; CI runs them all inswarm-aws.yml. Nothing here deploys or authenticates to AWS; the owner does (its README's "Deploying"). Its ownCLAUDE.mdhas the rules.examples/swarm-shared—swarm-shared(private, NEVER published; not inrelease-plan.mjs, and must stay out of it): the platform-independent part of the swarm, shared by its ports to other platforms (the same HTTP API, the same session semantics) - the session's logic, ids and types, the answer checks, the cursor (./workflow: what a workflow sandbox may import), and the HTTP API as a fetch-style handler over Web APIs ((request: Request) => Promise<Response>, nonode:*). Unliketest-serversit ships built JS (build: tsc ->dist, whichexportsnames): the swarm's image copies it intonode_modules, where Node strips no types. Its ownCLAUDE.mdhas the rules.
Each package has its own CLAUDE.md. Read it before changing that package — layout, conventions
and the reasons behind them live there. This file holds only what is shared.
Commands
Run from the repo root. Nx orders tasks by the dependency graph and caches them.
pnpm install # after any dependency change; commit pnpm-lock.yaml
pnpm check # typecheck + format:check + build + test, every project
pnpm affected # the same for what changed against main
pnpm test:e2e # Playwright over the built demo
pnpm nx test:e2e app # Playwright over the built app
pnpm nx <target> <project> # e.g. pnpm nx test @dudko.dev/agent-webProjects: @dudko.dev/agent, @dudko.dev/agent-web, @dudko.dev/agent-web-react,
@dudko.dev/test-servers, demo, app, site, worker, app-sandbox, swarm, swarm-shared,
swarm-cloudflare, swarm-gcp, swarm-aws.
Targets come from each package's scripts: typecheck, format:check, format, build, test
(and test:e2e in the React package and app, test:integration in swarm, test:e2e in swarm-cloudflare, swarm-gcp and swarm-aws - not part of pnpm check;
@dudko.dev/test-servers has no build).
After any change to .ts / .tsx, run the four checks for the packages you touched and
everything that depends on them (pnpm affected, or pnpm check when in doubt) with the Bash
tool. Do not infer success from "the change looks right".
How the packages fit
agent-web-reactanddemodepend onagent-webthroughworkspace:*: they always build and test against the core in this tree.agent-webstays a peer dependency of the React package for users (one core instance per app) — keep the peer range honest when the React package starts needing a newer core API.- Tests of the two browser packages import from
dist, the typecheck of the React package reads the core'sdisttypes, and the demo aliases the React package'sdist. That is whybuildcomes first innx.json(dependsOn). Do not addpretest/prebuildscripts that rebuild — two builds of the samedistin parallel race. agentandagent-webtaketest-serversas aworkspace:*dev dependency and import its TypeScript source directly (exportspoints atsrc/index.ts): there is nothing to build, and Node strips the types because pnpm's link resolves to the real path outsidenode_modules. It never becomes a runtime dependency of a published package.agentandagent-webare siblings, not dependants: public API, config fields, event names and semantics are shared by convention. A change to one usually needs the same change in the other, in the same pull request. Some code is a deliberate copy (the egress policy core, learning guards, the token estimate) — change both, with tests.- pnpm does not hoist: a package may import only what its own
package.jsondeclares. A new import in a test or an e2e file needs adevDependenciesentry in that package. - Dependency install scripts are off except for the ones listed in
pnpm-workspace.yaml(onlyBuiltDependencies). pnpm-workspace.yamlkeeps@types/json-schemaout of the hidden hoist (hoistPattern): the swarm's Temporal worker brings it (through webpack), and hoisted it would give the AI SDK's own.d.tsa realJSONSchema7and change what the cores typecheck against. Drop the exclusion once the cores' JSON schemas typecheck against it.
Conventions
- Prettier (root
.prettierrc.json): no semicolons, single quotes, trailing commas, width 100. It checks.ts/.tsx/.cssonly — do not run it on.md. - Docs live next to the code (the README goes to npm;
docs/*.mdare published on the site, not in the npm package): a new config field, event, export, env var or label is documented in the same pull request (each package'sCLAUDE.mdsays where). - Security boundaries (safe fetch / egress, learning guards, consent, OAuth) need a test for every guard and a mutation check.
- Never commit secrets, API keys or customer data, in tests or fixtures either.
Boundaries
- Do not push to
maindirectly; work on a branch and open a pull request. - Versions are per package (
packages/*/package.json). Do not bump them as part of a feature change — a release is its own pull request that bumps the version of the package(s) to publish. - Workflows:
ci.yml(checks + browser tests);release.yml(after CI passes onmain, publishes every package whose version is not on npm yet —.github/scripts/release-plan.mjsdecides — via npm Trusted Publishing, tags<dir>-v<version>and creates a GitHub release);live-model.yml(the Node agent against a real local model: gates its publish, and runs on PRs that touch its dependencies);swarm.yml(the swarm example's integration tests against a Postgres service and a Temporal dev server, its Docker image built without a push, and its Helm chart's lint / template / kubeconform, on changes toexamples/swarm,examples/swarm-sharedorpackages/agent);swarm-cloudflare.yml(the Cloudflare port's end-to-end tests againstwrangler dev, local only - it never deploys);swarm-gcp.yml(the Google Cloud port's unit and end-to-end tests against the Firestore emulator, its image built without a push, Terraform'sfmt/validate- local only, no Google credentials, it never deploys);swarm-aws.yml(the AWS port's unit and end-to-end tests against DynamoDB Local, its image built without a push, Terraform'sfmt/validate- local only, no AWS credentials, it never deploys);swarm-image.yml(publishes the swarm image for linux/amd64 + arm64 toghcr.io/dudko-dev/agent-swarm, and todocker.io/sergdudko/agent-swarmwhen theDOCKER_USER/DOCKER_PATsecrets are set: on anagent-v*tag - after a Release run, since release.yml's tag push starts no workflow - and by hand; never on PRs). Do not editrelease.ymlunless asked: npm's Trusted Publisher setting names that file and thereleaseenvironment. - The site and the demo are built and deployed by Cloudflare (Workers Builds:
pnpm nx build site, thenwrangler.jsoncpublishesapps/site/dist), not by a workflow here. The site is static assets, served without a script; there IS a Worker script (main:apps/worker/dist/index.js, built bypnpm nx build sitethroughsite's dev dependency onworker), andassets.run_worker_first: ["/mcp/*"]runs it for those paths ONLY - every other path, the 404 page included, is answered by the assets exactly as before. Keep it that way: a path added torun_worker_firstis a path the static site no longer answers first (apps/worker/tests/worker.test.tspins the config). Keep"previews": {}. - The apps' sandbox page is a second Workers Builds project (
agent-demo-apps, set up by the owner -apps/app-sandbox/README.md): buildpnpm nx build app-sandbox, deploynpx wrangler deploy --config apps/app-sandbox/wrangler.jsonc, served atagent-demo-apps.dudko.workers.dev(no Custom Domain: see above). Never fold it into the site's Worker orrun_worker_first: every site request would go through a script, and the page must be on ANOTHER origin than the site. autoupdate.yml(weekly):.github/scripts/autoupdate.mjsrunspnpm update -r --latest(excepttypescriptand@types/node), patch-bumps and changelogs the published packages whose owndependencieschanged, opens a PR, merges it when CI is green and dispatches the release. When the checks are red it dispatchesclaude.yml, which fixes the branch (up to 3 attempts). Events made withGITHUB_TOKENstart no workflows, which is why these two dispatchci.yml,live-model.ymlandrelease.ymlexplicitly — do not replace the dispatches with comment mentions or rely onpull_request/pushtriggers there. The same goes for the swarm image: a Release run autoupdate dispatched fires noworkflow_run, so autoupdate waits for the agent's release tag at the merge commit and dispatchesswarm-image.ymlwith it.- On an autoupdate branch (
chore/autoupdate-<run_id>): make the checks green with compatibility fixes only, never change product behaviour or versions; if that is impossible, say so in a PR comment instead of guessing.
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
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.

