codebase-snapshot 0.20.12 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +44 -6
  2. package/README.md +46 -19
  3. package/SECURITY.md +2 -2
  4. package/dist/bin.js +12173 -9823
  5. package/dist/{chunk-TUKY6KLH.js → chunk-TDPYLX7X.js} +6312 -4472
  6. package/dist/cli.cjs +12074 -9744
  7. package/dist/cli.d.cts +76 -2
  8. package/dist/cli.d.ts +76 -2
  9. package/dist/cli.js +549 -14
  10. package/dist/{generate-worker-DMzNbsAW.d.cts → generate-worker-D56JeXwx.d.cts} +2 -2
  11. package/dist/{generate-worker-CRMESc0b.d.ts → generate-worker-DakxZs-l.d.ts} +2 -2
  12. package/dist/index.cjs +6292 -4466
  13. package/dist/index.d.cts +281 -63
  14. package/dist/index.d.ts +281 -63
  15. package/dist/index.js +1 -1
  16. package/dist/mcp.cjs +10486 -4393
  17. package/dist/mcp.d.cts +26 -11
  18. package/dist/mcp.d.ts +26 -11
  19. package/dist/mcp.js +1 -1
  20. package/dist/{types-C5ytHMYz.d.ts → types-D5XYzksd.d.cts} +50 -2
  21. package/dist/{types-C5ytHMYz.d.cts → types-D5XYzksd.d.ts} +50 -2
  22. package/docs/about.md +86 -0
  23. package/docs/agent.md +28 -6
  24. package/docs/answer.md +99 -48
  25. package/docs/benchmarks.md +34 -34
  26. package/docs/brief.md +80 -81
  27. package/docs/cli.md +103 -27
  28. package/docs/codebase-token-budget.md +14 -13
  29. package/docs/configuration.md +1 -1
  30. package/docs/contents.md +66 -0
  31. package/docs/deploy.md +2 -2
  32. package/docs/faq.md +112 -0
  33. package/docs/glossary.md +152 -0
  34. package/docs/health.md +1 -1
  35. package/docs/how-to-feed-a-repo-to-claude.md +6 -0
  36. package/docs/impact.md +102 -0
  37. package/docs/install.md +4 -3
  38. package/docs/llm-codebase-context.md +166 -0
  39. package/docs/mcp-server-for-codebase.md +155 -0
  40. package/docs/mcp.md +81 -82
  41. package/docs/migration.md +83 -85
  42. package/docs/output.md +1 -3
  43. package/docs/security-review.md +20 -9
  44. package/docs/slice.md +1 -1
  45. package/docs/tools.md +159 -185
  46. package/docs/troubleshooting.md +11 -11
  47. package/docs/vs-code2prompt.md +7 -0
  48. package/docs/vs-gitingest.md +7 -0
  49. package/docs/vs-repomix.md +10 -1
  50. package/docs/workspace.md +1 -1
  51. package/package.json +9 -2
package/docs/answer.md CHANGED
@@ -1,54 +1,105 @@
1
- # Ask once, get cited context
1
+ # One question, one bounded context
2
2
 
3
- An agent with a question and a token budget has three ways to spend it: guess which files to read,
4
- run a tool that returns a plan, or run a tool that returns the context itself. `snapshot_answer` is
5
- the third, and it is the one that answers the question rather than describing how to answer it.
6
-
7
- ## One call
3
+ An agent usually has one question and one budget, not a browsing session. `snapshot_context` is
4
+ the one-call answer: give it a question, files or symbols, and it returns the smallest redacted,
5
+ line-numbered context that fits the token ceiling. Every planned file that did not fit is named in
6
+ `omitted[]`, and the response carries the same `trust` envelope as every other read-only tool.
8
7
 
9
8
  ```json
10
- { "name": "snapshot_answer", "arguments": { "question": "how does redaction decide what to mask?", "maxTokens": 20000 } }
9
+ {
10
+ "name": "snapshot_context",
11
+ "arguments": {
12
+ "question": "how does redaction decide what to mask?",
13
+ "maxTokens": 20000
14
+ }
15
+ }
11
16
  ```
12
17
 
