Skip to content

feat(kmp): promote per-response context-coverage signals into the MCP/API contract#115

Merged
tgarciai merged 2 commits into
mainfrom
feat/kmp-context-coverage-signals
May 30, 2026
Merged

feat(kmp): promote per-response context-coverage signals into the MCP/API contract#115
tgarciai merged 2 commits into
mainfrom
feat/kmp-context-coverage-signals

Conversation

@tgarciai
Copy link
Copy Markdown
Member

Promotes per-response, actionable context-coverage signals from OTel-only into the in-band KMP MCP/API contract so a navigating client (the operator) can estimate coverage and decide expand-vs-stop without OTel access. Criterion: a metric joins the contract only if per-response AND actionable; operational metrics (latency, call-count, lag) stay OTel-only.

Proto (memory.proto, non-breaking additive)

  • TemporalCoverage.dimensions: repeated DimensionCoverage{dimension,returned,present} — per-dimension coverage on temporal moves.
  • Proof.frontier_size (= |missing|) on wake/ask/temporal proofs.
  • ResponseQuality{nodes,relationships,details,detail_coverage,causal_density,truncated} on the five temporal moves + Trace + Inspect responses (the KMP-read-computable subset; render-path metrics excluded).

Plumbing

  • transport-grpc populates dimensions / frontier_size / quality from the bundle views.
  • rehydration-mcp serializes the new fields in the KMP JSON; fixtures updated + enriched.
  • Contract-stability test updated for the new response fields.

Backward/forward compatible: additive fields only, so old clients ignore them and a new kernel works with old clients.

Verified: fmt + clippy -D warnings + full gate (coverage 87.80%). Already built and deployed to the shared cluster as dev-1b494fe (release rev 130) for the operator's window-expansion work.

🤖 Generated with Claude Code

…/API contract

Promote per-response, actionable context-coverage signals from OTel-only into
the in-band KMP MCP/API contract so a navigating client (the operator) can
estimate coverage and decide expand-vs-stop without OTel access. Criterion: a
metric joins the contract only if it is per-response AND actionable; operational
metrics (latency, call-count, lag) stay OTel-only.

proto (memory.proto, non-breaking additive):
- TemporalCoverage.dimensions: repeated DimensionCoverage{dimension,returned,present}
  (per-dimension coverage on temporal moves).
- Proof.frontier_size (= |missing|) on wake/ask/temporal proofs.
- ResponseQuality{nodes,relationships,details,detail_coverage,causal_density,
  truncated} on the five temporal moves + Trace + Inspect responses. Quality is
  the KMP-read-computable subset (render-path metrics like noise_ratio/tokens are
  not available on memory tools, so excluded).

transport-grpc: populate dimensions / frontier_size / quality from the bundle
views (responses.rs + bundle_views.rs); copy quality through the Goto/Near/
Rewind/Forward builders.

mcp: serialize dimensions / frontier_size / quality in the KMP JSON
(kmp.rs); test fixtures updated + enriched, grpc_backend fixtures extended.

contract-stability test updated for the new response fields.

fmt + clippy -D warnings + workspace tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SonarCloud's quality gate flagged 4.2% duplication on new code: appending
`quality` to the Goto/Near/Rewind/Forward response field lists made the four
assertions identical. Assert them in a loop so the shared field set is stated
once.

Test-only; no production change. The contract is unchanged — each temporal
response must still match the exact field set (now including `quality`).

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

@tgarciai tgarciai merged commit 392205e into main May 30, 2026
19 checks passed
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