Add a Rust-native fresh-agent Ralph loop #73
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add an explicit Rust-native Ralph tool that iterates toward one immutable coding objective with a fresh local-model context each round. The shared working tree is durable memory; only one bounded structured handoff crosses rounds.
Depends on #72 for executable tool schemas, validation, and reliable structured report capture.
Plan
ralphtool with requiredobjectiveand optionalmax_rounds. Use an initial default of 8 rounds and a hard ceiling of 64; keep provider/model routing owned by the current session.status(continue,complete, orblocked),summary,evidence,next_steps, andblocker. Bound the serialized handoff to 16 KiB and reject malformed or oversized reports.continuerequires next steps and no blocker;completerequires concrete evidence and no next steps/blocker;blockedrequires a concrete blocker. Prevent child agents from invokingralphrecursively.Boundaries
Acceptance criteria
cargo fmt --all -- --check, Clippy with-D warnings,make bundle, andcargo test --all-featurespass.Implemented in
f2772f2. Added a foreground Rust-native ralph tool (objective required, max_rounds default 8, hard max 64) that reuses the selected session's model/runtime, workspace, AGENTS.md prompt, tool catalog, validation, permissions, and tool-card lifecycle. Each round gets a unique transient KV namespace and a freshly constructed child message list containing only the immutable objective, round/cap, and previous validated report. Paginated output and repeat state are isolated per round; child-started background jobs are stopped at every boundary; recursive ralph calls are denied. The child-only ralph_report contract enforces continue/complete/blocked semantics, exactly one standalone report, and a 16 KiB serialized cap. Completion/blockers are explicitly labeled worker-reported, while cancellation, malformed reports, round caps, and child failures stop cleanly with the last valid report preserved. Added deterministic scripted-backend tests for fresh prompts and every terminal path, DeepSeek DSML and GLM report capture, report validation/oversize rejection, unique context cleanup, and orphan-job prevention. Verification: cargo fmt --all -- --check; cargo clippy --all-targets --all-features -- -D warnings; make bundle; cargo test --all-features (181 passed, 14 hardware/browser fixtures ignored).