13
- The reply is a block: each planned file as a head window with line numbers, the planner reason it
14
- was chosen, and, under "Not included", every planned file that did not fit with the reason. The
15
- `usedTokens` figure is measured with the same estimator the manifest uses, so it is comparable with
16
- every other number this tool prints.
17
-
18
- ## Why not `plan_for` plus `read`?
19
-
20
- You can do that, and for a large investigation you may want to: the plan is cheaper and lets you
21
- decide. `snapshot_answer` exists because the common case is one question and a budget, and in that
22
- case the arithmetic (which file fits, how many lines of it, what to say about the rest) belongs in
23
- the server, not in every client.
24
-
25
- | Tool | Returns | Cost |
26
- | :--- | :--- | :--- |
27
- | `snapshot_plan_for` | paths, tokens, reasons, no content | cheap |
28
- | `snapshot_read` | one file window by path and line | medium |
29
- | `snapshot_answer` | planned windows within one budget, with reasons | medium |
30
- | `snapshot_budget` | what several budgets would each select | medium |
31
-
32
- ## What it will not do
33
-
34
- - **It will not invent a path.** Every window comes from a section in `parts/`.
35
- - **It will not silently truncate.** A file that did not fit is named under "Not included"; a file
36
- that was cut says `first lines of N`.
37
- - **It will not read the working tree.** Redaction and exclusions therefore still apply, and a file
38
- the snapshot excluded cannot be selected by asking nicely.
39
- - **It will not exceed the budget silently.** If the first planned file alone is larger than the
40
- budget it is still returned, and the block says `first lines of N`; an empty answer would be
41
- worse than an oversized one that admits it.
42
- - **It will not flood the transport.** One block is capped at 64 KiB, the same cap `snapshot_read`
43
- applies to one response; a block that hits it says `first 64 KiB of the window`. Without the cap
44
- a single 200 KB line came back whole, and `usedTokens` described text the client never got.
45
-
46
- ## The CLI version of the same question
47
-
48
- ```bash
49
- npx codebase-snapshot generate --slice "how does redaction decide what to mask?" --slice-tokens 20000
50
- ```
18
+ `planOnly: true` returns the ranked reading plan without bodies. Use it when you want to choose
19
+ what to open yourself; use the default when you want the context in one call. With `files` and
20
+ `symbols`, the planner is skipped and those targets are assembled directly, still under the same
21
+ budget and with the same omission list.
22
+
23
+ The live index is used by default, so uncommitted edits and new files are visible without running
24
+ generate. live: false requires the persisted snapshot.
25
+
26
+ ## When to use snapshot_context
27
+
28
+ - **An agent has one question and a token budget.** The tool returns a reading set, not a
29
+ repository. It is the difference between "here is the codebase" and "here is what answers this".
30
+ - **You want the plan before the bodies.** planOnly returns ranked files and token costs without
31
+ spending the budget on content. A caller can show the plan, ask a human to approve it, then fetch
32
+ the bodies.
33
+ - **You already know the files or symbols.** Pass files or symbols directly; the planner is skipped,
34
+ and the same budget and omission accounting still apply.
35
+
36
+ It is not the right tool for "review this whole pull request" (use a brief), "what does this change
37
+ break" (use impact), or "find a string" (use locate).
38
+
39
+ ## What the planner does
40
+
41
+ The planner scores files from the question terms against paths, symbol names, layers and kinds. It
42
+ adds importer centrality, then pulls in the imports of the strongest matches and a bounded number of
43
+ their callers. It takes whole files while they fit, halves a large file when its head is affordable,
44
+ and stops when the budget is exhausted. Every file it did not take is named in omitted.
45
+
46
+ The scoring is deliberately simple and inspectable. It is not an embedding search and does not
47
+ claim semantic understanding; a question whose terms do not appear in a path or symbol will fall
48
+ back to the most-imported files, and the response says so in trust.reasons.
49
+
50
+ ## What comes back
51
+
52
+ The structured response contains:
53
+
54
+ | Field | Meaning |
55
+ | :-- | :-- |
56
+ | budgetTokens | The ceiling the caller asked for. |
57
+ | usedTokens | The estimate actually spent on the returned bodies. |
58
+ | files | The chosen files, each with its part, layer, kind, line window and why it was chosen. |
59
+ | omitted | Every planned file that did not fit, with the reason. |
60
+ | trust | Index source, freshness, coverage, redaction count and named partial reasons. |
61
+
62
+ A file in files may be a window rather than the whole body. The window is line-numbered and states
63
+ whether more remains, so an agent can ask for the next page instead of assuming it has the file.
64
+
65
+ ## A worked example
66
+
67
+ {
68
+ "name": "snapshot_context",
69
+ "arguments": {
70
+ "question": "how does redaction decide what to mask?",
71
+ "maxTokens": 12000,
72
+ "linesPerFile": 120
73
+ }
74
+ }
75
+
76
+ A run on this repository typically selects the redaction engine, its pattern catalogue, the tests
77
+ that exercise span masking and the scanner that decides which files are eligible. The response
78
+ names the files that did not fit; if the redaction tests are omitted, the trust envelope still says
79
+ coverage is complete for the plan, because the plan itself is what was bounded. Read omitted before
80
+ concluding that the answer is complete.
81
+
82
+ ## Limits
83
+
84
+ - **Terms, not intent.** Synonyms the planner does not know are missed. Pass files or symbols when
85
+ you know the target.
86
+ - **Token estimates, not tokenizer counts.** The estimate is useful for choosing a budget; it is not
87
+ a model's exact count.
88
+ - **No write access.** The tool never edits or runs code. It returns context.
89
+ - **No guarantee of completeness.** A small budget can omit the one file that mattered; the omission
90
+ list is the honest part of the answer.
91
+
92
+ ## The old tools
93
+
94
+ `snapshot_answer`, `snapshot_plan_for` and `snapshot_budget` were folded into
95
+ `snapshot_context` in 0.21.0. The plan/budget distinction is now `planOnly: true`; a multi-budget
96
+ comparison is a sequence of calls, which is cheaper than a tool that exists only to repeat the
97
+ planner.
98
+
99
+ → [CLI reference](cli.md) · [MCP tools](tools.md) · [Impact](impact.md)
100
+
101
+ ## Related
51
102
 
52
- That writes a whole snapshot narrowed to the question, with `reports/selection.md` explaining every
53
- choice. The tool is for an agent that needs the text now; the command is for a reader who wants the
54
- selection on disk, auditable and reusable.
103
+ - [MCP tools](tools.md) — the other six tools and their schemas.
104
+ - [MCP server for a codebase](mcp-server-for-codebase.md) — setup and security.
105
+ - [LLM codebase context](llm-codebase-context.md) — the broader guide.
@@ -8,14 +8,14 @@ anyone can run:
8
8
  node scripts/benchmark.mjs /path/to/repo "the question to slice for"
9
9
  ```
10
10
 
11
- The run below used the default question, on the repository at 0.12.34: 313 files, 987,750 estimated
12
- tokens in full.
11
+ The run below used the default question, on this repository at **0.21.0 on 2026-11-30**: 221 files,
12
+ 764,225 estimated tokens in full.
13
13
 
14
14
  | Mode | Files | Parts | Tokens | vs full | Time |
15
15
  | :-- | --: | --: | --: | --: | --: |
16
- | full | 313 | 11 | 987,750 | 100% | 1.66 s |
17
- | slice | 4 | 1 | 66,430 | 6.7% | 1.57 s |
18
- | budget (30,000) | 21 | 1 | 36,315 | 3.7% | 1.55 s |
16
+ | full | 221 | 9 | 764,225 | 100% | 2.05 s |
17
+ | slice | 7 | 1 | 63,983 | 8.4% | 1.68 s |
18
+ | budget (30,000) | 22 | 1 | 36,005 | 4.7% | 1.69 s |
19
19
 
20
20
  ## What the columns mean
21
21
 
@@ -48,22 +48,22 @@ node scripts/benchmark-suite.mjs <url> ... # your own list
48
48
 
49
49
  Each repository is cloned shallow into a scratch directory, packed by all three tools, and the
50
50
  clone is deleted. A repository that cannot be cloned is reported as skipped with the reason, never
51
- dropped from the table. Measured at 0.14.5, repomix 1.19.0, gitingest from PyPI, and
52
- re-run on 2026-11-18 at 0.17.55: all ten repositories packed by all three tools, every number
53
- identical, which is what a deterministic scanner should do.
51
+ dropped from the table. Measured at **0.21.0 on 2026-11-30**, with repomix 1.19.0 and gitingest from
52
+ PyPI. The shape held; small file-count differences are policy (notably bounded previews), not
53
+ scanner drift.
54
54
 
55
55
  | Repository | Ours files | Ours tokens | repomix tokens | repomix / ours | gitingest bytes |
56
56
  | :-- | --: | --: | --: | --: | --: |
57
- | jonschlinkert/is-odd | 11 | 5,450 | 4,291 | 0.79 | 29,392 |
57
+ | jonschlinkert/is-odd | 11 | 5,447 | 4,291 | 0.79 | 29,392 |
58
58
  | chalk/chalk | 32 | 77,684 | 79,006 | 1.02 | 238,864 |
59
59
  | tj/co | 19 | 12,996 | 9,189 | 0.71 | 74,613 |
60
- | isaacs/minimatch | 85 | 319,879 | 64,846,987 | 202.72 | 1,800,672 |
61
- | moment/luxon | 151 | 303,032 | 250,093 | 0.83 | 806,740 |
60
+ | isaacs/minimatch | 87 | 303,508 | 64,794,947 | 213.49 | 1,764,476 |
61
+ | moment/luxon | 151 | 303,029 | 250,093 | 0.83 | 806,740 |
62
62
  | psf/requests | 117 | 382,695 | 687,333 | 1.80 | 524,712 |
63
63
  | pallets/click | 177 | 470,265 | 335,153 | 0.71 | 1,413,342 |
64
- | expressjs/express | 215 | 261,829 | 198,639 | 0.76 | 792,177 |
65
- | colinhacks/zod | 686 | 1,762,835 | 1,748,187 | 0.99 | 4,468,877 |
66
- | anuraghazra/github-readme-stats | 131 | 205,009 | 169,079 | 0.82 | 553,367 |
64
+ | expressjs/express | 215 | 261,817 | 198,639 | 0.76 | 792,177 |
65
+ | colinhacks/zod | 687 | 1,768,759 | 1,752,965 | 0.99 | 4,485,971 |
66
+ | anuraghazra/github-readme-stats | 131 | 205,013 | 169,079 | 0.82 | 553,367 |
67
67
 
68
68
  Read it carefully:
69
69
 
@@ -73,7 +73,7 @@ Read it carefully:
73
73
  reasonable estimates of the same text do.
74
74
  - **minimatch is the exception, and it is a policy difference, not an estimate.** That repository
75
75
  carries five benchmark fixtures of 20 to 25 MB of JSON. repomix emits them (64.8M tokens); our
76
- large-file rule emits a bounded preview and records the omission, so the pack stays 319,879 tokens.
76
+ large-file rule emits a bounded preview and records the omission, so the pack stays 303,508 tokens.
77
77
  A pack that will not fit in a context window has not helped the reader, however complete it is.
78
78
  - **gitingest publishes no token count**, so its column is the size of its one-document digest.
79
79
  - **File counts agree within one or two** everywhere except minimatch, where our preview keeps the
@@ -98,32 +98,32 @@ node scripts/compare.mjs --repomix # add --json for machine-readable output
98
98
  ```
99
99
 
100
100
  repomix is fetched through `npx` at run time and gitingest through `python -m gitingest`;
101
- neither is a dependency of this package. Measured on this repository at 0.14.2, repomix 1.19.0,
102
- gitingest from PyPI, same machine:
101
+ neither is a dependency of this package. Measured on this repository at **0.21.0 on 2026-11-30**,
102
+ repomix 1.19.0, gitingest from PyPI, same machine:
103
103
 
104
104
  | Tool / mode | Files | Content bytes | Tokens | vs full | Time |
105
105
  | :-- | --: | --: | --: | --: | --: |
106
- | codebase-snapshot (full) | 336 | 3,301,883 | 1,060,727 | 100% | 2.22 s |
107
- | codebase-snapshot (slice) | 4 | 239,837 | 66,903 | 6.3% | 2.14 s |
108
- | codebase-snapshot (budget 30,000) | 22 | 119,915 | 36,107 | 3.4% | 2.09 s |
109
- | repomix 1.19.0 | 335 | 3,519,653 | 888,168 | 83.7% | n/a |
110
- | gitingest | ? | 3,123,817 | n/a | n/a | n/a |
106
+ | codebase-snapshot (full) | 221 | 2,549,431 | 764,225 | 100% | 2.04 s |
107
+ | codebase-snapshot (slice) | 7 | 231,622 | 63,983 | 8.4% | 1.63 s |
108
+ | codebase-snapshot (budget 30,000) | 22 | 119,794 | 36,005 | 4.7% | 1.70 s |
109
+ | repomix 1.19.0 | 386 | 4,245,226 | 1,067,915 | 139.7% | n/a |
110
+ | gitingest | ? | 3,848,714 | n/a | n/a | n/a |
111
111
 
112
112
  Read that honestly:
113
113
 
114
- - **repomix reports fewer tokens for a similar pack** (854k against our 1.03M, 83%). The cause is
115
- the estimator, not the content: our manifest counts word runs, punctuation and newlines (the
116
- budget planner uses bytes/4), while repomix uses a tokenizer.
117
- Our number is conservative, which is the right direction for a budget — a plan that fits
118
- 1,027,911 tokens fits a tokenizer count of 854,178 far more often than the reverse.
119
- - **Our pack is smaller in bytes** (3.20 MB of file content against repomix's 3.39 MB of output,
120
- which includes its own wrappers), and the file sets differ slightly: 330 against 329.
114
+ - **The comparison is not a purity test.** repomix packed 386 files and 4.25 MB; our full run packed
115
+ 221 files and 2.55 MB. The file sets differ because the ignore rules differ, so the token totals
116
+ describe two different packs.
117
+ - **Each tool counts tokens its own way.** Our manifest counts word runs, punctuation and newlines
118
+ (the budget planner uses bytes/4); repomix uses a tokenizer. Neither is the model's exact count;
119
+ read the share, not the absolute number.
120
+ - **Our pack is smaller in bytes** (2.55 MB of file content against repomix's 4.25 MB of output,
121
+ which includes its own wrappers), and gitingest's digest is larger still at 3.85 MB.
121
122
  - **The modes are what the other tool does not have.** repomix packs the repository; a slice and a
122
- budget are the same snapshot narrowed after scanning, at 6.5% and 3.5% of the tokens.
123
- - **gitingest's digest is smaller in bytes** (3.12 MB against our 3.30 MB of file content), and it
124
- publishes no token count at all; the harness reports its digest size and says so. Its output is
125
- one flat document with a tree and a separator per file, which is why a byte comparison is the
126
- only honest one.
123
+ budget are the same snapshot narrowed after scanning, at 8.4% and 4.7% of our full tokens.
124
+ - **gitingest publishes no token count at all.** The harness reports its digest size and says so.
125
+ Its output is one flat document with a tree and a separator per file, which is why a byte
126
+ comparison is the only honest one.
127
127
 
128
128
  The same caveats apply to any comparison: different ignore rules, different wrappers, different
129
129
  tokenizers. What is comparable is the shape — full packs are too large for a context window, and a
package/docs/brief.md CHANGED
@@ -1,109 +1,108 @@
1
- # The brief: the half only you can write
1
+ # Briefs
2
2
 
3
- `PROMPT.md` is generated, and part of it cannot be. The manifest can prove which files are here,
4
- which were skipped and why, what the system map is and what the standard requires. It cannot know
5
- what the software is *for*, what has already gone wrong, or which failures this team would
6
- recognise. That is judgement, so it is supplied as a file and merged into the brief.
3
+ `codebase-snapshot brief` packs one reviewer-ready Markdown document: a question or a change, the
4
+ impact it reaches, the candidate tests, and bounded redacted source windows. It is the formatting
5
+ layer over `impact` and `context`; it does not invent a second graph.
7
6
 
8
- ```bash
9
- # init writes BRIEF.md next to the config, with the five headings and guidance in comments
10
- npx codebase-snapshot init --yes
7
+ ## Run it
11
8
 
12
- # then enable it with one edit, or name your own file on the command line
13
- npx codebase-snapshot generate --brief docs/brief.md
9
+ ```bash
10
+ codebase-snapshot brief "how does authentication work?"
11
+ codebase-snapshot brief --diff origin/main
12
+ codebase-snapshot brief --paths src/router.ts --out notes/review.md
13
+ codebase-snapshot brief --diff HEAD --copy
14
+ codebase-snapshot brief --diff HEAD --format json
14
15
  ```
15
16
 
16
- ```js
17
- // snapshot.config.mjs
18
- export default {
19
- brief: "BRIEF.md", // relative to the project root; a missing file is an error
20
- promptTask: "audit", // audit | review | explain
21
- };
22
- ```
17
+ With neither a question nor `--diff`/`--paths`, the change is the working tree against `HEAD`.
18
+ The brief uses the live index by default and writes nothing into the repository; `--no-live`
19
+ requires the persisted snapshot.
23
20
 
24
- ## The five headings
21
+ ## What it contains
25
22
 
26
- | Heading | What happens |
27
- | :--- | :--- |
28
- | `## Stakes` | rendered as its own section, right after the job |
29
- | `## The system` | replaces the generated narrative; the measured facts still follow under "What the index records" |
30
- | `## What came before` | rendered above the generated commit ledger |
31
- | `## The bar` | replaces the standard |
32
- | `## Calibration` | replaces the example failures |
23
+ 1. A trust stamp: index source, freshness, coverage, redaction count, omitted count, and any named
24
+ partial reason.
25
+ 2. The question or impact summary.
26
+ 3. For a change: changed files, symbol-pruned affected files, routes, candidate tests and warnings.
27
+ 4. For a diff: the diff hunks, passed through the same span-masking redaction as every other artifact.
28
+ No raw credential excerpt is copied into the brief.
29
+ 5. Bounded source windows for the files that matter, until `--max-tokens` is reached.
30
+ 6. A named list of files that did not fit or are unavailable. Nothing is dropped silently.
33
31
 
34
- Any other `##` heading is kept, verbatim, under **Owner notes**. Nothing is dropped because the
35
- merge did not recognise it — a brief is your text, and silently discarding a section is the one
36
- thing this tool does not do.
32
+ `--format pr-comment` renders the affected-file list and details as a collapsible GitHub comment.
33
+ `--out` writes inside the repository only; a path that escapes through `..` or a link is refused.
34
+ `--copy` uses the platform clipboard command (`clip`, `pbcopy`, `wl-copy` or `xclip`) with
35
+ `shell: false`.
37
36
 
38
- Every owner section is marked in `PROMPT.md` as written by the project owner, so a reader can tell
39
- an assertion from a measurement.
37
+ ## Options
40
38
 
41
- ## A worked example
39
+ | Option | Meaning |
40
+ | :-- | :-- |
41
+ | `--diff <ref>` | Compare the working tree with a git ref. |
42
+ | `--paths <a,b>` | Treat repository-relative paths as the change. |
43
+ | `--max-tokens <n>` | Token budget for the assembled brief (default 12000, minimum 500). |
44
+ | `--lines-per-file <n>` | Line window per file (default 80). |
45
+ | `--include-tests` | Include candidate tests, not only production impact. |
46
+ | `--copy` | Copy the finished brief to the clipboard. |
47
+ | `--out <path>` | Write the brief to a repository-relative path. |
48
+ | `--format json` | Return `{ markdown, usedTokens, files, omitted, trust }` and keep stdout parseable. |
49
+ | `--format pr-comment` | Render collapsible PR-comment sections. |
50
+ | `--no-cache` | Bypass the OS live-index summary cache. |
51
+ | `--no-live` | Require the generated snapshot. |
42
52
 
43
- ```markdown
44
- <!-- BRIEF.md: fill in what you know; an empty section is simply not rendered -->
53
+ ## When a brief is the right tool
45
54
 
46
- ## Stakes
55
+ - **A pull request needs one review artefact.** The brief puts the change, its affected files, the
56
+ candidate tests and bounded source windows in one Markdown document a reviewer can paste into a
57
+ comment or a model.
58
+ - **The reviewer is not the author.** A trust stamp and an explicit omission list let someone who
59
+ did not write the code judge whether the context is complete.
60
+ - **You need a redacted diff.** The diff is masked with the same span rules as every other artifact;
61
+ a credential in the hunk does not reach the brief.
47
62
 
48
- Runs live production for one owner. A wrong cleanup deletes their data, and the backup is taken by
49
- the same process it is protecting.
63
+ Use a snapshot instead when the task is "explain this repository"; use impact when the task is
64
+ "tell me what this change reaches" and you do not need prose.
50
65
 
51
- ## What came before
66
+ ## What a review looks like
52
67
 
53
- Four rounds, 23 defects. The recurring shapes: a guard at the route but not the timer, and an `ok`
54
- flag that means only that the call returned.
68
+ codebase-snapshot brief --diff origin/main --format pr-comment
55
69
 
56
- ## Calibration
70
+ ```text
71
+ # Change brief
57
72
 
58
- - a grant signed for one recipe executing another recipe's deletions
59
- - a recipe that never worked, because its test supplied a number where the daemon sends a string
60
- ```
73
+ Trust: source=live-overlay · freshness=live-computed · coverage=complete · redacted=0 · omitted=0
61
74
 
62
- ## What is refused, and why
75
+ **Changed:** 3 · **Affected:** 7 · **Tests:** 2
63
76
 
64
- Three things are errors rather than overrides, because each would make the document lie:
77
+ <details><summary>Affected files</summary>
78
+ ...
79
+ </details>
65
80
 
66
- - **a measured heading.** `Coverage`, `This snapshot`, `Attaching this`, `The job`, `What you have`
67
- and the rest are rendered from the manifest. Redefining one would let prose overwrite a
68
- measurement.
69
- - **a file that cannot be read.** A snapshot must not quietly ship without the half you wrote.
70
- - **an edited brief after generating.** Its digest is recorded, so `validate` reports
71
- `brief: docs/brief.md changed since this snapshot was generated`.
72
-
73
- A brief must also stay inside the repository and must not be a credential-bearing file; a path
74
- that escapes the repository is refused, because an untrusted `snapshot.config.json` must not turn
75
- the brief into a host-file read. Its prose is redacted with the full content scanner, so a PEM
76
- private key pasted into the text is masked as a block.
77
-
78
- Two smaller ones: a heading defined twice is ambiguous and refused, and a file over 64 KiB is
79
- refused with its size — past that it is a second codebase rather than instruction.
81
+ ### `src/auth/session.ts` — changed
82
+ ...
83
+ ```
80
84
 
81
- ## How the file is parsed
85
+ The exact headings depend on the format. In every format the same three facts are present: what
86
+ changed, what the tool believes it reaches, and what it could not include.
82
87
 
83
- | Input | Result |
84
- | :--- | :--- |
85
- | `## stakes`, `## STAKES` | the stakes section; headings match case-insensitively |
86
- | `## Stakes:` | the stakes section; a trailing colon is a typo, not a different heading |
87
- | `<!-- ... -->` | removed before parsing — the `init` scaffold is all comments and renders nothing |
88
- | a section with no text | not rendered at all |
89
- | a fenced block containing `## Coverage` | content, not a heading |
90
- | CRLF, or a UTF-8 byte-order mark | read like the plain case |
91
- | a control character | escaped, as everywhere else this tool reproduces text |
88
+ ## What it does not do
92
89
 
93
- ## The job changes, the standard does not
90
+ - It does not run the tests it names; it selects candidates.
91
+ - It does not prove runtime reachability; the impact report is a static, conservative analysis.
92
+ - It does not silently fill a budget with unrelated files. A file that does not fit is named in the
93
+ omission list.
94
+ - It does not edit the repository unless --out names a path; that write is confined to the repository.
94
95
 
95
- `promptTask` changes only the opening section:
96
+ ## Why it exists
96
97
 
97
- - `audit` (the default) — find what is still wrong or will break;
98
- - `review` — say what a change breaks, and what it claims but does not do;
99
- - `explain` — explain how a subsystem works, and cite the lines.
98
+ A review starts with a diff, but the diff is not the change: the call sites, the route and the test
99
+ that will fail are elsewhere. The brief puts those on one page, marks what is evidence and what is a
100
+ candidate, and stamps the trust envelope so a reader can tell a complete answer from a partial one.
100
101
 
101
- The standard, the coverage duty and the answer shape are the same in all three. An unknown value
102
- is a usage error, never a silent fall back to the default.
102
+ → [Impact reports](impact.md) · [CLI reference](cli.md) · [MCP tools](tools.md)
103
103
 
104
- ## Relationship to the rest of the snapshot
104
+ ## Related
105
105
 
106
- `brief` is instruction, not payload: changing it does not change the files that are copied, but it
107
- does change the config digest, so a stale brief is flagged exactly like a stale snapshot. The
108
- writer’s prose is masked like every other reproduced string, and the brief file itself is an
109
- ordinary file in the repository — it may be snapshotted, or excluded with `excludePatterns`.
106
+ - [Impact reports](impact.md) — the analysis a brief is built from.
107
+ - [MCP server for a codebase](mcp-server-for-codebase.md) — the same tools over MCP.
108
+ - [LLM codebase context](llm-codebase-context.md) — the broader guide.