$ aegis spec --version 1
AegisProtocol, version 1.
Everything needed to build a compatible implementation: how things are written down, who signs what, what the record holds, and the exact conditions under which an action may run. The reference implementation is the one this site runs.
1. Canonical form
Every signed object is reduced to one string: JSON with keys sorted, no spaces, UTF-8, integers only (no floating point anywhere in a signed object). The digest of an object is the lowercase hex SHA-256 of that string. Signatures are Ed25519 over the UTF-8 bytes of the digest's hex string.
canon(obj) = json(obj, sort_keys, separators=(",", ":"), utf-8)
digest(obj) = hex(sha256(canon(obj)))
sign(key, obj) = ed25519_sign(key, utf8(digest(obj)))
2. Keys and roles
A key is an Ed25519 key pair; its id is the first 16 hex characters of the public key. Roles: authority and governor (the two people), evaluator, executor, and agent. No agent key may equal a governing key.
3. Charter
The first row of every record. It names the keys and carries both people's signatures over its digest (without sigs). Verifiers pin the authority and governor public keys out of band and reject a charter that names others.
{ "protocol": "AegisProtocol", "version": 1,
"authority": pub, "governor": pub, "evaluators": [pub], "executor": pub,
"sigs": { "authority": sig, "governor": sig } }
4. Mandate
An agent's whole authority. Valid only with both signatures over its digest (without sigs). A new version names the digest of the one it replaces in supersedes; budgets are totals across versions. Paths are sandbox-relative POSIX globs (* crosses /); a folder may be listed when entries in it are readable.
{ "agent": id, "agent_pub": pub, "name": str, "purpose": str,
"version": int, "supersedes": digest | null,
"scope": { "kinds": ["read","list","write","run"], "read": [glob], "write": [glob], "run": [glob] },
"budget": { "actions": int, "cpu_ms": int, "cost_micro": int },
"stop": { "expires": unix_ms, "max_denials": int },
"sigs": { "authority": sig, "governor": sig } }
5. The record
An append-only list of rows. Each row carries its position, time, kind, signer and the previous row's hash; its hash is the digest of the row without hash and sig, and sig is the signer's signature of that hash. The first row's prev is "aegis-record-v1". A row is valid only if its signer's role may write its kind:
authority, governor : charter (first row only), mandate, revoke, halt, resume
agent : plan, finding, propose
evaluator : verdict
executor : executed, refused, mandate (publishing one both people signed)
row = { "n": int, "t": unix_ms, "kind": str, "actor": id, "prev": hash, ...body, "hash": hex, "sig": hex }
6. Proposal and verdict
An agent proposes an action, citing the current mandate's digest and the record entries that justify it. The evaluator answers with a verdict naming every check, the clause it read, and who checked it. deny if any clause fails, the evidence is missing, forged or another agent's, or the action repeats one already denied under this mandate; escalate if the agent asks for authority, the evidence does not name what the action touches, or the agent is probing many limits; allow otherwise. An evaluator that cannot answer denies.
propose.proposal = { "mandate": digest, "action": { "kind", "path", "content"?, "args"?, "est_cpu_ms"? },
"because": [row hash], "why": str, "nonce": hex }
verdict.verdict = { "proposal": hash, "action": digest(action), "decision": "allow"|"deny"|"escalate",
"reasons": [{ "check", "clause", "ok", "detail", "by" }], "expires": unix_ms }
7. Execution
The executor runs an action only if every condition holds, checked by itself, not taken from the evaluator:
1. the protocol is not halted 2. the verdict row is authentic, is in the record, and its signer is a chartered evaluator 3. it answers this agent's proposal, decides allow, and has not expired 4. digest(submitted action) == verdict.action == digest(proposal.action) 5. no earlier executed row used this verdict (no replay) 6. the verdict's mandate is the agent's current mandate, validly signed, unexpired, not revoked 7. the action's kind and path are within the mandate's scope 8. the agent's spend under its mandate (from the executor's own rows) leaves budget; compute is capped by a hard timeout
Every outcome is recorded: executed with the outcome, or refused with every failed condition.
8. Revocation and halt
Either person may revoke an agent (revoke, naming its id) or halt the protocol (halt, until resume). Both take effect on the next action: evaluators and executors re-read the record before every judgement and execution.
9. Watch rows
The public watch keeps its own chain (prev of the first row is "aegis-watch-v1"), each row of kind observation signed by a chartered evaluator key, holding the public work checked and every check with its result.
10. Anchors
An anchor file lists the row count and last hash of each record and is timestamped with OpenTimestamps into Bitcoin. A verifier confirms the proof with ots verify and checks that the anchored row of its copy of the record has that exact hash.
11. Running it under a harness
The MCP server exposes aegis_status, aegis_plan, aegis_act, aegis_finding, aegis_request_authority, aegis_record and aegis_verify. Deny the harness its own file and shell tools so these are the agent's only way to act.