Skip to content

B4: harness-reframe prototype (experiment iteration → score + deterministic driver) - #120

Open
aarontrowbridge wants to merge 1 commit into
mainfrom
b4-harness-reframe-prototype
Open

B4: harness-reframe prototype (experiment iteration → score + deterministic driver)#120
aarontrowbridge wants to merge 1 commit into
mainfrom
b4-harness-reframe-prototype

Conversation

@aarontrowbridge

@aarontrowbridge aarontrowbridge commented Jul 9, 2026

Copy link
Copy Markdown
Member

Part of #109. Prototype for review — not a full close of the issue.

⚠️ This is the deepest / most-architectural slice of the depth-1 redesign and is deliberately shipped as a PROTOTYPE for review, not a merge-now change. It proves the shape of dissolving the LLM orchestrator for one experiment iteration; the full develop-mode DAG walk and retiring orchestrator.md are the B8 epic (#115), explicitly out of scope here.

What this proves

One experiment iteration runs end-to-end driven by a score + deterministic TS driver, not an LLM orchestrator:

select target (from ITERATION.toml, data)      ← no LLM
      │
dispatch ONE experimenter leaf (flat/depth-1)   ← the ONLY model seam; it authors the Julia script
      │
derive SolveSpec from the score + launch via    ← amico-run --spec runs the launch gate
the amico-run CLI (the §7.3 "harness calls         and, for tier-2/3, the independent re-rollout
the CLI directly" spine)
      │
record outcome + gate promotion on `agree`      ← bookkeeping, in code

The trust-tier, source exemplar, env, and promote decision are all data or code — the only judgment call in the loop is the single flat leaf that authors the script. That is the orchestrator dissolving, for one iteration.

Stands on #107 (G-1)

Per #107's recorded ruling: score-first for flow + a thin TS driver only for what the stage model can't express. The experiment-iteration loop is exactly that exception, so the flow lives as data (an ITERATION.toml harness score) and the loop lives as a thin driver in the amico-run (CLI) lineage. Blocked-by #107.

Acceptance criteria (#109)

  • one experiment iteration runs end-to-end driven by score + driver, not an LLM orchestrator
  • experimenter dispatched flat (depth-1); re-rollout gate runs incl. tier-2 (composed); promotion gated on agree
  • no control-flow logic left in an agent prompt for this path (it is runExperimentIteration, TS)

What changed

  • packages/amico-run/src/harness/iteration_score.ts (parse/validate the data-defined flow) + experiment_iteration.ts (the deterministic loop; the single model seam dispatchExperimenter is pluggable — production wires it to opencode run --agent experimenter).
  • Re-rollout gate extended to tier-2 (composed) per spec §4.3, not just tier-3/free — isVerifiedTier() in verify.ts is the single source of truth; cli.ts gates on it.
  • packages/extension/scores/experiment-iteration/ITERATION.toml — the example harness score (data). It is not a SCORE.md, so the interview repertoire loader ignores it by design.
  • Runnable demo + tests with deterministic fakes (no LLM, no Julia).
  • s31 grep-guard now recurses src/ so it also covers the new harness subdir (tool layer stays CLI/spawn: no fetch/MCP/HTTP).

What a reviewer runs

pnpm install
pnpm --filter @amicode/schema build
pnpm --filter @amicode/amico-run build
pnpm --filter @amicode/amico-run test          # 115 pass (was 106); the B4 acceptance is experiment_iteration.test.ts
pnpm --filter @amicode/amico-run demo:harness   # prints each deterministic step + the outcome, ends "PASS … No LLM in the control-flow loop."

Verified locally: amico-run typecheck clean, 115/115 tests pass, demo prints PASS. Extension scores/lint tests unaffected (the new dir is ignored by the interview loader).

Design choices a human should confirm

  1. Driver home = amico-run (CLI lineage), not the VS Code extension. Rationale: spec §7.3 makes the deterministic harness "call the CLI directly — no LLM," and the driver shells amico-run --spec so the launch gate + re-rollout are reused, not re-implemented. The example score still lives under extension/scores/. If reviewers want the driver in the extension proper, that's a move, not a rewrite.
  2. The SolveSpec is derived from the score, not authored by the leaf. The leaf authors only the Julia script; tier/source/env come from the data. This maximizes the "no LLM in control flow" property. Confirm that's the intended division of labor for the experimenter contract.
  3. Promotion policy for non-verified tiers. promote_on = "agree" gates verified tiers on the re-rollout; a vetted (tier-1) target has no re-rollout, so the driver promotes on completed (template-trusted). Confirm that's the desired tier-1 behavior.
  4. isVerifiedTier = {free, composed}. This is the §4.3 tier-2 extension (G-7 leaned default-on). Confirm default-on for composed vs per-score opt-in.

Notes

🤖 Generated with Claude Code

Prove one experiment iteration can run driven by a score + deterministic
TS driver rather than an LLM orchestrator (spec-20260708-112732 §3.2/§4.3,
plan slice B4, amicode#109). Stands on amicode#107's G-1 ruling: score-first
for flow + a thin TS driver only where the stage model can't express iteration.

What lands:
- `amico-run` harness module (src/harness/): an iteration-score parser (the
  data-defined flow) + `runExperimentIteration`, the deterministic control-flow
  loop that replaces the orchestrator prompt for one iteration — select target →
  dispatch ONE flat/depth-1 experimenter leaf → launch via the amico-run CLI →
  re-rollout verify → record + gate promotion on `agree`. The single model seam
  (`dispatchExperimenter`) is pluggable; production wires it to
  `opencode run --agent experimenter`.
- Re-rollout gate extended to TIER-2 (composed), not just tier-3/free (§4.3):
  `isVerifiedTier` is the single source of truth; cli.ts gates on it.
- Example harness score at extension/scores/experiment-iteration/ITERATION.toml
  (ignored by the interview repertoire loader, which only reads SCORE.md).
- Runnable demo (`pnpm --filter @amicode/amico-run demo:harness`) + tests that
  run the iteration with NO LLM and NO Julia (deterministic fakes), asserting:
  exactly one flat leaf, tier-2 re-rollout runs, promotion gated on agree.
- s31 grep-guard now recurses src/ so it covers the new harness subdir
  (no fetch/MCP/HTTP in the tool layer).

amico-run: 115 tests pass (was 106); typecheck clean; demo PASS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant