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.
- package/CHANGELOG.md +44 -6
- package/README.md +46 -19
- package/SECURITY.md +2 -2
- package/dist/bin.js +12173 -9823
- package/dist/{chunk-TUKY6KLH.js → chunk-TDPYLX7X.js} +6312 -4472
- package/dist/cli.cjs +12074 -9744
- package/dist/cli.d.cts +76 -2
- package/dist/cli.d.ts +76 -2
- package/dist/cli.js +549 -14
- package/dist/{generate-worker-DMzNbsAW.d.cts → generate-worker-D56JeXwx.d.cts} +2 -2
- package/dist/{generate-worker-CRMESc0b.d.ts → generate-worker-DakxZs-l.d.ts} +2 -2
- package/dist/index.cjs +6292 -4466
- package/dist/index.d.cts +281 -63
- package/dist/index.d.ts +281 -63
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +10486 -4393
- package/dist/mcp.d.cts +26 -11
- package/dist/mcp.d.ts +26 -11
- package/dist/mcp.js +1 -1
- package/dist/{types-C5ytHMYz.d.ts → types-D5XYzksd.d.cts} +50 -2
- package/dist/{types-C5ytHMYz.d.cts → types-D5XYzksd.d.ts} +50 -2
- package/docs/about.md +86 -0
- package/docs/agent.md +28 -6
- package/docs/answer.md +99 -48
- package/docs/benchmarks.md +34 -34
- package/docs/brief.md +80 -81
- package/docs/cli.md +103 -27
- package/docs/codebase-token-budget.md +14 -13
- package/docs/configuration.md +1 -1
- package/docs/contents.md +66 -0
- package/docs/deploy.md +2 -2
- package/docs/faq.md +112 -0
- package/docs/glossary.md +152 -0
- package/docs/health.md +1 -1
- package/docs/how-to-feed-a-repo-to-claude.md +6 -0
- package/docs/impact.md +102 -0
- package/docs/install.md +4 -3
- package/docs/llm-codebase-context.md +166 -0
- package/docs/mcp-server-for-codebase.md +155 -0
- package/docs/mcp.md +81 -82
- package/docs/migration.md +83 -85
- package/docs/output.md +1 -3
- package/docs/security-review.md +20 -9
- package/docs/slice.md +1 -1
- package/docs/tools.md +159 -185
- package/docs/troubleshooting.md +11 -11
- package/docs/vs-code2prompt.md +7 -0
- package/docs/vs-gitingest.md +7 -0
- package/docs/vs-repomix.md +10 -1
- package/docs/workspace.md +1 -1
- package/package.json +9 -2
package/docs/answer.md
CHANGED
|
@@ -1,54 +1,105 @@
|
|
|
1
|
-
#
|
|
1
|
+
# One question, one bounded context
|
|
2
2
|
|
|
3
|
-
An agent
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
{
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
package/docs/benchmarks.md
CHANGED
|
@@ -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
|
|
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 |
|
|
17
|
-
| slice |
|
|
18
|
-
| budget (30,000) |
|
|
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.
|
|
52
|
-
|
|
53
|
-
|
|
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,
|
|
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 |
|
|
61
|
-
| moment/luxon | 151 | 303,
|
|
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,
|
|
65
|
-
| colinhacks/zod |
|
|
66
|
-
| anuraghazra/github-readme-stats | 131 | 205,
|
|
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
|
|
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.
|
|
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) |
|
|
107
|
-
| codebase-snapshot (slice) |
|
|
108
|
-
| codebase-snapshot (budget 30,000) | 22 | 119,
|
|
109
|
-
| repomix 1.19.0 |
|
|
110
|
-
| gitingest | ? | 3,
|
|
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
|
-
- **
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
|
123
|
-
- **gitingest
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
#
|
|
1
|
+
# Briefs
|
|
2
2
|
|
|
3
|
-
`
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
##
|
|
21
|
+
## What it contains
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
39
|
-
an assertion from a measurement.
|
|
37
|
+
## Options
|
|
40
38
|
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
|
66
|
+
## What a review looks like
|
|
52
67
|
|
|
53
|
-
|
|
54
|
-
flag that means only that the call returned.
|
|
68
|
+
codebase-snapshot brief --diff origin/main --format pr-comment
|
|
55
69
|
|
|
56
|
-
|
|
70
|
+
```text
|
|
71
|
+
# Change brief
|
|
57
72
|
|
|
58
|
-
-
|
|
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
|
-
|
|
75
|
+
**Changed:** 3 · **Affected:** 7 · **Tests:** 2
|
|
63
76
|
|
|
64
|
-
|
|
77
|
+
<details><summary>Affected files</summary>
|
|
78
|
+
...
|
|
79
|
+
</details>
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
96
|
+
## Why it exists
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
104
|
+
## Related
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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.
|