Skip to content

feat(schemas): add AgentPassport schema — five-class typed agent classification [T0-1] - #228

Merged
mdheller merged 2 commits into
mainfrom
feat/t0-1-agent-passport-schema
Jul 31, 2026
Merged

feat(schemas): add AgentPassport schema — five-class typed agent classification [T0-1]#228
mdheller merged 2 commits into
mainfrom
feat/t0-1-agent-passport-schema

Conversation

@mdheller

Copy link
Copy Markdown
Contributor

Implements T0-1 — the Tranche 0 anchor. Everything downstream imports urn:srcos:agent-passport:* as a stable reference, so this merges first.

What changed

  • schemas/AgentPassport.json (v1.0.0, draft 2020-12) — five-class typed host-agent classification. Identity (bundle_id/pid/binary_path), agent_class enum (exactly 5), boolean permission flags, spatial authorization arrays, intelligence constraints, capability_exceptions, interrupt_level, attestation.
  • examples/agent-passport.json — collection covering system_core, intelligence_automation, and third_party.
  • tools/validate_agent_passport_examples.py — validates every example element and asserts 5 rejection invariants.
  • Makefilevalidate-agent-passport-examples wired into validate.

Design decisions

  • Cross-field invariants enforced in JSON Schema via allOf/if-then where expressible (intelligence_automation requires its 3 constraint fields; third_party cannot set system_bundle: true; suppress_user_authorization_prompt: true requires is_apple_signed: true). The work order notes these "may not be expressible in JSON Schema" and defers to SHACL — SHACL (T1-4) remains authoritative, but this repo treats an un-enforced control as no control, so the expressible subset is enforced here too and proven by rejection tests.
  • Required set = bundle_id, agent_class, the 4 permission flags, interrupt_level — matching the field set T5-1's good fixture implies, so downstream good fixtures stay valid.
  • pid documented as session-scoped, not a stable identifier.

Exact commands run

python3 tools/validate_agent_passport_examples.py
make validate-agent-passport-examples
make validate-duplicate-schema-ids
make validate            # full chain

Pass/fail output

  • validate_agent_passport_examples.pyOK: AgentPassport schema valid; 3 example passports validated (classes: intelligence_automation, system_core, third_party); 5 rejection invariants enforced (R1-R5)
  • make validate-duplicate-schema-idsOK: 323 unique schema $id values
  • make validateOK: validate (full chain, exit 0)

Rejection invariants proven (each fed to the schema, each rejected):
R1 third_party+system_bundle:true · R2 unsigned suppression · R3 intelligence_automation missing a constraint field · R4 unknown class (anySource) · R5 missing bundle_id.

Acceptance criteria

  • Schema validates against draft 2020-12
  • agent_class enum contains exactly five values (asserted by the validator)
  • suppress_user_authorization_prompt: true only valid when is_apple_signed: true (enforced + R2)
  • third_party cannot have system_bundle: true (enforced + R1)
  • intelligence_automation requires all three intelligence constraint fields (enforced + R3)
  • capability_exceptions entries require all four fields
  • pid documented as session-scoped
  • Example validates; covers ≥1 third_party and ≥1 system_core
  • make validate passes

Known gaps / deviations (explicit)

  • attested_at/attestation_source kept optional at the top level (not required), so downstream minimal good fixtures (T5-1) stay valid. The Known Gap "attestation timestamp required" is honored via the property descriptions and deferred to SHACL (T1-4) for class-conditional enforcement. Flagging this as a deliberate cross-tranche-consistency choice for review.
  • capability_exceptions.expires is optional and nullable (date-time or null).
  • The example file is a JSON array (collection) so one file can cover multiple classes per the acceptance criteria; the validator validates each element.

Blocked

  • Nothing blocked.

Source: Tranche Work Orders v1.0 (2026-06-09). Closes #227.

…sification (T0-1)

Anchor vocabulary object for the agent-system domain: the canonical typed
classification for agents/services on SourceOS-managed hosts. Five-class model
(system_core, intelligence_automation, app_helper, legacy_bridge, third_party)
governing execution authorization, spatial permissions, and intelligence
constraints. Downstream tranches import urn:srcos:agent-passport:* as a stable
reference.

- schemas/AgentPassport.json: schema v1.0.0 (draft 2020-12). Cross-field
  invariants enforced via allOf/if-then where JSON-Schema-expressible
  (intelligence_automation requires its 3 constraint fields; third_party cannot
  set system_bundle:true; suppress requires is_apple_signed); SHACL (T1-4)
  authoritative.
- examples/agent-passport.json: collection covering system_core,
  intelligence_automation, third_party.
- tools/validate_agent_passport_examples.py: validates every example element and
  asserts 5 rejection invariants (R1-R5) — a control observed refusing.
