Commit Graph

1 Commits

Author SHA1 Message Date
Bo 5968234af9 feat(evolve): port mt-olympus guardrail substrate — mechanical pre-cycle halt gate + doctrine ADRs (soc-sfjx #substrate) (#399)
## Why

`soc-g2qd` built six `/evolve` CLI primitives the skill never called; an
unsupervised session then drifted for ~10h on green CI alone. Research
(`.agents/research/2026-05-21-mt-olympus-evolve-loop.md`) showed
mt-olympus runs the **same** `/evolve` skill non-stop (~245 cycles)
because its guardrails are **mechanical** — a `halt-check.sh` that *runs
before every cycle* — not prose the agent can skip. This ports that
property to agentops.

## What changed

| Surface | Change |
|---|---|
| `scripts/evolve/halt-check.sh` (NEW) | Mechanical pre-cycle gate:
operator markers (KILL/STOP/DORMANT/HANDOFF) with soc-5qit non-sticky +
TTL semantics, goal-regression (cycle-history `goals_passing` drop),
prior-cycle-FAIL restorative signal. `--json` + human modes.
shellcheck-clean. |
| `skills/evolve/SKILL.md` Step 1 | **Wired**: replaces the 40-line
inline marker block with `bash scripts/evolve/halt-check.sh` (graceful
inline fallback for repos lacking it). Step 0 now reads
`docs/adr`/`docs/decisions` doctrine each cycle. |
| `docs/adr/ADR-0007`, `ADR-0008` (NEW) | Deterministic-no-self-stop +
intelligent-agile operating-model doctrine, adapted to agentops
conventions (numbered `docs/adr/`) from mt-olympus's `docs/decisions/`
ADRs. |
| `docs/documentation-index.md` | Catalogue ADR-0007/0008. |
| `tests/scripts/evolve-halt-check.bats` (NEW) | L2: gate behavior
(markers/TTL/regression/fail/auto-clear) **AND** proves SKILL.md
actually invokes the gate. |

## Lessons from soc-g2qd applied (so this isn't a repeat)

- **Adapt, not blind-copy:** halt-check reads agentops's existing
`cycle-history.jsonl` schema (not mt-olympus's `cycle-*-report.json`);
ADRs follow the `docs/adr/ADR-NNNN` convention (not `docs/decisions/`).
Dropped `emit-cycle-report.sh` + `validate-cycle-closeout.sh` mid-build
— agentops already has `scripts/evolve-log-cycle.sh`; parallel writers
would duplicate infra.
- **Wire + test the consumer:** bats test 1 fails if SKILL.md stops
calling the gate — the orphaned-primitive regression guard the prior
epic lacked.

## How tested

- `shellcheck scripts/evolve/halt-check.sh` — clean
- `bats tests/scripts/evolve-halt-check.bats` — 11/11 (incl.
consumer-wiring proof)
- `test-token-budgets.sh` — skills/evolve 9966 < 10000 (the Step 1
rewrite netted negative)
- `markdownlint` ADR-0007/0008 — 0 errors

Sibling pattern: mirrors mt-olympus `scripts/evolve/halt-check.sh`
(priority-ordered marker/regression checks, `--json` contract), adapted
to agentops markers.

Fitness: evolve guardrails 0 mechanical → 1 enforced pre-cycle; tests 0
→ 11 passing; skill budget 9989 → 9966.

Closes-scenario: soc-sfjx#substrate
Bounded-context: BC5-Runtime
Evidence: scripts/evolve/halt-check.sh
2026-05-22 07:05:27 -04:00