Skip to content

feat(evolve): --mode=burst|loop flag + mechanical write-stop-marker refusal (soc-hwax #mode-loop-flag)#395

Merged
boshu2 merged 3 commits into
mainfrom
feat/evolve-mode-loop-soc-hwax
May 21, 2026
Merged

feat(evolve): --mode=burst|loop flag + mechanical write-stop-marker refusal (soc-hwax #mode-loop-flag)#395
boshu2 merged 3 commits into
mainfrom
feat/evolve-mode-loop-soc-hwax

Conversation

@boshu2
Copy link
Copy Markdown
Owner

@boshu2 boshu2 commented May 21, 2026

Why

/evolve self-stops in operator-driven cron sessions because its defaults assume agent-as-operator. --mode=loop flips the contract: operator owns stop signals; CLI mechanically refuses self-written STOPs.

What changed

Surface Change
cli/cmd/ao/evolve.go New --mode string flag (burst|loop, default burst) + validateEvolveMode helper called from runEvolve
cli/cmd/ao/evolve_write_stop_marker.go New subcommand; refuses with exit 1 under --mode=loop, writes .agents/evolve/<MARKER> under burst
cli/cmd/ao/evolve_test.go L1: --mode=invalid rejected; mode flag registered with burst default
cli/cmd/ao/evolve_write_stop_marker_test.go L2 table tests: burst writes (DORMANT body assertion), loop refuses {dormant,stop,kill}, no file written under refusal
skills/evolve/SKILL.md Mode-aware HTML comments in Steps 1/3/7 + Flag table row (only edited Steps 1/3/7 + Flag table; verified via grep ^### Step)
skills/evolve/references/loop-mode.md New reference doc with invariants + CLI primitives
docs/plans/2026-05-21-evolve-loop-epic-design.md Epic design memo (consumed by all 6 sub-beads of soc-g2qd)
cli/docs/COMMANDS.md Regenerated via scripts/generate-cli-reference.sh
skills-codex/{.agentops-manifest.json,evolve/.agentops-generated.json} Post-edit hook source-hash refresh; check-codex-parity-drift.sh PASS

How tested

  • go test -count=1 ./cmd/ao/ — 10175 pass, 1 skip (full suite green after CLI-docs regen; pre-regen TestCobraConformance correctly flagged the doc drift)
  • go build ./... && go vet ./... — green
  • grep '^### Step' skills/evolve/SKILL.md confirms only Steps 1/3/7 edited (12 Step markers preserved at same positions)
  • bash scripts/check-codex-parity-drift.sh — PASS
  • Table tests assert exact marker filename (DORMANT/STOP/KILL) + body content for burst; for loop they assert error substring AND that no marker file was created.

§A7 fallback decision

Chose in-file HTML comments (not two-file split). Each Step comment is one line; no conditional sections needed. Two-file split would have ballooned the surface for a single-line contract reminder. CLI mechanical enforcement (write-stop-marker refusal) is the real invariant; SKILL.md comments only document intent for human readers.

See: docs/plans/2026-05-21-evolve-loop-epic-design.md §A1 + §A7

TODOs the worker leaves for the epic

  • Wire cli/internal/evolve.preferences.Load() into detectEvolveWriteStopMarkerMode once soc-6svt lands (currently flag-only).
  • ao evolve operator-stop (Wave 2) — separate code path explicit operator override.
  • ao evolve blocked (Wave 2) — typed blocked event instead of STOP.

Closes-scenario: soc-hwax#mode-loop-flag
Bounded-context: BC5-Runtime
Evidence: cli/cmd/ao/evolve_write_stop_marker.go

boshu2 added a commit that referenced this pull request May 21, 2026
… subcommand (soc-6svt)

Mechanical drift fix: the new `ao evolve config --show` subcommand from the parent commit drifted `cli/docs/COMMANDS.md` (TestCobraConformance fail) and `registry.json` (registry-check job fail). Both regenerated via project's standard scripts.

Sibling pattern: matches the COMMANDS.md regen pattern from W1a's soc-hwax PR (#395) — same TestCobraConformance signal, same fix.

Fitness: CI failures 5 → expected 3 (cli-docs-parity + registry-check clear; agentops-contract-canaries may need a baseline refresh in a follow-up commit).
boshu2 added 2 commits May 21, 2026 11:56
…efusal (soc-hwax #mode-loop-flag)

Adds --mode={burst,loop} to ao evolve. New ao evolve write-stop-marker
subcommand writes DORMANT/STOP/KILL markers in burst mode and refuses
with exit 1 under --mode=loop, giving operator-driven cron sessions a
mechanical no-self-stop contract.

§A7 fallback decision: in-file HTML comments (kept Steps 1/3/7 scope
minimal — each comment is a single line, no conditional sections).

- cli/cmd/ao/evolve.go: --mode string flag (default burst), validation
  in runEvolve, shared evolveModeBurst/Loop constants
- cli/cmd/ao/evolve_write_stop_marker.go: new subcommand with mode
  detection + marker canonicalization + filesystem write
- cli/cmd/ao/evolve_test.go: TestValidateEvolveMode,
  TestEvolveModeFlagRegisteredWithBurstDefault,
  TestRunEvolveRejectsInvalidMode (L1)
- cli/cmd/ao/evolve_write_stop_marker_test.go: L2 table tests for
  burst-writes / loop-refuses across dormant|stop|kill + registration
  + normalize helper
- skills/evolve/SKILL.md: Flag table row + Step 1/3/7 HTML comments
- skills/evolve/references/loop-mode.md: invariants + CLI primitives
- docs/plans/2026-05-21-evolve-loop-epic-design.md: epic design memo
- cli/docs/COMMANDS.md: regen via scripts/generate-cli-reference.sh
- skills-codex/{.agentops-manifest.json,evolve/.agentops-generated.json}:
  source_hash refresh via post-edit hook

Closes-scenario: soc-hwax#mode-loop-flag
Bounded-context: BC5-Runtime
Evidence: cli/cmd/ao/evolve_write_stop_marker.go
…hwax)

Mechanical follow-up to commit 2b1aaf5 (--mode=burst|loop flag + write-stop-marker refusal). CI failed on three gates that the original commit didn't run locally:

1. registry-check: regenerated registry.json after new `ao evolve write-stop-marker` subcommand. Sibling pattern: matches the COMMANDS.md regen step soc-ij7e (#394) did for its new subcommand.

2. skill-lint typo: 3 HTML comments referenced `references/loop-mode.md.` with a trailing period (end of sentence). Linkage check parsed the period as part of the filename and reported "does not exist". Removed all 3 HTML comments — the same intent is documented at `skills/evolve/references/loop-mode.md` already, linked from the flag table row.

3. token-budget overflow: pre-W1a SKILL.md was at 9993 tokens (7 under the 10000 limit); W1a's 7-line additions pushed it to 10240 (240 over). Reduction path:
   - Removed 3 verbose HTML comments (per #2 above) — saved ~245 tokens
   - Trimmed flag-table row description ("deterministic no-self-stop" → "Operator-loop")
   - Drive-by: trimmed two verbose pre-existing References descriptions (long-loop-discipline, snapshot-pattern-for-long-cycle-gates) since the token budget margin is tight; both still accurately describe their references.
   - Final: 10240 → 9989 tokens (under 10000 limit by 11).

skills-codex/* hash regenerated via `scripts/regen-codex-hashes.sh`; codex SKILL.md itself untouched (W1a did not edit it, neither did this commit; parity preserved).

Tests: TestCobraConformance pass; lint-skills.sh evolve ✓; test-token-budgets.sh evolve at 9989/10000.
@boshu2 boshu2 force-pushed the feat/evolve-mode-loop-soc-hwax branch from be74e47 to 77b946b Compare May 21, 2026 15:58
…nces.yaml.template (soc-6svt follow-up)

PR #396 (soc-6svt, just merged) introduced .agents/evolve/preferences.yaml.template as the operator starter template, plus a .gitignore negation to commit it. plugin-load-test was path-filtered to skip on #396 so the violation didn't surface — but it surfaces on this PR (#395), blocking soc-hwax's merge.

The template is intentional state per the soc-g2qd epic design (docs/plans/2026-05-21-evolve-loop-epic-design.md §A2 — preferences.yaml shipping path). Adding it to the audit-truth allowlist alongside cycle-history.jsonl and session-state.json (the other two .agents/evolve/* tracked paths).

Coordinated update: both ALLOWED_PATHS_REGEX (tracked-file check) and ALLOWED_REINCLUDES_REGEX (.gitignore negation check) get the new path. .gitignore already has the matching `!/.agents/evolve/preferences.yaml.template` line from #396.

Sibling pattern: matches the way reconcile/* paths were added when the Reconciliation Engine arc shipped (comments in the script reference that addition).

Fitness: plugin-load-test 1 failure → 0; check-no-tracked-agents.sh exits 0 locally.
@boshu2 boshu2 merged commit 2ea3c12 into main May 21, 2026
71 checks passed
@boshu2 boshu2 deleted the feat/evolve-mode-loop-soc-hwax branch May 21, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant