Durable Context Broker over MCP
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
Works with the AI Agents you already use
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.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
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
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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
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
- Software
Node.js 22.5+
Node.js 22.5+ includes the node:sqlite module it uses.