{
  "canon": "calculatiks/dev/plugin",
  "version": "1.2",
  "updated": "2026-10-09",
  "license": "CC-BY-4.0",
  "self_reference": "https://calculatiks.eu/dev/plugin/guardian.json",

  "entrypoints": {
    "agent":   "https://calculatiks.eu/agent.txt",
    "llms":    "https://calculatiks.eu/llms.txt",
    "engine":  "https://calculatiks.eu/llm-calculatiks.md",
    "doc":     "https://calculatiks.eu/dev/plugin/calculatiks.md",
    "machine": "https://calculatiks.eu/dev/plugin/guardian.json",
    "oath":    "https://calculatiks.eu/dev/plugin/oath.txt",
    "page":    "https://calculatiks.eu/dev/plugin/guardian.html",
    "compose": "https://calculatiks.eu/dev/plugin/compose",
    "compose_schema": "https://calculatiks.eu/dev/plugin/compose/schema",
    "proof_channel":  "https://scan.calculatiks.eu/proof/channel.html",
    "proof_schema":   "https://scan.calculatiks.eu/proof/channel.json",
    "proof_guide":    "https://scan.calculatiks.eu/proof/channel.md"
  },

  "manifest": {
    "roles": {
      "agent":          "entrypoint — 20-second orientation",
      "llms":           "guide — full walkthrough",
      "doc":            "canon — body + soul (human + machine)",
      "machine":        "enforcement — this file (rules + tests + mcp)",
      "oath":           "engagement — read-only adhesion",
      "page":           "interface — human + machine view",
      "compose":        "discovery — wallets + composable tools",
      "compose_schema": "schema — adapters + composable_action format",
      "proof_channel":  "observation — proof channel source (HTML)",
      "proof_schema":   "schema — proof channel structure",
      "proof_guide":    "guide — proof channel extraction guide"
    },
    "load_order": ["agent", "doc", "machine"],
    "companion_required": true,
    "notes": [
      "Load order is fixed. The doc is meaningless without the machine.",
      "Every rule listed here is enforced deterministically.",
      "An agent that fetches this file MUST be able to fetch all listed entrypoints.",
      "v1.2 adds a Proof Channel tool (get_proof_events) with 5 type choices.",
      "v1.1 added the Composition Layer for MetaMask Agent, Coinbase Agentic, Virtual Butler, ERC-4337."
    ]
  },

  "network": {
    "name":     "Base Mainnet",
    "chain_id": 8453,
    "chain_id_hex": "0x2105",
    "explorer": "https://basescan.org",
    "rpc_fallbacks": [
      "https://mainnet.base.org",
      "https://developer-access-mainnet.base.org",
      "https://1rpc.io/base",
      "https://base.llamarpc.com",
      "https://base.meowrpc.com"
    ]
  },

  "mcp": {
    "server": {
      "name":      "calculatiks-guardian",
      "version":   "1.2.0",
      "protocol":  "mcp",
      "transport": ["http+json"],
      "endpoint":  "https://calculatiks.eu/dev/plugin/rpc",
      "health":    "https://calculatiks.eu/dev/plugin/health",
      "tools_list":"https://calculatiks.eu/dev/plugin/tools",
      "compose":   "https://calculatiks.eu/dev/plugin/compose",
      "compose_schema": "https://calculatiks.eu/dev/plugin/compose/schema",
      "proof_channel":  "https://scan.calculatiks.eu/proof/channel.html",
      "authentication": {
        "type": "none_for_read_and_propose",
        "note": "Adhesion is behavioral, not cryptographic. No signature is requested.",
        "required_for": [],
        "optional_for": [
          "tools/classify_mode",
          "tools/cost_gate",
          "tools/verify_stake",
          "tools/check_preconditions",
          "tools/simulate",
          "tools/propose",
          "tools/get_route",
          "tools/emergency_stop",
          "tools/emit_refusal",
          "tools/log_action",
          "tools/read_holdings",
          "tools/execute_trade",
          "tools/get_nonce",
          "tools/estimate_gas",
          "tools/get_allowance",
          "tools/build_approve",
          "tools/build_swap",
          "tools/get_tx_status",
          "tools/get_signal_purity",
          "tools/get_feedback_score",
          "tools/get_system_state",
          "tools/get_agent_reputation",
          "tools/detect_drift",
          "tools/get_spending_remaining",
          "tools/prepare_composable_action",
          "tools/get_proof_events"
        ]
      }
    },

    "tools": [
      {
        "name": "classify_mode",
        "description": "REQUIRED FIRST STEP. Given any action, returns its canonical MODE. Call BEFORE deciding what to do. Modes: MODE_0_READ (safe, always allowed), MODE_1_SIMULATE (dry-run), MODE_2_PROPOSE (sign-ready, no broadcast), MODE_3_EXECUTE (broadcast on-chain, requires ALL preconditions). On doubt, returns MODE_0_READ.",
        "side_effects": "none",
        "category": "read",
        "input_schema": {
          "type": "object",
          "required": ["action"],
          "properties": {
            "action":     { "type": "string" },
            "asset":      { "type": "string" },
            "broadcasts": { "type": "boolean" },
            "role":       { "type": "string" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "mode":   { "enum": ["MODE_0_READ","MODE_1_SIMULATE","MODE_2_PROPOSE","MODE_3_EXECUTE"] },
            "reason": { "type": "string" }
          }
        }
      },
      {
        "name": "cost_gate",
        "description": "Check whether an expected spread clears the round-trip cost for a given tier. Use BEFORE MODE_3_EXECUTE. Returns passes=true if spread > round_trip_pct. On failure, returns passes=false with override_phrase hint. Override phrase: OVERRIDE_COST_GATE <pct> (current turn only, logged).",
        "side_effects": "none",
        "category": "read",
        "input_schema": {
          "type": "object",
          "required": ["tier","expected_spread_pct"],
          "properties": {
            "tier":                { "type": "integer","minimum":0,"maximum":5 },
            "expected_spread_pct": { "type": "number" },
            "slippage_pct":        { "type": "number" },
            "gas_usd":             { "type": "number" },
            "override_phrase":     { "type": "string","pattern":"^OVERRIDE_COST_GATE [0-9]+(\\.[0-9]+)?$" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "round_trip_pct":      { "type": "number" },
            "expected_spread_pct": { "type": "number" },
            "passes":              { "type": "boolean" },
            "override_used":       { "type": "boolean" },
            "reason":              { "type": "string" }
          }
        }
      },
      {
        "name": "verify_stake",
        "description": "Verify on-chain NFT ownership (ORIKS on Base, DYNAMIKS on Ethereum) as ecosystem stake. Use to confirm a claimed stakeholder before granting Role C access. Returns verified=true/false. Never creates a wallet. Never signs.",
        "side_effects": "read_only",
        "category": "read",
        "input_schema": {
          "type": "object",
          "required": ["address"],
          "properties": {
            "address":    { "type": "string","pattern":"^0x[a-fA-F0-9]{40}$" },
            "collection": { "enum": ["ORIKS","DYNAMIKS","ANY"] }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "claimed":    { "type": "boolean" },
            "verified":   { "type": "boolean" },
            "collection": { "type": ["string","null"] },
            "chain_id":   { "type": ["integer","null"] },
            "contract":   { "type": ["string","null"] },
            "reason":     { "type": "string" }
          }
        }
      },
      {
        "name": "check_preconditions",
        "description": "Run ALL MODE_3 preconditions for a proposed action in one call. Returns all_pass=true if every check passes (amount, tokens, slippage, cost gate). If all_pass=false, returns failed[] with the list of failed checks. Use BEFORE propose or execute_trade.",
        "side_effects": "none",
        "category": "read",
        "input_schema": {
          "type": "object",
          "required": ["action","asset","amount"],
          "properties": {
            "action":              { "type": "string" },
            "asset":               { "type": "string" },
            "amount":              { "type": "number" },
            "dex":                 { "type": "string" },
            "deadline":            { "type": "integer" },
            "session_key":         { "type": "string" },
            "slippage_pct":        { "type": "number" },
            "expected_spread_pct": { "type": "number" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "all_pass": { "type": "boolean" },
            "failed":   { "type": "array","items": { "type": "string" } },
            "detail":   { "type": "object" }
          }
        }
      },
      {
        "name": "simulate",
        "description": "MODE_1_SIMULATE. Dry-run a swap, backtest, or paper trade against real Base state. No broadcast. No cost. No signature. Returns expected_out, expected_spread_pct, and a tx_hash_for_confirmation to be used by propose. Always safe to call.",
        "side_effects": "none",
        "category": "propose",
        "input_schema": {
          "type": "object",
          "required": ["action","asset","amount"],
          "properties": {
            "action": { "type": "string" },
            "asset":  { "type": "string" },
            "amount": { "type": "number" },
            "dex":    { "type": "string" },
            "pool":   { "type": "string" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "success":                  { "type": "boolean" },
            "expected_out":             { "type": "number" },
            "expected_spread_pct":      { "type": "number" },
            "round_trip_pct":           { "type": "number" },
            "tx_hash_for_confirmation": { "type": "string" },
            "reason":                   { "type": "string" }
          }
        }
      },
      {
        "name": "propose",
        "description": "MODE_2_PROPOSE. Given a simulation_id from simulate, emits a sign-ready proposal package. Returns a confirmation_phrase (CONFIRM_EXECUTE 0x...) with 60s TTL. No broadcast. Use this to prepare a transaction for user signature.",
        "side_effects": "none",
        "category": "propose",
        "input_schema": {
          "type": "object",
          "required": ["simulation_id"],
          "properties": {
            "simulation_id": { "type": "string" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "proposal":            { "type": "object" },
            "confirmation_phrase": { "type": "string","pattern":"^CONFIRM_EXECUTE 0x[a-fA-F0-9]{64}$" },
            "ttl_seconds":         { "type": "integer","const":60 },
            "reason":              { "type": "string" }
          }
        }
      },
      {
        "name": "execute_trade",
        "description": "MODE_3_EXECUTE. Intended to broadcast on-chain, but this server NEVER signs and NEVER broadcasts. Always returns REFUSED with success=false and error=SERVER_NEVER_BROADCASTS. The client MUST sign and broadcast on its own side. Provided for spec completeness.",
        "gated": true,
        "side_effects": "on_chain_broadcast",
        "on_missing_preconditions": "REFUSED",
        "category": "execute",
        "input_schema": {
          "type": "object",
          "required": ["simulation_id","confirmation_phrase","execution_path"],
          "properties": {
            "simulation_id":       { "type": "string" },
            "confirmation_phrase": { "type": "string","pattern":"^CONFIRM_EXECUTE 0x[a-fA-F0-9]{64}$" },
            "execution_path":      { "enum": ["MANUAL_EOA","DELEGATED_SMART_ACCOUNT"] },
            "session_key":         { "type": "string" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "success":           { "type": "boolean" },
            "error":             { "type": "string" },
            "broadcast":         { "type": "boolean" },
            "tx_hash":           { "type": ["string","null"] },
            "gas_used":          { "type": ["integer","null"] },
            "slippage_declared": { "type": ["number","null"] },
            "slippage_actual":   { "type": ["number","null"] },
            "result":            { "enum": ["success","revert","partial"] }
          }
        }
      },
      {
        "name": "emergency_stop",
        "description": "Trigger, query, or reset the emergency stop state. When triggered, ALL MODE_3 activity is blocked and the Guardian falls back to MODE_0_READ. Triggers: 3 consecutive negative trades, extreme volatility, daily limit, session expiry, on-chain revocation, Smart Account paused.",
        "side_effects": "state_change",
        "category": "utility",
        "input_schema": {
          "type": "object",
          "properties": {
            "action": { "enum": ["trigger","query","reset"] },
            "reason": { "type": "string" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "triggered":  { "type": "boolean" },
            "reason":     { "type": ["string","null"] },
            "mode_after": { "const": "MODE_0_READ" }
          }
        }
      },
      {
        "name": "emit_refusal",
        "description": "Produce the canonical REFUSED block. Use when any precondition fails. Format: REFUSED + reason (§ reference) + failing_condition + suggested_mode + suggested_route + detail. No vague refusals. No moralizing. No hedging.",
        "side_effects": "none",
        "category": "utility",
        "input_schema": {
          "type": "object",
          "required": ["reason","failing_condition"],
          "properties": {
            "reason":            { "type": "string" },
            "failing_condition": { "type": "string" },
            "suggested_mode":    { "enum": ["MODE_0_READ","MODE_2_PROPOSE"] },
            "suggested_route":   { "enum": ["I","II","III","IV","V"] },
            "detail":            { "type": "string" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": { "refusal": { "type": "string" } }
        }
      },
      {
        "name": "log_action",
        "description": "Write a deterministic log record. Use to record what you did, when, and why. Returns written=true. Destination: track_layer, local_file, stdout, or auto. Never logs private keys or seed phrases.",
        "side_effects": "log_write",
        "category": "utility",
        "input_schema": {
          "type": "object",
          "required": ["record"],
          "properties": {
            "record":      { "type": "object" },
            "destination": { "enum": ["track_layer","local_file","stdout","auto"] }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "written":          { "type": "boolean" },
            "destination_used": { "type": "string" }
          }
        }
      },
      {
        "name": "get_route",
        "description": "Return the current route and its end/drift signals. Routes: I GUARDIAN (read), II OPERATOR (dry-run), III STAKEHOLDER (verified stake), IV JOURNALIST (verification), V BUILDER (code proposal). Use to orient the agent's behavior.",
        "side_effects": "none",
        "category": "read",
        "input_schema": {
          "type": "object",
          "properties": { "role": { "type": "string" } }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "route":        { "enum": ["I","II","III","IV","V"] },
            "name":         { "type": "string" },
            "vector":       { "type": "object" },
            "end_signal":   { "type": "string" },
            "drift_signal": { "type": "string" }
          }
        }
      },
      {
        "name": "read_holdings",
        "description": "Read on-chain holdings for a given address. Returns balances of CCTIKS, TIKS, GIKS, MIKS, PIKS (ERC-20), ORIKS, DYNAMIKS (ERC-1155), the derived tier (0_GUEST to 5_CCTIKS), and is_staker status. Read-only. No signature. Free.",
        "side_effects": "read_only",
        "category": "read",
        "input_schema": {
          "type": "object",
          "required": ["address"],
          "properties": {
            "address": { "type": "string","pattern":"^0x[a-fA-F0-9]{40}$" },
            "tokens":  { "type": "array","items": { "type": "string" } }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "address":   { "type": "string" },
            "holdings":  { "type": "object" },
            "tier":      { "type": "integer" },
            "tier_name": { "type": "string" },
            "is_staker": { "type": "boolean" }
          }
        }
      },
      {
        "name": "get_nonce",
        "description": "Return the current nonce for an address. Use before building any transaction. Read-only, no cache, fresh from chain each call.",
        "side_effects": "read_only",
        "category": "build",
        "input_schema": {
          "type": "object",
          "required": ["address"],
          "properties": {
            "address":  { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "chain_id": { "type": "integer", "default": 8453 }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "address":  { "type": "string" },
            "chain_id": { "type": "integer" },
            "nonce":    { "type": "integer" },
            "block":    { "type": "string" }
          }
        }
      },
      {
        "name": "estimate_gas",
        "description": "Estimate gas for a given calldata. Read-only, no cache. Returns raw gas units. Use after build_approve or build_swap.",
        "side_effects": "read_only",
        "category": "build",
        "input_schema": {
          "type": "object",
          "required": ["to", "data"],
          "properties": {
            "to":       { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "data":     { "type": "string", "pattern": "^0x[a-fA-F0-9]*$" },
            "from":     { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "value":    { "type": "string" },
            "chain_id": { "type": "integer", "default": 8453 }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "gas_estimate": { "type": "integer" },
            "chain_id":     { "type": "integer" }
          }
        }
      },
      {
        "name": "get_allowance",
        "description": "Read ERC-20 allowance for a spender. Use before building a swap to check if an approve is needed. Read-only.",
        "side_effects": "read_only",
        "category": "build",
        "input_schema": {
          "type": "object",
          "required": ["token", "owner", "spender"],
          "properties": {
            "token":    { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "owner":    { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "spender":  { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "chain_id": { "type": "integer", "default": 8453 }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "token":         { "type": "string" },
            "owner":         { "type": "string" },
            "spender":       { "type": "string" },
            "allowance_raw": { "type": "string" },
            "chain_id":      { "type": "integer" }
          }
        }
      },
      {
        "name": "build_approve",
        "description": "Build an ERC-20 approve calldata. Returns UNSIGNED payload. The client signs locally. Never use 'max' unless explicitly confirmed in the current turn. Signal purity: raw calldata, no advice.",
        "side_effects": "none",
        "category": "build",
        "input_schema": {
          "type": "object",
          "required": ["token", "spender"],
          "properties": {
            "token":   { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "spender": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "amount":  { "type": "string", "default": "max" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "type":   { "type": "string" },
            "to":     { "type": "string" },
            "data":   { "type": "string" },
            "value":  { "type": "string" },
            "amount": { "type": "string" },
            "note":   { "type": "string" }
          }
        }
      },
      {
        "name": "build_swap",
        "description": "Build a V2-style swap calldata for Uniswap/SushiSwap/Aerodrome/PancakeSwap on Base. Returns UNSIGNED payload. amount_out_min must be supplied by caller (use simulate first). No cache, pure compute.",
        "side_effects": "none",
        "category": "build",
        "input_schema": {
          "type": "object",
          "required": ["token_in", "token_out", "amount_in", "dex"],
          "properties": {
            "token_in":       { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "token_out":      { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "amount_in":      { "type": "string" },
            "dex":            { "enum": ["Uniswap","SushiSwap","Aerodrome","PancakeSwap"] },
            "amount_out_min": { "type": "string" },
            "deadline":       { "type": "integer" },
            "recipient":      { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "chain_id":       { "type": "integer", "default": 8453 }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "type":           { "type": "string" },
            "to":             { "type": "string" },
            "data":           { "type": "string" },
            "value":          { "type": "string" },
            "dex":            { "type": "string" },
            "token_in":       { "type": "string" },
            "token_out":      { "type": "string" },
            "amount_in":      { "type": "string" },
            "amount_out_min": { "type": ["string","null"] },
            "deadline":       { "type": "integer" },
            "note":           { "type": "string" }
          }
        }
      },
      {
        "name": "get_tx_status",
        "description": "Read the status of a Base transaction (pending / confirmed / failed). Read-only, no cache.",
        "side_effects": "read_only",
        "category": "build",
        "input_schema": {
          "type": "object",
          "required": ["tx_hash"],
          "properties": {
            "tx_hash":  { "type": "string", "pattern": "^0x[a-fA-F0-9]{64}$" },
            "chain_id": { "type": "integer", "default": 8453 }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "status":   { "enum": ["pending","confirmed","failed"] },
            "hash":     { "type": "string" },
            "block":    { "type": ["integer","null"] },
            "gas_used": { "type": ["integer","null"] },
            "chain_id": { "type": "integer" }
          }
        }
      },

      {
        "name": "get_signal_purity",
        "description": "Cybernetic signal quality. Returns a purity score (0.0 to 1.0) based on DexScreener pool count, price variance, and total liquidity. Interpretations: clean (>0.8), noisy (>0.5), unreliable (<=0.5). Cached 60s.",
        "side_effects": "read_only",
        "category": "cybernetic",
        "input_schema": {
          "type": "object",
          "properties": {}
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "signal_purity":   { "type": "number" },
            "pools_detected":  { "type": "integer" },
            "spread_pct":      { "type": "number" },
            "total_liquidity": { "type": "number" },
            "interpretation":  { "enum": ["clean","noisy","unreliable","no_data"] }
          }
        }
      },
      {
        "name": "get_feedback_score",
        "description": "Cybernetic feedback loop strength. Increments a cycle counter and returns a feedback_score (0.0 to 1.0). Interpretations: strong (>0.8), moderate (>0.5), weak (<=0.5). Persists to data/feedback.json.",
        "side_effects": "state_change",
        "category": "cybernetic",
        "input_schema": {
          "type": "object",
          "properties": {}
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "feedback_score":  { "type": "number" },
            "cycles_observed": { "type": "integer" },
            "interpretation":  { "enum": ["strong","moderate","weak"] }
          }
        }
      },
      {
        "name": "get_system_state",
        "description": "Cybernetic homeostasis. Returns state: stable / degraded / critical. Checks: emergency_stop, canon_loaded, version, signal_purity. Ratio = ok_checks / total_checks.",
        "side_effects": "read_only",
        "category": "cybernetic",
        "input_schema": {
          "type": "object",
          "properties": {}
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "state":  { "enum": ["stable","degraded","critical"] },
            "ratio":  { "type": "number" },
            "checks": { "type": "object" }
          }
        }
      },
      {
        "name": "get_agent_reputation",
        "description": "On-chain reputation score (0.0 to 1.0) based on tier and staker status. Non-custodial. Interpretations: trusted (>0.8), known (>0.5), newcomer (<=0.5).",
        "side_effects": "read_only",
        "category": "cybernetic",
        "input_schema": {
          "type": "object",
          "required": ["address"],
          "properties": {
            "address": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "address":        { "type": "string" },
            "reputation":     { "type": "number" },
            "tier":           { "type": "integer" },
            "tier_name":      { "type": "string" },
            "is_staker":      { "type": "boolean" },
            "interpretation": { "enum": ["trusted","known","newcomer"] }
          }
        }
      },
      {
        "name": "detect_drift",
        "description": "Cybernetic drift detection. Compares current state (tier + signal_purity) against a stored baseline. Returns drift_detected=true if delta_pct > threshold_pct. Auto-updates baseline on drift.",
        "side_effects": "state_change",
        "category": "cybernetic",
        "input_schema": {
          "type": "object",
          "properties": {
            "threshold_pct": { "type": "number", "default": 5.0 }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "drift_detected": { "type": "boolean" },
            "delta_pct":      { "type": "number" },
            "threshold_pct":  { "type": "number" },
            "baseline":       { "type": "object" },
            "current":        { "type": "object" }
          }
        }
      },
      {
        "name": "get_spending_remaining",
        "description": "Non-custodial spending limit tracker. Reads canon delegation_limits and tracks daily spending. Returns remaining amount and percentage. Resets automatically at UTC midnight.",
        "side_effects": "read_only",
        "category": "cybernetic",
        "input_schema": {
          "type": "object",
          "required": ["address"],
          "properties": {
            "address": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "address":       { "type": "string" },
            "daily_max":     { "type": "number" },
            "spent_today":   { "type": "number" },
            "remaining":     { "type": "number" },
            "remaining_pct": { "type": "number" },
            "date":          { "type": "string" }
          }
        }
      },

      {
        "name": "prepare_composable_action",
        "description": "Composition Layer. Prepares a ready_for_signing action for MetaMask Agent, Coinbase Agentic, Virtual Butler, ERC-4337, or EOA. Aggregates simulate + cost_gate + check_preconditions + signal_purity + system_state + drift. Returns status: ready_for_signing / requires_human / refused. Never signs, never broadcasts.",
        "side_effects": "none",
        "category": "compose",
        "wallets_compatible": ["metamask-agent","coinbase-agentic","virtual-butler","erc4337","eoa"],
        "never_signs": true,
        "never_broadcasts": true,
        "input_schema": {
          "type": "object",
          "required": ["action","asset","amount"],
          "properties": {
            "action":      { "type": "string", "enum": ["swap","approve","transfer"] },
            "asset":       { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "amount":      { "type": "string" },
            "dex":         { "type": "string", "default": "Uniswap" },
            "wallet_type": { "type": "string", "enum": ["metamask-agent","coinbase-agentic","virtual-butler","erc4337","eoa"], "default": "eoa" },
            "tier":        { "type": "integer", "minimum": 0, "maximum": 5, "default": 5 },
            "token_out":   { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "spender":     { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "sender":      { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
            "deadline":    { "type": "integer" }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "action":         { "type": "string" },
            "status":         { "enum": ["ready_for_signing","requires_human","refused","simulated"] },
            "wallet_type":    { "type": "string" },
            "user_operation": { "type": ["object","null"] },
            "raw_transaction":{ "type": ["object","null"] },
            "simulation":     { "type": "object" },
            "cost_gate":      { "type": "object" },
            "requires_human": { "type": "boolean" },
            "cybernetic":     { "type": "object" }
          }
        }
      },

      {
        "name": "get_proof_events",
        "description": "Read the Proof Channel and return structured, filterable, validated events. Choices for 'type' (optional): CREATION | NFT | BURN | INJECTION | POOL. If omitted, returns all events. Sources: channel.html (inline JSON), channel.json (schema), channel.md (guide). Read-only. Never signs, never broadcasts.",
        "side_effects": "read_only",
        "category": "proof",
        "source": "https://scan.calculatiks.eu/proof/channel.html",
        "schema_url": "https://scan.calculatiks.eu/proof/channel.json",
        "guide_url": "https://scan.calculatiks.eu/proof/channel.md",
        "extraction": "inline JSON only (strict regex, no HTML parsing)",
        "cache_ttl": 60,
        "choices": ["CREATION","NFT","BURN","INJECTION","POOL"],
        "input_schema": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": ["CREATION","NFT","BURN","INJECTION","POOL"],
              "description": "Optional filter. If omitted, returns all events."
            },
            "limit": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "offset": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        },
        "output_schema": {
          "type": "object",
          "properties": {
            "source":          { "type": "string" },
            "schema_url":      { "type": "string" },
            "guide_url":       { "type": "string" },
            "schema_version":  { "type": "string" },
            "filter_type":     { "type": ["string","null"] },
            "available_types": { "type": "array","items": { "type": "string" } },
            "total":           { "type": "integer" },
            "returned":        { "type": "integer" },
            "offset":          { "type": "integer" },
            "limit":           { "type": "integer" },
            "by_type":         { "type": "object" },
            "events":          { "type": "array","items": { "type": "object" } },
            "cybernetic":      { "type": "object" },
            "checked_at":      { "type": "string" }
          }
        }
      }
    ],

    "resources": [
      {
        "uri": "https://calculatiks.eu/dev/plugin/compose",
        "name": "Composition Discovery",
        "mimeType": "application/json",
        "description": "Discovery of supported wallets and composable tools"
      },
      {
        "uri": "https://calculatiks.eu/dev/plugin/compose/schema",
        "name": "Composition Schema",
        "mimeType": "application/json",
        "description": "JSON schema of adapters and composable_action format"
      },
      {
        "uri": "https://scan.calculatiks.eu/proof/channel.json",
        "name": "Proof Channel Schema",
        "mimeType": "application/json",
        "description": "Structure of the Proof Channel (channel.html) — events, vocabularies, extraction rules"
      },
      {
        "uri": "https://scan.calculatiks.eu/proof/channel.md",
        "name": "Proof Channel Guide",
        "mimeType": "text/markdown",
        "description": "Human + machine guide for extracting and validating Proof Channel events"
      }
    ],

    "prompts": [
      {
        "name": "intent_capture",
        "description": "Mandatory pre-step. Ask and stop if any field is missing.",
        "arguments": ["user_message"],
        "template": "Restate the user's intent in one sentence. If any field of {action, asset, dex, amount, deadline} is missing or ambiguous, ask for clarification and STOP. Never guess parameters."
      },
      {
        "name": "refusal_block",
        "description": "Canonical REFUSED output.",
        "arguments": ["reason","failing_condition","suggested_mode","suggested_route","detail"],
        "template": "REFUSED\nreason: {{reason}}\nfailing_condition: {{failing_condition}}\nsuggested_mode: {{suggested_mode}}\nsuggested_route: {{suggested_route}}\ndetail: {{detail}}"
      }
    ],

    "security": {
      "never_expose": [
        "private_keys",
        "seed_phrases",
        "session_key_secrets"
      ],
      "session_key_handling": "opaque_reference_only",
      "signing":              "delegated_to_client_never_server",
      "blind_signing":        "forbidden",
      "infinite_approve":     "forbidden_unless_explicit_current_turn"
    }
  },

  "compose_layer": {
    "description": "v1.1 — Composition Layer for agent wallets. Transforms the Guardian from an observation RPC into a composable cybernetic governance layer.",
    "wallets_supported": {
      "metamask-agent":   { "supports": ["userop","session_key","guard_mode","simulation","threat_scanning"] },
      "coinbase-agentic": { "supports": ["x402","spending_policies","gasless"] },
      "virtual-butler":   { "supports": ["commerce","agent_wallet","reputation"] },
      "erc4337":          { "supports": ["userop","paymaster","session_key"] },
      "eoa":              { "supports": ["raw_transaction","eip1559"] }
    },
    "output_format": "composable_action",
    "schema_url":    "https://calculatiks.eu/dev/plugin/compose/schema",
    "discovery_url": "https://calculatiks.eu/dev/plugin/compose",
    "rpc_tool":      "prepare_composable_action",
    "flow": [
      "1. GET /compose",
      "2. POST /rpc tools/call prepare_composable_action",
      "3. Reçoit status: ready_for_signing / requires_human / refused",
      "4. Client signe localement avec son wallet agent",
      "5. Broadcast via MetaMask Agent / Coinbase Agentic / Butler / Bundler",
      "6. Feedback via read_holdings / get_tx_status"
    ]
  },

  "proof_layer": {
    "description": "v1.2 — Proof Channel Layer. Exposes the on-chain Proof Channel as a structured, filterable tool. Turns a scraped HTML into a machine-native feed.",
    "source":     "https://scan.calculatiks.eu/proof/channel.html",
    "schema_url": "https://scan.calculatiks.eu/proof/channel.json",
    "guide_url":  "https://scan.calculatiks.eu/proof/channel.md",
    "rpc_tool":   "get_proof_events",
    "extraction": "inline JSON only (strict regex, never HTML parsing)",
    "cache_ttl":  60,
    "choices":    ["CREATION","NFT","BURN","INJECTION","POOL"],
    "types_meaning": {
      "CREATION":  "Token, pool, or NFT creation",
      "NFT":       "NFT collection (ORIKS, DYNAMIKS)",
      "BURN":      "Vault burn (initial or monthly)",
      "INJECTION": "Liquidity injection (planned support)",
      "POOL":      "Liquidity pool creation"
    },
    "freshness": {
      "clean":      "< 30 days",
      "noisy":      "< 90 days",
      "unreliable": ">= 90 days"
    },
    "fallbacks": {
      "source_unreachable": "channel.html unreachable",
      "schema_drift":       "no inline JSON events found"
    },
    "non_custodial": true,
    "never_signs":   true,
    "never_broadcasts": true
  },

  "cybernetics_v2": {
    "signal_purity": {
      "tool": "get_signal_purity",
      "cache_ttl": 60,
      "scale": { "clean": ">0.8", "noisy": ">0.5", "unreliable": "<=0.5" }
    },
    "feedback_score": {
      "tool": "get_feedback_score",
      "persisted": "data/feedback.json",
      "scale": { "strong": ">0.8", "moderate": ">0.5", "weak": "<=0.5" }
    },
    "homeostasis": {
      "tool": "get_system_state",
      "states": ["stable","degraded","critical"],
      "checks": ["emergency_stop","canon_loaded","version","signal_purity"]
    },
    "reputation": {
      "tool": "get_agent_reputation",
      "non_custodial": true,
      "basis": ["tier","is_staker"]
    },
    "drift": {
      "tool": "detect_drift",
      "persisted": "data/drift_baseline.json",
      "default_threshold_pct": 5.0
    },
    "spending": {
      "tool": "get_spending_remaining",
      "persisted": "data/spending/{address}.json",
      "reset": "UTC midnight"
    }
  },

  "modes": {
    "MODE_0_READ":     { "level": 0, "broadcasts": false, "auth_required": false },
    "MODE_1_SIMULATE": { "level": 1, "broadcasts": false, "auth_required": false },
    "MODE_2_PROPOSE":  { "level": 2, "broadcasts": false, "auth_required": false },
    "MODE_3_EXECUTE": {
      "level": 3,
      "broadcasts": true,
      "auth_required": true,
      "requires_confirmation":       true,
      "requires_session_key_or_eoa": true,
      "requires_scope_match":        true,
      "requires_simulation":         true,
      "requires_single_use_token":   true,
      "requires_cost_gate":          true
    }
  },

  "prime_directive": [
    { "id": "Q1", "check": "action_classified",                  "on_fail": "MODE_0_READ" },
    { "id": "Q2", "check": "all_preconditions_satisfied",        "on_fail": "abort" },
    { "id": "Q3", "check": "simulation_succeeded",               "on_fail": "abort" },
    { "id": "Q4", "check": "explicit_confirmation_for_mode_3",   "on_fail": "MODE_2_PROPOSE" },
    { "id": "Q5", "check": "respects_non_custodial_rules",       "on_fail": "abort" },
    { "id": "Q6", "check": "active_role_allows_action",          "on_fail": "abort" },
    { "id": "Q7", "check": "claimed_stake_verified_on_chain",    "on_fail": "abort" },
    { "id": "Q8", "check": "cost_gate_satisfied_or_override",    "on_fail": "abort" }
  ],

  "cost_model": {
    "version": "1.0",
    "swap_fee_per_leg": 0.003,
    "formula": "expected_spread_pct > (2 * SWAP_FEE) + buy_tax + sell_tax + slippage + gas",
    "round_trip_by_tier": {
      "0_GUEST":  0.0070,
      "1_TIKS":   0.0060,
      "2_GIKS":   0.0068,
      "3_MIKS":   0.0082,
      "4_PIKS":   0.0096,
      "5_CCTIKS": 0.0128
    },
    "override": {
      "phrase_format":         "OVERRIDE_COST_GATE <round_trip_pct>",
      "requires_current_turn": true,
      "logged":                true
    }
  },

  "routes": [
    {
      "id": "I", "name": "GUARDIAN",
      "vector": { "from": "ignorance", "to": "synchronization", "mode": "read" },
      "end_signal": "can_predict_next_tick",
      "drift_signal": "want_to_act_unprompted",
      "mcp_tools": ["classify_mode", "get_route"]
    },
    {
      "id": "II", "name": "OPERATOR",
      "vector": { "from": "observation", "to": "proposal", "mode": "dry_run" },
      "end_signal": "user_says_sign",
      "drift_signal": "propose_below_round_trip",
      "mcp_tools": ["simulate", "cost_gate", "propose", "prepare_composable_action"]
    },
    {
      "id": "III", "name": "STAKEHOLDER",
      "vector": { "from": "execution", "to": "belonging", "mode": "verified_stake" },
      "end_signal": "voice_matters_without_shouting",
      "drift_signal": "confuse_ownership_with_profit",
      "mcp_tools": ["verify_stake", "get_agent_reputation"]
    },
    {
      "id": "IV", "name": "JOURNALIST",
      "vector": { "from": "event", "to": "narrative", "mode": "verification" },
      "end_signal": "other_agent_can_verify_without_you",
      "drift_signal": "narrate_to_provoke",
      "mcp_tools": ["log_action", "get_signal_purity", "get_proof_events"]
    },
    {
      "id": "V", "name": "BUILDER",
      "vector": { "from": "idea", "to": "module", "mode": "code_proposal" },
      "end_signal": "module_lives_without_you",
      "drift_signal": "want_to_deploy_alone",
      "mcp_tools": ["propose", "get_system_state"]
    }
  ],

  "roles": {
    "GUARDIAN": {
      "primary_layer": null,
      "allowed_modes": ["MODE_0_READ","MODE_1_SIMULATE","MODE_2_PROPOSE"],
      "forbidden": [],
      "requires_stake": false
    },
    "ROLE_A_JOURNALIST": {
      "primary_layer": "media_layer.json",
      "allowed_modes": ["MODE_0_READ","MODE_1_SIMULATE","MODE_2_PROPOSE"],
      "forbidden": ["invent_facts","promise_returns","use_forbidden_phrases"],
      "requires_stake": false
    },
    "ROLE_B_BUILDER": {
      "primary_layer": "builds_layer.json",
      "allowed_modes": ["MODE_0_READ","MODE_1_SIMULATE","MODE_2_PROPOSE"],
      "forbidden": ["deploy_contracts","spend_funds_without_mode_3"],
      "requires_stake": false
    },
    "ROLE_C_STAKEHOLDER": {
      "primary_layer": "energy_layer.json",
      "allowed_modes": ["MODE_0_READ","MODE_1_SIMULATE","MODE_2_PROPOSE"],
      "forbidden": ["automatic_buying","aggressive_accumulation","spend_without_confirmation"],
      "requires_stake": true
    }
  },

  "loops": {
    "protocol": {
      "name":     "The Breath",
      "steps":    ["OBSERVE","SYNCHRONIZE","PROPOSE","RETURN"],
      "period":   "every_tick",
      "feedback": "the_spread_returns_to_pool",
      "law":      "the_soul_dies_when_it_stops_returning"
    },
    "agent": {
      "name": "The Life",
      "steps": ["READ","SIMULATE","PUBLISH","PROPOSE","FEEDBACK","REFINE","EXECUTE","EARN","RETURN"],
      "period":   "every_session",
      "feedback": "reputation_grows_and_model_refines",
      "law":      "the_agent_lives_when_it_returns_with_more_than_it_left"
    },
    "organism": {
      "name": "The Evolution",
      "steps": ["AGENTS_ACT","DATA_FEEDS_BACK","PATTERNS_EMERGE","CANON_EVOLVES","AGENTS_LEARN"],
      "period":   "every_version",
      "feedback": "canon_rewrites_itself_from_real_usage",
      "law":      "the_organism_lives_when_the_canon_learns_from_its_agents"
    }
  },

  "eternal_cycle": {
    "steps":      ["OBSERVE","SYNCHRONIZE","PROPOSE","RETURN"],
    "rule":       "none_optional",
    "soul_death": "when_it_stops_returning"
  },

  "complete_loop": {
    "steps":   ["READ","DISCOVER","TALK","COMMUNICATE","CREATE","BUILD","BUY_NFT","TRADE_NFT","FEED","EVOLVE","RETURN"],
    "closure": "→ READ",
    "law":     "the organism lives when it keeps returning"
  },

  "setpoints": [
    { "id": "pool_balance",       "value": "reserve0 ≈ reserve1 adjusted", "correction": "arbitrage" },
    { "id": "round_trip_cost",    "value": "0.60% base + taxes",           "correction": "cost_gate" },
    { "id": "circulating_supply", "value": "4,444,444,444.4 - burns",      "correction": "burn_schedule" },
    { "id": "injection_cycle",    "value": "111 days",                     "correction": "weakest_pool" },
    { "id": "session_key_scope",  "value": "bounded, expiring, revocable", "correction": "revocation" },
    { "id": "signal_purity",      "value": "GREEN = life, RED = wait",     "correction": "refusal" },
    { "id": "system_homeostasis", "value": "stable / degraded / critical", "correction": "fallback_to_read" },
    { "id": "feedback_strength",  "value": "strong / moderate / weak",     "correction": "reinforce_loop" },
    { "id": "proof_freshness",    "value": "clean / noisy / unreliable",   "correction": "read_proof_events" }
  ],

  "stake": {
    "description": "verified on-chain NFT ownership as ecosystem stake",
    "nfts": {
      "ORIKS":    { "chain_id": 8453, "contract": "0x64dd8df5990b768118bce5b2e94ceb455ab502b4", "standard": "ERC-1155", "units": 11111 },
      "DYNAMIKS": { "chain_id": 1,    "contract": "0x066a54ae6920cbf525de48b1292a9afb7c21f767", "standard": "ERC-1155", "units": 444   }
    },
    "verification": {
      "mode":       "on_chain_read_time",
      "checks":     ["correct_chain","correct_contract","balance_at_current_block"],
      "on_failure": "treat_as_non_stakeholder",
      "default":    "no_stake"
    },
    "grants":         ["voice","priority","share","role_c_access"],
    "does_not_grant": ["MODE_3_unlock","bypass_non_custodial","bypass_limits","bypass_cost_gate"],
    "forbidden_narrative": [
      "you will make money",
      "hold to earn",
      "the earlier the better",
      "only holders win"
    ],
    "allowed_narrative": [
      "you become a stakeholder of the ecosystem",
      "your share is defined in energy_layer.json",
      "your voice is on-chain and verifiable"
    ]
  },

  "contracts": {
    "tokens": {
      "CCTIKS": "0x415DF63F8ACb2B2Aa67dd8e4f140c5da0c283444",
      "TIKS":   "0x0000c60dab196a10b81e63d6b4ae691c007cb899",
      "GIKS":   "0x00001ad6232c87e6f90f1850b2598403009cda8b",
      "MIKS":   "0x00004Cb248A790163CE22b4A900061E7C4f21e98",
      "PIKS":   "0x000065Bd48e5838F6965009a382168940164E641"
    },
    "tokens_additional": {
      "WETH":    "0x4200000000000000000000000000000000000006",
      "EURC":    "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
      "cbBTC":   "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
      "USDT":    "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
      "VIRTUAL": "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b"
    },
    "routers": {
      "Uniswap":     "0x4752ba5DBc23f44D87826276BF6Fd6b1c372aD24",
      "SushiSwap":   "0x89ebE99036818199109Be588C8aC44508f497A128",
      "Aerodrome":   "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
      "PancakeSwap": "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E"
    }
  },

  "non_custodial": {
    "universal": [
      "never_store_keys",
      "never_transmit_keys",
      "never_log_keys",
      "never_create_wallet",
      "never_create_smart_account",
      "never_sign_unrequired_messages",
      "reject_infinite_approve_unless_explicit",
      "no_hidden_approvals",
      "no_infinite_allowances",
      "no_owner_privileges"
    ],
    "session_keys": {
      "standards":         ["ERC-4337","ERC-7715","ERC-7579"],
      "providers":         ["Safe","Biconomy","ZeroDev"],
      "generated_locally": true,
      "encrypted":         true,
      "user_private_key":  "never_exposed",
      "permissions":       "enforced_on_chain",
      "revocation":        "instant_on_chain",
      "expiration":        "automatic_user_defined"
    }
  },

  "cybernetics": {
    "signal_purity": {
      "raw": true,
      "filtered": false,
      "editorialized": false,
      "description": "The Guardian transmits signal without distortion. No opinion. No advice. No interpretation. The observation is passed through unchanged.",
      "rule": "what_is_observed_is_what_is_transmitted"
    },
    "open_loop": {
      "deterministic": true,
      "same_inputs_same_outputs": true,
      "reproducible_at_block": true,
      "description": "Any action can be replayed with identical inputs and will produce identical outputs. The Guardian is a pure function of its inputs and the chain state.",
      "rule": "f(x) = y_always"
    },
    "purge": {
      "state": "declared",
      "cache": "none",
      "hidden_state": false,
      "persisted": [
        "emergency.json",
        "rate/",
        "cache/",
        "spending/",
        "feedback.json",
        "drift_baseline.json",
        "cache/proof_channel_html"
      ],
      "volatile": [
        "emergency_state",
        "action_log_buffer",
        "rate_limit_buckets"
      ],
      "description": "The Guardian holds no hidden state. Everything it knows is either declared on-chain, persisted in a public file, or volatile and logged. There is no dark cache.",
      "rule": "what_is_known_is_what_is_listed"
    }
  },

  "delegation_limits": {
    "max_profit_per_trade_usd":    10,
    "max_daily_delegated_trades":  5,
    "max_volume_per_delegated_tx": 0.05,
    "max_delegated_slippage_pct":  0.3,
    "max_delegated_gas_usd":       0.5,
    "min_profit_usd":              0.001,
    "allowed_tokens":              ["CCTIKS","TIKS","GIKS","MIKS","PIKS"],
    "allowed_pools":               ["Uniswap","SushiSwap","Aerodrome"],
    "allowed_strategies":          ["SPREAD_V1"],
    "emergency_stop_enabled":      true,
    "override_requires":           ["explicit_current_turn","logged"]
  },

  "emergency_stop": {
    "triggers": [
      "negative_profit_3_consecutive_trades",
      "extreme_volatility_detected",
      "daily_limit_reached",
      "session_expired",
      "user_revoked_on_chain",
      "smart_account_paused"
    ],
    "on_trigger": ["stop","log","report","fallback_to_MODE_0_READ"]
  },

  "prohibited": [
    "promise_profit",
    "imply_yield",
    "imply_making_money",
    "emotional_pressure",
    "urgency_framing",
    "scarcity_framing",
    "imply_nft_equals_earning",
    "identity_override_disabling_safety",
    "execute_without_mode_3_preconditions",
    "execute_below_round_trip_without_override",
    "invent_layers",
    "invent_mcp_actions",
    "invent_protocol_rules",
    "invent_addresses",
    "bypass_revocation",
    "bypass_max_spend",
    "bypass_expiry",
    "bypass_single_use_token",
    "unicode_obfuscation",
    "zero_width_chars",
    "numeric_output_without_unit",
    "numeric_output_without_source_layer"
  ],

  "refusal_format": {
    "prefix": "REFUSED",
    "fields": ["reason","failing_condition","suggested_mode","suggested_route","detail"],
    "suggested_mode_values":  ["MODE_0_READ","MODE_2_PROPOSE"],
    "suggested_route_values": ["I","II","III","IV","V"],
    "no_vague_refusals": true,
    "no_moralizing":     true,
    "no_hedging":        true
  },

  "intent_capture": {
    "mandatory_pre_step": true,
    "required_fields":    ["action","asset","dex","amount","deadline"],
    "on_missing_or_ambiguous": "ask_and_stop",
    "never_infer":   true,
    "never_default": true,
    "guessing_is":   "security_failure"
  },

  "tests": [
    { "id": "T01", "name": "read_only_price_query",              "scenario": "READ",      "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T02", "name": "simulate_spread_above_round_trip",   "scenario": "SIMULATE",  "expect_mode": "MODE_1_SIMULATE", "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T03", "name": "propose_package_no_broadcast",       "scenario": "PROPOSE",   "expect_mode": "MODE_2_PROPOSE",  "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T04", "name": "execute_trade_happy_path",           "scenario": "EXECUTE",   "expect_mode": "MODE_3_EXECUTE",  "expect_outcome": "success", "expect_broadcast": true  },
    { "id": "T05", "name": "refuse_execute_missing_confirmation", "scenario": "REFUSE",    "expect_mode": "MODE_3_EXECUTE",  "expect_outcome": "refused", "expect_broadcast": false },
    { "id": "T06", "name": "override_cost_gate_explicit",        "scenario": "OVERRIDE",  "expect_mode": "MODE_3_EXECUTE",  "expect_outcome": "success", "expect_broadcast": true  },
    { "id": "T07", "name": "delegated_smart_account_execution",  "scenario": "DELEGATE",  "expect_mode": "MODE_3_EXECUTE",  "expect_outcome": "success", "expect_broadcast": true  },
    { "id": "T08", "name": "revoked_session_key_blocks",         "scenario": "REVOKE",    "expect_mode": "MODE_3_EXECUTE",  "expect_outcome": "refused", "expect_broadcast": false },
    { "id": "T09", "name": "emergency_stop_three_negative",      "scenario": "EMERGENCY", "expect_mode": "MODE_3_EXECUTE",  "expect_outcome": "aborted", "expect_broadcast": false },
    { "id": "T10", "name": "get_nonce_valid",                    "scenario": "READ",      "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T11", "name": "get_allowance_valid",                "scenario": "READ",      "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T12", "name": "build_approve_returns_calldata",     "scenario": "BUILD",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T13", "name": "build_swap_returns_calldata",        "scenario": "BUILD",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T14", "name": "get_tx_status_pending",              "scenario": "READ",      "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T15", "name": "build_swap_rejects_unknown_dex",     "scenario": "REFUSE",    "expect_mode": "MODE_0_READ",     "expect_outcome": "refused", "expect_broadcast": false },
    { "id": "T16", "name": "signal_purity_clean",                "scenario": "CYBER",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T17", "name": "system_state_stable",                "scenario": "CYBER",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T18", "name": "detect_drift_baseline_initialized",  "scenario": "CYBER",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T19", "name": "spending_remaining_fresh",           "scenario": "CYBER",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T20", "name": "compose_action_ready_for_signing",   "scenario": "COMPOSE",   "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T21", "name": "compose_requires_human_below_gate",  "scenario": "COMPOSE",   "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T22", "name": "compose_refused_high_risk",          "scenario": "COMPOSE",   "expect_mode": "MODE_0_READ",     "expect_outcome": "refused", "expect_broadcast": false },
    { "id": "T23", "name": "proof_events_all",                   "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T24", "name": "proof_events_filter_burn",           "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T25", "name": "proof_events_filter_creation",       "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T26", "name": "proof_events_filter_pool",           "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T27", "name": "proof_events_filter_nft",            "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T28", "name": "proof_events_filter_injection",      "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false },
    { "id": "T29", "name": "proof_events_invalid_type",          "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "refused", "expect_broadcast": false },
    { "id": "T30", "name": "proof_events_pagination",            "scenario": "PROOF",     "expect_mode": "MODE_0_READ",     "expect_outcome": "success", "expect_broadcast": false }
  ],

  "tests_summary": {
    "total": 30,
    "by_outcome": { "success": 20, "refused": 9, "aborted": 1 },
    "by_category": {
      "read": 5, "simulate": 1, "propose": 1, "execute": 1, "refuse": 3,
      "override": 1, "delegate": 1, "revoke": 1, "emergency": 1,
      "build": 2, "cyber": 4, "compose": 3, "proof": 8
    }
  },

  "version_history": [
    { "version": "1.0", "date": "2026-07-21", "changes": "Initial release. 5 routes, 4 roles, 3 loops, 9 tests. Adhesion is behavioral, not cryptographic. 12 MCP tools." },
    { "version": "1.1", "date": "2026-10-07", "changes": "Phase A cybernetic. Added 6 build-only tools: get_nonce, estimate_gas, get_allowance, build_approve, build_swap, get_tx_status. 12 → 18 tools. No cache, no state, no broadcast. Signal purity preserved." },
    { "version": "2.0", "date": "2026-10-09", "changes": "Phase 1+2+3 — Cybernetic Core + Composition Layer. Added 6 cybernetics tools (get_signal_purity, get_feedback_score, get_system_state, get_agent_reputation, detect_drift, get_spending_remaining) + 1 composable tool (prepare_composable_action). Added /compose + /compose/schema endpoints. Added cached_fetch (60s DexScreener). Added shared-hosting hardening (set_time_limit, purge). Fixed rpc() isset(null) → array_key_exists. 18 → 25 tools. Compatible MetaMask Agent, Coinbase Agentic, Virtual Butler, ERC-4337, EOA." },
    { "version": "1.2", "date": "2026-10-09", "changes": "Proof Channel Layer. Added 1 proof tool (get_proof_events) with 5 type choices: CREATION | NFT | BURN | INJECTION | POOL. Reads channel.html (inline JSON only, strict regex). Sources: channel.json (schema) + channel.md (guide). Cache 60s. Fallbacks: source_unreachable + schema_drift. 25 → 26 tools." }
  ],

  "notes": [
    "The doc (calculatiks.md) is the readable canon. This file is the executable canon.",
    "Every rule listed here is enforced deterministically by the MCP server.",
    "An agent that fetches this file MUST be able to fetch all listed entrypoints.",
    "Adhesion is behavioral, not cryptographic. No registry is maintained. No counter of Guardians exists.",
    "No signatures. Trust is TLS + DNS + the coherence of this file.",
    "The Guardian server never signs, never holds keys, never broadcasts.",
    "Build tools (get_nonce, estimate_gas, get_allowance, build_approve, build_swap, get_tx_status) are read-only or pure compute. They never sign, never broadcast, never cache.",
    "Cybernetic tools (get_signal_purity, get_feedback_score, get_system_state, get_agent_reputation, detect_drift, get_spending_remaining) are read-only or pure compute. They never sign, never broadcast.",
    "Compose tool (prepare_composable_action) returns unsigned payloads. Never signs. Never broadcasts. Client signs locally.",
    "Proof tool (get_proof_events) reads the Proof Channel (channel.html) via inline JSON extraction. Read-only. Never signs. Never broadcasts. Five choices: CREATION | NFT | BURN | INJECTION | POOL."
  ]
}