claude-prompts-mcp
AGENTS.md192 starsChanged 31 days 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…
- Commits and pushes
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,337 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
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
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.
- Distinctive: line 56
ONLY sanctioned plan mention and it asserts that this PR advances the plan it names: the gate FAILS when the PR closes none of that plan's …
- Distinctive: line 74
Leave it to an adoption PR.
- Distinctive: line 108
Read the relevant doc before editing.
- Very specific: line 161
MCP Contract Dev: Verify upstream first (rg "paramName" src/mcp/tools src/modules src/engine).
- Very specific: line 165
Framework validity: Always frameworkManager.getFramework(id) -- never hardcode framework lists.
- Very specific: line 168
Pipeline state: Use context.gates, context.frameworkAuthority, context.diagnostics -- never mutate arrays directly.
≈ “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.
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 -- Prompts, templates, chains flow through MCP tools.
- 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 -- CI owns the full test suite; local checks are a subset chosen by who is running them. A change's own check (the test, validator or probe that reads what the change wrote) runs with the change, and nothing wider. Before a push:
npm run typecheck && npm run lint:ratchet && npm run typecheck:tests:ratchet && npm run validate:all.test:all(unit, integration and e2e) runs once, in CI, at the pull request; a red run is fixed on the branch, never merged around. Runtest:alllocally only to reproduce a CI failure or when no pull request will carry the change.typecheck:tests:ratchetis not optional:tsconfig.jsonexcludestests/, sotypecheckis blind to every call site a signature change breaks.test:ciis an alias fortest:unitand says nothing about the integration or e2e jobs. Owner ruling 2026-10-05, after a profile measured the full suite running three times in series per change while CI was green on 32 of 33 pull requests. (flips when a defect reachesmainthat a localtest:allwould have caught and the pull request's CI did not)
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: three positive
controls, the body against .github/pull_request_template.md, the squash commit against the parser
release-please reads it with, 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 it asserts that this PR advances the plan it names: the gate FAILS
when the PR closes none of that plan's open rows, when it closes the last row without retiring the
plan in the same PR, or when the file does not exist. The footer is also the join key a reader greps
to assemble a multi-PR initiative (ADR 0003); a Decision: ADR-NNNN trailer must name an existing
ADR. The scripts that enforce this are managed by the fleet delivery contract
(.delivery-contract.json); validate:delivery-contract fails on any local edit to them, and a
newer contract is adopted with delivery-contract update (CONTRIBUTING.md §Pull Request Process).
The squash check exists because release-please leaves out, silently, any commit its parser rejects
-- no changelog line, no version bump, no BREAKING CHANGE note -- and what it parses is not the body
as written: GitHub re-flows the body at 72 columns, so a long line can open name( and close it on
the next line. That dropped #501 (a breaking change) and #503 from a release although both bodies
passed every other check. On a refusal, put the example on one line inside a fenced block, reword
the line, or add a BEGIN_COMMIT_OVERRIDE block to the body -- the marker counts anywhere in the
body, even quoted in backticks, so never mention it in prose.
One more step warns and never gates: scripts/warn-contract-lag.mjs annotates a PR when
.delivery-contract.json trails a repository-standards release that changed the contract template.
Leave it to an adoption PR.
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. Both exist because following the documented steps once still
shipped an unchecked title (#283) and a hand-written body cost a second CI run (#312).
This section is projected into AGENTS.md (PROJECTED_HANDBOOK_SECTIONS in
scripts/sync-project-guidance.js); Codex and OpenCode also reach it through CONTRIBUTING.md
§Pull Request Process and the usage text pr-check.mjs prints without arguments.
Documentation Map
| Topic | Doc |
| Architecture & runtime | docs/architecture/overview.md |
| SQLite persistence | docs/architecture/sqlite-persistence.md |
| Configuration file, precedence, startup refusals | docs/reference/configuration.md |
| Workspaces, overlays, resource paths | docs/guides/custom-resources.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 |
| Retired spellings (generated) | docs/reference/upgrading.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 a tracked package-lock.json (root or server/) has drifted from its installed node_modules — compares npm's own node_modules/.package-lock.json, so 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, or its code reads a parameter the command does not declare, on all three tools. A read is a property read reaching the handler, processor or pipeline stage — never a name in a string, and never a destructured key that is not used |
npm run validate:retirements | Join retirements.json to its refusal sites, test drivers, docs and generated page; warn past forgetAfter |
npm run retirements:list | Print each retired spelling with its dates and refusal sites |
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. - The server executes shell commands, under operator-held controls.
shell_verifygate criteria and the inline:: verify:"..."operator run throughsh -c(shared/utils/process.ts); script tools run an author-supplied file through a fixed interpreter. Ground-truth verification by exit code is the feature. What bounds it:MCP_SHELL_VERIFY_ALLOWLISTover WHICH command (unset refuses every shell verification with a message naming the variable; never a degrade-to-advisory),MCP_SHELL_VERIFY_ALLOWED_DIRSover WHERE (unset means the server's own directory), and an unconditional refusal of resource-supplied environment keys that decide what a command resolves to (PATH,LD_*,NODE_OPTIONS,PYTHONPATH,BASH_ENV,IFSand siblings). Both transports reach the same sink. Entry format, theUNSAFE_ALLOW_ALLsentinel and the refused-key list:docs/guides/gates.md§shell_verify. - Instruction surface (accepted, documented): a prompt's
systemMessage,userMessageTemplate,descriptionand argument descriptions ARE instruction to the client LLM. Two surfaces deliver that text before anyone invokes anything:prompts/list(fetched at connect) carries every description, andresource_manager list detail:"full"returns everysystemMessage. Treat a prompt pack as a dependency, not a config file. The HTTP catalog route is credential-gated; the MCP surface is not, 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.
- Retired spellings: a retired spelling is refused, never accepted with a note. It has one entry in
tooling/contracts/registries/retirements.json; its refusal site reads the entry's member from the generatedshared/utils/_generated/retirement-notices.ts(namespace import;npm run generate:retirements-docwrites it), or, outside TypeScript (a shipped resource script, a hook), the entry'srefusalSitesnames the file and a marker it holds;validate:retirementsjoins the two. Guides never name it: only the generateddocs/reference/upgrading.mddoes. Wording that calls a form old but still accepted (still works,legacy,deprecated) fails the same gate in docs and in strings the product shows, outside the dated exemptions inserver/scripts/retirement-wording.json. So does a sentence in a user-facing or architecture doc that promises a change (a scheduled release, a default about to flip, a temporary state): a doc says what the product does today, and a planned change is written in a plan. ->CONTRIBUTING.md§Retiring a Spelling - 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 pathrgmisses (ESLintclaude/no-compat-reexport-shim). A markerless barrel is not banned (~60 exist) but prefer direct imports:validate:archexpresses layer and cycle boundaries as paths, and a barrel spanning layers launders the real edge. Dead barrels are found bynpx knip, notvalidate:arch. Useinternal/for a genuinely private region. - Concurrent sessions: work in a linked worktree created with
npm run worktree:create -- <path> <branch> --from origin/main, never a second session in this checkout and never Claude Code's--worktree/EnterWorktree(CONTRIBUTING.md§Working in a second worktree records why, including the sharednode_modulessymlinks). 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 (paths):
MCP_WORKSPACEroots resources and state;MCP_RUNTIME_ROOT/MCP_CONFIG_PATHoverride theirs. One ordered list per type, earlier wins (getResourceLocations): project.claude-prompts/(STDIO), the workspace folder (the write root without a project folder),paths.resourcesentries with"bundled"where listed (no list: last; left out: no shipped content). Unusable paths refuse startup; the plugin sets no path env, Codex'smcp.jsonkeeps${PLUGIN_ROOT}. ->docs/reference/configuration.md·docs/guides/custom-resources.md - 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.

