Durable Context Broker over MCP

    1

    Agents lose their state between sessions, or keep it in a file any session can overwrite with a truncated copy that still looks fine.

    $39

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Durable Context Broker over MCP

    Example session with this skill installed

    Set up shared memory for my three Claude Code sessions and the orchestrator so they can hand off state without stepping on each other, and show me it refusing a bad write.

    • Read your context and instructions
    • Compiled the durable context broker

    Summary

    The broker runs locally with one store per tenant; all three sessions and the orchestrator are registered through the stdio transport with their own --author names. The orchestrator owns platform/orchestrator-state; sessions write under session/* and project/*. A session that tried to write the platform scope was refused, and a truncated rewrite of a 38 KB plan was refused too. Both refusals left the previous versions intact.

    Registration

    claude mcp add context -- node ./context-broker/scripts/mcp-stdio.mjs --dir ./context-store --tenant acme --author session-api
    claude mcp add context -- node ./context-broker/scripts/mcp-stdio.mjs --dir ./context-store --tenant acme --author session-web
    claude mcp add context -- node ./context-broker/scripts/mcp-stdio.mjs --dir ./context-store --tenant acme --author session-infra
    claude mcp add context -- node ./context-broker/scripts/mcp-stdio.mjs --dir ./context-store --tenant acme --author orchestrator
    

    Each agent's instructions now carry the cold-start protocol: context_list, then context_summary on relevant scopes, context_read only what the summaries justify, and context_write with a fresh summary before ending.

    Refusal 1: a session writing shared state

    session-web called context_write with scope: "platform/orchestrator-state":

    isError: true
    PLATFORM_SCOPE_GUARD: "platform/orchestrator-state" is a shared platform scope. Session-owned context belongs under session/* or project/*. To update shared platform state DELIBERATELY, retry with allow_platform_scope: true.
    

    Nothing was written; context_versions on that scope still shows the orchestrator's version 7.

    Refusal 2: a truncated rewrite

    session-api rewrote project/billing-migration (38,412 bytes, v4) with 45 bytes:

    SHRINK_GUARD: this write would shrink "project/billing-migration" from 38412 to 45 bytes (more than 10x smaller). That usually means a wrong scope or truncated content. If deliberate, retry with allow_shrink: true. The previous version remains retrievable either way.
    

    The session re-read v4, produced the full updated plan, and wrote v5 (39,104 bytes) with a summary.

    Attribution

    $ context_versions project/billing-migration
      v5  author=session-api   claimedAuthor=null   39104 bytes  2026-10-29T14:02Z  hasSummary=true
      v4  author=session-api   claimedAuthor=null   38412 bytes  2026-10-29T11:40Z  hasSummary=true
      v3  author=orchestrator  claimedAuthor="pm"   12003 bytes  2026-10-28T19:11Z  hasSummary=true
    

    author comes from the registered --author; the pm label the orchestrator passed is shown as unverified claimedAuthor.

    Tests

    $ node --test scripts/context.test.mjs
    ℹ tests 7  pass 7  fail 0
    

    Next

    For a second machine, run scripts/server.mjs --dir /srv/context --keys-file app-keys.txt behind your reverse proxy and switch the adapters to --url ... --key-file ...; the same guards apply over HTTP.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Agents lose their state between sessions, or keep it in a file any session can overwrite with a truncated copy that still looks fine. This broker fixes both.

    What it stores: context documents as versions in SQLite (one file per tenant), with a writer-supplied summary for cold starts. 20 versions kept per scope, 100 for shared platform/* scopes. A 200,000-character cap that errors instead of truncating.

    What it refuses: writes to platform/* without an explicit flag (a session misreading its own name must not clobber shared state), and any write that shrinks a document of 4 KB or more by more than 10x without an explicit flag (that is a wrong scope or a truncated write). The previous version survives either way. Both guards live in the broker, so every transport enforces them identically.

    Who wrote it: the author of a version is the authenticated principal (the app key, or --author in local mode). The tool's author argument is stored separately as an unverified claimedAuthor.

    Transports: mcp-stdio.mjs for Claude Code, Cursor, Codex CLI and any stdio MCP client, in local mode (no server) or remote mode (bearer key from a file); server.mjs with a REST API, MCP Streamable HTTP at /mcp, bearer app keys that select tenant and author, and RFC 9728 resource metadata.

    Tools: context_list, context_summary, context_read, context_write, context_versions.

    Tests: 7 cases covering guards, pruning, attribution, HTTP tenant isolation and the spawned stdio transport. Node 22.5+, no packages, no outbound network. Includes the scope conventions and the cold-start protocol to put in your agents' instructions.

    Requires Node 22.5+. No full-text search. HTTP mode requires a separate reverse proxy for TLS. Single-process writer per SQLite store (use server mode for multiple concurrent writers).

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 19 days ago

    Requires

    Node.js 22.5+

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed19 days ago

    What's inside

    Frequently Asked Questions

    This skill acts as a permanent 'hard drive' for agent memory, using SQLite to prevent the common issue where agents accidentally overwrite or truncate their own context files during long sessions.

    The broker is compatible with any platform supporting the Model Context Protocol (MCP), including Claude Code, Cursor, and Codex CLI, and works locally via stdio or remotely via HTTP.

    Unlike manual prompting, which relies on the agent's logic to manage files, this skill enforces hard database constraints and versioning that the agent cannot bypass, ensuring data integrity even if the model hallucinations.

    You will need Node.js version 22.5 or higher to utilize the native SQLite drivers, and for the HTTP transport mode, a reverse proxy is recommended if you require TLS encryption.

    The skill automatically maintains a history of 20 to 100 versions per document, allowing you to audit exactly which agent made specific changes and roll back if an agent corrupts the current state.

    The package includes the full Node.js source code for the MCP server, support for both stdio and HTTP transports, and documentation for configuring tenant isolation and scope guards.

    New in LLM Ops