Skip to content

Deterministic Controls: The Foundation of Autonomy ​

An AI assistant that cannot verify its own work can only ever be as trustworthy as the human reviewing every line behind it. Deterministic Controls are the mechanical, falsifiable checks — tests, validator scripts, schema contracts, diff guards — that let an agent confirm its own output is correct without asking a human to re-read it first.

This capability is what turns a single supervised assistant into an autonomous worker, giving the AI engineer the ability to orchestrate fleets of agents safely.

Why "Trust Me" Doesn't Scale ​

Natural-language self-reporting ("I ran the tests and they pass", "This fix is complete") is not verification — it is a claim. Claims compound risk as autonomy increases:

Without a deterministic gate, every unit of agent autonomy is paid for with an equal unit of human review. With one, the agent absorbs its own review-and-repair loop, and the human only intervenes on a final pass/fail signal.


The Autonomy Ladder ​

Deterministic controls are the prerequisite for each step up in scope:

LevelBehaviorWhat Makes It Safe
0 — SupervisedHuman reviews every change before it mergesHuman is the only check; no controls needed, no autonomy either
1 — Self-Checking AgentAgent runs the narrowest test command or a validator script before declaring "done"A falsifiable Done When criterion replaces subjective confidence
2 — Delegated TaskAn engineer hands an agent a whole feature or audit finding and walks awayThe agent's own gate (tests, schema validation, scope guard) is trusted as the completion signal
3 — Multi-Agent OrchestrationAn orchestrator agent (or engineer) fans work out to several specialist agents in parallel or in sequenceEach specialist's output is independently, mechanically verifiable — the orchestrator never has to manually audit every sub-agent's work

Coding Pal's Golden Split encodes Levels 1 to 3: agents own scope and method, instructions own standards, and deterministic primitives own the mechanical validators and guards that turn "I think this is correct" into "this passed."


The Four Deterministic Control Roles ​

In Coding Pal, persistent context is organized into four canonical primitives (Instructions, Agents, Skills, and Prompts) distributed via APM to GitHub Copilot, Claude Code, and Cursor.

Rather than inventing incompatible file extensions that AI harnesses and package managers cannot load, deterministic controls are organized into four architectural roles that live inside and empower the canonical primitives:

1. 📄 Contracts (Normative Schemas) ​

  • Where It Lives: Inside a Skill under skills/<name>/references/.
  • Purpose: Authoritative machine-readable definition of markers, fields, and structures that downstream agents and CI workflows expect.
  • Examples in Coding Pal:
    • skills/contract-validator/references/contract-schema.md & validate-contract.mjs (generic declarative schema validation).
    • skills/audit-reporting/references/report-contract.md (audit markers, finding categories, severity limits).
    • skills/think-plan/references/think-plan-contract.md (specification headings, invariant sections, bootability checklists).
    • skills/scope-guard/references/guard-contract.md (path matching semantics, forbidden file lists).

2. 🛡️ Guards (Blast-Radius & State Bounding) ​

  • Where It Lives: Guided by Instructions; executed by Skill scripts (skills/<name>/scripts/).
  • Purpose: Enforce mechanical boundaries on what an agent is permitted to touch during or after a code modification.
  • Mechanisms:
    • Scope Whitelisting: Asserts that modified files match declared allowedPaths (skills/scope-guard/scripts/scope-guard.mjs).
    • Dependency Bloat Sentinel: Mechanically prevents unprompted additions to package.json or banned packages (skills/dependency-guard/scripts/dependency-guard.mjs).
    • Secret & Credential Sentinel: Scans diffs to prevent accidental hardcoding of AWS keys, private keys, or tokens (skills/secret-guard/scripts/secret-guard.mjs).
    • Diff Churn Limiter: Caps lines added and deleted to prevent unprompted mass refactorings.

3. 🚦 Gates & Verifiers (Falsifiable Completion Criteria) ​

  • Where It Lives: Defined in an Agent's Done When; executed by Skill scripts (skills/<name>/scripts/) and CI/harness hooks.
  • Purpose: Replaces subjective self-confidence ("I tested it and it works") with an executable verification command that yields 0 on success or structured diagnostics for agent self-repair.
  • Mechanisms:
    • Multi-Stage Verification Gate: Runs linting, type checks, and narrowest tests sequentially with fail-fast semantics (skills/task-gate/scripts/task-gate.mjs).
    • Specification Validator: Checks that think.md and plan.md are structurally complete and bootable before build agents touch source code (skills/think-plan/scripts/validate-specs.mjs).
    • Narrowest Test Command: Runs the focused test suite specifically covering modified files (npm test -- --findRelatedTests).

4. 🎯 Probes & Oracles (Falsifiability Assertions) ​

  • Where It Lives: Inside a Skill under scripts/ and fixtures/.
  • Purpose: Mechanically proves that a test or migration is genuinely falsifiable and non-vacuous.
  • Mechanisms:
    • Anti-Tautology Probe: Stashes or reverts a code fix, runs the newly created test to assert it fails (proving it actually tests the bug), then restores the fix and asserts it passes (skills/test-probe/scripts/test-probe.mjs).
    • Rollback & Roundtrip Oracle: For database migrations or stateful scripts, executes forward $\rightarrow$ rollback $\rightarrow$ forward to mechanically verify that schema changes can be cleanly undone (skills/rollback-probe/scripts/rollback-probe.mjs).
    • Performance Budget Gate: Parses benchmark exports (e.g. benchmark.json from k6) and fails if latency or error thresholds are breached (skills/k6-performance-examples/).

Deterministic Controls Across the Agent Lifecycle ​

Deterministic controls operate across four distinct phases of the agent execution lifecycle:

Lifecycle PhaseControl PrimitiveDeterministic MechanismFailure Remediation
1. Ingress / Pre-flightBaseline SentinelVerifies clean git working tree, clean compilation, and passing test suite before agent edits.Aborts early; prevents attributing pre-existing errors to the agent.
2. In-flight / ExecutionGuard & HookScope whitelisting (allowedPaths), forbidden lockfile detection, AST rule checking, diff churn limits.Blocks unauthorized tool action; returns mechanical error to agent context.
3. Egress / CompletionGate / VerifierStructural Markdown/JSON validators, narrowest test run, lint and type checks (tsc --noEmit).Prevents declaring completion; provides structured diagnostics for self-repair.
4. Multi-Agent Hand-offContract / OracleInter-agent artifact validation (e.g., validate-specs.mjs verifying think.md before plan.md starts).Rejects artifact hand-off; halts orchestration pipeline before errors compound.

Orchestrating Fleets with Deterministic Gates ​

The more agents an engineer or orchestrator coordinates, the less feasible it becomes to manually inspect each output. Orchestration at scale is only possible when every agent in the chain reports through a machine-checkable gate instead of prose:

Without those gates, the orchestrator (human or agent) becomes the bottleneck again — reading every diff from every specialist. With them, the orchestrator only needs to react to failures, freeing an AI engineer to run many more agents than they could ever personally review.


What Counts as a Deterministic Control ​

MechanismExample in Coding PalOwned By
Blast-radius diff guardskills/scope-guard/scripts/scope-guard.mjs checks modified paths & churnGuard (skills/scope-guard)
Dependency bloat sentinelskills/dependency-guard/scripts/dependency-guard.mjs checks package manifestsGuard (skills/dependency-guard)
Secret & credential guardskills/secret-guard/scripts/secret-guard.mjs scans diffs for keys & tokensGuard (skills/secret-guard)
Multi-stage verification gateskills/task-gate/scripts/task-gate.mjs runs lint/build/tests with self-repair diagnosticsGate (skills/task-gate)
Declarative contract validatorskills/contract-validator/scripts/validate-contract.mjs asserts artifact schemaContract (skills/contract-validator)
Anti-tautology falsifiability probeskills/test-probe/scripts/test-probe.mjs verifies tests fail when fix is removedProbe (skills/test-probe)
Migration rollback probeskills/rollback-probe/scripts/rollback-probe.mjs verifies reversibility & idempotencyProbe (skills/rollback-probe)
Artifact validator scriptskills/audit-reporting/scripts/audit-report.mjs checks report structureGate (Skill)
Specification validatorskills/think-plan/scripts/validate-specs.mjs checks heading sequence & bootabilityGate (Skill)
Falsifiable Done When"Every file in scope has been reviewed" / "Narrowest test suite passes"Agent
Narrowest test commandnpm test -- tests/auth.test.js run after a surgical fixAgent
Schema/contract validationreferences/contract-schema.md, references/guard-contract.mdContract (Skill)

A control only counts as deterministic if it produces the same verdict given the same input, regardless of which model or agent ran it. If the check depends on an LLM re-reading its own output and vouching for it, it is not yet deterministic — it is still a claim.


Building New Deterministic Controls ​

When authoring a new agent or skill that should eventually run unsupervised or as part of an orchestrated pipeline:

  1. Define the completion criterion first. Write the falsifiable "Done When" before writing the agent's method.
  2. Externalize the check. Put the validation logic in a script or test, not in the agent's reasoning. Scripts belong in skills/<name>/scripts/, fixtures in skills/<name>/fixtures/.
  3. Make failure actionable. The validator's output should tell the agent (or the next agent in the chain) exactly what to fix, not just pass/fail.
  4. Keep the gate cheap to run. A control that takes longer than the task it verifies will not survive orchestration at scale.

Next Steps ​

  • Revisit the Golden Split to see how skills and guards distribute ownership.
  • See a full worked example in Audit & Remediation, where CI gating rejects reports that fail schema validation.
  • Browse the Skills Catalog for existing validator scripts and guards.

Published and maintained by ALTEN