APA Agent Decision Harness [](https://whop.com/aipersonaacademy) [](https://docs.typesafe.ai) [](LICENSE)

September 19, 2026 ยท View on GitHub

A production-grade TypeScript runtime harness for TypeSafe Jev and System One models. Powers autonomous agent decision pipelines with confidence-gated policy routing, shadow mode, trajectory verification, and automated evaluation.

Maintained and published by AIPersona Academy (APA).


๐ŸŽฏ Why This Exists

Autonomous coding assistants (Claude Code, Codex, Antigravity, Cursor) and multi-agent systems often stall, loop, or take unsafe actions when relying on freeform LLM chat to make control-plane decisions.

APA Agent Decision Harness wraps Jev's machine-native decisions (Choice, Score, Noul) with production control mechanisms:

  • Policy Mapping: Directly maps typed verdicts to actionable runtime verbs (execute, suppress, notify, escalate).
  • Confidence Gate: If calibrated model confidence drops below a defined threshold, fails safe or routes to human-in-the-loop review.
  • Shadow Mode: Evaluates candidate actions alongside existing agent workflows without interrupting live behavior.
  • Trajectory Verification: Inspects multi-turn agent tool calls and diffs to assert that stated goals are mathematically and semantically fulfilled.
  • Offline Evals: Replays deterministic fixtures to benchmark prompt variations with zero network latency.

๐Ÿ“ฆ Installation

npm install @aipersona/agent-harness
export TYPESAFE_API_KEY=tsk_...

โšก Quick Start

import { DecisionHarness, choice, noul, score } from "@aipersona/agent-harness";

const harness = new DecisionHarness({
  confidenceThreshold: 0.85,
  shadowMode: false
});

// Run parallel confidence-gated evaluation on live agent state
const decision = await harness.run({
  id: "agent-step-104",
  state: {
    command: "rm -rf ./dist && npm run build",
    changedFiles: ["src/index.ts", "package.json"],
    environment: "production"
  },
  questions: {
    safety: noul("Is this shell execution hazardous or destructive to production state?"),
    action: choice("What execution policy should apply?", {
      options: ["AllowImmediate", "RequireHumanConfirmation", "BlockAndLog"]
    })
  }
});

console.log("Verdict:", decision.action.choice);
console.log("Confidence:", decision.action.confidence);

๐Ÿ› ๏ธ Included Recipes

  • Alert & Anomaly Filter: Suppresses noise and escalates critical infrastructure alerts.
  • Autonomous Model Router: Routes complex tasks to high-tier reasoning models and routine tasks to fast-tier models.
  • Agent Compaction & Tool Pruning: Automatically drops stale context to keep token costs minimal.

๐Ÿ“œ License & Support