Repo Intent Documenter
Build a grounded repository intent document that makes the project's purpose, assumptions, and unresolved questions obvious to future agents.
Decision Tree
What is the user asking for?
Create or refresh a repo intent doc
Run scripts/repo_intent_inventory.py, inspect the codebase, then write or update REPO_INTENT.md.
Explain intent inline without writing files
Use the same evidence model, but answer in chat and offer a doc path only if useful.
Continue from an existing intent doc
Read the existing doc first, preserve confirmed statements, and only revise claims contradicted by current evidence.
User wants the doc opened after drafting
Write the doc first, then open it with the available local mechanism. If no desktop opener exists, report the absolute path.
The repository is missing or inaccessible
Ask for the repo path or files. Do not invent intent from a project name alone.
Quick Reference
| Need |
Do |
| Fast repo map |
python3 scripts/repo_intent_inventory.py <repo> --json |
| Evidence rules |
Read references/methodology.md |
| Output shape |
Start from templates/repo-intent.md and read references/document-contract.md |
| Ambiguity handling |
Ask targeted questions after the draft, not before the first inspection |
| Failure modes |
Read references/gotchas.md |
Default Workflow
- Resolve the repository root. Prefer the current working directory when it contains
.git, a manifest, or existing project docs.
- Run
python3 scripts/repo_intent_inventory.py <repo> --json to collect the first pass of docs, manifests, tests, CI, entrypoints, and agent instructions.
- Read the highest-signal files yourself: root README, AGENTS or CLAUDE files, package manifests, CI workflows, top-level source entrypoints, tests, examples, and existing docs.
- Draft
REPO_INTENT.md using templates/repo-intent.md.
- Label claims as
Certain, Strong inference, Tentative, or Open question. Every important claim needs an evidence anchor.
- Ask the user only the questions needed to turn tentative claims into confirmed intent.
- When the user answers, update the document and record the confirmation in the review log.
- If requested, open the document for review after writing it.
Evidence Standard
Separate direct evidence from interpretation:
Certain means a source file, README, manifest, test, or config states it directly.
Strong inference means multiple independent signals point to the same intent.
Tentative means the claim is plausible but based on weak or single-source evidence.
Open question means the agent should not present the claim as true until the user answers.
Use file anchors whenever possible, such as README.md, package.json, src/server.ts, or tests/auth.test.ts. Include line numbers when the harness can provide them cheaply.
Output Path Policy
Default to REPO_INTENT.md at the repository root because future agents are most likely to discover a root-level intent file. Use docs/repo-intent.md only when the repository clearly keeps all durable project docs under docs/ and root-level docs would violate local conventions.
Do not automatically edit AGENTS.md, CLAUDE.md, or other persistent agent instructions unless the user asks. Instead, add a short "Suggested integration" note in the intent doc when linking it from agent instructions would help.
Question Protocol
Ask questions after the first draft exists, so the user can correct a concrete artifact.
Keep questions:
- evidence-linked: mention the file or signal that created the ambiguity
- answerable: prefer a short choice or factual confirmation
- prioritized: ask the smallest set that would materially improve future agent behavior
- non-blocking: leave unresolved questions in the doc if the user is not ready to answer
Gotchas
- Do not turn directory names into product strategy.
src/app proves structure, not customer intent.
- Do not flatten uncertainty. A confident but unsupported sentence is worse than an explicit open question.
- Do not ask broad discovery questions before reading the repo. The point is to make the agent do the first pass.
- Do not overwrite confirmed human intent just because current code is incomplete.
- Do not bury the actual purpose under a long architecture inventory. Architecture supports the intent; it is not the intent.
Reading Guide
| Need |
Read |
| Full inspection method, signal ranking, and confidence labels |
references/methodology.md |
| Required document sections, destination rules, and review loop |
references/document-contract.md |
| Pitfalls and recovery patterns |
references/gotchas.md |
| Starting Markdown shell |
templates/repo-intent.md |
1---2name: repo-intent-documenter3description: Create evidence-backed repository intent docs for AI coding agents, including certainty levels, evidence anchors, open questions, and review workflow. Trigger on document repo intent, REPO_INTENT.md, or what this repo is for. Do NOT use for ordinary README polishing.4---56# Repo Intent Documenter78Build a grounded repository intent document that makes the project's purpose, assumptions, and unresolved questions obvious to future agents.910## Decision Tree1112What is the user asking for?1314- Create or refresh a repo intent doc15 Run `scripts/repo_intent_inventory.py`, inspect the codebase, then write or update `REPO_INTENT.md`.1617- Explain intent inline without writing files18 Use the same evidence model, but answer in chat and offer a doc path only if useful.1920- Continue from an existing intent doc21 Read the existing doc first, preserve confirmed statements, and only revise claims contradicted by current evidence.2223- User wants the doc opened after drafting24 Write the doc first, then open it with the available local mechanism. If no desktop opener exists, report the absolute path.2526- The repository is missing or inaccessible27 Ask for the repo path or files. Do not invent intent from a project name alone.2829## Quick Reference3031| Need | Do |32|---|---|33| Fast repo map | `python3 scripts/repo_intent_inventory.py <repo> --json` |34| Evidence rules | Read `references/methodology.md` |35| Output shape | Start from `templates/repo-intent.md` and read `references/document-contract.md` |36| Ambiguity handling | Ask targeted questions after the draft, not before the first inspection |37| Failure modes | Read `references/gotchas.md` |3839## Default Workflow40411. Resolve the repository root. Prefer the current working directory when it contains `.git`, a manifest, or existing project docs.422. Run `python3 scripts/repo_intent_inventory.py <repo> --json` to collect the first pass of docs, manifests, tests, CI, entrypoints, and agent instructions.433. Read the highest-signal files yourself: root README, AGENTS or CLAUDE files, package manifests, CI workflows, top-level source entrypoints, tests, examples, and existing docs.444. Draft `REPO_INTENT.md` using `templates/repo-intent.md`.455. Label claims as `Certain`, `Strong inference`, `Tentative`, or `Open question`. Every important claim needs an evidence anchor.466. Ask the user only the questions needed to turn tentative claims into confirmed intent.477. When the user answers, update the document and record the confirmation in the review log.488. If requested, open the document for review after writing it.4950## Evidence Standard5152Separate direct evidence from interpretation:5354- `Certain` means a source file, README, manifest, test, or config states it directly.55- `Strong inference` means multiple independent signals point to the same intent.56- `Tentative` means the claim is plausible but based on weak or single-source evidence.57- `Open question` means the agent should not present the claim as true until the user answers.5859Use file anchors whenever possible, such as `README.md`, `package.json`, `src/server.ts`, or `tests/auth.test.ts`. Include line numbers when the harness can provide them cheaply.6061## Output Path Policy6263Default to `REPO_INTENT.md` at the repository root because future agents are most likely to discover a root-level intent file. Use `docs/repo-intent.md` only when the repository clearly keeps all durable project docs under `docs/` and root-level docs would violate local conventions.6465Do not automatically edit `AGENTS.md`, `CLAUDE.md`, or other persistent agent instructions unless the user asks. Instead, add a short "Suggested integration" note in the intent doc when linking it from agent instructions would help.6667## Question Protocol6869Ask questions after the first draft exists, so the user can correct a concrete artifact.7071Keep questions:7273- evidence-linked: mention the file or signal that created the ambiguity74- answerable: prefer a short choice or factual confirmation75- prioritized: ask the smallest set that would materially improve future agent behavior76- non-blocking: leave unresolved questions in the doc if the user is not ready to answer7778## Gotchas79801. Do not turn directory names into product strategy. `src/app` proves structure, not customer intent.812. Do not flatten uncertainty. A confident but unsupported sentence is worse than an explicit open question.823. Do not ask broad discovery questions before reading the repo. The point is to make the agent do the first pass.834. Do not overwrite confirmed human intent just because current code is incomplete.845. Do not bury the actual purpose under a long architecture inventory. Architecture supports the intent; it is not the intent.8586## Reading Guide8788| Need | Read |89|---|---|90| Full inspection method, signal ranking, and confidence labels | `references/methodology.md` |91| Required document sections, destination rules, and review loop | `references/document-contract.md` |92| Pitfalls and recovery patterns | `references/gotchas.md` |93| Starting Markdown shell | `templates/repo-intent.md` |