Skip to main content

Module codegen

Module codegen 

Source
Expand description

Code-generation harness — a domain-specific agent harness for writing and verifying code, mirroring browser but for the code domain.

The browser harness needed an LLM judge because page state is not reducible to a boolean. Code is different: a build/test command’s exit code is the ground truth. So this harness centers on one primitive the rest of the framework lacked — a structured, configured, gate-able verification tool — and otherwise composes existing machinery (AgentRunner, GoalCondition’s independent-judge repair loop, builtins rooted at a workspace, guardrails).

  • VerifyCommandTool runs the harness-configured verify command(s) and emits a machine-greppable VERIFY_RESULT: sentinel (PASS/FAIL + exit code). Its two reasons to exist over raw bash: the command is configured (the agent never guesses it) and the result is structured and gate-able.
  • parse_latest_verify reads that sentinel back out of a transcript — the seam for a deterministic completion gate.

See tasks/codegen-harness-2026-06-02.md for the full design + non-duplication rationale (what we deliberately do NOT build from claw-code).

Re-exports§

pub use builder::CODE_SYSTEM_PROMPT;
pub use builder::CodeAgentBuilder;
pub use builder::code_goal;
pub use builder::code_tools;
pub use verify::VerifyCommandTool;
pub use verify::VerifyOutcome;
pub use verify::parse_latest_verify;
pub use verify::render_verify_result;

Modules§

builder
CodeAgentBuilder — a domain-specific harness for code generation, mirroring BrowserAgentBuilder. It curates the code builtins rooted at a workspace, adds the VerifyCommandTool, installs a loop-invariant system prompt, and (optionally) gates completion on a GoalCondition whose independent judge keys on the deterministic VERIFY_RESULT: sentinel. Everything else (the ReAct loop, the goal-driven repair continuation, workspace jailing, guardrails) is reused, not rebuilt.
verify
Deterministic verification: the verify tool + the pure render/parse of its machine-greppable VERIFY_RESULT: sentinel.