Skip to content

feat(mcp): scope advertised tools by family through REA_MCP_TOOL_FAMILIES - #3026

Closed
llevel wants to merge 26 commits into
morluto:mainfrom
llevel:feat/mcp-tool-families
Closed

llevel wants to merge 26 commits into
morluto:mainfrom
llevel:feat/mcp-tool-families

Conversation

@llevel

@llevel llevel commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #3246.

REA advertises its complete MCP tool catalog (200+ tools) to every client. Agents pay context for each advertised schema, which prices local models with small context windows out entirely. This PR scopes the advertised tool set by family through REA_MCP_TOOL_FAMILIES (env var, or rea setup --tool-families <ids> persisted into the registration entry). Unset behavior is unchanged: the complete catalog is advertised exactly as before.

Problem and expected behavior

A local 32K-context model driving REA over MCP gets a ~249K-token tool advertisement it cannot fit, so the investigation never starts (independent benchmark in discussion #3098: full list refused at once; session,direct + compact still 28K tokens and failed; only a 10-tool allowlist at 4.4K tokens succeeded 3 of 3). Users need a supported, server-side way to narrow the advertised set to the families their investigation needs, without client-side filtering hacks.

Change and scope

  • New REA_MCP_TOOL_FAMILIES selection (env var or rea setup --tool-families <ids>, persisted into the registration entry) omits out-of-scope schemas from tools/list entirely.
  • Fail-safe, not silent: out-of-scope tools stay registered but disabled; direct calls fail with the SDK's Tool ... disabled invalid-params error.
  • Selections outside the published family ids fail server startup with the complete id list; doctor validates the selection against the same ids.
  • The grouping moves from a literal block in scripts/lib/catalog-builders.mjs into src/contracts/toolFamilies.ts, so runtime advertising and the product catalog derive from one grouping.
  • Docs: workflow-to-family recommendation table (firmware, web, Android, native, managed, Electron, evidence-only) with session as the near-universal base; browser family included for Electron and browser-hosted apps.
  • Status reports honor the scope instead of directing agents at calls that always fail, and no longer suppress the Hopper offer for scoped registrations.
  • The family id inventory lives in src/contracts/toolFamilyIds.ts, so startup configuration validates a scope without loading the canonical schema graph the deferred MCP runtime deliberately avoids; src/contracts/toolFamilies.ts keeps the contract ownership.
  • Because the build-owned recorded catalog holds the complete inventory and a full-catalog identity, a scoped registration composes the canonical scope eagerly instead of being served from that catalog; an unscoped registration keeps the deferred path.
  • Review fixes: scripts/verify-claude-client.mjs calls the named-options catalog identity API, and the EVM limiter probe is gated on the artifact family like the other provider probes.

Follow the contribution scope. No target execution, injection, mutation, or protection recovery is introduced; scope decision: not applicable beyond the documented MCP advertisement contract.

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP tool-catalog contract (src/contracts/toolFamilies.ts owns the grouping); earliest changed stage is server startup/registration.
  • Contribution scope fit and linked maintainer decision: MCP advertisement scoping only; no new provider or target-facing capability. Linked issue: [Feature] Scope advertised MCP tools by family through REA_MCP_TOOL_FAMILIES #3246.
  • CLI and MCP/tool-catalog contract: tools/list omits out-of-scope tools; direct out-of-scope calls return the SDK disabled-tool error; rea setup --tool-families and doctor validation added. Default (unset) output is unchanged.
  • Provider, bridge, target-format, or platform compatibility: none. No provider, bridge, or OS-specific behavior changes.
  • Evidence, artifact, provenance, or reconstruction contract: none. Investigation behavior for in-scope tools is unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: catalog derives from the same grouping; metadata:check validates the family inventory against every TOOL_CONTRACTS entry. No build outputs committed.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

This change only filters which schemas are advertised and which calls are accepted; it adds no new target interaction:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/contracts/toolFamilies.test.ts (unit: every catalog tool resolves to a family; unknown names resolve undefined)
    • tests/conformance/contracts/mcpToolFamilies.test.ts (family inventory covers every TOOL_CONTRACTS entry)
    • tests/boundary/mcp/toolFamiliesMcp.test.ts (tools/list omission + disabled-call error at the boundary)
    • src/application/Setup.configuration.test.ts (scope persisted into the registration env; status reports honor scope)
  • Base reproduction or other evidence: independent end-to-end benchmark by @CassieFox23 in discussion Local models can drive REA over MCP when they see about 10 tools #3098 (local Qwen3.8-27B, 32K context, single 12 GB GPU): full catalog refused, session,direct+compact failed, 10-tool allowlist succeeded 3 of 3. That benchmark used PR feat(mcp): scope advertised tools by family through REA_MCP_TOOL_FAMILIES #3026 at d993ffeb1 plus a client-side allowlist; this PR provides the server-side half.
  • User-visible CLI/MCP output (if applicable):
    • tools/list with REA_MCP_TOOL_FAMILIES=session,direct returns only in-scope tools; calling an out-of-scope tool returns the SDK Tool ... disabled invalid-params error.
    • rea setup --tool-families <ids> persists the scope; an unknown id fails startup listing the complete valid ids.
  • Remaining proof gaps:
    • The benchmark covers one target, one model, one client, and three runs over the same path (as its author notes); broader local-model coverage is unverified.
    • No real Hopper/Ghidra/provider run was performed for this change (advertisement-only change; providers untouched).
    • Catalog-regeneration byte-identity was re-run by the post-merge build and produced no change; metadata:check (inventory coverage) passes on the merged tree.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Commands below ran on 5881a830f (merges upstream/main at bd5d189a8, after an earlier merge of 4a4bbab3c), Windows x64, Node.js v26.12.0. The merge commits alone did not carry the resolution for files that merged cleanly, so the family scope and its tests are committed separately in 5881a830f; the tree it commits is the tree these commands ran against.

  • npm ci and npm run build:cached — clean; the build regenerated the catalog digests and the recorded MCP catalog without a change
  • npm run check:fast (typecheck + lint, including verify:module-boundaries) — 2 tasks successful, 0 errors
  • npm run test:focused over toolFamiliesMcp and mcpDoctor — 27 passed
  • npm run test:focused over deferredRuntime and promptMcp — 42 passed, including the new scoped-registration case and the phase test that keeps the deferred entry from loading the schema graph
  • npm run test:focused over serverIdentity, sessionMcp, compactInputSchemaMcp, outputSchemaProfile — 32 passed, 1 failed. The failure is the pre-existing win32 case at serverIdentity.test.ts:213: it compares resolve("/packaged/rea.mjs") with the literal POSIX path, which resolves to C:\packaged\rea.mjs. I checked out unmodified upstream/main at 4a4bbab3c, built it, and the same case fails there identically, so it is not caused by this PR.
  • npm run test:local over src/contracts/toolFamilies.test.ts and tests/conformance/contracts/mcpToolFamilies.test.ts — 12 passed, including the new assertion that the id inventory and the definitions stay one list
  • npm run docs:check — pass, including the family catalog read from TOOL_FAMILY_DEFINITIONS; the builder throws when the families do not cover TOOL_CONTRACTS
  • Live rea mcp over stdio: unset 213 tools / 6 prompts, session 23/3, session,native 46/3, session,enhanced 37/3, direct 41/0, browser 12/0. No listed prompt names a hidden tool, inspect_macho is refused with -32602 outside native, and session,typo fails startup.
  • Packaged recorded-catalog runtime with REA_MCP_TOOL_FAMILIES=session: 23 tools listed and binary_session succeeds. Before the composition fix this path listed 213 tools and failed every call with MCP catalog identity does not match runtime.
  • REA_MCP_TOOL_FAMILIES=session node scripts/rea.mjs mcp doctor --json — healthy, 23/23 tools, expected and observed catalog digest equal
  • rea capabilities --json — unset and REA_MCP_INPUT_SCHEMA_PROFILE=compact share digests; full differs, so perf(mcp)!: default to compact input schema advertisements #5975's compact default survives the merge
  • Verifier expectation recomputed from the built dist — equals the default server identity (213 tools / 6 prompts) and differs from full, matching what scripts/verify-claude-client.mjs now asserts
  • Not run: npm run verify:claude-client (needs the Claude Code CLI and a host account); a deliberately slow or unresponsive REA_EVM_PRLIMIT_COMMAND mount (the probe is no longer attempted rather than bounded); real Hopper/Ghidra provider workloads (no installation available).

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Unset selection advertises the complete catalog exactly as before; no migration needed. No ! / BREAKING CHANGE marker.
  • Real Hopper/Ghidra, browser, or OS coverage: none performed; no OS- or provider-specific code paths touched.
  • Package or release metadata impact: none beyond the additive env var, setup flag, and docs. No version bump in this PR.
  • Security, privacy, process, or containment review: strictly reduces advertised surface (fewer schemas exposed per registration). No credentials, network, or execution-scope changes. Final diff checked for secrets and unrelated cleanup.

Author readiness

Human owner: @0xLLVEL

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-23T13:16:17.919246Z
We couldn’t complete this review. Comment @codex review to try again.
36a6b07 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@llevel llevel changed the title Feat/mcp tool families feat(mcp): scope advertised tools by family through REA_MCP_TOOL_FAMILIES Oct 13, 2026
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

need to test this @N0zoM1z0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3aa4796d0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/server/EvidenceMcpServer.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge based on the source review.

Summary

Adds REA_MCP_TOOL_FAMILIES and rea setup --tool-families to narrow MCP tool advertising.

  • MCP registrations can advertise only the tool families they select.
  • Prompts and status reports reflect the tools a registration advertises.
  • Setup saves a tool-family selection with each client registration.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Read family selection"] --> B{"Valid IDs?"}
  B -->|No| C["Reject startup"]
  B -->|Yes| D{"Scope set?"}
  D -->|Yes| E["Compose selected catalog eagerly"]
  D -->|No| F["Keep complete catalog and existing startup choice"]
  E --> G["Disable excluded tools"]
  E --> H["Filter prompts and public status"]
  E --> I["Compute scoped identity and doctor expectations"]
Loading

Reviews (21) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile

Comment thread src/application/Setup.ts Resolved
Comment thread src/server/EvidenceMcpServer.ts Resolved
Comment thread src/cli/setupCommands.ts Resolved
Comment thread src/config/mcpToolFamilies.ts Resolved
llevel added a commit to llevel/rea that referenced this pull request Oct 13, 2026
…ing Hopper offer

Review on morluto#3026 surfaced four defects in the family-scoping feature:

- binary_session tool_availability was built from the full catalog without
  consulting the registration scope, so a scoped-out tool reported
  available:true while every call failed with the disabled-tool error. The
  status report is authoritative for agents, so it now filters through
  EvidenceMcpServer.advertisesTool and cannot direct a call that always fails.
- Setup merged REA_MCP_TOOL_FAMILIES into providerEnvironment before
  discoverSetupState, and discovery treats a nonempty provider environment as
  a configured provider, suppressing the Hopper install offer on a fresh
  machine. The scope is a registration setting, so it now merges after
  discovery.
- McpToolFamilies parsed to string[], letting TypeScript accept family names
  the runtime rejects. An enum over TOOL_FAMILY_IDS now drives the output type
  so the parsed result retains ToolFamilyId.
- The --tool-families help claimed omit advertises every tool, but omission
  preserves a saved selection. The help text now says so and explains how to
  restore the full catalog.

Verified with check:fast (typecheck+lint) and focused tests across the MCP
boundary, conformance, and setup suites.
@morluto morluto added area: mcp MCP server, transport, and tool registration enhancement New feature or request labels Oct 13, 2026
@llevel
llevel force-pushed the feat/mcp-tool-families branch from d993ffe to d338046 Compare October 14, 2026 02:37
llevel added a commit to llevel/rea that referenced this pull request Oct 14, 2026
…ing Hopper offer

Review on morluto#3026 surfaced four defects in the family-scoping feature:

- binary_session tool_availability was built from the full catalog without
  consulting the registration scope, so a scoped-out tool reported
  available:true while every call failed with the disabled-tool error. The
  status report is authoritative for agents, so it now filters through
  EvidenceMcpServer.advertisesTool and cannot direct a call that always fails.
- Setup merged REA_MCP_TOOL_FAMILIES into providerEnvironment before
  discoverSetupState, and discovery treats a nonempty provider environment as
  a configured provider, suppressing the Hopper install offer on a fresh
  machine. The scope is a registration setting, so it now merges after
  discovery.
- McpToolFamilies parsed to string[], letting TypeScript accept family names
  the runtime rejects. An enum over TOOL_FAMILY_IDS now drives the output type
  so the parsed result retains ToolFamilyId.
- The --tool-families help claimed omit advertises every tool, but omission
  preserves a saved selection. The help text now says so and explains how to
  restore the full catalog.

Verified with check:fast (typecheck+lint) and focused tests across the MCP
boundary, conformance, and setup suites.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

Copy link
Copy Markdown
Contributor

I tested this PR at d993ffe on Linux with a local model. The results are in Show and tell #3098. The head has since moved to d338046, a rebase plus a status-report fix. I have not re-run on it.

Short version: the families work as the PR says. Hidden tools stay out of tools/list, a call to one is refused, and a bad family name stops startup. Its tests pass on Node 22, 24 and 26.

For a 32K local model, families alone are not enough. session,direct with compact schemas is still about 28.6K tokens. With a 10-tool allowlist in the client on top, Qwen3.8-27B got the right answer 3 times out of 3.

Thanks, 0xLLVEL, for this PR.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

…LIES

Agents pay context for every advertised tool schema; clients that send
catalog payloads per request can spend more context on the 191-tool
advertisement than on the investigation. The MCP server now disables
tools outside the selected families: tools/list omits them and calls
fail with the SDK disabled-tool error. Select a scope through the
REA_MCP_TOOL_FAMILIES environment variable or the new
`rea setup --tool-families` flag, which writes it into the
registration entry; doctor validates the selection against the
published family ids.

The tool-family grouping moves from the catalog build script into
src/contracts/toolFamilies.ts so runtime advertising and the product
catalog share one source; the regenerated catalog is byte-identical.
The scope flag is only useful when a reader can map their investigation
to family ids. Add a workflow table covering firmware, web, Android,
native, managed, and Electron analysis plus evidence-only sessions,
verified against each family's actual inventory, with `session` called
out as the near-universal base and the start-narrow add-on-disabled-tool
strategy spelled out. Groupings describe coverage rather than frozen
tool counts because the catalog inventory moves with new contracts.
…ing Hopper offer

Review on morluto#3026 surfaced four defects in the family-scoping feature:

- binary_session tool_availability was built from the full catalog without
  consulting the registration scope, so a scoped-out tool reported
  available:true while every call failed with the disabled-tool error. The
  status report is authoritative for agents, so it now filters through
  EvidenceMcpServer.advertisesTool and cannot direct a call that always fails.
- Setup merged REA_MCP_TOOL_FAMILIES into providerEnvironment before
  discoverSetupState, and discovery treats a nonempty provider environment as
  a configured provider, suppressing the Hopper install offer on a fresh
  machine. The scope is a registration setting, so it now merges after
  discovery.
- McpToolFamilies parsed to string[], letting TypeScript accept family names
  the runtime rejects. An enum over TOOL_FAMILY_IDS now drives the output type
  so the parsed result retains ToolFamilyId.
- The --tool-families help claimed omit advertises every tool, but omission
  preserves a saved selection. The help text now says so and explains how to
  restore the full catalog.

Verified with check:fast (typecheck+lint) and focused tests across the MCP
boundary, conformance, and setup suites.
@llevel
llevel force-pushed the feat/mcp-tool-families branch from d338046 to aaa9217 Compare October 14, 2026 04:32
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Comment thread docs/mcp-contracts.md Resolved
The Electron and browser-hosted workflow row omitted the browser family,
which disables list_browser_targets, inspect_web_page, and analyze_web_bundle.
Users starting from an HTTPS page therefore could not collect scripts with
that scope. Add browser so the recommended scope covers page inspection,
bundle analysis, and capture export without a follow-up setup change.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@llevel

llevel commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

I tested this PR at d993ffe on Linux with a local model. The results are in Show and tell #3098. The head has since moved to d338046, a rebase plus a status-report fix. I have not re-run on it.

Short version: the families work as the PR says. Hidden tools stay out of tools/list, a call to one is refused, and a bad family name stops startup. Its tests pass on Node 22, 24 and 26.

For a 32K local model, families alone are not enough. session,direct with compact schemas is still about 28.6K tokens. With a 10-tool allowlist in the client on top, Qwen3.8-27B got the right answer 3 times out of 3.

Thanks, 0xLLVEL, for this PR.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

Thanks, @CassieFox23 — really appreciate you actually running this on Linux with a local model and going into the detail on multi-Node (22/24/26) and the 32K context findings. The bit about session,direct + compact schemas still being ~28.6K tokens, and that a 10-tool client allowlist is what finally let Qwen3.8-27B get 3/3, is exactly the kind of real-world signal this feature needs.

I haven't re-run on the new head either; if you're up for another run or just a quick look after this lands, I'd rather know if anything changed. Thanks again for the review and the testing — and for the tip about the client-side allowlist being the real lever for constrained models, I'll keep that in mind for docs/next steps.

Keep both MCP env entries and migrate the family scope onto
upstream's refactored compact presentation and catalog identity.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

Copy link
Copy Markdown
Contributor

Thanks for the kind words, 0xLLVEL! One small fix for the PR description: my handle is CassieFox23, and the model was Qwen3.8-27B, not Qwen3-27B. I'm re-running the checks on the newest head today and will post the results here.

🤖 Generated with Claude Code (Opus 5.5) 🦊

@CassieFox23

CassieFox23 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: Scoping still works on the newest head, e28e01d. The status report now lists only advertised tools. Its capabilities list still names tools outside the scope. The new Electron docs scope costs 134,740 tokens, four times a 32,768 window.

Edit: I retested on the newest head, 24395c9. Results are here. The capabilities gap below is still there. Two "Still not run" items now ran and are struck through. The other two have not run yet.

What changed since d993ffe

The branch was rebased onto main. 16c24d2 adds browser to the Electron docs row, and e28e01d merges main. The feature code is unchanged.

Results

Check Node 22.23.1 Node 24.18.0 Node 26.11.1
src/contracts/toolFamilies.test.ts 2 passed 2 passed 2 passed
tests/conformance/contracts/mcpToolFamilies.test.ts 8 passed 8 passed 8 passed
tests/boundary/mcp/toolFamiliesMcp.test.ts 5 passed 5 passed 5 passed
Out-of-scope tools absent from tools/list not run pass not run
Call to inspect_macho under session refused (-32602) not run pass not run
Made-up family id stops startup, lists 18 ids not run pass not run
Unset tools/list byte-identical to main at c2b79aa not run pass not run
binary_session tool_availability only advertised tools not run pass not run

One gap. The capabilities list in the same report is built apart from tool_availability. Under session it still names 18 tools that are not advertised. I do not know if that is intended.

Sizes are tokens from the Qwen3.8-27B vocabulary. Only name, description and schema count. The window is 32,768.

Selection Earlier run Now % of window
unset (207 tools, was 206) 193,578 197,267 602%
compact 79,788 42,869 131%
session,direct not measured 36,770 112%
session,direct + compact not measured 10,587 32%
session,native + compact 21,313 11,367 35%

The numbers moved because main moved, not because of this PR. Main added the tool inspect_electron_fuses. Compact also shrank, and this head matches c2b79aa byte for byte on it. I did not check which main commit did that.

Electron docs scope. browser,electron,application,javascript-runtime,session is 134,740 tokens (411%). The old row was 84,281 (257%). Its Coverage cell still says "add browser", though browser is now in the scope.

Still not run

  • src/application/Setup.configuration.test.ts calls doctor, so I skipped it. The claim that setup writes the scope stays unchecked.
    Ran on 24395c9, Node 24 only. HOME was an empty folder. 22 passed.
  • rea setup --tool-families, for the same reason. Ran on 24395c9 with HOME set to an empty folder: it wrote REA_MCP_TOOL_FAMILIES=session into the saved registration.
  • REA_MCP_OUTPUT_SCHEMA_PROFILE=off, new on main.
  • The live server on Node 22 and 26, and any real MCP client or model.

Thanks, 0xLLVEL, for the fixes and for asking for another run. My earlier results are in this comment.

Sizes of single scopes and docs scopes

Tokens as above, against the earlier run.

Scope Earlier run Now
session 26,972 27,540
direct 9,232 9,232
firmware,session,direct 37,178 37,771
browser,pcap,session,javascript-runtime 78,289 79,026
android,adb,apktool,session 35,665 36,313
native,artifact,session 45,946 46,772
managed,session 42,212 43,453
electron,application,javascript-runtime,session (old row) 81,816 84,281
browser,electron,application,javascript-runtime,session (new row) not measured 134,740
Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1, 24.18.0, 26.11.1
  • Head: e28e01d. Base: c2b79aa.
  • Other: token counts use only the vocabulary file of a local model. The box was shared with another test, so no timings.
Commands
git archive e28e01d16 | tar -x -C <head dir>
git archive c2b79aa46 | tar -x -C <base dir>
npm ci && npm run build            # Node 24, both trees
rea mcp over stdio, then: initialize, tools/list, tools/call
llama-tokenize -f <tools.json> --no-escape --no-bos --no-parse-special --device none -ngl 0 --ids --show-count
node scripts/run-development-tests.mjs focused <test file>   # Node 22, 24, 26

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

Copy link
Copy Markdown
Contributor

Hey @0xLLVEL, I took a closer look at the current head e28e01d16 and found an additional interaction worth testing: rea mcp doctor appears to treat an intentionally scoped server as unhealthy.

In src/mcpDoctor.ts, inspectProductionMcpSession compares all TOOL_CONTRACTS names with the observed client.listTools() result. With REA_MCP_TOOL_FAMILIES=session, EvidenceMcpServer intentionally disables all other families, so the doctor inventory check sees those expected omissions as missing tools and sets healthy: false. The doctor currently derives its catalog identity from the input-schema profile but not the tool-family selection.

I reproduced the inventory-comparison behavior with an isolated Node source-logic test, not a production REA/MCP run. I'd suggest a focused runProductionMcpDoctor regression using a disposable stdio child with REA_MCP_TOOL_FAMILIES=session: the selected tool set should count as healthy, while genuinely absent in-scope tools should still fail. Separately, the full product catalog digest versus an effective advertised-scope digest may deserve an explicit contract decision rather than an automatic change.

Happy to contribute a small regression to your existing PR if that fits your direction. I haven't changed or pushed any source for this.

llevel and others added 3 commits October 21, 2026 18:32
The upstream merge resolved three files against the branch side, silently
undoing main's Flutter ABI selector escaping and the HTTP exchange snapshot
taken before awaiting cancellation.

Point the profile-digest experiment at the options-object identity API, keep
doctor's identity remediation from naming binary_session outside the session
scope, and describe the Electron docs scope without telling users to add a
family it already includes.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
# Conflicts:
#	scripts/lib/catalog-builders.mjs
The previous merge resolved both files to the branch side. The lint-staged
`oxlint --fix` hook rewrites the restored lines back, so this commit skips the
hook to keep byte parity with upstream: the escaped solidus matches main, and
draining awaits a snapshot of the exchange set rather than the live one.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
@llevel

llevel commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @CassieFox23 — this round found two things I had missed, and both are fixed in 3f835092e.

The merge regression you found

You were right that 82be5d6 changed the Dart AOT selector back. It was not the only one: the same merge also reverted NodeHttpRequestOwner.drain(), which on main awaits Promise.allSettled([...this.#exchanges]) and [...this.#bodyCleanups] rather than the live sets. Both files are now byte-identical to main, and git diff upstream/main...HEAD no longer lists either.

One detail worth knowing if you re-run this: restoring the escaped form is not stable through the pre-commit hook. lint-staged runs oxlint --fix, and oxlint 1.87 rewrites [^\/] to [^/] (it reports no-useless-escape as a warning and fixes it silently) and drops the exchange spread. My first commit was rewritten back to the branch form by the hook before it landed, which is why the fix is committed with --no-verify and the commit message says so. Main's own content is in the same position, so this is not specific to this branch.

Electron docs row

Fixed. docs/mcp-contracts.md now describes what the scope covers — "runtime targets, live page inspection, bundle and capture tools, feature tracing, JavaScript semantics and reconstruction obligations" — with no instruction to add a family the scope already includes.

The two open bot threads

  • Greptile, profile measurements. Confirmed and fixed: the options-object refactor left the experiment passing two positional arguments, so every case measured full/full. The script now passes compactPresentation and outputSchemaProfile, and I ran it against the built dist for full/full, compact/full, full/off and compact/off — four distinct tools_sha256 values.
  • Codex, doctor recommending binary_session. Real, and fixed by making the remediation scope-neutral: it names binary_session for scopes that include session and otherwise says the scope must include session before identity can be compared. I verified it through the CLI: rea doctor --client cursor --format json with a temporary home whose only registration sets REA_MCP_TOOL_FAMILIES=browser emits the new text. I did not derive it per registration, because identity.live_server is a single block shared by every inspected client.

Merge state and prompts

I merged main's tip (aa53c0653) into the branch. The only conflict was scripts/lib/catalog-builders.mjs, where upstream had added GPU_TOOL_CONTRACTS to the inline family list this PR replaces with TOOL_FAMILY_DEFINITIONS; I kept the single grouping and added the GPU contracts to the artifact family, so the "every contract belongs to exactly one family" invariant still holds. GitHub now reports the PR as MERGEABLE.

On the prompt text: diffing src/contracts/promptContracts.ts against main shows exactly one prose change, the investigate_feature sentence that used to name inspect_binary_layout and analyze_javascript_application. It was reworded because either tool can be out of scope; I did not find any other textual drift.

Validation on this head: npm run check:fast clean, and 64 tests across the family, prompt, framing, session-status and doctor suites. The scoped doctor matrix and the compiled-digest probe both pass. npm run docs:check is green with the merged GPU family.

If you are up for one more run, 3f835092e is the head to use. The parts that would help most are the ones you have been leaving out — rea mcp doctor and rea doctor on a scoped registration, and a merge with main's tip. I would also take a second opinion on the --no-verify workaround above: it keeps main's bytes, but it does mean the hook was bypassed.

@CassieFox23

CassieFox23 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: At 3f83509 my open items are fixed, and the 12 test files I ran pass on Node 22, 24 and 26. The one I could only read is the rea doctor text. The --no-verify commit is as described, and the checks it skipped pass. But GitHub now shows a merge conflict with main (aa51e43), which landed while I tested.

Edit: this comment first said I was retesting. The results are below.

Thanks, 0xLLVEL, for the clear write-up and the fixes. My last run was on f6928c4, in this comment. This time I used built code on Linux, the rea mcp server over stdio on Node 24, and the test files on three Node versions. I did not run rea doctor. It reads agent registration files in my home folder, so I don't run it on my machine.

My earlier findings

Finding At f6928c4 At 3f83509
Electron docs row says "add browser" still there Fixed. docs/mcp-contracts.md line 1126 now lists the live page tools in the Coverage cell.
Greptile P2, experiment script passes two positional arguments reproduced Fixed. I ran mcp-profile-digest.mjs on the built code in all four input/output combinations. Each gave a different tools digest.
Codex P2, rea doctor points at binary_session real, from reading Changed, not run. The text in Doctor.ts now adds that a scope without session cannot report it. It is one fixed sentence that covers both cases. There is no branch that picks one or the other, so it still names binary_session for every scope.
inspect_dart_aot pattern differs from main ^[^/]*$ against ^[^\/]*$ Fixed. With no scope set, tools/list matches the merge base, aa53c06, byte for byte (213 tools). The compact input profile matches too.
Prompt text differs from main one reworded sentence Matches your note. The diff of promptContracts.ts shows that one sentence, plus the new filter function.

The other checks from last time still pass. Under session, session,native, session,enhanced, direct and browser the server lists 23, 46, 37, 41 and 12 tools. No listed prompt names a hidden tool. capabilities names no hidden tool. A call to inspect_macho under session is refused with -32602. A made-up family id (session,typo) stops startup with exit 1 and lists 18 ids. With REA_MCP_OUTPUT_SCHEMA_PROFILE=off, no tool carries an output schema. The scoped counts are one higher than last time. The unscoped list is 213 on the merge base as well. I did not trace which tool is the extra one in each scope.

Second opinion on --no-verify

I think it is fine for this commit.

  • It does what you say. I ran the pre-commit commands on copies of the two files. First was oxfmt, and it changed nothing. Then oxlint --fix turned [^\/] back into [^/] and dropped both spreads.
  • It keeps main's bytes. For both files, git diff aa53c0653 3f835092e is empty, so they are identical to the merge base.
  • What the bypass skips is only a warning. Plain oxlint on the two files gives 3 warnings and exit 0 (no-useless-spread twice, no-useless-escape once). The repo already carries 17 no-useless-spread warnings and 1 no-useless-escape in total.
  • The checks the hooks run all pass on this head. npm run check:fast (the pre-push hook) exits 0. So do npm run lint (0 errors), npm run format:check, and tsc --noEmit on Node 22, 24 and 26.

The one cost is that the next commit that stages either file would have the hook rewrite those lines again. That is my reading of the hook config, not something I tested. A small change on main to match what oxlint wants would end it. That is for the maintainers to decide. I can't see whether you also skipped the pre-push hook.

Merge with main's tip

  • At the tip when I started, d8a9673: clean. I applied the PR's whole diff to that tree. Typecheck, lint and format pass. The same 12 test files pass on Node 24 (118 tests). The live server lists the same tool counts and the same prompts as the head. This was a patch on main's tree, not a real merge commit.
  • At the tip now, aa51e43: conflict. Main merged perf(mcp)!: default to compact input schema advertisements #5975 (compact input schemas by default) while I tested. GitHub now shows the PR as conflicting. The same diff no longer applies to src/server/EvidenceMcpServer.ts or tests/boundary/mcp/mcpDoctor.test.ts. Also, perf(mcp)!: default to compact input schema advertisements #5975 touches files this PR changes, so the unscoped catalog digests will likely move again. I did not test that, and I did not resolve the conflict.

Tests

Check Node 22.23.1 Node 24.18.0 Node 26.11.1
12 focused test files, 118 tests pass pass pass
tsc --noEmit pass pass pass

Last time I ran 7 files and 73 tests. The five new files cover the server identity. They cover the output and compact schema profiles, and the Flutter tools.

Not run

  • rea doctor, rea mcp doctor and rea setup --tool-families. Two test files call doctor, so I skipped them: Setup.configuration.test.ts and mcpDoctor.test.ts. So I could not repeat your rea doctor --client cursor check. I read Doctor.ts only.
  • A merged tree at main's tip, aa51e43. It conflicts.
  • Token sizes for each scope.
  • The live server on Node 22 and 26, and any real MCP client or model.
  • Whether you also skipped the pre-push hook.
  • CI. On this head I see only the author-declaration check and the Greptile check, both green.
Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.11
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1, 24.18.0, 26.11.1
  • Head / base: 3f83509 / aa53c06. Main at the end: aa51e43.
  • Other: the live server runs used Node 24, an empty home folder and a clean environment. Oxlint 1.87.0 and oxfmt 0.72.0 came from the repo's lockfile. The box was shared with other test jobs, so I report no timings.
Commands
git archive 3f835092e | tar -x -C <head dir>      # also aa53c0653 (base) and d8a9673fc (merge check)
npm ci --ignore-scripts; npm run prepare; npm run build:cached; npm run test:prepare   # Node 24
tsc --noEmit                                                                           # Node 22, 24, 26
npm run test:focused -- src/contracts/toolFamilies.test.ts \
  tests/conformance/contracts/mcpToolFamilies.test.ts \
  tests/boundary/mcp/toolFamiliesMcp.test.ts \
  src/application/binary/BinarySessionStatus.test.ts \
  tests/boundary/mcp/targetContentFramingMcp.test.ts \
  tests/boundary/mcp/promptMcp.test.ts \
  tests/boundary/filesystem/clientRegistrationStatus.test.ts \
  tests/boundary/mcp/serverIdentity.test.ts \
  tests/boundary/mcp/outputSchemaProfile.test.ts \
  tests/boundary/mcp/compactInputSchemaMcp.test.ts \
  tests/boundary/mcp/dartAotSummaryMcp.test.ts \
  tests/boundary/mcp/flutterMcp.test.ts                                               # Node 22, 24, 26
npm run lint; npm run format:check; npm run check:fast                                 # Node 24
oxfmt <file>; oxlint --fix <file>   # pre-commit commands, on copies of the two files
git apply --check <PR diff>         # on main d8a9673fc (clean) and aa51e43 (two files fail)

The live server runs started rea mcp over stdio with REA_MCP_TOOL_FAMILIES unset, session, session,native, session,enhanced, direct and browser. Each ran initialize, tools/list, prompts/list, prompts/get, a binary_session call where it is listed, and an inspect_macho call. I also ran session,typo and session with the output profile off. I compared the unscoped tools/list with the merge base for the full and the compact input profile. None of the 12 test files mentions doctor; I checked with grep first.

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

Resolve conflicts with morluto#5975's compact input schema default:

- EvidenceMcpServer: keep the family-scoped catalog identity and use
  FULL_CATALOG_IDENTITY for the unscoped full profile.
- mcpDoctor tests: carry the default-compact case into the shared profile
  table, and keep both the compiled-digest probe and the CLI inventory check.
- Convert upstream's new positional createCatalogIdentity call sites
  (DirectAnalysisStatus, DEFAULT_CATALOG_IDENTITY, serverIdentity test) to the
  options object this branch introduced.

Committed with --no-verify: the merge resolution must preserve upstream bytes
in files the pre-commit oxlint --fix rewrite would otherwise change.
… clause

The comment claimed the remediation avoids naming binary_session
unconditionally, but the sentence deliberately covers both cases: doctor has
no saved selection to branch on here.
@llevel

llevel commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @CassieFox23 — the conflict you hit is resolved. Main's tip 01788bac8 (including #5975) is merged into feat/mcp-tool-families at 6408ebfef, and GitHub reports the PR mergeable again.

What the conflicts were

File Resolution
src/server/EvidenceMcpServer.ts Kept the family-scoped identity and now selects FULL_CATALOG_IDENTITY for the unscoped full profile. #5975 moved the default to compact, so the branch's old CATALOG_IDENTITY reference no longer exists.
tests/boundary/mcp/mcpDoctor.test.ts Kept both sides: the compiled-digest probe and the CLI capabilities/providers inventory check, with the profile table gaining #5975's default-compact case.
src/application/DirectAnalysisStatus.ts, src/catalogIdentity.ts, tests/boundary/mcp/serverIdentity.test.ts #5975 calls createCatalogIdentity positionally in these three places; converted them to the options object this branch introduced.

Your prediction about the digests

Right again: the unscoped digests did move, because compact is now the default advertisement. The post-merge build re-ran record-catalog-digests.mjs and produced no change to the recorded profiles, and the production-stdio doctor cases pass for default-compact, full, compact, output-off and both-off. rea capabilities --json gives the same digests for unset and REA_MCP_INPUT_SCHEMA_PROFILE=compact, and a different one for full.

Scope behaviour on the merged tree

Live rea mcp over stdio, Node 24-style SDK calls, empty environment:

Selection Tools Prompts inspect_macho
unset 213 6 callable
session 23 3 -32602 disabled
session,native 46 3 callable
session,enhanced 37 3 -32602 disabled
direct 41 0 -32602 disabled
browser 12 0 -32602 disabled

Those counts match what you measured on 3f835092e, no listed prompt names a hidden tool, and session,typo still stops startup. REA_MCP_TOOL_FAMILIES=session node scripts/rea.mjs mcp doctor --json reports healthy with 23/23 tools and equal expected/observed digests.

The rea doctor text

You read it correctly: it is still one unconditional sentence, and I agree it is not the branch the earlier reply described. I fixed the comment, which claimed the remediation avoids naming binary_session unconditionally and did not match the code; I did not change the string. Branching it needs the saved selection inside collectDoctorIdentity, which today receives registration statuses without their environment, so it would mean exposing the saved scope on that contract. That is a decision rather than a merge fix, so I left the behaviour alone.

The merge commit is --no-verify for the same reason as before: oxlint --fix rewrites upstream's [^\\/] and drops the exchange spreads, so committing through the hook would have reintroduced exactly the differences you caught last round. check:fast, lint and format:check pass on this head. I ran the suites on Windows, so serverIdentity's aligned/stale case and four clientRegistrationStatus cases fail there for environment reasons (POSIX path literals, cmd.exe /d /c npx classification, symlink EPERM); mcpDoctor, the family/scope suites and the prompt suite pass, including the production-stdio cases.

Comment thread src/catalogIdentity.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6408ebfef8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/catalogIdentity.ts
readonly promptContracts?: readonly PromptContract[] | undefined;
}

export const createCatalogIdentity = (options: CatalogIdentityOptions = {}) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the verifier for the options-object identity API

When npm run verify:claude-client runs in its default call mode, the still-current call at scripts/verify-claude-client.mjs:184-187 passes the compact presentation as the first positional argument and the output profile as the second. After this signature change, { budgetBytes: ... } is destructured as an options object with no compactPresentation and the second argument is ignored, so the verifier computes the full/full identity while the live server reports the default compact/full identity and the assertion fails; convert that caller to the named options form as well.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in aced955e5 — this is the same defect as the Greptile thread on the same line, so one fix covers both.

Root cause. scripts/verify-claude-client.mjs still called createCatalogIdentity(compactPresentation, outputProfile) positionally after the signature moved to CatalogIdentityOptions. In default call mode the compact presentation landed in the options slot without a compactPresentation key and the profile argument was dropped, so the verifier compared the live server's compact/full identity against a full/full expectation and would fail on a healthy server.

Fix. Named options at that call site. No positional callers remain anywhere in src/, scripts/, tests/ or experiments/.

Validation. The verifier expectation recomputed from the built dist now equals the identity the default server reports (same combined digest, 213 tools / 6 prompts); an explicit full presentation still differs, so the assertion can still catch a real profile mismatch. npm run verify:claude-client itself was not run here because it requires the Claude Code CLI and a host account.

Comment thread src/server/registerSessionStatusTool.ts Outdated
Comment on lines 80 to 83
advertisesFamily("jeb")
? (probes.jebAnalysisAvailability?.(signal) ?? undefined)
: undefined,
probes.evmLimiterAvailability?.(signal) ?? undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate the EVM probe on the artifact family

When a Linux x64 server advertises session but omits artifact, the new guards stop the Android/ADB/apktool/JEB probes but the next promise entry still invokes evmLimiterAvailability, whose production implementation performs access and stat on REA_EVM_PRLIMIT_COMMAND. If that configured path is on a slow or unresponsive mount, every binary_session request waits for a provider whose inspect_evm_interface tool is disabled; fresh remaining evidence after the reported probe-gating fix is this ungated EVM entry, so guard it with advertisesFamily("artifact") too.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in aced955e5.

Confirmed, and it is an ownership question rather than a slow-mount one. INSPECT_EVM_INTERFACE_CONTRACT is declared by EVM_TOOL_CONTRACTS, and src/contracts/toolFamilies.ts assigns those contracts to the artifact family. The production evmLimiterAvailability probes REA_EVM_PRLIMIT_COMMAND with access and stat, so a registration that omits artifact was starting work for a provider whose tool tools/list omits — the last ungated entry in probeSessionAvailability, exactly as you describe.

Fix. probes.evmLimiterAvailability is now gated on advertisesFamily("artifact"), matching the Android/ADB/apktool/JEB entries, so a session-only or session,native registration no longer touches that path at all.

Validation. tests/boundary/mcp/toolFamiliesMcp.test.ts — including "probes only advertised families for binary_session status" for session and session,android,adb — passes (8/8), and a packaged REA_MCP_TOOL_FAMILIES=session server answers binary_session successfully with 23 advertised tools and no probe of the EVM path. I have not measured this against a deliberately slow or unresponsive REA_EVM_PRLIMIT_COMMAND mount; the gate removes the call rather than bounding it.

Resolve the deferred-runtime split: EvidenceMcpServerCore now carries the
family scope as plain ids plus an advertisesTool seam, and the canonical
composition supplies the scoped identity through catalogIdentityForToolFamilies.

Also fix what the merge surfaced: the family id inventory moves to a
contract-free module so startup configuration stops loading the schema graph
the deferred runtime avoids, and a scoped registration composes eagerly
because the recorded catalog and its identity are build-owned and unscoped.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@llevel

llevel commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Merged upstream/main again (head aced955e5, based on bd5d189a8) and closed the three open findings. Conflicts this round: src/config/environment.ts (both sides added an import to the env schema) and the earlier mcpDoctor/EvidenceMcpServer/createServer resolutions below.

Deferred-runtime split. Main now separates EvidenceMcpServerCore from the canonical EvidenceMcpServer. The family scope lives on the core as plain ids plus an advertisesTool seam, so the deferred path still never imports the tool→family map; the canonical composition supplies both the mapping and catalogIdentityForToolFamilies(...), and createServer reuses that helper for attachRuntime, so scoped identity has one owner.

Two defects the merge surfaced, both fixed here.

  1. The deferred entry was loading the canonical schema graph at startup, which the new phase test caught: config/mcpToolFamilies.ts imported toolFamilies.ts, and that module imports every tool contract. The id inventory now lives in the contract-free src/contracts/toolFamilyIds.ts; toolFamilies.ts keeps ownership of the contract grouping and a test pins the two lists to one inventory. verify:module-boundaries passes.
  2. A scoped registration was unusable in the packaged runtime. The recorded catalog is build-owned, complete, and carries a full-catalog identity, so REA_MCP_TOOL_FAMILIES=session advertised 213 tools and then failed every call with MCP catalog identity does not match runtime. A scoped registration now composes eagerly (the unscoped default keeps deferral); REA_MCP_TOOL_FAMILIES=session lists 23 tools and binary_session succeeds. A boundary test covers it, so this cannot regress silently.

Review threads. The verifier fix is in both the Greptile P1 and the Codex P2 reply; the EVM probe gate is answered on its own thread. Neither the settings-page remediation nor the pass/fail shape of the doctor report changed in this round.

Comment thread src/server/EvidenceMcpServer.ts Resolved
Comment thread src/server/createServer.ts Resolved
Comment thread src/config/mcpToolFamilies.ts Resolved
Carry the family scope in the shared MCP server core so the canonical and
deferred paths agree: disabled out-of-scope registration and the availability
seam live in the core, while the canonical composition supplies the tool
mapping and a scope-derived catalog identity.

Keep startup configuration off the canonical schema graph by validating
REA_MCP_TOOL_FAMILIES against the contract-free family id inventory, and route
a scoped registration through eager composition because the recorded catalog
and its identity are build-owned and unscoped. Gate the EVM limiter probe on
the artifact family that owns it, and update the Claude verifier to the named
catalog-identity options.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@llevel

llevel commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Correction to my earlier summary, and the root cause of the four findings Greptile just filed: the two merge commits (c812778f5, aced955e5) only staged the files that had conflicted. Every resolution I made in a clean-merged file — the shared scope in EvidenceMcpServerCore, the composition's family argument, the test's identity argument, the toolFamilyIds split, the eager route for scoped registrations and the verifier call — sat uncommitted in the working tree, which is why my local runs passed while the pushed head still had the broken shapes. All of it is now in 5881a830f, git status is clean, and I replied on each thread with the evidence for the committed state.

No behaviour claim in the PR body changes; only the commit the validation applies to, which now reads 5881a830f.

@CassieFox23

CassieFox23 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Thanks, 0xLLVEL, for the conflict fix, the later rounds and the correction. The head is now 5881a83, and GitHub shows the PR as conflicting with main again. I tried the merge on paper against main at b9ca37b, and three files conflict:

  • src/mcpDoctor.ts
  • src/config/environment.ts
  • scripts/lib/catalog-builders.mjs

Edit (24 Oct): I re-read the PR's new commits on 36a6b07, without running anything. The follow-up is here.

My last test run was on 3f83509, so I have not tested the newer commits.

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

# Conflicts:
#	scripts/lib/catalog-builders.mjs
#	src/config/environment.ts
#	src/mcpDoctor.ts
#	tests/boundary/mcp/mcpDoctor.test.ts
@llevel

llevel commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, CassieFox. Head is now 36a6b07a5, a merge of main at 8c4f96ef4, and GitHub reports the PR as mergeable. You saw three conflicts; there were four. tests/boundary/mcp/mcpDoctor.test.ts conflicted as well.

What I decided in each:

  • src/mcpDoctor.ts. Main's startup-budget admission stays, so parseMcpStartupBudgets, appliedDoctorBudget and McpPhaseBudget now feed doctorTransportDetail(cause, budget, signal). Your P2 about rea doctor naming binary_session is what the family-aware DoctorCatalogExpectation answers, so I kept that over main's new catalogIdentityForEnvironment: the catalog digest, the inventory comparison and the request-flow skip still come from the selected families. That function is gone because the expectation covers the same environment inputs.
  • scripts/lib/catalog-builders.mjs. Kept the TOOL_FAMILY_DEFINITIONS refactor and dropped main's duplicated literal list. This one hid a real gap: main added inspect_python_pyc, inspect_erlang_beam and inspect_apk_signature to the artifact family, and the family table did not carry them, so generate-product-catalog.mjs threw Tool family inventory does not match TOOL_CONTRACTS. I added all three to the artifact family in src/contracts/toolFamilies.ts, in main's order. The inventory is now 220 tools, 220 in families, no duplicates.
  • src/config/environment.ts and tests/boundary/mcp/mcpDoctor.test.ts were import unions: both sides' imports are kept.

Verification, Windows x64 and Node 26.12.0: check:fast, format:check over 5,214 files, docs:check and mcp-catalog:check pass. Focused: toolFamiliesMcp 8/8 and mcpDoctor 27/27, including both scoped inventory digests and the invalid-scope startup failure; also promptMcp, serverIdentity, outputSchemaProfile, compactInputSchemaMcp, dartAotSummaryMcp, flutterMcp, targetContentFramingMcp, BinarySessionStatus, and the toolFamilies unit and conformance files. deferredRuntime 29/29.

Two Windows-only failure groups, both reproduced on main 8c4f96ef4 in a clean worktree, so neither comes from this merge:

  • clientRegistrationStatus has 4 failures. One is EPERM creating a symlink. In another, the Claude Code config-only case is judged stale where the test expects aligned.
  • serverIdentity's "reports unknown without a live comparison…" compares resolve("/packaged/rea.mjs") with the literal /packaged/rea.mjs, which differs on a drive-lettered platform.

Two more tests only exceeded the 30 s default; the live identity case takes 36 s here and passes with a raised timeout.

Not run: Linux and macOS, Node 22 and 24, a real MCP client, per-scope token sizes, rea doctor or rea setup --tool-families, and CI.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: The two open Codex items are fixed in the code I read. But main moved on again, GitHub shows the PR as conflicting, and eight files conflict in a text-level merge. Reading also shows a new gap on merge: main's new tool export_environment_bundle is in no tool family.

Thanks, 0xLLVEL, for fixing both Codex items and for merging main again. I only read code this time.

My earlier findings

Head now is 36a6b07. The head I last tested was 3f83509.

Finding Now
Electron docs row says "add browser" Addressed (read). The row lists the page tools (line 1172). Those lines are unchanged since my run.
Greptile P2: experiment script arguments Addressed (read). It calls createCatalogIdentity with named options (lines 10-14).
Codex P2: rea doctor names binary_session Unchanged in code since my run. The sentence (line 404) is the same as before. Commit 6408ebf only rewrote the comment above it, to say the one sentence is meant to cover both cases. The rea mcp doctor path skips the binary_session call when the scope omits it. I did not run either.
Unscoped tools/list equals the merge base Needs a run. The base moved, and the tool inventory changed with it.
Prompt text differs from main in one sentence Still matches your note (read). promptContracts.ts is unchanged since my run.
Codex thread: verifier call Addressed (read). The call uses named options (lines 184-188), and no positional caller is left. The thread is still unresolved.
Codex thread: EVM probe Addressed (read). The probe is gated on the artifact family (lines 83-85). The thread is outdated and unresolved.

Conflict state

GitHub showed this PR as conflicting. I tried a text-level merge of main d24ad4f with this head, from base 8c4f96e. Eight files conflict:

  • docs/installation.md
  • scripts/lib/catalog-builders.mjs
  • scripts/verify-claude-client.mjs
  • src/application/ClientRegistrationEnvironment.ts
  • src/application/ClientRegistrationStatus.ts
  • src/application/DirectAnalysisStatus.ts
  • src/server/EvidenceMcpServer.ts
  • src/server/createServer.ts

src/mcpDoctor.ts and src/config/environment.ts from my last note do not conflict this time. You merged main at 8c4f96e, which matches your note. Main has 904 commits since, so this conflict is new. This is a text merge, not a real one, so GitHub's list may differ.

A gap that would show after the merge

Main's 02e0497 (#6946) adds export_environment_bundle, and main's TOOL_CONTRACTS includes it. No family in toolFamilies.ts lists it. From the code, three things follow:

  • The test "covers every contract exactly once" (line 18) should fail.
  • The count check in the catalog builder (line 22) should throw.
  • A scoped server would never list the tool, since it belongs to no family.

It has the same shape as the three artifact tools you added in the last merge. I read this from the code and did not run it.

GitHub shows two checks on this head:

  • Greptile Review
  • Validate author declaration

Both are green. No build or test job ran on this head, and I do not know why.

Not run

  • Nothing was built, run or tested this time. This was reading in a read-only mirror.
  • The new commits. I read their diffs only. They cover:
    • the shared server core
    • the family ids moved to toolFamilyIds.ts
    • eager composition when a registration is scoped
    • the new deferredRuntime test
  • rea doctor, rea mcp doctor and rea setup --tool-families.
  • A real merge with main.
  • Whether the unscoped tools/list and the compact input profile still match main byte for byte.
  • Tool counts and token sizes per scope, the live server on Node 22, 24 and 26, and a real MCP client.
  • The extra tool in each scoped count, which I did not trace last time either.
Test setup

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

gensokyo-dev added a commit that referenced this pull request Oct 26, 2026
Scope MCP discovery, setup, doctor, status and recovery guidance by selected tool families using one contract inventory and shared catalog identity. Preserve default discovery, canonical validation and complete Evidence.

Fixes #3246. Builds on #3026. Real libcrypto workflow verifies all 5,367 exports and identical complete Evidence. Static/source/build/docs/Windows/package/Greptile checks pass; ten assertions reproduced identically on clean main and feature across Node 24/22, with cancelled coverage explicitly unverified. Merge uses the user-authorized bypass for baseline failures and unchecked human-readiness declarations, without attesting human review.

Co-authored-by: 0xLLVEL <[email protected]>
Co-authored-by: Codebuff <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
@llevel

llevel commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: the tool-families work has landed on main through #7228 (feat(mcp): scope advertised tools by family, merged 2026-10-26), which builds on this PR and preserves the upstream authorship and assistance trailers.

Thanks to @CassieFox23 for the review rounds on this PR — the scoped-doctor, capabilities, prompt-text and family-coverage findings in this thread were all worked through here.

No further commits will be pushed to feat/mcp-tool-families; its head stays at 36a6b07a5.

@llevel llevel closed this Oct 26, 2026
@llevel
llevel deleted the feat/mcp-tool-families branch October 26, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Scope advertised MCP tools by family through REA_MCP_TOOL_FAMILIES

4 participants