feat: add brick_callers and brick_uncalled caller-status queries #7

Merged
trevon merged 3 commits from feat/caller-status into main 2026-09-25 02:51:17 +00:00
Owner

Problem

Agents asking "is this function used?" only had a bare zero in-degree, which conflates "nothing calls it" with "Brick could not resolve its callers" — and Brick resolves a minority of call sites on large C++ repositories.

Solution

Two read-only MCP queries over validated schema-4 models (src/callers.rs, src/mcp.rs):

  • brick_callers — per function: resolved (a resolved caller edge exists), unknown (no resolved caller, but the model records why one may exist: same-name unresolved call sites, name references, virtual/trait-impl/external-base members, framework attributes, implicit invocation, entry points, test code, incomplete parses, and — unless assume_closed_world — exported or external-linkage functions), or unreferenced (a review candidate with an explicit heuristic/compiler basis, never a dead-code proof). Returns complete nodes/edges plus metrics.resolution coverage and a fixed caveat.
  • brick_uncalled — per-language status counts and ordered unreferenced (optionally unknown) reports, with a limit.

Plus docs/research/cpp-rust-resolution.md (audit, literature rationale, experiment contract, labelled-corpus results, cross-tool coverage and dead-code spot checks, remaining limits) and the contract in docs/architecture/mcp.md.

Tests

  • tests/callers.rs (new) and the MCP CLI / benchmark runner updates.
  • Test-merged with current main (after #5): clean merge, cargo test 117 passed, 0 failed.

Merge order

Merge this before #6 (README split): #6 will then be updated to link docs/research/cpp-rust-resolution.md and to count six MCP tools instead of four.


The commits were written with Claude (see their Co-Authored-By trailers); this PR was opened by Claude at the maintainer's direction.

## Problem Agents asking "is this function used?" only had a bare zero in-degree, which conflates "nothing calls it" with "Brick could not resolve its callers" — and Brick resolves a minority of call sites on large C++ repositories. ## Solution Two read-only MCP queries over validated schema-4 models (`src/callers.rs`, `src/mcp.rs`): - `brick_callers` — per function: `resolved` (a resolved caller edge exists), `unknown` (no resolved caller, but the model records why one may exist: same-name unresolved call sites, name references, virtual/trait-impl/external-base members, framework attributes, implicit invocation, entry points, test code, incomplete parses, and — unless `assume_closed_world` — exported or external-linkage functions), or `unreferenced` (a review candidate with an explicit `heuristic`/`compiler` basis, never a dead-code proof). Returns complete nodes/edges plus `metrics.resolution` coverage and a fixed caveat. - `brick_uncalled` — per-language status counts and ordered `unreferenced` (optionally `unknown`) reports, with a limit. Plus `docs/research/cpp-rust-resolution.md` (audit, literature rationale, experiment contract, labelled-corpus results, cross-tool coverage and dead-code spot checks, remaining limits) and the contract in `docs/architecture/mcp.md`. ## Tests - `tests/callers.rs` (new) and the MCP CLI / benchmark runner updates. - Test-merged with current `main` (after #5): clean merge, `cargo test` 117 passed, 0 failed. ## Merge order Merge this before #6 (README split): #6 will then be updated to link `docs/research/cpp-rust-resolution.md` and to count six MCP tools instead of four. --- The commits were written with Claude (see their Co-Authored-By trailers); this PR was opened by Claude at the maintainer's direction.
Agents asking "is this function used?" get resolved, unknown, or
unreferenced per function instead of a bare zero in-degree. Unknown lists
why callers may exist: same-name unresolved call sites (excluding foreign
receivers and macros), name references (callbacks, address-taken, macro
bodies), virtual/trait-impl/external-base/outside-class members, framework
attributes, implicit protocol invocations, entry points, test code,
incomplete parses, and, unless assume_closed_world is set, exported or
external-linkage functions. Unreferenced is a review candidate with an
explicit heuristic/compiler evidence basis, never a dead-code proof.

The queries are read-only over validated schema-4 models and return
complete canonical nodes and edges plus metrics.resolution coverage.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
docs: record C/C++ and Rust resolution research and validation
Some checks failed
build / build-macos (pull_request) Has been cancelled
build / release (pull_request) Has been cancelled
build / build-linux (pull_request) Has been cancelled
6d4335d3ae
Adds the audit, literature rationale, experiment contract, labeled-corpus
results, Fold/Paperbridge/Brick/YAMS coverage and dead-code spot checks,
model changes, identity changes, and remaining limits.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merge branch 'main' into feat/caller-status
Some checks failed
build / build-linux (pull_request) Successful in 1m4s
build / build-macos (pull_request) Has been cancelled
build / release (pull_request) Has been cancelled
d7be35d7ef
trevon merged commit b160fea314 into main 2026-09-25 02:51:17 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
trevon/brick!7
No description provided.