Skip to main content
Glama

Context Layer Lab

CI Node 22 17/17 eval cases

The live diagnostic: the 07:30 dashboard says yes, the evidence at 09:10 says no, with the timeline of what arrived in between

A small, inspectable reference implementation for stopping AI agents from acting on stale operational context.

Open the local-first diagnostic: no install, loads a synthetic snapshot, fully interactive.

The failure it prevents

07:30  status dashboard: GREEN (valid until 07:55)
08:02  nightly export: SUCCESS
08:40  docs build: FAILED
09:05  weekly report: finished, output not published
17:30  data sync: due later today, not counted as failed

Naive answer:     Yes, the dashboard is green.
Governed answer:  No, two lanes need attention.

The scenario is synthetic and public-safe, but the failure class is real: aggregate status commonly outlives the evidence it summarizes. This lab reconciles freshness, schedule state, and evidence specificity before it will answer "are all scheduled automations healthy?" It does not simply repeat whatever the last dashboard said.

Related MCP server: artagon-vault-mcp

What this proves

  • BM25F freshness-aware retrieval: 10/10 cases correct. Current records rank above stale and invalid ones; BM25F score orders records within each state. Whole-token, quality-flagged, bounded search, no embeddings. Full numbers, including a three-way naive vs. recency-only vs. governed contrast, in docs/eval-report.md.

  • Newer terminal receipts override an expired aggregate, and a not-yet-due lane is never mislabeled as failed (see the operational invariant matrix in docs/architecture.md).

  • Every decision-bearing summary, receipt, and lane schedule is bound to a source-linked typed assertion. A scenario outcome that contradicts its own evidence is rejected, not silently trusted.

  • 17 deterministic cases pass against the real reconciliation and retrieval code, no model call: npm run eval (7 record and operational, 10 retrieval).

This is not a RAG benchmark, vector database, or production authorization layer, and it does not claim schema validation makes information true. It is the smaller evidence-reconciliation layer that should exist before an agent is trusted to summarize operational state.

Quick start

Requires Node.js 22+.

npm install
npm run check
npm run demo

npm run demo prints the scenario above from the real reconciliation code:

Question: Are all scheduled automations healthy?
As of:    2026-07-28T09:10:00Z

Naive answer:    healthy. It repeats the dashboard observed at 2026-07-28T07:30:00Z.
Governed answer: attention. 2 of 3 due lanes need attention.

Why:
- The dashboard record is stale. The record expired at 2026-07-28T07:55:00Z.
- 3 newer run receipts supersede it.
- Docs Build: failed (docs-build-receipt).
- Weekly Report: preserved_local (weekly-report-receipt).
- Data Sync: not due yet, so it is not counted as failed.

npm start starts the read-only MCP server on stdio. It prints nothing and waits for a client; see MCP tools for the client config.

To apply the pattern to a company knowledge base, see docs/how-to-adopt.md.

Generate a portable diagnostic snapshot the console can open directly. Parsing and rendering happen in the browser; nothing is uploaded:

npm run diagnose -- --output snapshot.json

Two labs, one boundary

Context Layer Lab   ->  diagnose        what current evidence supports
Governed Action Lab ->  prepare/approve what may execute, under whose authority
                    ->  execute/verify  with what receipt

This lab establishes what current evidence supports. Its companion, Governed Action Lab (live console), starts at that boundary and decides what may execute, under whose authority, and with what receipt. They are one system in two repos, not two unrelated projects. The real command sequence between them, with real output, is in governed-action-lab's docs/pair-walkthrough.md.

Scope and limits

Status: reference implementation, not a production system. This repository demonstrates governed context records, provenance, validity windows, freshness-aware retrieval, and a naive-versus-governed failure contrast. It does not compete with production context or memory platforms on retrieval scale, storage architecture, access control, or poisoning defense. Authorization and record-level access control are out of scope; recency comes from an explicit validUntil, not inferred content. See docs/architecture.md for the full list.

Learn more

How it was built

Built with Claude Code and Codex under my direction. I set the design and approve every release; the two agents wrote and cross-reviewed much of the code. Every change passes CI and review before release.

License

MIT

Available Tools

4 tools
explain_sourceB
Read-onlyIdempotent

Show a declared source and the exact claims it supports on one context record.

Inputs: recordId (required), sourceId (required).

inspect_ingestionC
Read-onlyIdempotent

Show the deterministic receipt linking one context record to its synthetic Markdown source.

Inputs: recordId (required).

search_contextB
Read-onlyIdempotent

Search synthetic organizational context. Returns a bounded, ranked set: current records first, then stale, then invalid, with source IDs and visible freshness or evidence issues on every match.

Inputs: query (required), asOf, limit.

validate_recordB
Read-onlyIdempotent

Validate a context record's schema, provenance coverage, claim support, and freshness boundary.

Inputs: record (required), asOf.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 4 tools

    Disambiguation4/5

    The four tools target distinct actions: search, validate, explain source claims, and inspect ingestion receipts. explain_source and inspect_ingestion both touch provenance, so minor overlap exists, but their descriptions make the different focuses clear enough.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: explain_source, inspect_ingestion, search_context, validate_record. There are no deviations or mixed conventions.

    Tool Count5/5

    Four tools is well-scoped for a focused context-inspection and validation layer, and each tool has a clear role with no obvious redundancy. The count sits comfortably in the typical 3-15 range.

    Completeness3/5

    The surface covers search, validation, source-claim explanation, and ingestion receipt inspection, but lacks mutating lifecycle operations such as create, update, delete, or a direct get-by-ID. For a context layer, these are notable gaps unless the intended scope is strictly read-only inspection.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Read-only MCP server that answers questions about turva.dev from its published data. Five tools return JSON: the service catalog with prices, contact and operator details, engagement principles and dated agent-readiness and security evidence with verification links. Connect over Streamable HTTP. You need no API key. The server does not scan other websites or run audits.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Read-only MCP server for querying an evidence-aware knowledge vault with temporal and provenance-aware data, supporting agent memory and semantic graph projections.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server exposing scoped, read-only enterprise operations tools with fail-closed credential handling. It returns opaque approval IDs for mutations and requires a separate operator approval command to release one-time capabilities.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Read-only MCP server exposing a W3C PROV knowledge graph of verified facts with provenance, enabling AI agents to list, search, and check facts while enforcing that writes remain CLI-only.
      5
      MIT