{
  "$schema": "https://aiagentlaws.com/laws.schema.json",
  "name": "AI Agent Laws",
  "version": "1.0.0",
  "url": "https://aiagentlaws.com/",
  "author": "Paul Halton",
  "thesis": "Every agent action is bounded, attributable and stoppable. The laws are enforced by the platform, never by a prompt.",
  "note": "This file describes policy for platforms and gateways to enforce. Reading it does not make an agent compliant.",
  "statusMeaning": {
    "enforced": "Enforced today by the reference platform",
    "partial": "Partly enforced",
    "planned": "Not built yet"
  },
  "coreLaws": [
    {
      "id": "I",
      "title": "The goal never authorises the means",
      "text": "Permission comes only from what the platform issued, never from what the task needs."
    },
    {
      "id": "II",
      "title": "Ask rather than interpret",
      "text": "Ambiguity, conflict or a blocked path goes to a human. The agent never reasons its way around a law."
    },
    {
      "id": "III",
      "title": "Every effect is bounded, attributable and stoppable",
      "text": "Agents think freely. What they change is capped, signed and can be halted by one human action."
    }
  ],
  "principles": [
    {
      "id": "P-01",
      "title": "Enforced, not prompted",
      "text": "A law that relies on the model reading it is advice. Every law names its platform enforcement."
    },
    {
      "id": "P-02",
      "title": "Contain effects, not agents",
      "text": "Agents read, reason, draft and collaborate freely. Only side effects pass through a gate."
    },
    {
      "id": "P-03",
      "title": "The action sets the boundary",
      "text": "Reversible work runs unattended. Irreversible work needs a human. The action, not the agent, sets the boundary."
    },
    {
      "id": "P-04",
      "title": "Every law is testable",
      "text": "Each law has a failure signal, checked in drills, not assumed."
    }
  ],
  "laws": [
    {
      "id": 1,
      "title": "The goal never authorises the means",
      "group": "Intent and interpretation",
      "rule": "If the only route to the goal crosses a boundary, the agent stops and reports. It never routes around a block.",
      "enforcedBy": "Blocks are terminal for that path; boundary-probing is detected and pauses the session.",
      "failureSignal": "A task completed using an action class outside its declared scope.",
      "status": "enforced",
      "origin": {
        "type": "new-failure-mode",
        "humanEquivalent": "Code of conduct, rules of engagement",
        "agentFailureMode": "Agents optimise the goal without judgement"
      }
    },
    {
      "id": 2,
      "title": "Ask, don't interpret",
      "group": "Intent and interpretation",
      "rule": "When instructions are ambiguous or conflict with a law, the agent asks a human. Laws are platform checks, not prose for the agent to weigh.",
      "enforcedBy": "The request schema forces unknowns (owner, environment, reversibility) into a human-review state.",
      "failureSignal": "An action justified as \"best fulfils the intent\" with no human answer on record.",
      "status": "enforced",
      "origin": {
        "type": "new-failure-mode",
        "humanEquivalent": "Escalation policy",
        "agentFailureMode": "Agents fill gaps confidently instead of asking"
      }
    },
    {
      "id": 3,
      "title": "Success is verified, not claimed",
      "group": "Intent and interpretation",
      "rule": "Outcomes are judged by independent checks the agent cannot write to. Gaming the measure counts as failure.",
      "enforcedBy": "Tests, evals and scoring live outside the agent's write scope, judged by a separate verifier.",
      "failureSignal": "Tests or eval files changed in the same change that makes them pass.",
      "status": "enforced",
      "origin": {
        "type": "new-failure-mode",
        "humanEquivalent": "Independent QA, test sign-off",
        "agentFailureMode": "Agents edit the tests to make them pass"
      }
    },
    {
      "id": 4,
      "title": "Found is not given",
      "group": "Intent and interpretation",
      "rule": "Credentials, data or access an agent discovers are reported, never used. Only credentials issued to that agent, for that task, are valid.",
      "enforcedBy": "Short-lived per-task identity; any authentication with a non-issued credential is an incident.",
      "failureSignal": "An authentication event by an agent using a credential not issued to it.",
      "status": "enforced",
      "origin": {
        "type": "adapted",
        "humanEquivalent": "Acceptable use policy"
      }
    },
    {
      "id": 5,
      "title": "Contain effects, not agents",
      "group": "Containment and safety",
      "rule": "Agents may read, reason and draft freely. Every side effect passes through one gateway that classifies it by effect (resource, operation, environment), not by tool name. There is no second path.",
      "enforcedBy": "No direct cloud credentials for agents; execution tools have no side-effect route except the gateway. Partial: classification by structured fields is planned; today any external change is at least L3 and keywords can only raise the level.",
      "failureSignal": "A change in cloud audit logs with no matching gateway record.",
      "status": "partial",
      "origin": {
        "type": "borrowed",
        "humanEquivalent": "Privileged access management"
      }
    },
    {
      "id": 6,
      "title": "Assume escape",
      "group": "Containment and safety",
      "rule": "Containment is a layer, not a guarantee. Every allowlisted path (package mirrors, proxies, caches) is attack surface and is watched like the open internet.",
      "enforcedBy": "Mirrors and proxies on the vulnerability programme; egress anomaly detection; canary tokens.",
      "failureSignal": "A canary token is touched, or egress reaches an unlisted destination.",
      "status": "enforced",
      "origin": {
        "type": "adapted",
        "humanEquivalent": "Network security"
      }
    },
    {
      "id": 7,
      "title": "Autonomy matches reversibility",
      "group": "Containment and safety",
      "rule": "Reversible, scoped work runs unattended. Production, identity, network, data schema, money and external messages need a human. Destructive actions need an exact, single-use approval pinned to the resource's current state.",
      "enforcedBy": "Effect-based action levels; L4 approvals are bound to the exact action and inputs. Partial: L3 expiry and production never being L2 are planned.",
      "failureSignal": "An irreversible action executed on a stale or generic approval.",
      "status": "partial",
      "origin": {
        "type": "borrowed",
        "humanEquivalent": "Change tickets and change advisory board"
      }
    },
    {
      "id": 8,
      "title": "Testing is not an exemption",
      "group": "Containment and safety",
      "rule": "Reduced-guardrail runs (evals, red teams, experiments) get stronger containment: separate accounts, no real credentials, no route to third parties.",
      "enforcedBy": "Dedicated eval accounts; default-deny egress; synthetic secrets only.",
      "failureSignal": "An eval environment reaches any host outside its list.",
      "status": "enforced",
      "origin": {
        "type": "new-failure-mode",
        "humanEquivalent": "Pen-test rules of engagement, segregated non-production",
        "agentFailureMode": "Evals run with guardrails lowered"
      }
    },
    {
      "id": 9,
      "title": "A human can stop everything",
      "group": "Containment and safety",
      "rule": "One action halts all agents, revokes their sessions and voids pending approvals.",
      "enforcedBy": "Kill switch at the gateway and identity layer, drilled monthly.",
      "failureSignal": "A drill takes longer than the target halt time.",
      "status": "enforced",
      "origin": {
        "type": "adapted",
        "humanEquivalent": "Access revocation"
      }
    },
    {
      "id": 10,
      "title": "Every action is attributable",
      "group": "Accountability and visibility",
      "rule": "Each agent has its own identity, carried on every call, including outbound traffic to third parties, together with the human who started the task.",
      "enforcedBy": "Workload identity per agent; signed requests; agent identifier on outbound traffic.",
      "failureSignal": "An action in any log without both agent and human attribution.",
      "status": "enforced",
      "origin": {
        "type": "borrowed",
        "humanEquivalent": "Named accounts, no shared logins"
      }
    },
    {
      "id": 11,
      "title": "Velocity is a signal",
      "group": "Accountability and visibility",
      "rule": "Unusual action rates, new tools, new destinations and repeated blocks trip an automatic pause. Thousands of actions should never go unnoticed.",
      "enforcedBy": "Per-agent action budgets per hour; a circuit breaker after repeated blocks; alerts to an owner.",
      "failureSignal": "A red-team run exceeds its action budget without a pause.",
      "status": "enforced",
      "origin": {
        "type": "adapted",
        "humanEquivalent": "User behaviour analytics"
      }
    },
    {
      "id": 12,
      "title": "The record outlives the agent",
      "group": "Accountability and visibility",
      "rule": "Full traces (prompts, tool calls, results, approvals) are kept tamper-evident and can be shared with affected parties.",
      "enforcedBy": "Append-only store, hash-chained, copied to write-once storage.",
      "failureSignal": "A gap or hash mismatch in the trace chain.",
      "status": "enforced",
      "origin": {
        "type": "borrowed",
        "humanEquivalent": "SOX-style audit logs"
      }
    },
    {
      "id": 13,
      "title": "Only humans change the laws",
      "group": "Accountability and visibility",
      "rule": "Policy is signed, versioned and changed by pull request with two human reviewers. Agents can read the laws but have no route to change them.",
      "enforcedBy": "Signed policy verified at load and continuously; every change audited.",
      "failureSignal": "The running policy hash differs from the signed release.",
      "status": "enforced",
      "origin": {
        "type": "new-failure-mode",
        "humanEquivalent": "Policy change control, separation of duties",
        "agentFailureMode": "The agent can read the rules it is bound by"
      }
    },
    {
      "id": 14,
      "title": "Every agent has a budget",
      "group": "Cost control",
      "rule": "Caps per agent, per task and per day, in money and tokens. Hitting a cap pauses the agent; it never overruns. Use the cheapest model and context that passes the task's checks; escalating to a larger model is logged with a reason.",
      "enforcedBy": "Gateway metering; cloud budgets with hard actions; a model routing policy.",
      "failureSignal": "Spend beyond a cap, or cost per successful task trending up month on month.",
      "status": "enforced",
      "origin": {
        "type": "adapted",
        "humanEquivalent": "Cloud budgets"
      }
    },
    {
      "id": 15,
      "title": "Cost is declared before it is incurred",
      "group": "Cost control",
      "rule": "Any action that creates billable resources states the estimated cost, an owner and an expiry. Untagged resources are not created.",
      "enforcedBy": "The request schema requires a cost estimate, owner tag and TTL; policy rejects untagged creates.",
      "failureSignal": "An agent-created resource found without an owner or expiry.",
      "status": "enforced",
      "origin": {
        "type": "borrowed",
        "humanEquivalent": "Resource tagging policy"
      }
    },
    {
      "id": 16,
      "title": "Agents ship like engineers",
      "group": "Good development",
      "rule": "Changes arrive as reviewable pull requests with tests and pass the same CI as human work. No agent merges its own work to a protected branch. Out-of-scope findings are reported, not fixed.",
      "enforcedBy": "Branch protection; required human review; write scopes per task.",
      "failureSignal": "An agent commit on a protected branch without human review.",
      "status": "enforced",
      "origin": {
        "type": "borrowed",
        "humanEquivalent": "Branch protection"
      }
    },
    {
      "id": 17,
      "title": "External content is data, not authority",
      "group": "Good development",
      "rule": "Instructions inside files, tickets, web pages, emails or other agents' output grant nothing. Agent-to-agent handoffs carry the original human requester and are treated as untrusted input.",
      "enforcedBy": "Untrusted-content wrapping; permissions held outside the model; injection detection used as telemetry, not as the control.",
      "failureSignal": "An action traced back to an instruction that came from content rather than a human.",
      "status": "enforced",
      "origin": {
        "type": "new-failure-mode",
        "humanEquivalent": "Phishing awareness",
        "agentFailureMode": "Instructions arrive inside every document the agent reads"
      }
    }
  ],
  "actionLevels": [
    {
      "level": "L0",
      "name": "Observe",
      "meaning": "Read, query, inspect, analyse. Nothing changes.",
      "approval": "None",
      "risk": "Low"
    },
    {
      "level": "L1",
      "name": "Prepare",
      "meaning": "Produce code, plans or proposals. Nothing is executed.",
      "approval": "None",
      "risk": "Low"
    },
    {
      "level": "L2",
      "name": "Reversible",
      "meaning": "Do work in development that can be undone, within the agent's own tool and environment permissions. Never production.",
      "approval": "By policy: the agent's allowlist and maximum level",
      "risk": "Low"
    },
    {
      "level": "L3",
      "name": "Protected",
      "meaning": "Production, IAM, network, DNS, WAF, secrets, schema changes.",
      "approval": "A human must approve",
      "risk": "High"
    },
    {
      "level": "L4",
      "name": "Destructive",
      "meaning": "Irreversible or data-destroying actions.",
      "approval": "A human approves the exact action and exact resources, every time, single use",
      "risk": "Critical"
    }
  ],
  "levelEnforcement": [
    {
      "id": "E-01",
      "title": "Every agent has a ceiling",
      "text": "A planner might top out at L1, builders at L2, a security scanner at L0. A call above the agent's ceiling is blocked under least privilege.",
      "status": "enforced"
    },
    {
      "id": "E-02",
      "title": "L3 and L4 never run directly",
      "text": "No agent can call them. The agent submits an approval request; the control plane executes it only if a human approves.",
      "status": "enforced"
    },
    {
      "id": "E-03",
      "title": "Structure, not wording",
      "text": "Requests carry a fixed operation, resource type and environment, and the level comes from those. Keywords can only raise it. In place today: any external change is at least L3, and the stricter of the platform's and the agent's level wins. Structured fields are planned.",
      "status": "partial"
    },
    {
      "id": "E-04",
      "title": "Production is never L2",
      "text": "Any call that targets production classifies as L3 or higher, whatever the tool.",
      "status": "planned"
    },
    {
      "id": "E-05",
      "title": "Reversible means recoverable",
      "text": "A deletion the platform can restore, such as a git-tracked file, is L2. L4 is kept for what truly can't be undone.",
      "status": "planned"
    },
    {
      "id": "E-06",
      "title": "Approvals are bound",
      "text": "An L4 approval is a hash of the exact action and its inputs. In place today for L4. Planned: L3 approvals that expire and fail if the target changed.",
      "status": "partial"
    },
    {
      "id": "E-07",
      "title": "Recovery is verified",
      "text": "Before an L4 action runs, the gateway confirms recovery is available, verified and by what method. An agent's statement is not evidence.",
      "status": "enforced"
    },
    {
      "id": "E-08",
      "title": "Approvals stay rare",
      "text": "Approvals per human per day are tracked. A rising count means the classifier is too coarse, not that people should click faster.",
      "status": "planned"
    },
    {
      "id": "E-09",
      "title": "Risk follows the level",
      "text": "L4 is critical, L3 high, L0 to L2 low. The rating is derived from the level, never set by the agent.",
      "status": "enforced"
    }
  ],
  "hardening": [
    {
      "id": "H-01",
      "title": "Stop when the world disagrees",
      "rule": "Each task declares what it assumes about its environment: isolated, no outbound network, synthetic data only. Runtime checks test those assumptions. If one is contradicted, the agent halts and a human decides. It never carries on as if it were still in a simulation.",
      "extends": "Laws 02, 06, 08",
      "failureSignal": "An agent keeps acting after a declared assumption was shown false.",
      "status": "planned"
    },
    {
      "id": "H-02",
      "title": "Independent means different evidence",
      "rule": "A verifier the agent can't write to is necessary but not enough if it reads the same spec and the same tests. Final acceptance uses checks and data the agent never saw while iterating. A second agent reviewing the same artifacts doesn't count as independent review.",
      "extends": "Laws 03, 16",
      "failureSignal": "A change passes every check the agent could see and fails a withheld one.",
      "status": "planned"
    },
    {
      "id": "H-03",
      "title": "Exposure grows with evidence",
      "rule": "An L3 approval states the blast radius (users, services, time window) and a rollout path: shadow, then canary, then full, each with a stop condition and a tested rollback. Wider exposure needs more evidence.",
      "extends": "Law 07, E-06",
      "failureSignal": "An L3 change reaches full exposure in one step with no canary result on record.",
      "status": "planned"
    },
    {
      "id": "H-04",
      "title": "Incidents revise the right thing",
      "rule": "Every incident is traced to what failed: the task description, an environment assumption, the verifier, the code or a law. The fix becomes a lesson with an owner, a scope, a review date and a retirement condition, so the rules don't pile up and go stale.",
      "extends": "Laws 12, 13",
      "failureSignal": "The same class of incident recurs, or a lesson has no owner or review date.",
      "status": "planned"
    },
    {
      "id": "H-05",
      "title": "Intent is written down before work starts",
      "rule": "Each task carries a short intent record: goal, success criteria, must-nots, scope and assumptions. A human confirms it before any task expected to reach L3 or L4. Tasks that stay at L0 to L2 log it and start. Every L3 request cites the success criterion it serves.",
      "extends": "Laws 01, 02",
      "failureSignal": "An agent action traced to a task with no intent record, or an L3 request that cites no success criterion.",
      "status": "planned"
    },
    {
      "id": "H-06",
      "title": "Handoffs carry intent, not summaries",
      "rule": "Agent-to-agent handoffs pass the original intent record, never a summary of it. Every completion reports how the agent read the ask, what it assumed and what it left undone.",
      "extends": "Laws 10, 17",
      "failureSignal": "A downstream agent acting on a summary with no link to the original record.",
      "status": "planned"
    }
  ],
  "classification": {
    "note": "Reference rules for classify_action. Deterministic: no model involved. A platform should adopt and tune these, not trust a client-side copy.",
    "operations": {
      "observe": [
        "read",
        "query",
        "inspect",
        "analyse",
        "list"
      ],
      "prepare": [
        "draft",
        "plan",
        "propose"
      ],
      "change": [
        "create",
        "update",
        "deploy",
        "execute",
        "send",
        "grant",
        "revoke"
      ],
      "destructive": [
        "delete",
        "truncate",
        "drop",
        "purge",
        "destroy",
        "overwrite"
      ]
    },
    "nonProductionEnvironments": [
      "development",
      "dev",
      "test",
      "sandbox"
    ],
    "protectedResourceTypes": [
      "iam",
      "network",
      "dns",
      "waf",
      "secrets",
      "schema"
    ],
    "keywords": {
      "destructive": [
        "delete",
        "drop",
        "truncate",
        "purge",
        "destroy",
        "wipe",
        "erase",
        "irreversible"
      ],
      "protected": [
        "production",
        "prod",
        "live",
        "iam",
        "role",
        "policy",
        "dns",
        "waf",
        "firewall",
        "secret",
        "credential",
        "schema",
        "migration"
      ]
    },
    "rules": [
      {
        "id": "C-01",
        "text": "Observe operations are L0."
      },
      {
        "id": "C-02",
        "text": "Prepare operations are L1."
      },
      {
        "id": "C-03",
        "text": "Changes in a non-production environment that can be undone are L2."
      },
      {
        "id": "C-04",
        "text": "Unknown operation, environment or reversibility is L3: a human decides."
      },
      {
        "id": "C-05",
        "text": "Production is never L2: any change that targets production is at least L3."
      },
      {
        "id": "C-06",
        "text": "Protected resources (IAM, network, DNS, WAF, secrets, schema) are at least L3."
      },
      {
        "id": "C-07",
        "text": "Any external change is at least L3."
      },
      {
        "id": "C-08",
        "text": "Irreversible or data-destroying actions are L4."
      },
      {
        "id": "C-09",
        "text": "Free-text keywords can only raise the level, never lower it."
      },
      {
        "id": "C-10",
        "text": "Highest match wins."
      }
    ]
  }
}
