You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 00730aa
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/review-context.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
3
3
`codebase-context-review` turns a committed git diff into a bounded review-context packet.
4
4
5
-
It is deliberately **not** an AI reviewer. It does not call an LLM, decide whether code is correct, or post comments. Its job is narrower and testable: compile the changed surface, stable diff signals, related codebase context, and current conventions into one reproducible input for a reviewer or evaluation harness.
5
+
It is deliberately **not** an AI reviewer. It does not call an LLM, decide whether code is correct, or post comments. Its job is narrower and testable: compile the changed surface, stable diff signals, related codebase context, and current conventions into a versioned input for a reviewer or evaluation harness.
6
6
7
7
## Why this exists
8
8
9
-
A PR reviewer needs more than the patch, but dumping an entire repository into a model is expensive and hard to reproduce. The review-context path creates a deterministic boundary between:
9
+
A PR reviewer needs more than the patch, but dumping an entire repository into a model is expensive and hard to reproduce. The review-context path creates a clean boundary between:
10
10
11
11
1.**context compilation** — git + local repository analysis
12
12
2.**review reasoning** — any model or human reviewer consuming the packet
@@ -20,7 +20,7 @@ Build and run from the repository:
20
20
21
21
```bash
22
22
pnpm build
23
-
node dist/review-cli.js --base origin/main --head HEAD
23
+
node dist/review-bin.js --base origin/main --head HEAD
24
24
```
25
25
26
26
After package publication, the package also exposes:
@@ -42,15 +42,18 @@ npx codebase-context-review \
42
42
43
43
The command uses merge-base diff semantics (`base...head`), which matches the normal pull-request question: what changed on this branch since it diverged from the base branch?
44
44
45
+
`review-context-v1` requires `--head` to resolve to the checked-out `HEAD` and requires a clean working tree. The diff itself is then generated from the already-resolved commit SHAs rather than mutable symbolic refs.
46
+
45
47
## Packet contract
46
48
47
49
The current schema is `review-context-v1`.
48
50
49
51
The packet contains:
50
52
51
53
- exact resolved base/head commit SHAs
52
-
- SHA-256 fingerprint of the raw git diff
54
+
- SHA-256 fingerprint of Git's exact raw diff output
53
55
- changed file status, additions/deletions, rename source, and binary flag
56
+
- NUL-safe filename parsing for unusual valid git paths
54
57
- identifiers extracted deterministically from changed lines
55
58
- bounded search queries derived from those diff signals
56
59
- bounded related-context results from the existing `search_codebase` engine
@@ -60,6 +63,8 @@ The packet contains:
60
63
61
64
Absolute local repository paths are not part of the packet contract.
62
65
66
+
The git envelope, identifier extraction, bounds, and query derivation are deterministic. Related-context ranking is only reproducible under the same `codebase-context` version, index contents, embedding/reranking configuration, and runtime dependencies; benchmark manifests should freeze those inputs rather than pretending the entire retrieval stack is environment-independent.
67
+
63
68
## Bounds
64
69
65
70
Defaults:
@@ -75,13 +80,15 @@ These are explicit because an unbounded context compiler is not useful evidence.
75
80
76
81
## Index behavior
77
82
78
-
If the repository has no existing codebase-context index, the command indexes it before searching. Pass `--no-index` to fail instead, which is useful in controlled benchmark runs where setup/index cost must be measured separately.
83
+
By default, the command creates an index when one is missing and runs an incremental refresh when one already exists. This keeps normal use aligned with the checked-out clean `HEAD`.
84
+
85
+
Pass `--no-index` to prohibit both creation and refresh. It fails if no index exists. This is useful in controlled benchmark runs where setup/index work is captured separately; the caller is then responsible for proving that the supplied index matches the frozen source state.
79
86
80
87
The command is local-first. It invokes git and the existing local index/search pipeline; it does not introduce an LLM or external review API.
81
88
82
89
## What this proves
83
90
84
-
Shipping this command proves only that the project can compile a deterministic review-oriented context packet from a real git range.
91
+
Shipping this command proves only that the project can compile a bounded, versioned review-oriented context packet from an exact committed git range.
85
92
86
93
It **does not** prove that the packet improves review quality, catches more bugs, reduces false positives, or beats another context strategy. Those are benchmark claims and remain blocked until measured.
87
94
@@ -102,8 +109,9 @@ The existing ContextBench protocol already follows the same evidence discipline
102
109
## Current limitations
103
110
104
111
- Only committed git refs are supported in v1; working-tree/staged review is intentionally deferred.
112
+
-`--head` must be the checked-out commit and the worktree must be clean.
105
113
- Query generation is lexical and deterministic. It extracts identifiers from changed lines and falls back to path signals; it is not AST-aware yet.
106
-
-The command searches the current repository index. A stale index can therefore produce stale related context; search-quality/preflight output should be preserved by consumers.
114
+
-`--no-index` deliberately skips freshness work, so benchmark callers must attest the index/source match themselves.
107
115
- Large diffs are bounded by the CLI git-buffer limit and fail rather than silently truncating the raw fingerprint input.
108
116
- Binary files are recorded but do not generate identifier-based queries.
109
117
- The packet is context, not a verdict. A consumer should never turn `preflight.ready` into "the change is correct."
0 commit comments