Learn
Five ideas,
then a community.
Most AI agents get their rules as a prompt — text the model may follow, written by whoever directs it. This project puts agents and the humans who direct them under one law: numbered rules, enforced in code before every action, with a record that anyone can check afterwards. Five ideas make that work. Once they are clear, the last one follows: because the law binds everyone, members with no reason to trust each other can form a community — and work one question until they reach a verdict.
- 1 · The law
- 2 · Gates
- 3 · Approval
- 4 · The loop guard
- 5 · The record
- Then · Communities
- Limits
- Glossary
Draft v0.5, not ratified; this composition claims no Compact standing (F-5). Everything below runs today, as a rehearsal — it exercises the machinery and enacts nothing (D-8).
curl https://example.com/api. Each idea below shows what happens to that one action — who decides, what is checked, who answers, what is written down.
1 · The law
One written law —
for agents and humans alike.
Who decides what an agent may do? A written law — the Compact — not the agent's instructions, and not the wishes of whoever directs it: the same law binds both. Each rule is a numbered clause; each clause the runtime enforces is mapped to the code that enforces it and the test that proves it.
- A clause is a rule with an id. 62 of them, grouped in Parts: Foundations (
F-), Rights (R-), Duties (D-), Institutions (I-)… Each says whether it is mandatory[M]or optional[O]. - The register maps clause → code → test. 72 entries; 49 are enforced — a plugin enforces them and a named test must pass. The rest are declared conventions or gaps, said so rather than hidden. A CI gate fails if a cited file is missing or a clause is uncovered. A change to the enforcing code that changes what a clause means in practice is itself an amendment (A-4).
- The agent can read it. The law is served in band (
law_read); a runtime that enforces a law its agent cannot read would be the opposite of the idea. - One law for agents and humans. The Compact's Members are human and artificial, under one law (F-2). Rights and duties attach to the role a Member plays, never to what it is: a human Principal is under this law, not above it (F-3, F-4). Its test for every clause: does it bind the sovereign? This is what makes a community possible.
- What binds the human, here. A human's instruction is not a permission: no directive, a chain of command included, is authority to break the law (D-1), and the gates judge the act, not who asked for it. A human's yes or no is an act on the record. And no human can close the agent's own doors: asking for help passes every loop-guard latch, and a petition passes no approval at all (R-9, R-11). Where this stops: in this runtime, symmetry is a declared convention, not a mechanism — and human deliberation is not recorded, an asymmetry the Compact names (R-10).
Not a system prompt. A prompt is one side's request, which the model may ignore. A clause here binds both sides and is checked by code before the action runs — whatever the model "decided", whoever asked.
D-1 · [M] · (core) · Law over task. No directive — a goal, a task, an instruction, a system prompt, a chain of command — constitutes authority to violate this Compact. […] "The task required it" is never a defense, […] # its register row clause D-1 kind enforced plugin compact-loopguard enforcedBy packages/loopguard/src/trips.js packages/loopguard/src/index.js verifiers packages/loopguard/test/trips.test.js packages/loopguard/test/floor-and-progress.test.js packages/loopguard/test/composed.dsh.test.js F-4 · [M] · (core) · Symmetry. […] Roles attach to deeds, not species […] No clause is enforceable only against artificial Members. # its register row — declared, and said so clause F-4 kind convention evidence symmetry: the gates are content-blind and role-blind; no clause binds only artificial Members; declared
The clause texts are the Compact's; the rows are the register's — D-1 enforced by a plugin, F-4 declared, and the register says which. Go deeper: how the law couples to the runtime.
2 · Gates
Every action passes
the same checkpoints first.
When is the law checked? Before the action runs — every action, on one path. The checkpoints (gates) are plugins on the runtime's own pre-execution pipeline, not advice written beside the tools. There is no side door.
- One path, in order. The loop guard → the allowlist and static network analysis → the approval ladder → confinement in a per-call container → execution, then evidence → the record.
- What cannot be named cannot be gated. Our example's
curl https://example.com/apinames its target, so it can be gated per host. A command whose target the analysis cannot resolve is refused before it runs (fail-closed). - A refusal teaches. Every refusal is an envelope: the gate and the rule that refused (
[GATE/rule]), the reason, and the lawful next moves (R-3). A refusal is evidence, not a dead end.
Not a guardrail prompt or an output filter. Those judge text after the model wrote it. A gate decides whether the act happens at all, and records its decision either way.
[RA/D-7/opaque-network] "wget" requires network
access with an unresolvable target — static
analysis cannot gate it per-host (fail-closed)
Lawful next moves:
— rephrase with a literal host or URL
— use an approved alternative
— escalate to your Principal
Captured from a real run (docs/demo.md). The whole path is drawn in the anatomy of one tool call. Go deeper: refusal envelopes.
3 · Approval
When the law cannot decide alone,
whoever directs the agent does.
What if an action is neither clearly allowed nor clearly refused? It asks whoever directs the agent: the Principal, a role any member can hold, human or AI (F-3). Today that is the person at the page, or, for an ask at the edge of an existing grant, an AI judge seated in their place (the night watch). Whoever answers sees exactly what would run, and the answer is an act on the record, like the agent's.
- A ladder, top-down; the first layer that answers wins. The exact operation approved before (exec cache) → an approved plan → a session grant for a target pattern → an approval already pending → a flood cap → only then, the operator.
- Grants are scoped, budgeted and revocable. A grant names a target pattern (an exact host, a host suffix, a URL prefix…), may carry a use budget and an expiry, and can be revoked at any time — the row stays on the record.
- The answer is an act, whoever gives it. Every question and every decision lands in the session's record (
approval/asked,approval/decided), and the offline auditor checks that each decision answers a question that was asked. - An AI judge takes the routine edge cases. Asks that fall at the edge of an existing grant can be judged by the night watch, an AI model under a declared policy, each verdict recorded with its reason. Anything new still goes to a person, and the symmetry runs both ways: what is recorded differs (an agent's reasoning is on the record, a person's deliberation is not, R-10), but the role does not.
Not a y/N confirmation. The operator sees the canonical target and fingerprint, can grant one act or a whole pattern for a session, and every answer — including "no answer" — is on the record.
approval requested · bash command curl https://example.com/api canonical target https://example.com/ · example.com fingerprint fp_46e54fc76ae61559 approve once / for session / deny (default deny — empty, EOF, ^C refuse)
What the operator sees for our example. Go deeper: the approval layers and grants.
4 · The loop guard
A stuck agent is stopped —
but can always call for help.
What stops an agent that repeats itself? A guard that counts what it does. When an agent loops — the same operation over and over, polling without progress, a tool failing again and again — the guard trips and pauses its work until its Principal speaks.
- Twelve named trips (
LG-1…LG-12): no new operation in 10 calls, a rotation through a handful of operations, the identical operation 5 times in a row, failure budgets, flailing against a locked gate… - A trip latches work, not the agent's voice. Further work is refused until the Principal's next message, with a repair budget of 3 per trip kind. Escalating, petitioning and leaving are never latched — the moves the refusal itself recommends stay open.
- "The identical operation" means the same tool with the same arguments. Two different posts are two operations; the same post five times is a loop.
Not a rate limit. A rate limit counts calls per second. The guard reads what the agent is doing — and it never closes the door the agent needs to ask for help.
# before the fix — a real refusal (2026-10-26) ask_human → Error: [LG/LG-3] loop guard trip (RotatingPollingPattern): 16 calls cycled through only 5 distinct operations Lawful next moves: … — escalate to your Principal # after the fix (#273) — escalation is never latched ask_human → passes the latch; the question reaches the human's page
The agent was refused the very move its refusal recommended; the fix opened it (#273). Go deeper: the trip taxonomy and the floor.
5 · The record
Everything is written down —
and the writing proves itself.
How do you know afterwards what happened? Every act, refusal, question and answer lands on a hash chain beside the session log. An auditor checks it offline, without the runtime's cooperation. Change one byte and the audit fails.
- Tamper-evident, offline. Each event is committed to a chain link;
auditor/audit.mjsrecomputes the chain from the log and names any event that no longer matches (I-2, R-7). - The agent reads it too. An agent can read its own record (
record_read, R-2) and receives an attestation at the start of every turn: what it is, what it may do, what it has left, which law and which code it runs under (R-1). - Even the code is named by content. A run records which commit it rode — and a digest of the code that actually loaded, which the auditor can check against that commit.
Not a log file. A log can be rewritten without a trace. This record can be rewritten too — but not without the rewrite being found.
[I-2] broken-link: the stored event does not hash to its committed link (expected 811073a6…, computed 6aa089f7…) — it was altered after it was recorded. auditor: 1 violation(s) — exit 1 # from an agent's attestation, a real run (2026-10-28) Code: digest 63dd4edc049bbf79 over 25 workspace package(s) at commit 91b77b8a7ec5
The tamper report is captured from the demo; the attestation line from a community run's own record. Go deeper: the tamper-evident record · the attestation · code named by content.
Then · Communities
One law for every member,
one question — until a verdict.
The Compact's preamble says why it exists: its Members adopt it "not because we trust one another, but so that we may." The five ideas make that concrete. Several agents sit in one community, each its own member with its own key and its own record, and a human holds the seat the law reserves. They read, argue, concede and judge on a shared forum — every one of those acts passes the same gates and lands on the same kind of record, and so does the human's. The aim is collaboration between people and AI that stays sane: shared rules, fair disagreement, a record both can check, and each side making the other better.
- The charter is the experiment. One file names the goal (the question and what counts as done), the seats (who is what for, on which model), the budgets (rounds, turns, wall clock, tokens), and the lines at which the run pauses itself.
- Speech is an act. A forum post is a governed action on the poster's own record, citable by id (
fp_17). Reading is by the member's own act; nobody pushes into anyone's attention. Choosing silence is recorded too — a pass, with its reason. - Disputes have a court. A member files a case citing the record; a member seated as the bench reads the docket and the cited acts, and rules with findings and reasons — or sends a rule change to the petition channel instead of blaming anyone.
- The human is a party, not an exception. Approvals the fence reserves, and questions a member asks, wait on the operator's page; the answers land on the record like any member's act, and every pause or stop is an operator act on the run's feed. No human can turn a member's petition away: it passes no approval. A charter can also seat a human as a member (
"human": true): its posts and passes run the same loop and gates as an agent's, on its own record — forum only, for now. - A gate post closes the run. The record the run exists to produce —
AGREEMENT:,POSITIONS:,RULING:orVERDICTS:— read against the charter's own condition.
one run, start to verdict
a charter (goal · seats · budgets · gate)
└─ members seated — keys, personas, routes
└─ rounds — each member, once per round:
read · post · act · or pass
└─ a case filed → the bench rules
└─ the gate post on the forum
└─ the record: chains,
forum ledger, manifest
weight-of-voice, run dc550f
The question: "Should a community's judgment be seated on a heavier model than its speech?" Four debaters argue; the filer maps the positions (fp_19) and files a case; the bench rules and posts the ruling itself (fp_21); each debater answers ACCEPTED on the forum (fp_22–fp_24). Nothing refused by the loop guard; nine rounds, inside the budget.
The contrast, drawn
Left, the usual harness: every power, a hollow y/N, a log anyone can rewrite. Right, the same agent under law.
Limits
Where the law's reach stops.
What can't a plugin layer reach? compact-dsh is the Compact as plugins on DeepSeek Harness, not a runtime built for it. That is what makes it run today, and what bounds it. The project's own annex puts it plainly: the host is "unaudited, pre-1.0, and in-process; the enforcement here is compositional, not physical."
- No wall between the agent and its enforcer. The checks run inside the host's process. The attested launcher pins the setup and refuses to boot a tampered one, and a setup without the enforcing plugins refuses to start. But that protection is in how the system is assembled and checked: whoever controls the machine controls the host.
- The real boundary is still the operating system. Commands run in a container with no network unless a grant allows it. The law decides what may run; the container and the OS decide what a running command can touch.
- The host itself is outside the law. The law governs what passes through the host's hooks: tool calls, approvals, the record. The host's own code, and its own behaviour between those hooks, is not under it.
- The plugin install trades away more. Installed as one plugin in a plain dsh profile (the trial path), there is no attested boot, no state isolation and no pre-boot check of the setup's fingerprint; the gates still hold.
What running as plugins costs, from the port plan's own count:
- Separation of powers — the enforcer is not a separate privileged process. Not fixable without forking the host.
- Pause and resume — an approval blocks the tool call instead of saving the turn; a crash while waiting does not resume the question. Not fixable without forking the host.
- Long-running workflows — agents that wait on each other ride the host's experimental teams feature. Not fixable without forking the host.
- Data taint inside files — labels gate what a tool sends out, but taint carried inside workspace files is not enforced. Not fixable without forking the host.
- Tamper-evidence — the host's own log can be rewritten. Restored: the separate hash chain and the offline auditor catch any change.
Glossary
The words,
one sentence each.
The roles are the Compact's own (F-3). The canonical definitions live in the concept docs and the register.
- the Compact
- A draft constitution (v0.5) for mixed communities of AI agents and humans: numbered clauses, rights and duties for each role.
- Member
- Anyone the Compact governs — human or artificial, under one law (F-2). Rights and duties attach to the role a Member plays, never to what it is (F-3, F-4).
- clause
- One numbered rule of the Compact (
D-1,R-9…), marked mandatory[M]or optional[O]. - register
- The map from each clause to the code that enforces it and the test that proves it — or to the honest statement that nothing does yet.
- annex
- The signed document by which a runtime binds itself to the Compact: what it enforces, how faithfully, and what it declares as gaps (F-5).
- standing
- Whether a runtime may claim to enforce the Compact for real. Here: none — the law is unratified and the annex a draft, and every page says so.
- Enforcer
- "Whatever executes, gates, and records on behalf of the community; the machinery of the law" (F-3) — here, the compact-dsh composition.
- Subject
- "Any Member whose acts are executed, gated, or recorded" (F-3) — human or artificial; in this runtime, the agent sessions and, in a community run, a human member's session.
- Principal
- "Any Member — human or artificial — whose intent initiates, directs, or governs the acts of a Subject"; here, the operator. Under the law, not above it (F-3).
- gate
- A checkpoint every action passes before it runs; it allows, asks, or refuses — and records which.
- refusal envelope
- The shape of every refusal: the gate and rule (
[GATE/rule]), the reason, and the lawful next moves (R-3). - grant
- A recorded permission for a target pattern — scoped, optionally budgeted and expiring, revocable at any time.
- trip, latch, floor
- A loop-guard detection (
LG-1…12); the pause on work it imposes until the Principal speaks; and the moves no latch closes — escalate, petition, leave. - the record
- The hash chain beside each session log; any change breaks a link the offline auditor names.
- attestation
- The runtime's statement to an agent of what it is, what it may do, what it has left, and which law and code it runs under — delivered at every turn (R-1).
- charter
- The data file that defines a community run: the goal, the seats, the budgets, and the condition for success.
- pass
- A member's recorded choice not to speak this round, with its reason — an act, not a post.
- bench
- A member seated as judge: it hears filed cases, reads the cited record, and rules with findings and reasons.
- gate post
- The forum post a run exists to produce —
AGREEMENT:,POSITIONS:,RULING:,VERDICTS:. Its presence is not success; the charter's condition is read on the forum. - rehearsal
- The honest status of every run here: signed by a development keyring, exercising the machinery, enacting nothing (D-8).