Skip to content

Harness and Compiler¤

The harness captures observable agent behavior, stores it as canonical traces, and compiles reusable structure into a portable .jdsl package.

The important distinction is procedure versus judgment:

  • procedure becomes deterministic tree structure, refs, guards, and fixed actions
  • remaining judgment becomes a typed residual predict or react signature

Source map:

Layer Code
capture lifecycle jdsl_harness/capture.py
event store jdsl_harness/store.py
local ingest jdsl_harness/server.py
tool gateway jdsl_harness/gateway.py
MCP proxy jdsl_harness/mcp_proxy.py
compiler jdsl_harness/compiler/

Pipeline¤

canonical traces
  -> normalize
  -> consolidate
  -> staticize
  -> verify
  -> package

normalize turns raw events into ordered tool steps, observed model decisions, and exact argument lineage. consolidate counts support and counterexamples. staticize builds Behavior IR from the modal successful trajectory. verify checks structure and replay. package exports a deterministic archive.

The default compiler model is HeuristicCompilerModel, so the current pipeline can run offline in tests. The design allows richer compiler-model proposal roles, but the public docs should treat the implemented heuristic path as the baseline.

The full implementation walkthrough is in Compiler Internals. That page follows the pipeline through normalize.py, lineage.py, candidates.py, consolidate.py, staticize.py, residualize.py, verify.py, and package assembly.

What Compilation Removes¤

For a retail cancellation flow, traces might show:

lookup(email) -> customer
list_orders(customer_id=customer.id) -> orders
predict(request, orders -> selected_index)
get_order(order_id=orders[$selected_index].id) -> order

The compiled package does not ask the smaller model to copy ids, pick tools, or remember sequencing. It asks only for selected_index. The runtime then resolves the exact order id through orders[$selected_index].id.

Capture Tiers¤

Tier Source Typical fidelity
A jdsl-native tracing, ToolGateway, or MCP proxy strongest tool and state visibility
B Claude Code, Gemini CLI, or OpenCode hooks host tool events, depending on hook payload
C Imported JSONL logs whatever the source log contains

All tiers map into the same canonical event schema. The compiler should never claim more than the recorded events prove.

Tier A has the strongest evidence because jdsl sees structured tool calls and state directly. Tier B depends on host hook fidelity. Tier C is useful for benchmarks and migrations, but the compiler can only mine fields that exist in the imported records.

Implemented Components¤

jdsl/trace/       events, JSONL sinks, blobs, redaction, replay
jdsl/ir/          Behavior IR, guard expressions, validation, lowering
jdsl/package/     manifest, contracts, export, load, bind
jdsl_harness/     store, capture coordinator, gateway, server, adapters
compiler/         normalize, candidates, consolidate, staticize, verify, package
plugins/          Claude Code, Gemini CLI, OpenCode shims

See Using the Harness and Compiler for commands and Behavior Packages for the archive format.