- Makefile: validate-agent-passport-examples wired into validate.

Closes #227
Copilot AI review requested due to automatic review settings July 31, 2026 03:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new normative AgentPassport JSON Schema (Tranche 0 anchor vocabulary) plus fixture examples and a repo-native validator, and wires the validator into make validate to keep downstream references to urn:srcos:agent-passport:* stable and checked.

Changes:

  • Introduces schemas/AgentPassport.json (draft 2020-12) defining the five-class agent classification model and several cross-field invariants.
  • Adds examples/agent-passport.json as a multi-instance fixture (array) covering multiple agent classes.
  • Adds tools/validate_agent_passport_examples.py and wires it into Makefile validation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
schemas/AgentPassport.json New canonical schema for five-class agent classification plus cross-field constraints.
examples/agent-passport.json Example passports (array) covering system_core, intelligence_automation, and third_party.
tools/validate_agent_passport_examples.py Validator enforcing schema validity, example validity, and rejection invariants.
Makefile Adds validate-agent-passport-examples target and includes it in validate.

from pathlib import Path
from typing import Any

from jsonschema import Draft202012Validator
Comment on lines +57 to +65
def main() -> int:
schema = load(SCHEMA_PATH)
Draft202012Validator.check_schema(schema)
validator = Draft202012Validator(schema)

# agent_class enum must contain exactly the five canonical values.
enum = set(schema["properties"]["agent_class"]["enum"])
if enum != EXPECTED_CLASSES:
fail(f"agent_class enum must be exactly the five classes, got {sorted(enum)}")
Comment on lines +23 to +26
"pid": {
"type": "integer",
"description": "SESSION-SCOPED process id. NOT a stable identifier: it is reused across processes and reboots and must never be used for cross-session correlation or authorization."
},
Comment thread schemas/AgentPassport.json Outdated
"legacy_bridge",
"third_party"
],
"description": "Typed classification. system_core = _SYSTEM_CENTER_ daemons, highest privilege. intelligence_automation = proactive/prediction agents, constrained output. app_helper = application background daemons, standard user auth. legacy_bridge = legacy/modern connection bridge services. third_party = unsigned external applications."
Comment on lines +135 to +154
{
"$comment": "third_party must not claim system_bundle: true (class elevation).",
"if": {
"properties": { "agent_class": { "const": "third_party" } },
"required": ["agent_class"]
},
"then": {
"properties": { "system_bundle": { "const": false } }
}
},
{
"$comment": "suppress_user_authorization_prompt: true is only valid when is_apple_signed: true.",
"if": {
"properties": { "suppress_user_authorization_prompt": { "const": true } },
"required": ["suppress_user_authorization_prompt"]
},
"then": {
"properties": { "is_apple_signed": { "const": true } }
}
}
- CI 'Validate examples against schemas' crashed on the array-shaped example
  (example.get('type') on a list). Split into one object per file, each with a
  top-level type: AgentPassport discriminator, per the repo convention. Add the
  optional 'type' const property to the schema.
- Copilot: pid minimum 0; clarify system_core description (drop _SYSTEM_CENTER_
  placeholder); enforce SEAM-002 (third_party/app_helper/legacy_bridge cannot
  suppress the auth prompt even when apple-signed) and SEAM-008 (attested_at
  required when authorized_display_uuids asserted) via if/then; defensive
  jsonschema import + enum access in the validator.
- Validator now globs the example files and adds rejection invariant R6.
@mdheller

Copy link
Copy Markdown
Contributor Author

Copilot review — all five evaluated and addressed (commit b549ca9):

  1. jsonschema import crashes standalone — wrapped in try/except with a clear FAIL message.
  2. Unguarded schema[...][...]['enum'] access — now defensive (.get chain → clear FAIL, not a traceback).
  3. pid allows negatives — added minimum: 0.
  4. _SYSTEM_CENTER_ placeholder confusing — reworded the system_core description to name it as the source-ontology term, not a literal enum value.
  5. Documented-but-unenforced constraints — now enforced via if/then: SEAM-002 (third_party/app_helper/legacy_bridge cannot suppress the auth prompt even when apple-signed) and SEAM-008 (attested_at required when authorized_display_uuids is asserted). Added rejection invariant R6.

Also fixed the CI failure (unrelated to Copilot): the Validate examples against schemas job crashed on the array-shaped example; examples are now one object per file with a type discriminator per repo convention. make validate green; validator enforces R1-R6.

@mdheller
mdheller merged commit d83a1e4 into main Jul 31, 2026
7 checks passed
@mdheller
mdheller deleted the feat/t0-1-agent-passport-schema branch July 31, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(schemas): add AgentPassport schema — five-class typed agent classification [T0-1]

2 participants