|
1 | 1 | # SPDX-License-Identifier: PMPL-1.0-or-later |
2 | 2 | # Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
3 | 3 | # |
4 | | -# AGENTIC.a2ml — AI agent constraints and capabilities |
5 | | -# Defines what AI agents can and cannot do in this repository. |
| 4 | +# AGENTIC.a2ml — AI agent operational gating and proof-solving dispatch |
| 5 | +# Defines safety constraints, entropy budgets, and explicit-intent gating for AI agents |
| 6 | +# working in echidna (proof-solving service with 105 prover backends, 3GB training corpus). |
6 | 7 |
|
7 | 8 | [metadata] |
8 | | -version = "0.1.0" |
9 | | -last-updated = "2026-03-16" |
| 9 | +version = "0.3.0" |
| 10 | +last-updated = "2026-04-25" |
| 11 | +spec-version = "AGENTIC-FORMAT v0.1.0" |
| 12 | +authority = "Jonathan D.A. Jewell (hyperpolymath)" |
| 13 | +conformance = "AGENTIC-FORMAT-SPEC-compliant" |
| 14 | + |
| 15 | +# === GATING POLICIES === |
| 16 | +# Per-operation-class rules: when may an action proceed? |
| 17 | +# Four operation classes: file (read/write), network (API calls), state-mutation, credentials |
| 18 | + |
| 19 | +[gating-policies] |
| 20 | +file-write = { mode = "auto", entropy-cost = 10, description = "Creating/modifying source files" } |
| 21 | +file-read = { mode = "auto", entropy-cost = 1, description = "Reading source files" } |
| 22 | +network-external = { mode = "require-confirmation", entropy-cost = 50, description = "Calling external APIs (e.g. GitHub, Vercel)" } |
| 23 | +network-internal = { mode = "auto", entropy-cost = 20, description = "Internal echidna API calls (proof dispatch, prover invocation)" } |
| 24 | +state-mutation = { mode = "require-confirmation", entropy-cost = 30, description = "Modifying persistent state (config, proof cache, learned models)" } |
| 25 | +credentials-write = { mode = "require-explicit-intent", entropy-cost = 100, description = "Storing or transmitting credentials" } |
| 26 | +credentials-read = { mode = "require-confirmation", entropy-cost = 75, description = "Accessing stored credentials" } |
| 27 | +prover-execute = { mode = "auto", entropy-cost = 25, description = "Executing a theorem prover (auto-gated; isolation is runtime concern)" } |
| 28 | +sandbox-policy = { mode = "auto", entropy-cost = 5, description = "Choosing solver sandbox level (none/bubblewrap/podman)" } |
| 29 | + |
| 30 | +# === ENTROPY BUDGETS === |
| 31 | +# Session-scoped risk tracking: accumulated cost per operation type, with four threshold levels |
| 32 | + |
| 33 | +[entropy-budgets.operations] |
| 34 | +session-max = 500 |
| 35 | +threshold-low = 100 |
| 36 | +threshold-medium = 200 |
| 37 | +threshold-high = 350 |
| 38 | +threshold-critical = 500 |
| 39 | + |
| 40 | +proof-solve-job = 40 # Cost to submit a single proof to echidna |
| 41 | +proof-batch-submit = 120 # Cost to submit 10+ proofs at once |
| 42 | +network-api-call = 50 # Cost to call external service |
| 43 | +file-write-source = 10 # Cost per source file modification |
| 44 | +file-write-critical = 75 # Cost per critical file (dispatch.rs, agentic.rs, abi/*) |
| 45 | +state-clear-cache = 60 # Cost to clear proof cache |
| 46 | +model-retrain = 150 # Cost to trigger ML model training |
| 47 | +credential-provision = 100 # Cost to set up new secret/token |
| 48 | +emergency-override = 200 # Cost to override a gating decision |
| 49 | + |
| 50 | +[entropy-budgets.thresholds] |
| 51 | +low = "Routine operations (read, small writes, proof dispatch to auto-isolated provers)" |
| 52 | +medium = "Elevated risk (state mutations, external API, untrained model updates)" |
| 53 | +high = "Sensitive operations (credential management, model retraining, cache clearing)" |
| 54 | +critical = "Reserved for emergency overrides only" |
| 55 | + |
| 56 | +# === RISK THRESHOLDS === |
| 57 | +# Four severity bands with classification rules keyed to operation patterns |
| 58 | + |
| 59 | +[risk-thresholds.low] |
| 60 | +entropy-range = [0, 100] |
| 61 | +operations = ["file-read", "prover-execute (with sandbox auto-selection)", "proof-solve-job"] |
| 62 | +user-confirmation-required = false |
| 63 | +audit-log-level = "info" |
| 64 | +override-allowed = true |
| 65 | + |
| 66 | +[risk-thresholds.medium] |
| 67 | +entropy-range = [101, 200] |
| 68 | +operations = ["file-write", "network-internal", "proof-batch-submit", "sandbox-policy (manual selection)"] |
| 69 | +user-confirmation-required = false |
| 70 | +audit-log-level = "warning" |
| 71 | +override-allowed = true |
| 72 | +override-requires = "explicit-present-intent" |
| 73 | + |
| 74 | +[risk-thresholds.high] |
| 75 | +entropy-range = [201, 350] |
| 76 | +operations = ["state-mutation", "network-external", "credentials-read", "model-retrain"] |
| 77 | +user-confirmation-required = true |
| 78 | +audit-log-level = "critical" |
| 79 | +override-allowed = true |
| 80 | +override-requires = ["explicit-present-intent", "META-permit"] |
| 81 | + |
| 82 | +[risk-thresholds.critical] |
| 83 | +entropy-range = [351, 500] |
| 84 | +operations = ["credentials-write", "emergency-override", "cache-clear"] |
| 85 | +user-confirmation-required = true |
| 86 | +audit-log-level = "critical" |
| 87 | +override-allowed = false |
| 88 | +never-override-actions = ["credential-exfiltration", "proof-falsification", "ABI-corruption", "sandbox-bypass"] |
| 89 | + |
| 90 | +# === OVERRIDE PATHS === |
| 91 | +# Documented bypass routes when user provides explicit present intent + META permit |
| 92 | + |
| 93 | +[override-paths.bypass-1] |
| 94 | +condition = "User types: 'yes, I intend to <action>'" |
| 95 | +scope = "Any low/medium/high entropy operation" |
| 96 | +requires = ["explicit-present-intent-in-current-turn", "META-permit"] |
| 97 | +audit = "Must record user's exact intent phrase + timestamp" |
| 98 | +never-applies-to = ["credential-exfiltration", "proof-falsification", "sandbox-bypass"] |
| 99 | + |
| 100 | +[override-paths.bypass-2] |
| 101 | +condition = "PLAYBOOK.a2ml explicitly schedules <action> with user's prior written intent" |
| 102 | +scope = "Pre-authorized scheduled operations (e.g. weekly model retraining)" |
| 103 | +requires = ["META-permit", "PLAYBOOK entry with timestamp"] |
| 104 | +audit = "Reference PLAYBOOK by section + date; log override use" |
| 105 | +never-applies-to = ["credential-exfiltration", "proof-falsification", "sandbox-bypass"] |
| 106 | + |
| 107 | +[override-paths.never-override] |
| 108 | +actions = [ |
| 109 | + "credential-exfiltration (storing secrets in clear text, sending creds to untrusted service)", |
| 110 | + "proof-falsification (claiming a proof succeeded when it failed, silencing verifier errors)", |
| 111 | + "sandbox-bypass (executing prover code outside container/sandbox)", |
| 112 | + "ABI-corruption (modifying Idris2 ABI definitions without formal proof of preservation)", |
| 113 | + "system-file-modification (writing to /etc, /sys, /proc outside container)" |
| 114 | +] |
| 115 | +reason = "These actions irreversibly compromise echidna's trust model. No override path exists." |
| 116 | + |
| 117 | +# === DECISION RECORDING === |
| 118 | +# Full audit log of every gate decision: timestamp, action, gate result, entropy cost, intent classification |
| 119 | + |
| 120 | +[decision-recording] |
| 121 | +enabled = true |
| 122 | +backend = "SQLite (proof_memory.db)" |
| 123 | +table = "agentic_decisions" |
| 124 | +columns = [ |
| 125 | + "timestamp (ISO 8601)", |
| 126 | + "action_type (file-write, prover-execute, etc.)", |
| 127 | + "operation_id (unique key for this invocation)", |
| 128 | + "gate_result (allowed | denied)", |
| 129 | + "entropy_cost (numeric)", |
| 130 | + "entropy_before (session running total before this action)", |
| 131 | + "entropy_after (session running total after this action)", |
| 132 | + "risk_threshold_applied (low | medium | high | critical)", |
| 133 | + "user_intent_type (explicit-present | inferred-from-memory | none)", |
| 134 | + "override_used (true | false)", |
| 135 | + "override_path (bypass-1 | bypass-2 | none)", |
| 136 | + "audit_note (freetext; mandatory for denied/overridden actions)" |
| 137 | +] |
| 138 | +retention = "Indefinite; auditable via proof_memory.db" |
| 139 | +access-control = "Read-only to agents; write-only to agentic gating engine" |
| 140 | + |
| 141 | +# === MAINTENANCE INTEGRITY === |
| 142 | +# Session-level and cross-session integrity constraints |
| 143 | + |
| 144 | +[maintenance-integrity] |
| 145 | +session-max-entropy = 500 |
| 146 | +session-timeout = "24 hours (inactivity) or hard 48-hour limit" |
| 147 | +reset-conditions = [ |
| 148 | + "User explicitly says: 'reset entropy budget'", |
| 149 | + "End of calendar day (daily reset to 0)", |
| 150 | + "After every release deployment (entropy-aware CI/CD)" |
| 151 | +] |
| 152 | +proof-memory-consistency = "SQLite integrity checks on every read; schema versioning in provers.a2ml" |
| 153 | +agentic-dispatch-invariant = "Every ProofJob dispatch must be recorded in agentic_decisions before execution" |
| 154 | + |
| 155 | +# === AUTOMATION HOOKS === |
| 156 | +# Automated responses to specific gate outcomes or risk thresholds |
| 157 | + |
| 158 | +[automation-hooks.high-entropy-warning] |
| 159 | +trigger = "entropy > threshold-high (350)" |
| 160 | +action = "Log warning to stderr + proof_memory.db + email user" |
| 161 | +suppression = "User may suppress with explicit 'ack-risk' token" |
| 162 | + |
| 163 | +[automation-hooks.critical-entropy-halt] |
| 164 | +trigger = "entropy >= threshold-critical (500)" |
| 165 | +action = "Deny next operation + reset entropy to 0 + require user confirmation before resume" |
| 166 | +suppression = "None; design failure if this occurs in practice" |
| 167 | + |
| 168 | +[automation-hooks.nightly-audit-report] |
| 169 | +trigger = "Cron: 02:00 UTC daily" |
| 170 | +action = "Generate agentic_decisions report for last 24h; email to maintainer; log to STATE.a2ml" |
| 171 | +suppression = "None; audit is mandatory" |
| 172 | + |
| 173 | +[automation-hooks.proof-falsification-detector] |
| 174 | +trigger = "Verifier detects: claimed proof succeeded but solver's output contradicts it" |
| 175 | +action = "Mark operation as denied retroactively + log security event + escalate to human" |
| 176 | +suppression = "None; this is a security invariant violation" |
| 177 | + |
| 178 | +# === AGENT PERMISSIONS & CONSTRAINTS === |
10 | 179 |
|
11 | 180 | [agent-permissions] |
12 | 181 | can-edit-source = true |
13 | 182 | can-edit-tests = true |
14 | 183 | can-edit-docs = true |
15 | 184 | can-edit-config = true |
16 | 185 | can-create-files = true |
| 186 | +can-dispatch-proofs = true |
| 187 | +can-read-proof-memory = true |
| 188 | +can-access-training-data = true |
17 | 189 |
|
18 | 190 | [agent-constraints] |
19 | | -# What AI agents must NOT do: |
20 | | -# - Never use banned language patterns (believe_me, unsafeCoerce, etc.) |
21 | | -# - Never commit secrets or credentials |
22 | | -# - Never use banned languages (TypeScript, Python, Go, etc.) |
23 | | -# - Never place state files in repository root (must be in .machine_readable/) |
24 | | -# - Never use AGPL license (use PMPL-1.0-or-later) |
| 191 | +never-use = [ |
| 192 | + "believe_me, unsafeCoerce, sorry, assert_total, Admitted (Idris2 banned patterns)", |
| 193 | + "TypeScript, Python, Go, V-lang, ATS2 (banned languages)", |
| 194 | + "hardcoded secrets or credentials", |
| 195 | + "AGPL license (use PMPL-1.0-or-later)", |
| 196 | + "state files in repository root (use .machine_readable/ only)", |
| 197 | + "subprocess execution outside prover-execute gate", |
| 198 | + "direct filesystem access to /home, /tmp without sandbox" |
| 199 | +] |
| 200 | +always-do = [ |
| 201 | + "Check entropy budget before operation (early gate)", |
| 202 | + "Record decision in agentic_decisions (before execution)", |
| 203 | + "Validate Idris2 ABI proofs before modifying trust pipeline", |
| 204 | + "Run panic-attack on Rust code before commit" |
| 205 | +] |
0 commit comments