Skip to content

feat: agentic related-code reading (point 1 — biggest quality lever)#10

Merged
NeverENG merged 1 commit into
mainfrom
feat/agentic-related-files
May 30, 2026
Merged

feat: agentic related-code reading (point 1 — biggest quality lever)#10
NeverENG merged 1 commit into
mainfrom
feat/agentic-related-files

Conversation

@NeverENG

Copy link
Copy Markdown
Owner

What

Implements the #1 quality lever from DESIGN.md §六: agentic related-code reading.

Until now BanGD reviewed only the diff plus the full contents of the changed files. It never saw the untouched code a change depends on — the struct/interface defined in another file, the caller that already holds a lock, the package's other methods sharing an invariant. That's exactly the context architecture-level reasoning needs.

How

A new core module src/core/related.ts adds one model-directed planning round before the review:

  1. Plan — the model names the untouched files it needs, inferred from the Go imports/identifiers already visible in the changed code (no hallucinated paths).
  2. Fetch — the core pulls each via readFile, bounded by count (MAX_RELATED_FILES) and char budget (RELATED_CHAR_BUDGET). A miss returns null and is dropped — cheap.
  3. Review — fetched files feed into the review as a dedicated context block.

Deliberate scope (v1)

  • One round, reusing the existing single-shot generateStructured port — no multi-turn tool-use redesign. Earns its keep first; multi-round / interleaved tool-use is a documented later refinement.
  • Related files land in the user-message tail, so the large cached system prompt (caching) is unaffected.
  • Observable: ReviewOutcome.relatedFiles surfaces which files were pulled — shown in the PR comment footer, the Action log, and the smoke output. This is the concrete demonstration of the lever working for a judged deliverable.
  • Planning failure is never fatal (returns []; the review proceeds).

Tests

  • New src/core/related.test.ts (9 cases): trim/dedupe, exclude changed files, drop non-strings, cap, no-paths/throw[], schema identity, fetch-and-drop-misses.
  • review.test.ts updated to be schema-aware + a new case asserting planner-named files are fetched and injected.
  • All 65 tests pass; typecheck + lint clean; dist/ bundle rebuilt and committed.

🤖 Generated with Claude Code

…depends on (point 1)

The #1 quality lever in DESIGN.md §六: reviewing only the diff + changed files
misses the untouched code a change depends on (struct defs elsewhere, callers
holding a lock). Add one model-directed planning round (src/core/related.ts):
the model names the untouched files it needs from the imports/identifiers already
visible in the changed code, the core fetches them via readFile (bounded by count
+ char budget; a miss is cheap), and they feed into the review as extra context.

Deliberately minimal v1: one round, reusing the single-shot generateStructured
port (no multi-turn tool-use redesign), related files go in the user-message tail
so the cached system prompt is unaffected. Observable: ReviewOutcome.relatedFiles
surfaces which files were pulled (comment footer + Action log + smoke output).
Planning failure is never fatal (returns []).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@NeverENG NeverENG merged commit 753d09c into main May 30, 2026
1 check passed
@NeverENG NeverENG deleted the feat/agentic-related-files branch May 30, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant