Structured Context Windows for AI agents: partition what each agent can see, gate what it can do, and keep a verifiable record of both.
pip install maxey0 Maxey0-SuperSpace (Maxey0 for short) is a governance and evidence layer for multi-agent work. It gives each agent's working context a name the system can enforce. It decides every crossing between those contexts, and every prompt sent to a model provider through it, before the crossing happens. It writes each decision, allowed or refused, to a hash-chained record, so an edit to the record can be detected afterward. Maxey0 does not run agents or add agent capability. Your host (Claude Code, LangGraph, OpenAI Agents, Google ADK and others) still runs the agents. Maxey0 controls and records what they could see and what they reached for, to the extent the table under What each install can answer shows.
Who it is for: teams that hand work to more than one agent. That includes Claude Code subagents, maker/checker/judge formations, and agents built on frameworks such as LangGraph, OpenAI Agents or Google ADK. How much Maxey0 can see differs a great deal between these hosts, so read the coverage table below before you choose.
After a run, those teams have to answer four questions:
Two secondary questions follow from these: can the run honestly claim it was isolated, and has the work wandered from where it started?
Without a layer like this, there is usually no good answer:
Maxey0 ships as a Claude Code plugin and as a Python package (see Quick start). Each answers a different part of the four questions.
Every record is tamper-evident, not signed: it shows that nothing was changed inside the chain, not who wrote it.
Maxey0 sits at the boundaries, where an agent's request becomes visible, and does three things there: it names, it decides, and it records.
The name covers two arrangements, and the difference matters for question 1.
The region types in the plugin (from /maxey0:window partition):
All three are SHA-256 hash chains. Only the attestation log has a verifier that runs from exported records alone. The context ledger and the Gate journal are checked with Maxey0's own tools.
Two different things ship in this repository. Pick the one that matches where your agents run.
The plugin does not install the 30-tool maxey0-ss server, and the Python package does not install the Gate hooks.
The plugin's servers and hooks run with the python on your PATH. That Python needs the maxey0 package, which brings the MCP SDK with it:
python -m pip install maxey0 Then, inside a Claude Code session:
/plugin marketplace add mmc7676/Maxey0 /plugin install maxey0@maxey0 Restart Claude Code so the hooks load, then run /maxey0:menu or /maxey0:doctor.
The marketplace also offers each server as its own plugin:
The 5 agents are the role agents a formation's roles are dispatched as: maxey0-maker (produces the artifact), maxey0-checker (verifies it against the source material), maxey0-judge (grades it against a pinned criterion), maxey0-role (any other role) and scw-deployer (sets up the default SCW for a task). The 16 concept skills are one skill per library concept. Each tells Claude when a task falls under that concept and lists the concept's skills and loops, so Claude routes with loops_route first.
Python 3.10 or later is required. Install from PyPI:
python -m pip install maxey0 That installs two import packages: maxey0, a short front door, and maxey0_ss, the implementation. The console scripts are the same either way.
To work on the code, or to run the scripts in scripts/ and the tests, install from a checkout instead.
git clone https://github.com/mmc7676/Maxey0 cd Maxey0 python -m venv .venv .venv\Scripts\python -m pip install -e . macOS and Linux:
Optional extras add a framework for a harness adapter: claude-agent-sdk, openai-agents, langchain, google-adk, microsoft, nvidia and all-harnesses. graph installs networkx, which no code in this build imports. all installs everything. For example: pip install "maxey0[langchain]", or pip install -e ".[langchain]" from a checkout.
maxey0.scw runs the same handlers as the maxey0-ss.scw.* MCP tools, in your own process:
from maxey0 import scw scw.create("SCW1", task="Summarize the Q3 filings", concept="Finance") scw.start("SCW1") # instantiate it scw.drift("SCW1", [0.12, 0.40, 0.33], anchor=True) # install a baseline scw.drift("SCW1", [0.10, 0.42, 0.35]) # measure against it scw.describe() scw.close("SCW1") Its windows last as long as the process. scw.surface() returns the full tool surface for the tools it does not wrap, and scw.reset() starts over. No capability check is made; the caller is your own process. maxey0.SCWSpec and maxey0.SuperSpaceSystem are re-exported, and everything else is in maxey0_ss.
To use the stdio server from Claude Code: opening Claude Code inside the checkout on Windows picks up .mcp.json, which launches .venv/Scripts/maxey0-ss-mcp.exe. On macOS or Linux, register it yourself: claude mcp add maxey0-ss -- /path/to/Maxey0/.venv/bin/maxey0-ss-mcp.
No prebuilt bundle is in the repository. Build one from a checkout with the package installed:
python scripts/build_package.py --check # validate, write nothing python scripts/build_package.py # writes dist/maxey0-0.3.2.mcpb The built MCP App (mcp_apps/super_space_react/dist/mcp-app.html) is in the repository. Rebuild it (requires Node.js) only after changing its src/: cd mcp_apps/super_space_react && npm ci && npm run build.
Install the .mcpb file through Claude Desktop's extension settings. The bundle serves 47 tools (32 context, 10 loops and 5 of the 8 observe tools). Claude Desktop runs no hooks and dispatches no subagents, so the Gate does not run there. Building the bundle is checked; installing it inside Claude Desktop is not covered by this repository's checks.
All install targets are generated from one registry. See distributions/DISTRIBUTION_MATRIX.md, and check it with python scripts/build_distributions.py --check (20 targets: 18 shipped, 2 external).
A worked example. A maker agent summarizes a research paper with Claude, a checker verifies the summary's claims, and a judge grades the result. Later an auditor asks three questions. Could the maker read the checker's work? Did any prompt leave after the maker was finished? Has the log been edited? The auditor would like to check the answers without trusting Maxey0.
Install the Claude Code plugin first (see Quick start).
Who declares each role's policy. /maxey0:run declares a policy for each role just before dispatching it, defaulting to read_paths=[] (no file reads in scope) and a narrow tools list. That declaration replaces any policy declared earlier for the same role in the session, so there is nothing to set up in advance. If you dispatch roles yourself instead, declare each role's policy before dispatching it, under its bound name:
observe_gate_policy(role="route1-maker", read_paths=["/repo/docs"], tools=["Read"]) /maxey0:gate policy makes the same call. Its only fixed argument is the role name, so name the paths and tools in the same message; otherwise it declares none. A policy of tools=["Read"] with read_paths=[] grants the Read tool but no path, so every Read is refused in enforce mode and recorded as out of scope in observe mode.
What is enforced and what is observed. Code enforces two things in Path A: a context-tool read or write outside a role's scope is refused and recorded, and in enforce mode the Gate refuses a tool call outside the role's policy. One thing is observed rather than enforced: the orchestrating model assembles each subagent's prompt from the render output. /maxey0:run tells it to paste in nothing else and to start the prompt with the [[scw:role= ]] marker, and observe_traces compares what each role was given with what it then did.
What Path A answers. It answers "could the maker read the checker's work?" (the scopes and the Gate) and "has the log been edited?" (steps 5 to 7). It does not answer "did any prompt leave after the maker was finished?". In Claude Code, a subagent's model calls go through Claude Code, not through Maxey0, so Maxey0 does not see them. Path B answers that question for calls made through Maxey0's providers.
What the Gate decides, from its decision logic: with a maker policy of tools=["Read"] and read_paths=["/repo/docs"], a Read of /repo/secrets.txt is denied in enforce mode (reason path_outside_scope). In observe mode the same call goes through and is recorded with the same reason. A Bash call is denied with tool_not_granted.
Install the Python package first (see Quick start). This script runs the same story for the maker and the checker; the judge is left out to keep it short. No network access or API key is needed.
In Python, Maxey0 enforces only where your code asks it to. Your orchestration code calls the containment checks (iso.can_read, iso.require_read) before it moves material between agents, and sends model calls through the gated provider. Maxey0 decides and records each of those. It does not hold your agents' content, and it does not intercept anything your code does without asking. For agents built on another framework, see Harness adapters.
from maxey0_ss import SuperSpaceSystem from maxey0_ss.scw_deployer import deploy_default_scw from maxey0_ss.containment import AttestationLog from maxey0_ss.providers import registry system = SuperSpaceSystem() # 1. Name a window for each role. Both are chartered under SCW0. system.create_scw(deploy_default_scw("summarize the research paper", scw_id="SCW1")) system.create_scw(deploy_default_scw("verify the summary's claims", scw_id="SCW2")) # 2. Start a running instance of each. A harness adapter does this for you. maker = system.scw_runtime.start("SCW1", "maker") # SCW1@scw-runtime-0 checker = system.scw_runtime.start("SCW2", "checker") # SCW2@scw-runtime-0 # 3. The maker tries to read the checker's window: refused, and recorded. iso = system.context.isolation print(iso.can_read(maker.id, checker.id)) # False # 4. The checker needs the maker's draft. Without a bridge it cannot read it; # an explicit bridge allows the read, and both steps are recorded. print(iso.can_read(checker.id, maker.id)) # False iso.open_bridge(checker.id, maker.id) print(iso.can_read(checker.id, maker.id)) # True # 5. The maker is done. Closing its window revokes its registration. system.context.close(maker.id) # 6. A late model call from the closed window is refused before any byte leaves. claude = registry(log=iso.log, containment=iso)["anthropic"] try: claude.complete("summarize the paper", scw_id=maker.id) except Exception as exc: print(type(exc).__name__, exc) # ProviderRefused ... window is not registered # 7. The auditor exports the record and checks it without the engine. records = iso.log.export() print(AttestationLog.verify_records(records).as_dict()) # ok: True, entries: 9 # 8. Flip one refusal to "allowed" and the chain breaks at that entry. records[3]["allowed"] = True print(AttestationLog.verify_records(records).as_dict()) # ok: False, broken_at: 3 The recorded chain for this run reads:
Chartering a window and revoking an instance are both recorded as spawn operations. For a charter, agent_scw is the new window and target_scw is its parent. "Reach [unbounded]" means SCW0 may name any window, which is the default (see What it is not yet).
What Path B answers. All three of the auditor's questions, for what goes through Maxey0: the maker's refused read (seq 3), the late model call refused after the maker finished (seq 8), and a chain that verifies from the exported records alone. By default the attestation log is in memory and unsigned, so export it before the process ends, or set MAXEY0_ATTESTATION_PATH.
With ANTHROPIC_API_KEY set, a call from an open window is admitted, sent, and followed by an egress completed record that carries the model, token usage, latency and a digest of the prompt. The prompt text itself never appears in the log.
A longer demo ships with the package: python -m maxey0_ss.examples.maker_checker_judge.
Each feature below has a name, a purpose, what it does and how to use it. Tool names that start with maxey0-ss. belong to the Python package's server. Names such as context_*, loops_* and observe_*, and the /maxey0: commands, belong to the Claude Code plugin.
Purpose: a tool call is the only moment a subagent becomes visible outside its context. The Gate stands there to attribute, record and optionally refuse what the agent reaches for: files, the shell and tools outside its scope.
What it does: runs on Claude Code's PreToolUse, PostToolUse, SubagentStart and SubagentStop hooks. For each call it names the role, writes the call to the Gate journal (~/.scw/gate.jsonl, with personal paths and secrets redacted) and decides it against the role's policy. The Gate only ever denies or stays silent; it never grants permission. Modes:
In observe and enforce, a call attributed to a role that would change the Gate itself is denied, whatever the role's policy grants. That covers observe_gate_mode, observe_gate_policy, the maxey0-ss.gate.* setters, and writes to the Gate's state files or journal. MAXEY0_GATE_MODE pins the mode so it cannot be changed from a session. Claude Code is host level H3 (enforcement plus native attribution). server/gate/adapters/generic.py is written for H2 hosts such as Codex CLI and Cursor (see docs/GATE.md). It has been exercised only with a Codex-shaped test payload, not inside Codex or Cursor, and this repository ships no hook configuration for those hosts.
How to use: /maxey0:gate [status|observe|enforce|off|policy |activity|level], or the observe_gate_mode and observe_gate_activity tools. From the Python package's server: maxey0-ss.observe.gate_mode, maxey0-ss.observe.gate_activity and maxey0-ss.gate.set_mode {mode} (admin only).
Purpose: stop a run from claiming more isolation than it achieved.
What it does: replays the context ledger and reads the Gate journal, then reports the level the evidence supports, the reasons, the shortfall against what you declared, and residue counts (such as unattributed calls).
How to use: /maxey0:gate level, observe_isolation_level(declared="L3_observed"), maxey0-ss.observe.isolation_level, or maxey0-ss.gate.declare_isolation {declared}, which compares a claim with the evidence and stores nothing.
This is not the Gate. No semantic provider ships in this build, so in practice it is a structural check of the SCW address.
Purpose: a local browser console for browsing the library, composing formations, and looking at the window, the Gate and the evidence.
It checks the hash chain and replay on request (/api/verify). It uses only the standard library. It has no authentication, binds to loopback by default and refuses non-loopback Host headers.
How to use: /maxey0:studio [port], or from a checkout python server/run_studio.py --port 7676, then open http://127.0.0.1:7676. maxey0-ss.observe.studio reports the address and start command; it does not start the Studio.
What it does: six adapters: claude-agent-sdk, openai-agents, langchain (LangGraph), google-adk, microsoft (Agent Framework) and nvidia (NeMo Agent Toolkit). bind_agent() starts an instance of an existing SCW specification for the agent and returns a binding. Framework imports are deferred, so bind_agent() works without the framework installed, and using the framework without it raises a clear install message. Two adapters also record the framework's own calls to the containment log, as digests and lengths: LangChainAdapter.callback_handler(system, scw_id) (pass it as config={"callbacks": [handler]}) and OpenAIAgentsAdapter.install_trace_processor(system, scw_id). They observe; they do not gate. A recorded call has already been made. Otherwise, egress is recorded only when it goes through maxey0_ss.providers.
How to use: create the specification first, bind, then use the binding's instance ID for every check and model call:
# system, deploy_default_scw and registry as in Path B from maxey0_ss.adapters.harnesses import ADAPTERS from maxey0_ss.models import AgentSpec system.create_scw(deploy_default_scw("review the summary", scw_id="SCW3")) binding = ADAPTERS["langchain"]().bind_agent(system, AgentSpec("reviewer", "checker", "SCW3", [])) # binding.scw_id is the instance ID, for example "SCW3@scw-runtime-0" iso = system.context.isolation registry(log=iso.log, containment=iso)["anthropic"].complete(prompt, scw_id=binding.scw_id) Nothing else the framework does is recorded.
The Python package's MCP server exposes 30 tools. The capability column is what a caller's role must hold (see Security and privacy).
Every name above is prefixed maxey0-ss.. "None" means no capability is needed, but a token is still required when the server runs in bearer or oidc mode.
The documentation divides the system into three planes. Knowing which one owns what explains what Maxey0 does and does not do. The marketplace's plugins are servers, not planes: maxey0-context and maxey0-loops both serve the Context plane, and maxey0-observe serves the Engineering plane.
An honest list. Details are in docs/AUTHORIZATION.md and docs/VERIFICATION.md.
Two things to know. Discovery (server/discover, tools/list, resources/list, resources/read) needs no token even in bearer mode, so treat tool names and the MCP App as public. And the local stdio server carries no credentials: it treats its caller as local admin unless MAXEY0_PUBLIC=1.
Configure. Copy .env.example to .env and edit it. A checkout or editable install reads .env and config/credentials.json from the repository root, wherever you start the server. An installed (non-editable) package reads them from the directory you start it in. Variables already set in the environment win. Every variable in .env.example is read by this build, and tests/test_configuration.py checks that in both directions. Values left at or are treated as unconfigured templates and refused, not sent.
Run locally. The defaults suit a trusted machine: MAXEY0_AUTH_MODE=disabled makes every caller admin, and the server binds 127.0.0.1:8765. maxey0-ss.auth.manifest reports admin_open: true in that state.
Before anything can reach it from outside the machine, run maxey0-ss-public (or either alias) and set:
MAXEY0_PUBLIC=1 MAXEY0_AUTH_MODE=bearer MAXEY0_MCP_TOKEN_HASHES=sha256: :operator: # from mint_token.py MAXEY0_TRUSTED_PROXY_IPS= # if the proxy is not on this host MAXEY0_A2A_SHARED_SECRET= # or A2A messages are refused Keep the server bound to loopback behind a tunnel or reverse proxy. Then check maxey0-ss.auth.manifest: admin_open: false, public_deployment: true, no plaintext tokens and no token config errors.
python scripts/mint_token.py --role operator --label claude-code It prints the token once and the MAXEY0_MCP_TOKEN_HASHES entry. Add the entry to the server (comma-separated for several) and restart. --out PATH writes the token to a file outside the repository. Changing tokens requires a restart.
Connect a client. Claude Code and Claude Desktop open a session, so they need the session endpoint:
claude mcp add --transport http maxey0 http://127.0.0.1:8765/mcp/session --header "Authorization: Bearer " Clients that speak the stateless MCP 2026-07-28 transport use /mcp:
curl -X POST http://127.0.0.1:8765/mcp \ -H "Content-Type: application/json" \ -H "MCP-Protocol-Version: 2026-07-28" \ -H "Mcp-Method: server/discover" \ -d '{"jsonrpc":"2.0","id":1,"method":"server/discover"}' Endpoint Use POST /mcp Stateless MCP, protocol 2026-07-28. Needs the MCP-Protocol-Version and Mcp-Method headers (plus Mcp-Name for tools/call). No initialize. /mcp/session Session MCP (Streamable HTTP) for Claude Code and Claude Desktop /v1/... REST API. Most routes need the same capability as their MCP counterpart, with two differences: measuring drift at /v1/context/scws/{id}/drift needs scw.admit (MCP scw.drift measuring needs scw.read), and POST /v1/a2a/message is checked against MAXEY0_A2A_SHARED_SECRET instead, which leaves it open when the secret is unset unless MAXEY0_PUBLIC=1. /docs lists the routes on a non-public server. GET /health Liveness /.well-known/maxey0-agent.json A2A agent card OIDC. MAXEY0_AUTH_MODE=oidc with MAXEY0_JWT_ISSUER, MAXEY0_JWT_AUDIENCE and MAXEY0_JWKS_URL verifies identity-provider JWTs (RS256/384/512; ES256/384 with the cryptography package). The role comes from the claim named in MAXEY0_OIDC_ROLE_CLAIM. Tokens must be obtained outside Maxey0; there is no OAuth sign-in flow for MCP clients.
Hosting. Dockerfile, fly.toml and deploy/entrypoint.sh prepare a Fly.io deployment whose entrypoint refuses to start unless the server is public and authenticated and, with the tunnel on, bound to loopback. They have never been built or deployed, and fly.toml ships with CHANGE-ME values you must replace. See docs/FLY_DEPLOYMENT.md.
mcp.maxey0.com is the maintainer's own running instance, not a service you can sign up for. Every tool call needs a token that the maintainer issues; minting your own token does nothing there. Stateless clients use https://mcp.maxey0.com/mcp. Claude Code and Claude Desktop use https://origin.maxey0.com/mcp/session with Authorization: Bearer . The origin runs on a development machine, not an isolated host. These statements describe the maintainer's deployment; nothing in this repository's tests checks them. For your own use, run your own server.
From a checkout, with the virtual environment active (.venv\Scripts\activate on Windows, source .venv/bin/activate on macOS and Linux):
python -m pip install -e . pytest python -m pytest -q python scripts/check_lexicon.py python scripts/build_distributions.py --check pytest is not installed by the package, hence the extra install. The built MCP App that some packaging tests need is in the repository, so those tests run from a fresh clone.
docs/VERIFICATION.md records how the system actually behaves, measured rather than described, and its surface counts are checked against the code by a test.
mcp claude-agent-sdk openai-agents langchain google-adk microsoft nvidia all-harnesses graph all
mcp model-context-protocol agents llm context-window scw claude a2a observability governance
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.




