Skip to content

Autonomous missions: charter → plan → phase gates → code-gated done#102

Merged
BillJr99 merged 2 commits into
masterfrom
claude/agent-planning-iteration-dxbxrd
Jun 29, 2026
Merged

Autonomous missions: charter → plan → phase gates → code-gated done#102
BillJr99 merged 2 commits into
masterfrom
claude/agent-planning-iteration-dxbxrd

Conversation

@BillJr99

Copy link
Copy Markdown
Owner

Summary

This PR implements a complete autonomous mission orchestrator that drives a single objective from charter through discovery, product, engineering, validation, and deployment phases to a machine-checkable done gate—with no human follow-up required.

The mission runner wraps existing per-workflow engines (WorkflowRunner, RalphLoop, AutoresearchLoop) in a macro plan→execute→evaluate→refine→iterate loop. Every boundary is trace-committed to git so the execution trail is auditable, and per-cycle telemetry makes the loop observable.

Key Changes

New modules:

  • mission.py — MissionRunner orchestrator, MissionPlan/PhaseSpec living artifacts, charter-first ordering
  • charter.py — Chief's up-front commitment (mission statement, scope, success criteria, constraints); persisted as .clk/state/charter.json + CHARTER.md
  • done_gate.py — Machine-checkable completion gate (tests green, deliverables exist, QA pass, ralph pass, no TODOs, charter criteria); adaptive for test-less projects
  • deliberation.py — Self-reflection preamble + blocking Q&A for producing dispatches
  • telemetry.py — Per-cycle accumulator (thread-safe) for loop observability; renders compact line + activity event
  • noop_guard.py — Detects when producing agents emit prose without file mutations; escalating re-dispatch with repair preamble

Modified modules:

  • workflow.py — Integrated done-gate evaluation, telemetry threading, mission-mode flag, supervise-cycles override; added deliberation preamble injection
  • evaluator.py — Auto-derives real test commands (pytest/npm/compileall) instead of vacuous pass; marks weak gates for adaptive done-gate
  • agent.py — Tracks file mutations applied per run; added mission-level chief dispatch types (charter, mission_plan, phase_gate)
  • casting.py — Added CharterProposal and PlanProposal parsing
  • cli.py — New mission command (alias auto); run now drives full mission by default with --once for single cycle
  • config.py — New config blocks: mission.*, done_gate.*, deliberation.*, validation.auto_derive
  • git_ops.py — New commit_trace() for structured execution-trace commits at mission boundaries
  • tui.py — Mission dispatch in TUI job handler

Tests:

  • test_done_gate.py — Unit tests for gate verdicts (tests red, missing deliverables, QA fail, etc.)
  • test_mission_living_plan.py — Plan/charter roundtrip, phase ordering, validation derivation
  • test_noop_guard.py — Mutation detection and response-quality flag
  • test_debate.py — Adversarial debate-panel refinement
  • test_mission_e2e.py — End-to-end mission with shell provider (verifies gates fire, artifacts written, telemetry emitted)

Documentation:

  • README updated with autonomous-missions section and new knobs
  • .env.example and kickoff.sh updated with mission/done-gate/debate config
  • Inline docstrings explain charter-first ordering, gate semantics, and trace-commit strategy

Notable Implementation Details

  1. Charter-first ordering: Mission always asks chief to write charter before proposing plan; plan is derived from charter so "done" is measured against committed criteria, not drifting.

  2. Living plan artifact: .clk/state/mission.json + MISSION.md persisted after each phase, showing status, iterations used, gate history; enables mid-mission inspection and recovery.

  3. Adaptive done-gate: When evaluator marks gate as "weak" (no real test command available for docs/research projects), tests-green requirement is relaxed so mission can still finish.

  4. No-op guard: Producing stages that apply zero file mutations are re-dispatched with escalating repair preamble; prevents agents from "describing work instead of doing it."

  5. Deliberation: Self

https://claude.ai/code/session_01AHao68VweSg6a9Q1sJUR65

claude added 2 commits June 29, 2026 22:25
Make the plan->execute->evaluate->refine->iterate loop actually fire by
moving guarantees from prompt text into the harness, and add a single-prompt
autonomous mission that drives the whole lifecycle to a code-gated done.

Autonomy
- clk run (and the TUI first message / REST single-prompt) now drive a full
  MissionRunner to a gated done by default; clk mission/auto is the explicit
  form; clk run --once keeps the legacy single-workflow pass.
- Charter first (charter.py): the chief commits a charter; the living plan
  (mission.py, .clk/state/mission.json) and done-gate derive from it.
- Phase sequencing with chief phase-gates (pass/repeat/revise/done).

Reliability reinforcements (harness-enforced)
- done_gate.py: ACTION:done is a request; the loop stops only when a
  machine-checkable gate passes (tests/qa/ralph/deliverables/charter), with
  an adaptive tests-green relaxation for test-less projects. Stop artifact is
  done_granted.md.
- noop_guard.py + response_quality noop flag: a producing stage that changed
  no files is re-dispatched with an escalating preamble.
- evaluator: no vacuous pass on empty checks; derive_validation() infers a
  real command (pytest/npm/compileall smoke).
- robustness.auto_refine defaults to "all"; refine_max_rounds 10.
- deliberation.py: self-reflect preamble + blocking peer Q&A; a phase gate
  cannot pass with unresolved blocking questions.
- git_ops.commit_trace + telemetry.py: structured boundary commits and a
  per-cycle loop_cycle_summary line/event.

Tests / docs / CI / pi-extension
- New offline unit tests (done_gate, noop_guard, mission living-plan) and a
  shell-provider mission e2e; existing single-workflow e2e moved to --once.
- CI runs the offline mission e2e; README documents the new behavior and
  corrects the stated defaults.
- pi-extension quality scorer gains the matching noop flag + tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AHao68VweSg6a9Q1sJUR65
…nobs

Debate panel (multi-critic refinement)
- robustness.debate (off|careful_only|all, default careful_only) +
  debate_lenses + debate_max_rounds. WorkflowRunner._debate_loop fans out one
  adversarial critic per lens in parallel, each tries to break the work and
  engages with peers' critiques across rounds (posted to the blackboard as
  post_type=debate); the worker is kept only on majority-accept + mean score
  >= threshold, else the combined critiques drive a revision. Takes precedence
  over the single-critic refine loop. Emits debate_round events.

Env-var plumbing (config -> .env.example -> kickoff.sh -> README)
- .env.example documents every new knob: robustness.debate*, and the
  mission / done_gate / noop_guard / deliberation blocks + validation.auto_derive.
- kickoff.sh maps them via _set() (+ a new _csv cast for list knobs:
  debate_lenses, mission.default_phases, noop_guard.producing_agents).
- README: new "Adversarial debate panel" robustness layer, debate rows in the
  cost-guardrails table, corrected auto_refine/refine_max_rounds defaults, and
  an env-var note in the Autonomous missions section.

Tests
- tests/test_debate.py (gating + lens selection) and a deterministic debate-loop
  integration test (panel fans out, revises, accepts).
- test_docs_consistency extended to enforce env.example + kickoff parity for the
  new config blocks. Full unit suite green (421 passed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AHao68VweSg6a9Q1sJUR65
@BillJr99 BillJr99 merged commit 5f5895c into master Jun 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants