claude-prompts-mcp
AGENTS.md187 starsChanged 3 months agoMITView on GitHub
- Edit CLAUDE.md and .claude/rules/*.md; do not edit this generated file. - This compact file is the default Codex/OpenCode context. It preserves the project-wide decisions that change most tasks while staying within Codex's documented default 32 KiB project guidance budget. - Claude Code applies rule paths: natively. Codex and OpenCode do not, so use the dispatch table below: when a task touches a matching path, read that canonical rule before editing. - For project details not projected here, consult CLAUDE.md…
- Reads credentials
- Commits and pushes
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 repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 4
Do not edit this downstream compatibility file.
- Very specific: line 55
ONLY sanctioned plan mention and the gate FAILS while that plan's status: is non-final, so a PR executing one step of a multi-step plan …
- Distinctive: line 95
Read the relevant doc before editing.
- Very specific: line 146
MCP Contract Dev: Verify upstream first (rg "paramName" src/mcp/tools src/modules src/engine).
- Very specific: line 151
Framework validity: Always frameworkManager.getFramework(id) -- never hardcode framework lists.
- Very specific: line 153
Pipeline state: Use context.gates, context.frameworkAuthority, context.diagnostics -- never mutate arrays directly.
≈ “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.
Files
<!-- GENERATED by scripts/sync-project-guidance.js.
Source of truth: CLAUDE.md and .claude/rules/*.md.
This is a compact semantic projection, not a concatenation.
Do not edit this downstream compatibility file. -->Agent Rules · Claude Prompts MCP
Canonical ownership and loading
- Edit
CLAUDE.mdand.claude/rules/*.md; do not edit this generated file. - This compact file is the default Codex/OpenCode context. It preserves the project-wide decisions that change most tasks while staying within Codex's documented default 32 KiB project guidance budget.
- Claude Code applies rule
paths:natively. Codex and OpenCode do not, so use the dispatch table below: when a task touches a matching path, read that canonical rule before editing. - For project details not projected here, consult
CLAUDE.mdand its documentation pointers.
Core Principles
- MCP Tooling Only -- Prompts, templates, chains flow through MCP tools. Manual edits under
server/prompts/**forbidden. - Contract ownership -- Hand-written schemas in
src/mcp/tools/schemas/own runtime validation;tooling/contracts/*.jsonown descriptions/parameter metadata generated intosrc/mcp/contracts/schemas/_generated/. Runnpm run generate:contracts, never edit_generated/.config.schema.json<-ConfigFile(generate:config-schema). - Transport Parity -- Runtime changes must work in STDIO and Streamable HTTP. The two differ in instance lifetime, and that difference is load-bearing: STDIO pins one
McpServerper connection, while HTTP builds a fresh one per request. A change that mutates a registered instance passes STDIO and silently no-ops over HTTP. HTTP+SSE was removed in the SDK v2 upgrade. - Docs/Code Lockstep -- Update relevant doc in
docs/when behavior changes. - Validation Discipline --
npm run typecheck && npm run lint:ratchet && npm run typecheck:tests:ratchet && npm run test:allminimum.validate:arch(module boundaries) is not a separate add-on: it is a member of thevalidate:allsuite below, and runs there.typecheck:tests:ratchetis not optional:tsconfig.jsonexcludestests/, sotypecheckis blind to every call site a signature change breaks, andvalidate:all-- which CI runs whole -- runs the ratchet second. Omitting it locally means CI fails on work that passed every gate you ran.test:all, nottest:ci:test:ciis an alias fortest:unitand runs neithertests/integrationnortests/e2e, while CI runs both as separate jobs -- so its name promises the opposite of what it does. Measured 2026-08-27: a default-deny control landed with the unit suite green, and 20 integration plus 17 e2e failures went unseen for five commits because every local check stopped attest:ci.pre-pushdoes not run integration or e2e tests -- CI runs them at the PR boundary.test:allis the only way to catch this locally before a push.
Node.js Support Boundaries
| Surface | Supported Node.js | Enforcement |
| MCP server and desktop extension | >=22.13.0 | server/package.json, manifest.json, CI on 22.13.0 and 24 |
| Standalone CPM CLI | >=18.18.0 | cli/package.json and CLI runtime validation |
| Local development and publishing | 24 | .node-version and publish workflows |
The server floor is where node:sqlite is available without an experimental flag. The standalone CLI remains a separate, self-contained compatibility surface.
Pull Request Boundary
npm run pr:check is the whole local gate, and it is a subset of CI by construction.
PR Conventions is a required context whose gating steps on a non-bot PR are: two positive
controls, the body against .github/pull_request_template.md, and commitlint on the title. Run
every one of them before gh pr create, from the repo root:
TITLE="feat(scope): outcome"
npm run pr:body -- --out /tmp/pr-body.md # seed it; never author a body from scratch
$EDITOR /tmp/pr-body.md
npm run pr:check -- --body-file /tmp/pr-body.md --title "$TITLE"The template requires ## Demonstration (consumer-observable before/after, or n/a: <reason>), a
## How it was verified TABLE (claim · probe · baseline -> measured · the mutation that fails it --
a count with no baseline is noise), and ## Notes for Reviewers, under a 400-word above-the-fold
budget that fenced blocks, tables and <details> do not count against. The Plan: footer is the
ONLY sanctioned plan mention and the gate FAILS while that plan's status: is non-final, so a PR
executing one step of a multi-step plan omits the footer entirely.
Parity is enforced rather than documented: scripts/pr-check.mjs names each workflow step it
mirrors and server/tests/unit/scripts/pr-check-ci-parity.test.ts reads pr-conventions.yml and
fails when the two sets diverge. That test exists because the relation had already broken in the
direction that costs a CI cycle -- CONTRIBUTING.md documented only the body check, and the body
checker states outright that it "does not read the title beyond its type", so following the
instructions exactly still shipped an unchecked title (#283, subject-case, 2026-09-14). A
hand-written body cost a second run three missing sections and a 488-word fold (#312, 2026-09-16).
This section IS projected into AGENTS.md (PROJECTED_HANDBOOK_SECTIONS in
scripts/sync-project-guidance.js). It previously was not: the projection measured 32,709 of its
32,768-byte ceiling with this section absent -- 59 bytes of headroom, not enough to add it. Evicting
## Validation Gates (one contract, impact-aware subsets) (below) freed the room: that section is
CI-routing detail a Codex or OpenCode reader does not need to act on, while this one is a command
they run before every PR. Codex and OpenCode also still reach this contract through
CONTRIBUTING.md §Pull Request Process and the usage text pr-check.mjs prints when invoked
without arguments.
Documentation Map
| Topic | Doc |
| Architecture & runtime | docs/architecture/overview.md |
| SQLite persistence | docs/architecture/sqlite-persistence.md |
| MCP tools & symbolic commands | docs/reference/mcp-tools.md |
| MCP contract maintenance | docs/guides/mcp-contract-maintenance.md |
| Prompt authoring | docs/tutorials/build-first-prompt.md |
| Chains lifecycle | docs/concepts/chains-lifecycle.md |
| Gates | docs/guides/gates.md |
| Injection control | docs/guides/injection-control.md |
| Identity & scope | docs/guides/identity-scope.md |
| Skills Sync | docs/guides/skills-sync.md |
| Telemetry & observability | docs/guides/telemetry-observability.md |
| Troubleshooting | docs/guides/troubleshooting.md |
| Contributing & PR process | CONTRIBUTING.md |
| README charter (root README authoring rules) | docs/portfolio/readme-charter.md |
| Release highlights | CHANGELOG.md |
Read the relevant doc before editing. Update docs when behavior changes.
Command Reference (run inside server/)
| Command | Purpose |
npm run build | esbuild bundle -> dist/index.js |
npm run verify:mcp | Spawn a server from dist/ and prove all 3 MCP tools answer — use instead of restarting Claude Code to check a build. Refuses to run against a stale dist/ |
npm run typecheck | Strict TS type validation — src/ only, tsconfig.json excludes tests/ |
npm test | Full Jest suite |
npm run lint:ratchet | Fail if ESLint violations increased or decreased without lowering the baseline |
npm run typecheck:tests:ratchet | Fail if tests/ type errors increased or decreased without a baseline update. Covers call sites typecheck misses — a broken test file can otherwise land green |
npm run generate:contracts | Regenerate MCP schemas from contracts |
npm run validate:lockfile-sync | Fail when node_modules has drifted from package-lock.json — compares npm's own node_modules/.package-lock.json, so no subprocess and no output parsing |
npm run setup:python | Install the pinned Ruff/Pyrefly/Pytest/PyYAML from requirements-dev.txt — the same file CI installs from |
npm run validate:all | Full validation suite |
npm run validate:arch | Dependency Cruiser architecture rules |
npm run validate:contracts | Verify generated artifacts in sync |
npm run validate:domain-ownership | Check the Domain Ownership Matrix against every module's owns declaration, both directions |
npm run validate:tool-parameter-reads | Fail when a tool command declares a parameter its code never reads, on all three tools. A read is a property read reaching the handler, processor or pipeline stage — never a name in a string |
npm run test:integration | FIRST for new features |
npm run test:coverage | Baseline coverage (target: >80%) |
npm run skills:export | Export skills from skills-sync.yaml |
Domain Ownership Matrix (ENFORCED)
Stages are thin orchestration. Domain logic lives in owner services.
validate:domain-ownership checks this table both ways against each module's module.yaml owns block -- a row and its declaration must change together, and a row naming a symbol nobody exports, or a path the symbol is not defined in, fails.
| If you need... | Owner Service | Stage May Only |
| Gate normalization | GateService (gates/services/) | Call gateService.normalize() |
| Gate enhancement | GateEnhancementService | Call enhancementService.enhance*() |
| Gate selection | GateManager (gates/gate-manager.ts) | Call gateManager.selectGates() |
| Gate enforcement mode | resolveEnforcementMode (execution/pipeline/decisions/gates/) | Call resolveEnforcementMode(mode) -- a pure import, because context.gateEnforcement is optional and ?. would silently relax enforcement |
| Gate verdict processing | GateVerdictProcessor (gates/services/) | Call processor.handleGateAction() |
| Inline gate parsing | InlineGateProcessor (gates/services/) | Call processor.processInlineGates() |
| Prompt resolution | PromptRegistry (prompts/registry.ts) | Call registry.get() |
| Command parsing | UnifiedCommandParser (execution/parsers/command-parser.ts) | Call parser.parseCommand() |
| Step capture | StepCaptureService (execution/capture/) | Call captureService.captureStep() |
| Response assembly | ResponseAssembler (execution/formatting/) | Call assembler.format*() |
| Framework selection | FrameworkManager (frameworks/) | Call frameworkManager.selectFramework() |
| Framework validity | FrameworkManager | Call frameworkManager.getFramework(id) -- never hardcode |
| Injection decisions | InjectionDecisionService (execution/pipeline/decisions/injection/) | Call service.decide() |
| Style resolution | StyleManager (modules/formatting/style-manager.ts) | Call styleManager.getStyle() |
| Delegation handoff evidence | resolveHandoffEvidence (execution/delegation/handoff-contract.ts) | Call resolveHandoffEvidence(input) -- a pure import, never re-parse the HANDOFF RESULT trailer inline |
| Detached report routing | resolveDetachedReport (execution/delegation/detached.ts) | Call resolveDetachedReport(input) -- a pure import; a late result lands on the node its trailer names, never on the current step |
Key Constraints
- MCP Contract Dev: Verify upstream first (
rg "paramName" src/mcp/tools src/modules src/engine). Contract, schema, generated metadata, router, manager/types, and service must agree. - Client-work boundary: Prompt and chain steps guide the client LLM, and resource operations may write only server-owned resource and runtime-state paths. The server DOES execute shell commands, under one operator-held control.
shell_verifygate criteria and the inline:: verify:"..."operator both run their command throughsh -c(shared/utils/process.ts:381), and script tools run an author-supplied file through a fixed interpreter. This is not incidental — ground-truth verification by exit code is the feature. What bounds it is three operator-held controls (below), not the absence of the capability:MCP_SHELL_VERIFY_ALLOWLISTover WHICH command,MCP_SHELL_VERIFY_ALLOWED_DIRSover WHERE, and a non-negotiable refusal of resource-supplied environment keys that decide what a command resolves to. This line previously claimed the opposite; it was false from the firstshell_verifygate, and it is the sentence a reader consults when deciding how far to trust a third-party gate. - Instruction surface (accepted, documented): A prompt's
systemMessage,userMessageTemplate,description, and argument descriptions ARE instruction to the client LLM. That is the product, not a defect — but it means installing a third-party prompt pack is equivalent to letting its author write into your model's context, and two surfaces deliver that text before anyone invokes anything: the MCP-standardprompts/list(which clients typically fetch at connect) carries every prompt'sdescriptionand every argument description, andresource_manager list detail:"full"returns every prompt'ssystemMessagein a single call. Measured 2026-08-25. Treat a prompt pack the way you would treat a dependency, not a config file. The HTTP catalog route serving the same fields is credential-gated (MCP_CATALOG_READ_TOKEN); the MCP surface is not, by design, because the operator chose the client. - Guidance owner:
PromptGuidanceServiceremains the central framework-guidance service. Do not introduce a parallel coordinator/orchestrator with overlapping responsibility. - Framework validity: Always
frameworkManager.getFramework(id)-- never hardcode framework lists. - Consolidation over addition: Enhance existing systems vs creating new ones.
- Pipeline state: Use
context.gates,context.frameworkAuthority,context.diagnostics-- never mutate arrays directly. - Module organization: import the defining module directly. Banned is the compat re-export shim -- a file whose whole body is
export ... fromAND which carries a back-compat marker, giving a symbol a second import path sorgfor the canonical one misses consumers (the ESLint ruleclaude/no-compat-reexport-shimenforces exactly this). A markerless barrel is NOT banned andsrc/has ~60 of them; prefer direct imports anyway, becausevalidate:archexpresses layer + cycle boundaries as paths, and a barrel spanning layers launders the real edge. Intra-layer barrels launder nothing -- judge by whether consumers cross a layer. A file that re-exports and defines something is not a barrel (infra/logging/index.ts). Dead-barrel detection isnpx knip;validate:archcannot see it (no-orphansneeds no incoming AND no outgoing edges, and a re-export always has outgoing). Useinternal/for a genuinely private region. - Concurrent sessions: work in a linked worktree, never a second session in this checkout — worktrees share
.git/configbut not HEAD, and a shared HEAD moves under whoever is mid-edit. Create withnpm run worktree:create -- <path> <branch> --from origin/main(the path resolves from the repo root). Do not use Claude Code's--worktree/EnterWorktreehere: anthropics/claude-code#72714 writes an absolutizedcore.hooksPathinto the shared.git/config, disabling hooks in every worktree including this one — plaingit worktree addis equally unsafe, for the reasonCONTRIBUTING.md§Working in a second worktree records. A new worktree'snode_modulesandserver/node_modulesare symlinks pointing back at this checkout, sonpm cior an install from a branch that changedpackage-lock.jsonwrites through them and mutates every worktree's dependency tree at once. Set a distinctPORTif two trees run servers. - Commit convention: Conventional Commits enforced. Scopes (
commitlint.config.mjsis the enforced list; keep this andCONTRIBUTING.mdin lockstep with it):server,cli,runtime,pipeline,gates,frameworks,prompts,chains,styles,scripts,hooks,resources,mcp-tools,contracts,parsers,ci,deps,config,logging,metrics,docs,tests,semantic,execution. - Environment (execution capability):
MCP_SHELL_VERIFY_ALLOWLISTdeclares which commandsshell_verifymay run. Unset means every shell verification is refused — the gate fails with a message naming this variable, and the server keeps serving. Entries are newline-separated (not comma: commands contain commas); an entry ending*is a prefix, but a command carrying shell control characters (; & | \< > $(or a newline) must match exactly, because a prefix cannot bound what follows a;. The single entryUNSAFE_ALLOW_ALL` permits everything, for an operator who authors all their own gates and accepts the risk. Both transports read it — this is not a listener concern: the sink is reached identically over STDIO and HTTP. The refusal is deliberately not a degrade-to-advisory; a gate reporting as passed while having verified nothing is a defect this repo has already fixed once. - Environment (execution capability, continued):
MCP_SHELL_VERIFY_ALLOWED_DIRSdeclares directories, beyond the server's own, that a gate'sshell_working_dirmay resolve inside. Unset does not mean "anywhere" — it means the server's own directory, which is where a gate that says nothing already runs. Same newline-separated form and sameUNSAFE_ALLOW_ALLsentinel as the command allowlist, and deliberately a separate declaration: accepting arbitrary commands is not accepting arbitrary directories. There is no third variable for the environment, and that asymmetry is the point. A resource-suppliedshell_env/tool.envnaming a key that decides what a command RESOLVES to —PATH,LD_*,DYLD_*,NODE_OPTIONS,PYTHONPATH,BASH_ENV,IFSand their siblings — is refused outright, with no opt-out, because otherwise the allowlist bounds a string whose meaning the author still picks: measured 2026-08-29, an operator allowlisting exactlygit statusran the gate author'sgit. Ordinary variables pass through untouched. The full list and the mechanism behind each entry are inshared/utils/process.ts. - Environment (paths):
MCP_WORKSPACE(primary — the default for resources AND runtime state),MCP_RESOURCES_PATH(resources base override),MCP_RUNTIME_ROOT(writable root forruntime-state/and relativelogs/),MCP_CONFIG_PATH(config file override, same as--config). Every path setting the server cannot use refuses startup on both transports, before serving, naming the flag or variable, the value, its resolved path, what is wrong and what removing it falls back to: a config path that is not a readable JSON file, anMCP_WORKSPACE/--workspaceorMCP_RESOURCES_PATHthat is not an existing directory, and a workspaceconfig.jsonthat exists but is unreadable, a directory, or not a JSON object. Before 2026-09-14 each booted on something nobody asked for -- a named config file ignored, a missing workspace created by the logsmkdir, a missing resources path served as the bundled catalog, a malformed workspace config replaced by built-in defaults. One check (PathResolver.assertUsablePathSettings) runs increateRuntimeFoundationbefore the watcher, the transport choice and anymkdir; the path getters stay unchecked because tests and tooling resolve paths that need not exist. What still falls back, on purpose: a workspace with noconfig.json(packaged config), an empty value (unset),MCP_RUNTIME_ROOT(created on demand), and the packagedconfig.jsonitself (built-in defaults).MCP_WORKSPACEis not the SSOT for all paths: the other three each override it for their own concern, which is what lets a personal resource library live underMCP_WORKSPACEwhilestate.dband logs stay put. Workspace resources overlay bundled ones — the bundled tree stays loaded underneath, and a same-id workspace entry wins. Before 2026-08-28 the workspace root REPLACED the bundle: one workspace framework was enough to make the server exit withFATAL: Framework 'cageerf' not found, and one workspace prompt made the served catalog that one prompt. Overlay detection compares the workspace to the package root, soMCP_RESOURCES_PATHalone does not enable overlays — a personal store must setMCP_WORKSPACE. The Claude Code plugin sets bothMCP_WORKSPACEandMCP_RUNTIME_ROOTto${CLAUDE_PLUGIN_DATA}(.mcp.json, rendered frommcp.jsonbyscripts/render-distributions.mjs): the directory Claude Code keeps across plugin updates and creates before the server starts, while the entry point stays under${CLAUDE_PLUGIN_ROOT}, which every update replaces. The canonical Agent Pluginsmcp.jsonkeepsMCP_WORKSPACE=${PLUGIN_ROOT}, because Codex does not passPLUGIN_DATAto the MCP server. Hooks do not inherit the server's environment, soget_state_db_path()probes${CLAUDE_PLUGIN_DATA}/runtime-state/state.dbafterMCP_RUNTIME_ROOT. A custom workspace is the write root: withoutMCP_RESOURCES_PATH, a type resolves to<workspace>/resources/<type>/even before it exists (a legacy<workspace>/<type>/keeps it), the first write creates it, loaders read it as empty until then, and the file observer watches it once it appears. - Environment (secrets):
MCP_CATALOG_READ_TOKENgates executable prompt detail/history/compare;MCP_CATALOG_WRITE_TOKENindependently gates preview/apply/rollback and every legacy/api/v1/tools/*mutation. Either unset value refuses its surface (503), equal read/write values disable writes, and authentication runs before prompt lookup/body parsing.MCP_HTTP_ALLOWED_ORIGINSis a comma-separated allowlist for requests carryingOrigin; absentOriginremains valid for server-side clients. HTTP transport only — STDIO reads none of these values.
-> .claude/rules/mcp-contracts.md for critical contract constraints (path-loaded)
-> .claude/rules/sqlite-persistence.md for critical persistence constraints (path-loaded)
-> docs/guides/mcp-contract-maintenance.md for the full contract procedure
-> docs/architecture/sqlite-persistence.md for the table map, scope split, and schema history
-> docs/architecture/overview.md for architecture, pipeline stages, subsystems
-> docs/reference/mcp-tools.md for MCP tool workflows, symbolic command language
-> docs/guides/injection-control.md for injection types, frequency, hierarchy
-> docs/guides/gates.md for gate/framework structure and hot-reload
-> /testing skill for test patterns and project-specific coverage
Conditional project guidance
- Multi-Platform Extension Alignment (
hooks/**,.claude-plugin/**,manifest.json,mcp.json,server/scripts/synchronize-downstream-lock.js) -> before editing a matching path, read.claude/rules/extension-alignment.mdand treat it as mandatory project guidance. - MCP Contract Maintenance Standards (
server/tooling/contracts/**/*.json,server/src/mcp/contracts/schemas/_generated/**,server/src/mcp/tools/**/*.ts,server/scripts/generate-contracts.ts,docs/reference/mcp-tools.md) -> before editing a matching path, read.claude/rules/mcp-contracts.mdand treat it as mandatory project guidance. - state.db Persistence Rules (
server/src/infra/database/**,server/src/**/*-store.ts,server/src/**/*-registry.ts,server/src/**/*-indexer.ts,server/scripts/validate-table-contracts.ts,server/scripts/validate-no-phantom-columns.ts) -> before editing a matching path, read.claude/rules/sqlite-persistence.mdand treat it as mandatory project guidance.
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.

