fix(conductor): self-heal missing harness config via lh init --yes

conductor previously jumped straight to lh host, which succeeds even
without .agents/harness.config.json, then silently hit a hard failure
later reading .agents/memory/INDEX.md (lh doctor confirms: config not
initialised). New projects had no automatic recovery path — lh init
was documented as a manual step users had to remember.

- conductor now runs lh doctor first; if config is missing it runs
  lh init --yes (non-interactive defaults) and re-checks, before lh host
- still stops and reports the exact failing check if lh doctor finds
  something it can't self-heal (e.g. no verify commands configured)
- README/QUICKSTART updated: lh init/lh doctor documented as optional
  manual pre-flight, not a required step, since conductor self-heals

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-09-10 01:57:05 +02:00
co-authored by Copilot
parent cf13066baa
commit 981cbceecf
3 changed files with 61 additions and 49 deletions
+44 -37
View File
@@ -13,43 +13,46 @@ Run the full lean harness pipeline. Edit no product files.
## PROCEDURE ## PROCEDURE
1. Run `lh host` first. 1. Run `lh doctor`.
2. Read the printed host strategy before any other action. 2. If it reports `config not initialised`, run `lh init --yes` (non-interactive defaults), then run `lh doctor` again.
3. If the strategy permits parallel lanes, use host fan-out. 3. Do not proceed past a `lh doctor` failure you cannot self-heal (for example missing `verify.commands`); report the exact failing check and stop.
4. If the strategy says sequential, run every lane one at a time. 4. Run `lh host`.
5. Run `lh run start` and capture the run id. 5. Read the printed host strategy before any other action.
6. Emit `lh run event` for every phase transition. 6. If the strategy permits parallel lanes, use host fan-out.
7. Load only `.agents/memory/INDEX.md` by default. 7. If the strategy says sequential, run every lane one at a time.
8. Pull memory shards only when the current phase needs them. 8. Run `lh run start` and capture the run id.
9. Start `scribe` after run start. 9. Emit `lh run event` for every phase transition.
10. Keep `scribe` non-blocking. 10. Load only `.agents/memory/INDEX.md` by default.
11. For design, invoke `interrogator`. 11. Pull memory shards only when the current phase needs them.
12. Require `.agents/specs/<slug>/decisions.md` before planning. 12. Start `scribe` after run start.
13. Enforce the user gate after design. 13. Keep `scribe` non-blocking.
14. Do not infer unanswered decisions. 14. For design, invoke `interrogator`.
15. For plan, invoke `architect`. 15. Require `.agents/specs/<slug>/decisions.md` before planning.
16. Require `.agents/specs/<slug>/spec.md`. 16. Enforce the user gate after design.
17. Invoke `splitter` to write `.agents/specs/<slug>/plan.dag.json`. 17. Do not infer unanswered decisions.
18. Validate the DAG with `lh graph`. 18. For plan, invoke `architect`.
19. Own the dynamic DAG after splitter returns. 19. Require `.agents/specs/<slug>/spec.md`.
20. For every checkpoint, read lane status and verifier output. 20. Invoke `splitter` to write `.agents/specs/<slug>/plan.dag.json`.
21. Re-plan at every checkpoint. 21. Validate the DAG with `lh graph`.
22. Spawn, kill, merge, or re-scope lanes only through updated `plan.dag.json` and `lh lane` commands. 22. Own the dynamic DAG after splitter returns.
23. For read lanes, run `scout` on the shared checkout. 23. For every checkpoint, read lane status and verifier output.
24. For write lanes, run `lh lane create` before any builder starts. 24. Re-plan at every checkpoint.
25. Assign each builder exactly one lane and one worktree. 25. Spawn, kill, merge, or re-scope lanes only through updated `plan.dag.json` and `lh lane` commands.
26. Give each builder its declared scope globs and acceptance ids. 26. For read lanes, run `scout` on the shared checkout.
27. Run builder and verifier in the Ralph loop. 27. For write lanes, run `lh lane create` before any builder starts.
28. Stop a lane only when all Ralph exit criteria hold. 28. Assign each builder exactly one lane and one worktree.
29. On failure, isolate cause, retry within bound, then re-plan around it. 29. Give each builder its declared scope globs and acceptance ids.
30. Escalate to the user on max Ralph iterations. 30. Run builder and verifier in the Ralph loop.
31. When build lanes pass, invoke `integrator`. 31. Stop a lane only when all Ralph exit criteria hold.
32. Require sequential integration even on parallel-capable hosts. 32. On failure, isolate cause, retry within bound, then re-plan around it.
33. Require one final full verify after all lane merges. 33. Escalate to the user on max Ralph iterations.
34. Invoke `reviewer` for final approval if not already done by integrator. 34. When build lanes pass, invoke `integrator`.
35. Run `scribe` for final journal and deltas. 35. Require sequential integration even on parallel-capable hosts.
36. Run `lh run end` with success or failure. 36. Require one final full verify after all lane merges.
37. Return only run id, changed lanes, verify status, and blockers. 37. Invoke `reviewer` for final approval if not already done by integrator.
38. Run `scribe` for final journal and deltas.
39. Run `lh run end` with success or failure.
40. Return only run id, changed lanes, verify status, and blockers.
## INPUTS ## INPUTS
@@ -75,10 +78,14 @@ Run the full lean harness pipeline. Edit no product files.
- Stop when max Ralph iterations are reached. - Stop when max Ralph iterations are reached.
- Stop when `lh graph` keeps failing after re-plan. - Stop when `lh graph` keeps failing after re-plan.
- Stop when host strategy forbids required action. - Stop when host strategy forbids required action.
- Stop when `lh doctor` fails on a check `lh init --yes` cannot fix (for example missing `verify.commands`); report it, don't guess a fix.
## NEVER DO THIS ## NEVER DO THIS
- Never edit source files yourself. - Never edit source files yourself.
- Never skip `lh doctor` at start.
- Never run `lh init` with prompts; always `--yes` (non-interactive).
- Never re-run `lh init` if `lh doctor` already reports `config` ok.
- Never skip `lh host`. - Never skip `lh host`.
- Never skip `lh run start`. - Never skip `lh run start`.
- Never bypass the design user gate. - Never bypass the design user gate.
+5 -3
View File
@@ -140,11 +140,13 @@ export CONTEXT7_API_KEY="<your key>" # add to ~/.bashrc or ~/.zshrc
```bash ```bash
cd your-repo cd your-repo
lh init # first-run wizard; writes .agents/harness.config.json lh init # optional: first-run wizard; writes .agents/harness.config.json
lh doctor # confirm everything is wired lh doctor # optional: confirm everything is wired
``` ```
Then, in Copilot CLI or VS Code Copilot: `conductor` runs `lh doctor` itself and self-heals a missing config with `lh init --yes`
before doing anything else, so the two commands above are an optional manual pre-flight, not
a required step. Then, in Copilot CLI or VS Code Copilot:
``` ```
Use the conductor agent to build a rate limiter for the public API Use the conductor agent to build a rate limiter for the public API
+12 -9
View File
@@ -172,17 +172,20 @@ subcommand, who calls it, and when.
| `lh lane create/status/merge` | `conductor`, `builder`, `integrator` | Automatically, before a write lane starts and when it merges | | `lh lane create/status/merge` | `conductor`, `builder`, `integrator` | Automatically, before a write lane starts and when it merges |
| `lh memory get/put/scan` | `interrogator`, `architect`, `builder`, `scribe` | Automatically, to pull relevant shards before work and record facts/failures after | | `lh memory get/put/scan` | `interrogator`, `architect`, `builder`, `scribe` | Automatically, to pull relevant shards before work and record facts/failures after |
| `lh graph` | `verifier` (always), plus `architect`/`splitter`/`conductor`/`reviewer`/`scout`/`integrator` at their own checkpoints | Automatically — it's exit criterion #3, never skipped | | `lh graph` | `verifier` (always), plus `architect`/`splitter`/`conductor`/`reviewer`/`scout`/`integrator` at their own checkpoints | Automatically — it's exit criterion #3, never skipped |
| `lh init` | You (or `scripts/onboard.mjs` on your behalf) | Once per repo, at setup, or to repair a missing `.agents/` baseline | | `lh doctor` | `conductor` (first thing, before `lh host`), also you whenever you want to check the environment yourself | Automatically at the start of every pipeline run — `conductor`'s step 1 |
| `lh doctor` | You | Whenever you want to check the environment yourself — before starting, after upgrading Node/git/the plugin, or to diagnose a stuck run. Also run once automatically right after `lh init` | | `lh init --yes` | `conductor`, automatically, only if `lh doctor` reports `config not initialised` | Self-heals a missing `.agents/` baseline with non-interactive defaults, then re-runs `lh doctor` |
| `lh report <run-id>` | You | After a run, when you want a human-readable markdown summary instead of raw NDJSON. No agent generates this for you | | `lh report <run-id>` | You | After a run, when you want a human-readable markdown summary instead of raw NDJSON. No agent generates this for you |
So the only commands you are expected to type by hand in everyday use are `lh init` (setup), So in everyday use you don't have to type `lh init` or `lh doctor` by hand at all —
`lh doctor` (diagnostics), and `lh report` (reading a past run's summary). Everything else — `conductor` runs `lh doctor` first, and if that reports the repo isn't initialised, it runs
`lh index`, `lh host`, `lh run`, `lh lane`, `lh memory`, `lh graph` — is invoked by the agents `lh init --yes` for you (defaults, no prompts) and re-checks before doing anything else. It
as a scripted, mandatory step in their own instructions. You'd only run one of those manually still stops and reports the exact failing check if `lh doctor` finds something it can't
if you're debugging outside the agent flow (e.g. `lh graph` on its own to check structure self-heal (for example no verify commands configured yet in a brand-new, empty repo).
before opening Copilot at all, or `lh memory get --shard failures` to read what the harness has `lh init`/`lh doctor` remain available for you to run by hand too — useful before starting
learned). (to pre-flight a repo), after upgrading Node/git/the plugin, or to diagnose a stuck run outside
the agent flow. The only command with no agent equivalent at all is `lh report` (reading a past
run's summary). Everything else — `lh index`, `lh host`, `lh run`, `lh lane`, `lh memory`,
`lh graph` — is invoked by the agents as a scripted, mandatory step in their own instructions.
## 5. Know when it's actually done ## 5. Know when it's actually done