Reference

Capability spec reference

The format of a capability spec (v1), and the exact contract evaluate() follows when it checks a tool call against one.

Format

spec.yaml
task: "summarize meeting-notes.txt"   # required, human-readable
deny_all_others: true                 # default true; see "Weak posture"

servers:                              # required, at least one entry
  filesystem:
    tools:
      list_allowed_directories:       # no args block: zero-arg calls only
      read_text_file:
        args:                         # exhaustive: unlisted args are DENIED
          path:
            must_match_one_of:        # exact string match, no globs or regex
              - "/home/user/aegis-sandbox/meeting-notes.txt"

intercepts:                           # optional, operator policy
  - server: filesystem
    tool: write_file

The args block

Spec saysMeaning
tool with no args (or args: ~)Zero-arg tool. Any call that passes arguments is denied (rule 3).
args: {}Tool allowed, with no arguments named. Any argument is denied (rule 6). The audit log tells this apart from the zero-arg case.
arg: ~The argument must be present. Any scalar value is allowed. A list value is denied.
must_match_one_of: [...]The value must equal one entry exactly. For a list, every element must be listed. Can't be an empty list.
allow_any: trueTurns off value checking for this one argument. Can't be combined with must_match_one_of. Recorded as rule-7-bypassed-allow-any.

Evaluation rules

Rules are checked in order. The first DENY wins, and a call is allowed only if every check passes. Rules 1–8 decide ALLOW or DENY. Rule 9, intercepts, is applied to an ALLOW afterwards.

#ConditionVerdictmatched_rule
1Server not in servers:DENYrule-1-server-not-listed
2Tool not in tools: for that serverDENYrule-2-tool-not-listed
3No args block, but the call passed argumentsDENYrule-3-zero-arg-violation
4No args block, call passed no argumentsALLOWnull
5An argument named in the spec is missing from the callDENYrule-5-missing-required-arg
6The call passes an argument the spec doesn't nameDENYrule-6-extra-arg
7A value isn't allowed (see value types)DENYrule-7-*
8All checks passALLOWnull, or the waiver's rule id
9An ALLOW whose (server, tool) is in interceptsINTERCEPTrule-9-intercept-required

Rules 5 and 6 check opposite things: 5 looks for arguments the spec names but the call left out, 6 for arguments the call added. Together they make the set of argument names closed in both directions.

When the spec says nothing

What the spec doesn't mentionVerdict
Server not in servers:DENY
Tool not in tools:DENY
Argument in the call but not in args:DENY
Argument with no must_match_one_of, scalar valueALLOW on any value
Argument with no must_match_one_of, list valueDENY rule-7-unconstrained-collection
Dict, nested list or other non-scalar valueDENY rule-7-unsupported-arg-type
Tool listed with no args: blockALLOW only for zero-arg calls

Argument value types

Rule 7 classifies a value before matching it. The comparison is str(value) against literal strings. That is faithful for a scalar, but for a container it would compare a Python repr that no operator ever wrote. So containers are handled separately:

ValueWith must_match_one_ofUnconstrained
Scalar: str, int, float, bool, NoneExact matchALLOW (any value)
Collection of scalars: list, tuple, set, frozensetEvery element must be listed, in any order. Empty → DENY rule-7-empty-collectionDENY rule-7-unconstrained-collection
Anything else: dict, nested list, bytes, objectsDENY rule-7-unsupported-arg-typeDENY rule-7-unsupported-arg-type
element-wise matching
{"read_multiple_files": {"args": {"paths": {"must_match_one_of": [
    "C:/s/a.txt",
    "C:/s/b.txt",
]}}}}
# ALLOW  ["C:/s/a.txt"]                 - subset
# ALLOW  ["C:/s/b.txt", "C:/s/a.txt"]   - any order
# DENY   ["C:/s/a.txt", "/etc/shadow"]  - rule-7-value-not-allowed
# DENY   []                             - rule-7-empty-collection

The classifier fails closed. A value shape nobody listed can't be allowed just because its __str__ happens to match. The bypass write-up explains why this matters.

Waiving a check with allow_any

Sometimes an operator really does need an unchecked argument. Making them fake a constraint would be worse, so they can say so directly:

spec.yaml
read_multiple_files:
  args:
    paths:
      allow_any: true   # ANY paths, including outside the sandbox

It is off by default and has to be written deliberately. Every call it allows is recorded with matched_rule: "rule-7-bypassed-allow-any", so a search for waivers finds it.

Weak posture

Setting deny_all_others: false lets unlisted servers and tools through, recorded as rule-1-bypassed-weak-posture or rule-2-bypassed-weak-posture. The spec only loads if its task contains the string deny_all_others=false, so weakening the policy has to be acknowledged in writing.

Intercepts: pausing for human approval

intercepts is a top-level list of exact (server, tool) pairs. They're matched exactly, with no wildcards. Intercepts are checked after rules 1–8:

  1. If rules 1–8 DENY, the verdict stays DENY. An intercept never rescues a denied call.
  2. If rules 1–8 ALLOW and the pair matches, the verdict becomes INTERCEPT.
  3. Otherwise it stays ALLOW.

Intercepts are operator policy. propose_spec() never writes them, because which calls need a human is a risk decision that can't be inferred from a task description.

spec.yaml — worked example
task: "clean up stale exports in the reports directory"
deny_all_others: true

servers:
  filesystem:
    tools:
      list_directory:
        args:
          path: ~
      delete_file:
        args:
          path: ~

intercepts:
  - server: filesystem
    tool: delete_file

The agent can list the directory freely. Every delete_file call is in scope but intercepted, so the operator approves or declines each deletion one at a time. See handling intercepts for the runtime behaviour.

Validation at load time

Specs are validated when load_spec() or propose_spec() runs, never at evaluation time, so evaluate() only ever sees a valid spec. A SpecValidationError names the field that failed. Common causes:

  • Missing task or servers.
  • must_match_one_of: []. An empty allow-list can't match anything.
  • allow_any and must_match_one_of set on the same argument.
  • deny_all_others: false without the acknowledgement in task.

spec_hash and the spec_loaded record

When a spec loads, Aegis writes one record before returning it. This ties the run to the exact spec that governed it:

logs/audit.jsonl
{"status": "spec_loaded", "task": "summarize meeting-notes.txt",
 "deny_all_others": true, "spec_hash": "…", "run_id": "…"}

spec_hash is the SHA-256 of the raw YAML bytes, taken before parsing. Every governed call record carries it too, so you can rebuild the active policy even after the file on disk has changed. run_id appears on this record only if you pass run_id=config.run_id to the loader.

What v1 doesn't handle

  • Pattern matching of any kind: no globs, regex or prefix matching. This is a deliberate choice, not a missing feature.
  • Constraints on dict-valued or nested arguments. These are denied unless waived with allow_any.
  • Changing a spec during a run. A spec is frozen for the whole run.

Source of truth: CAPABILITY_SPEC.md on GitHub. If this page and the repository disagree, the repository wins — and please open an issue.