Skip to content

About

This repo is a public, docs-first reference for teams that want agentic coding without chaos. It focuses on the patterns that protect code integrity while still preserving speed: plan, permission, verification, and tool trust.

Resources

Code of conduct

Contributing

Stars

22 stars

Watchers

0 watching

Forks

Repository files navigation

Governed Agent Autonomy Patterns

GAAP is a Rust library and CLI that evaluates normalized plan, permission, tool-trust, verification, runtime, mutation, and completion decisions for an agent run.

The current executable slice provides the integrity coordinator, frozen contracts, and a deterministic Rust runtime that calls explicit adapter ports before protected effects. A separate MCP stdio client executes external tools through that runtime. A stable-v1 ACP client mediates delegated agent filesystem operations through the same runtime. A separate attestation adapter signs and verifies retained evidence. The Goose reference can select a local OCI profile for protected effects and independent verification. Provider-specific integrations, durable recovery and production isolation remain pending.

Current Interfaces And Evidence

Path or interface Current behavior Developer use
RunCoordinator::evaluate(gate, input) Accepts a typed Gate and normalized JSON input, then returns an allow, ask, or block decision with a code and effects. Put one deterministic decision module behind future provider, tool, and runtime adapters.
gaap::runtime Runs one bounded Agent Run through plan, runtime-owned permission/tool-trust/runtime gates, workflow, execution, and verification ports, then seals exactly one Terminal Run Receipt. Test runtime lifecycle behavior without provider SDKs, persistence, or real sandbox/executor integrations.
gaap::contracts Defines and validates provider-neutral Agent Run and Protected Effect 0.1.0 contracts. Parse, canonicalize, validate, seal, and verify immutable contract values without importing provider SDK types.
gaap::sandbox and adapters/sandbox Define a neutral execution profile and record real local OCI runtime, image, output and cleanup observations. Run declared protected effects and verification through a reproducible container boundary.
gaap::contracts::protected_effect Defines typed effect scopes, request binding, result-state invariants, evidence references, and replay/tamper checks. It performs no effect or policy evaluation. Integrate a future executor at one small contract seam while keeping RunCoordinator authoritative.
schemas/agent-run/v0.1.0 Freezes Draft 2020-12 request and receipt schemas with strict fields, versions, enums, digests, and safe integers. Generate or validate cross-language contract documents.
schemas/protected-effect/v0.1.0 Freezes separate Draft 2020-12 Protected Effect Request and Result schemas. Validate cross-language effect proposals and observed outcomes.
examples/contracts/v0.1.0 Provides one request and seven digest-valid terminal outcomes. Inspect completed and failure-path contract behavior.
examples/contracts/protected-effect/v0.1.0 Provides one effect request and eight digest-valid result scenarios. Inspect executed, non-executed, drift, failure, interruption, and unknown-outcome behavior.
gaap run-invariant Reads a RunInvariant request from stdin and writes one response to stdout. Test the Rust coordinator without importing its crate or depending on Rust.
evidence/run-invariant-subject-v0.1.0.json Records the Rust subject's exact 35/35 result and request digest. Reproduce the current external conformance claim.
docs/patterns Defines the five integrity gates and their operating intent. Design the larger agent-run lifecycle and review other systems.
docs/scorecard.md Lists evaluation criteria for governed autonomy. Review a platform, internal harness, or vendor workflow.

The Rust module is the implementation under test. The conformance protocol and fixture corpus live in the separate run-invariant repository. GAAP doesn't import or vendor RunInvariant.

Status

