Skip to content

feat(mcp): select views of retained analysis results - #1180

Merged
N0zoM1z0 merged 5 commits into
morluto:mainfrom
mvanhorn:fix/inspect-analysis-view
Oct 9, 2026
Merged

N0zoM1z0 merged 5 commits into
morluto:mainfrom
mvanhorn:fix/inspect-analysis-view

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Agents can now project a summary, one section or module, or a stable page from already completed layout or JavaScript application Evidence after a large MCP result, without repeating analysis.

Fixes #1050

Demo

Analysis view demo

Complete result (~2 MB) Summary view (~5 KB) One module Page from retained result
full summary module page

The sample is a generated local app, not third-party code.

Problem and expected behavior

A completed inspect_binary_layout or analyze_javascript_application result can exceed the MCP stdio receive buffer once Evidence wrapping and repeated encodings are applied. Callers still need a compact overview, a single section or module, or a bounded page of identity rows from that retained record.

inspect_analysis_view (CLI inspect-analysis-view) reads inline Evidence or an exact same-session evidence_id and returns only the selected projection. It does not start Hopper, Ghidra, IDA, or JavaScript reconstruction. Page limit is a caller-selected positive integer. Actual serialized size determines transport admission; oversized views retain complete derived Evidence and return its reference for recovery.

Change and scope

New application workflow behind shared CLI and MCP adapters:

  • Domain projectors for binary layout (summary, facet mitigations|linkage, item sections|symbols, page) and JavaScript applications (summary, item modules, page).
  • Source is a discriminated union: { kind: "retained-evidence", evidence_id } or { kind: "inline", evidence }.
  • Output is evidenceResultOf the view. view_digest is SHA-256 of the canonical projected JSON and changes when the projection changes; it is not the parent digest.
  • Derived Evidence uses ANALYSIS_VIEW_PROVIDER, predicate rea.analysis-view, parent authority, and evidence_links to the parent.
  • Authored skill text in skill-src/ (skill version 34). Catalog regenerated; build outputs not committed.

Out of scope: other parent operations, rewriting executable bytes, saving or closing an attached GUI database, and paging arbitrary JSON with --filter-output.

Contract and boundary impact

  • Semantic owner and earliest changed stage: domain src/domain/analysisView/, then application AnalysisViewService, CLI/MCP adapters.
  • CLI and MCP/tool-catalog contract: new inspect_analysis_view / inspect-analysis-view on TOOL_CONTRACTS; kind application; effects session Evidence write only (inspect_analysis_view: evidence).
  • Provider, bridge, target-format, or platform compatibility: none. Views do not launch a deep provider.
  • Evidence, artifact, provenance, or reconstruction contract: derived view Evidence; parent identity and limitations preserved; JavaScript summaries include application/semantic coverage and unknown counts without embedding full graphs. Module items preserve recorded property values and source locations; pages include only JavaScript assets, bundled modules and source modules.
  • Process execution, authorization, cleanup, or containment impact: none beyond recording the derived Evidence record.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in skill-src/ and never commit build outputs): ANALYSIS_VIEW_PROVIDER added to catalog-core/builders; authored skill version 34; src/generatedPackageMetadata.ts skillVersion 34.

Evidence and regression coverage

  • Tests added or updated: domain projectors; application retained/inline/stale-id paths; MCP schema advertisement and retained layout/JS views; CLI JSON file and malformed-input paths; catalog, capability inventory, JSON-input status, and prompt contract follow-ups.
  • Base reproduction or other evidence: on 70e5c247 the tool is absent from TOOL_CONTRACTS and the CLI.
  • User-visible CLI/MCP output (if applicable): generated local sample . Complete analysis 1,983,271 bytes; CLI summary 4,966 bytes; one module 7,448 bytes; page 5,165 bytes. MCP retained summary/item/page 6,932 / 9,967 / 7,267 bytes. Coverage for the page view: examined=8, total=22, next_offset=8, exhausted=false.
  • Remaining proof gaps: real Hopper/Ghidra layout Evidence was not exercised on this host.

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

  • npm ci — pass (374 packages, 0 vulnerabilities)
  • npm run test:focused -- src/domain/analysisView/analysisView.test.ts src/application/analysisView/AnalysisViewService.test.ts tests/boundary/mcp/analysisViewMcp.test.ts tests/boundary/cli/analysisViewCli.test.ts tests/boundary/cli/productCatalog.test.ts tests/boundary/mcp/binaryDiagnosticsMcp.test.ts tests/boundary/mcp/retainedApplicationEvidenceMcp.test.ts src/contracts/toolContracts.test.ts src/application/CapabilityInventory.test.ts src/contracts/promptContracts.test.ts tests/boundary/cli/jsonInputStatus.test.ts src/contracts/contractSnapshot.test.ts — pass (12 files, 95 tests)
  • npm run check:fast — pass
  • npm run check — pass (typecheck, lint, format, knip, metadata:check; 6/6 turbo tasks)
  • npm run docs:check — pass
  • npm run verify:test-discovery — pass (“Discovered all 654 test files exactly once.”)

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Additive tool and CLI command.
  • Real Hopper/Ghidra, browser, or OS coverage: not run. Layout views are covered with fixture layout Evidence; JavaScript views ran against a generated local sample.
  • Package or release metadata impact: skill version 34; catalog family totals include ANALYSIS_VIEW_TOOL_CONTRACTS.
  • Security, privacy, process, or containment review: views read caller-supplied or same-session Evidence only. Transport credentials are not introduced. Page limit is a measured stdio-budget bound.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • 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.

Maintainer follow-up verification

Current main integrated; follow-up ea0aa95a fixes retained-graph reparsing, module selection, captured-value preservation, semantic coverage, subject identity handling and the duplicate-code gate. The original demo remains above.

  • 33 focused source/schema/CLI/MCP tests pass across six files, including oversized escaped observations, retained recovery and subsequent calls.
  • npm run check:ci -- --concurrency=1 and pre-push npm run check:fast pass.
  • Native Windows complete Notion 7.6.1: one analysis, followed by summary, module and stable/disjoint pages through the pinned SDK with its default receive buffer. Text and structured views match. Evidence identity and retained trace digest match the previously verified complete analysis.
  • Summary: 53.6 ms / 40,562 bytes; module: 31.5 ms / 40,302 bytes; pages: 24.3–28.7 ms / 35,052–35,408 bytes. Process-family peak 1.25 GiB; all owned processes close successfully.
  • This local lane uses a compiled source snapshot and reused isolated pinned dependencies. CI covers the genuine package and platform gates. The final guidance-only follow-up 045b9370 also passes all seven pinned-SDK schema tests and pre-push checks. CI run 37883418585 passes all 22 checks on the final exact head.

Add inspect_analysis_view so callers can read a summary, one
section/module, or a stable page from already completed layout or
JavaScript application Evidence without repeating analysis.
Narrow projected view unions in tests, rebind JavaScript companion
graphs after fixture edits, and refresh the authored skill version.
@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.

@N0zoM1z0
N0zoM1z0 self-requested a review October 9, 2026 03:41
@N0zoM1z0

N0zoM1z0 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for the implementation and the thoughtful demo! I’m reviewing it now and testing the retained views on a real Notion ASAR. I’ll add any needed fixes to this PR.

@N0zoM1z0

N0zoM1z0 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Pushed ea0aa95a with the follow-up fixes: reuse validated retained graphs, keep module pages scoped to modules, preserve captured property values, include semantic coverage, and check artifact identity. I also removed the unsupported page-size guarantee and fixed the duplicate-code CI failure.

The real Windows Notion run passed with one analysis: summary 54 ms, module 31 ms, pages 24–29 ms, all around 35–41 KB. Evidence identity and the retained trace match the previous complete analysis. Focused CLI/MCP/schema regressions pass, including oversized selected values and recovery. The remaining CI jobs are running.

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 045b9370. The follow-up fixes preserve complete observations and artifact identity, reuse validated retained graphs, and cover malformed selectors and oversized escaped observations. Focused CLI/MCP regressions and the complete native Windows Notion workflow pass; all 22 CI checks are green. Thanks again for the implementation and demo.

@N0zoM1z0
N0zoM1z0 merged commit db675f1 into morluto:main Oct 9, 2026
22 checks passed
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
Add explicit summary, facet, item and paged views of retained analysis Evidence without repeating analysis. Preserve captured observations, graph validation, artifact identity, coverage and complete default results.

Fixes morluto#1050

Verified with focused source, CLI, pinned-SDK schema and MCP tests, serial static checks, and one complete native Windows Notion ASAR workflow. Real Hopper/Ghidra verification was not performed for this provider-independent projection change.

Co-authored-by: Matt Van Horn <[email protected]>
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Many thanks @N0zoM1z0 for landing the MCP view selection. Agents can now pull one section or page of a finished analysis without rerunning it.

@morluto morluto added enhancement New feature or request area: mcp MCP server, transport, and tool registration labels Oct 14, 2026
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] Add caller-selected views for large analysis results over MCP

3 participants