Commit Graph

2 Commits

Author SHA1 Message Date
Colby McHenry 44cea15358 feat(mcp): codegraph_node reads files like the Read tool (offset/limit, byte-parity)
Make codegraph_node a drop-in, faster Read for indexed source files so agents
reach for it during implementation instead of the Read tool:

- file mode returns current source numbered byte-for-byte like Read (<n>\t<line>,
  no padding, trailing line kept), narrowable with offset/limit (Read semantics);
  content is the default, symbolsOnly:true for the structural map.
- one-line blast-radius header (used by N files); honest pagination for large
  files; #383 (yaml/properties never dumped) and #527 (validatePathWithinRoot) preserved.
- reframed codegraph_node description + server-instructions: read a source file
  with codegraph_node instead of Read — same bytes, faster, + blast radius.

Investigated and REJECTED a PreToolUse(Read) redirect hook: clean A/B showed a
blanket deny-redirect regresses simple edits (~2x tool calls; agent routes around
it via Bash). Eval scripts kept as archived artifacts; rationale in
docs/design/agent-codegraph-adoption.md.

Tests: node-file-view.test.ts (9, incl. strict <n>\t parity). Full suite green (1270).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 12:00:19 -04:00
Colby Mchenry 7175dc456c feat(mcp): steer agents to codegraph during implementation + file-view node mode (#733)
* feat(mcp): steer agents to codegraph during implementation, not just Q&A

Two changes targeting agents that reach for Read during edits instead of codegraph:

1. Reframe the agent-facing steering (server-instructions + codegraph_node/explore
   descriptions): drop "consult BEFORE ... not during"; position codegraph_node as
   the Read upgrade for a named symbol (verbatim current on-disk source, safe to
   Edit from, + caller/callee trail), explore PRIMARY / node SECONDARY, with the
   "cached intelligence — better context, fewer tokens" framing.

2. File-view mode: codegraph_node now accepts a `file` with no `symbol` and returns
   that file's symbol map + graph role (its dependents), plus verbatim bodies with
   includeCode — so it can displace a path-keyed Read, not just a symbol lookup.
   Resolves a path or basename; dedups nested members; budget-capped.

To be A/B'd on an implementation task before shipping (per the retrieval doctrine:
steering changes must be measured, not assumed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(changelog): note codegraph_node file-view + implementation steering

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 09:47:23 -04:00