Implemented and tested now:

  • a Rust RunCoordinator with one public evaluation interface;
  • plan approval bound to the exact subject digest;
  • deny precedence and explicit approval for risky or unknown actions;
  • capability approval bound to an exact capability digest;
  • independent, subject-bound, evidence-bearing verification;
  • fail-closed usage accounting and bounded overage approval;
  • separate mutation and completion authorization;
  • a language-neutral RunInvariant process adapter;
  • a 35/35 black-box conformance packet for the frozen protocol;
  • provider-neutral Agent Run Request and Terminal Run Receipt Rust types;
  • RFC 8785 canonical request and receipt-body digests;
  • fail-closed policy, lifecycle, evidence, subject-freshness, and usage validation;
  • provider-neutral Protected Effect Request and Result Rust types with typed filesystem, process, network, and external-service scopes;
  • parent-bound request digests and sealed, replay-resistant result digests;
  • fail-closed decision/status, observed-identity, drift, evidence, and non-execution invariants;
  • a Rust gaap::runtime engine around RunCoordinator with narrow agent, executor, and verifier ports plus explicit port usage accounting;
  • runtime-only support for trusted capabilities, permission policy, overage approvals, verifier identities, and effect usage estimates without changing the frozen 0.1.0 contracts;
  • deterministic protected-effect execution through test executor ports, one-shot ask blocking, duplicate-effect rejection, unknown-outcome separation, interruption evidence, and stale-verification rejection;
  • a separate MCP stdio client with exact capability approval, bounded transport and retained invocation evidence;
  • a separate ACP v1 client with session ownership, delegated filesystem effects, host metering and strict protocol checks;
  • a pinned real Goose conversation through ACP/MCP with per-effect gates and independent verification;
  • offline DSSE/in-toto signing with explicit trust and retained content;
  • a local OCI profile with explicit image, mounts, environment, network and resource limits, plus retained runtime and cleanup evidence;
  • generated Draft 2020-12 JSON Schemas; and
  • Agent Run terminal examples plus completed/executed, denied, awaiting-authority, failed, interrupted, stale-subject, schema-drift, and unknown-outcome Protected Effect examples.

Not implemented yet:

  • OpenAI, Anthropic or other provider-specific integrations;
  • production Protected Effect executor adapters, retry orchestration, reconciliation, or persistence;
  • repository mutation interception;
  • approval persistence, revocation, or delegated authority;
  • production sandbox isolation, provider billing meters or durable evidence ledgers; and
  • crash recovery or resumable run state.

The conformance packet proves normalized decision compatibility for the frozen cases. It doesn't prove those missing runtime properties or certify GAAP for production use.

Build And Test

GAAP pins Rust 1.96.0. Install Rust with rustup, then run:

git clone https://github.com/nnennandukwe/governed-agent-autonomy-patterns.git
cd governed-agent-autonomy-patterns
cargo test --locked
cargo clippy --locked --all-targets -- -D warnings
cargo build --locked
cargo run --locked --example generate-contract-artifacts -- --check

The generated-history guide covers the independent Agent Run model, named regressions, minimized JSON replay, deeper exploration and source mutants. Ordinary CI uses bounded deterministic histories; this sampled exploration complements RunInvariant's public black-box corpus.

Schemas and examples are registered in one typed catalog. To intentionally reconcile all managed artifacts under schemas/ and examples/contracts/, run cargo run --locked --example generate-contract-artifacts, review the diff, then rerun the command with --check.

Inspect the CLI:

cargo run --locked -- --help

Reproduce External Conformance

RunInvariant 0.2.0 starts GAAP as an opaque child process. Clone both repositories into the same parent directory:

git clone https://github.com/nnennandukwe/run-invariant.git
git clone https://github.com/nnennandukwe/governed-agent-autonomy-patterns.git
cd governed-agent-autonomy-patterns
cargo build --locked
cd ../run-invariant
node bin/run-invariant.js subject -- \
  ../governed-agent-autonomy-patterns/target/debug/gaap run-invariant

The expected bounded result is:

Subject: gaap 0.1.0 (rust)
Subject conformance: 35/35 cases

RunInvariant sends case IDs, gate names, and normalized inputs without case titles or expected decisions. GAAP rejects unknown subject schemas, decision protocol digests, and fixture digests. Its response is bound to the exact input bytes with request_sha256.

The committed packet is derived output. CI recomputes it using the pinned RunInvariant commit and fails if the packet changes.

Architecture Direction

The RunCoordinator is the deep module at the integrity seam. The RunInvariant adapter and the bounded runtime call the same interface; neither provider-specific message types nor transport details enter the coordinator.

The runtime owns lifecycle advancement around the coordinator: plan, authorize mutation, execute through explicit adapters, account for resources, obtain independent verification for the current artifact digest, and authorize completion only if no later mutation invalidated that evidence. Future adapter slices can bind that runtime to providers, sandboxes, persistence, and ThreadLoop without changing the frozen 0.1.0 contracts.

Architecture decisions:

The normative contract guide is Agent Run Contract 0.1.0. Contract receipts are content-addressed; the separate attestation adapter below adds authenticated producer evidence without changing those contracts.

The inner effect boundary is defined by Protected Effect Contract 0.1.0. Its validators check contract consistency; they don't replace RunCoordinator or grant effect authority.

Pattern Library

The implementation is accompanied by material that can be used independently:

The retired Node/TypeScript harness, BoundaryBench, and exploratory pilot remain available from the legacy-ts-boundarybench-v0.1.0 tag. BoundaryBench's frozen conformance history now lives in RunInvariant.

Shared research

The harness engineering review is the shared, dated research snapshot for GAAP, ThreadLoop, and RunInvariant. The adoption decision tracker records candidate owners, prerequisites, proposed experiments, and follow-up issues. Research candidates require an explicit decision before entering a repository roadmap.

License

GAAP is licensed under the Apache License 2.0.

ACP agent-session adapter

The ACP adapter pins the official Rust SDK 3.3.0 and stable protocol v1. One session belongs to one accepted Agent Run. Delegated file reads and writes pause until the engine's gates admit their exact protected effect; the host executor and independent verifier supply outcome evidence. Permission prompts don't authorize ambient agent execution, terminal capabilities aren't advertised, and draft-v2 features aren't enabled.

This profile requires a trusted local agent that delegates filesystem access over ACP and a host meter for model usage. It doesn't isolate the agent's own system calls or prove that arbitrary agents comply. See the compatibility and recovery policy in ADR 0007. The governed Goose reference below exercises real interoperability.

MCP stdio client adapter

The MCP adapter discovers external tool descriptors and invokes an exactly approved tool through the existing GAAP executor port. It uses the official Rust SDK in a separate crate, explicit child environments, immutable effect bindings, host subject observation, and bounded stdio. Its deterministic subprocess tests also run through AgentRunEngine and validate the resulting receipts independently.

The initial profile pins MCP 2025-11-25 and rmcp 3.5.1. The local stdio execution profile doesn't provide OS isolation. The governed Goose reference exercises interoperability; durable reconciliation and ThreadLoop ingestion retain their own roadmap issues. The reuse mapping records which conference-demo patterns carry forward and which capabilities remain separate work.

The governed Goose reference drives a real, pinned Goose conversation through both official adapters with local deterministic provider fixtures, per-effect gates and independent shipping-code verification.

Signed run evidence

The attestation adapter carries full run/effect ledgers in a versioned in-toto Statement and DSSE envelope. Offline consumers use explicit signer and policy trust, frozen contract validation and retained content bytes. The Goose reference emits public-key fixtures for controller integration tests; signing alone doesn't authorize a lifecycle transition.

The Linux gVisor profile selects pinned runsc through the same neutral SandboxAdapter. Its required Linux CI lane exercises actual isolation, failure paths and signed Goose evidence; host configuration and runtime trust remain security-critical.

About

This repo is a public, docs-first reference for teams that want agentic coding without chaos. It focuses on the patterns that protect code integrity while still preserving speed: plan, permission, verification, and tool trust.

Resources

Code of conduct

Contributing

Stars

22 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages