leos-agent 7.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +544 -28
- package/commands/handoff.md +11 -0
- package/commands/handon.md +10 -0
- package/commands/review-pr.md +9 -0
- package/commands-claude/watch-review.md +9 -0
- package/index.js +12 -0
- package/package.json +29 -14
- package/payload/codex-agents/leo-executor.toml +36 -0
- package/payload/codex-agents/leo-runner.toml +28 -0
- package/rules/preferences.md +97 -0
- package/scripts/check.py +244 -0
- package/scripts/ghreview.py +17 -3
- package/scripts/handoff.py +183 -0
- package/scripts/leo-install.py +509 -0
- package/scripts/measure_context.py +113 -0
- package/scripts/publish-npm.py +138 -0
- package/scripts/watch_review.py +169 -0
- package/skills/doctor/SKILL.md +73 -115
- package/skills/doctor/agents/openai.yaml +5 -0
- package/skills/handoff/SKILL.md +99 -0
- package/skills/handoff/agents/openai.yaml +5 -0
- package/skills/handon/SKILL.md +61 -0
- package/skills/install/SKILL.md +79 -0
- package/skills/install/agents/openai.yaml +5 -0
- package/skills/review-pr/SKILL.md +59 -318
- package/skills/review-pr/reference/lenses.md +67 -0
- package/skills/review-pr/reference/procedure.md +348 -0
- package/skills-claude/attach-pr/SKILL.md +178 -0
- package/skills-claude/watch-review/SKILL.md +91 -0
- package/adapters/cursor/agents/executor.md +0 -17
- package/adapters/cursor/agents/expert.md +0 -70
- package/adapters/cursor/agents/explore.md +0 -16
- package/adapters/cursor/agents/implementer.md +0 -18
- package/adapters/cursor/agents/investigator.md +0 -18
- package/adapters/cursor/agents/planner.md +0 -28
- package/adapters/cursor/agents/review-lens.md +0 -22
- package/adapters/cursor/agents/reviewer.md +0 -34
- package/adapters/opencode/agents.json +0 -105
- package/adapters/opencode/plugin.js +0 -576
- package/config/MCP_PINS.md +0 -17
- package/config/models.json +0 -676
- package/hooks/bash-guard.py +0 -583
- package/hooks/cursor-guard.py +0 -84
- package/hooks/hooks-cursor.json +0 -11
- package/hooks/hooks.json +0 -20
- package/hooks/session-start.py +0 -148
- package/roles/executor.md +0 -15
- package/roles/expert.md +0 -67
- package/roles/explore.md +0 -13
- package/roles/implementer.md +0 -16
- package/roles/investigator.md +0 -15
- package/roles/planner.md +0 -25
- package/roles/review-lens.md +0 -20
- package/roles/reviewer.md +0 -31
- package/scripts/doctor.py +0 -520
- package/scripts/jsonc_bridge.cjs +0 -23
- package/scripts/memory.py +0 -744
- package/scripts/render_adapters.py +0 -508
- package/scripts/setup.py +0 -1753
- package/settings.json +0 -7
- package/skills/.gitkeep +0 -0
- package/skills/brainstorming/SKILL.md +0 -111
- package/skills/debugging/SKILL.md +0 -100
- package/skills/delegation/SKILL.md +0 -143
- package/skills/executing-plans/SKILL.md +0 -117
- package/skills/finishing-a-branch/SKILL.md +0 -125
- package/skills/freshness/SKILL.md +0 -131
- package/skills/memory/SKILL.md +0 -154
- package/skills/resolve-ticket/SKILL.md +0 -275
- package/skills/setup/SKILL.md +0 -199
- package/skills/setup/agents/openai.yaml +0 -5
- package/skills/test-first/SKILL.md +0 -92
- package/skills/using-leo/SKILL.md +0 -101
- package/skills/using-leo/references/claude-mapping.md +0 -33
- package/skills/using-leo/references/codex-mapping.md +0 -33
- package/skills/using-leo/references/cursor-mapping.md +0 -35
- package/skills/using-leo/references/hermes-mapping.md +0 -37
- package/skills/using-leo/references/opencode-mapping.md +0 -39
- package/skills/verification/SKILL.md +0 -110
- package/skills/visual-verification/SKILL.md +0 -115
- package/skills/watch-review/SKILL.md +0 -128
- package/skills/watch-review/agents/openai.yaml +0 -5
- package/skills/worktrees/SKILL.md +0 -131
- package/skills/writing-plans/SKILL.md +0 -97
- package/skills/writing-skills/SKILL.md +0 -141
- package/vendor/jsonc-parser-3.3.1/LICENSE.md +0 -21
- package/vendor/jsonc-parser-3.3.1/README.md +0 -26
- package/vendor/jsonc-parser-3.3.1/lib/umd/impl/edit.js +0 -201
- package/vendor/jsonc-parser-3.3.1/lib/umd/impl/format.js +0 -275
- package/vendor/jsonc-parser-3.3.1/lib/umd/impl/parser.js +0 -682
- package/vendor/jsonc-parser-3.3.1/lib/umd/impl/scanner.js +0 -456
- package/vendor/jsonc-parser-3.3.1/lib/umd/impl/string-intern.js +0 -42
- package/vendor/jsonc-parser-3.3.1/lib/umd/main.d.ts +0 -351
- package/vendor/jsonc-parser-3.3.1/lib/umd/main.js +0 -194
- package/vendor/jsonc-parser-3.3.1/package.json +0 -37
- package/workflows/cost-tiered-fix.js +0 -287
package/settings.json
DELETED
package/skills/.gitkeep
DELETED
|
File without changes
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: brainstorming
|
|
3
|
-
description: >
|
|
4
|
-
Design gate before non-trivial code — proportional to blast radius and
|
|
5
|
-
reversibility, the deliberate opposite of an unconditional gate. Contained,
|
|
6
|
-
easily reversible changes clear with one sentence of rationale; changes with
|
|
7
|
-
wide blast radius, hard to reverse, or that introduce new surface need
|
|
8
|
-
genuine, viable alternatives with trade-offs weighed before any code gets
|
|
9
|
-
written. Produces the chosen approach and its trade-offs, sized to the gate,
|
|
10
|
-
handed off to leo:writing-plans. Use when choosing an approach before
|
|
11
|
-
non-trivial code. Do not use for contained reversible tweaks, investigation,
|
|
12
|
-
or writing the plan itself.
|
|
13
|
-
when_to_use: >
|
|
14
|
-
Before starting non-trivial code: a new feature, a new integration surface,
|
|
15
|
-
a schema or data-model change, anything that's expensive or awkward to
|
|
16
|
-
undo. NOT for a contained, easily reversible tweak (that just needs one
|
|
17
|
-
sentence of rationale, not this skill's full procedure), NOT for pure
|
|
18
|
-
investigation (use investigator), and NOT for writing the plan itself
|
|
19
|
-
(leo:writing-plans) — brainstorming stops at a chosen approach, it never
|
|
20
|
-
slides into implementation.
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
# brainstorming
|
|
24
|
-
|
|
25
|
-
Core rule: the depth of the design gate is proportional to blast radius and
|
|
26
|
-
reversibility, not to how the task felt when it landed. A one-line change to
|
|
27
|
-
a private helper does not need three alternatives; a new public API or a
|
|
28
|
-
schema migration does.
|
|
29
|
-
|
|
30
|
-
## Size the gate first
|
|
31
|
-
|
|
32
|
-
Before generating anything, classify the change:
|
|
33
|
-
|
|
34
|
-
- **Contained + easily reversible** (a local refactor, an internal helper, a
|
|
35
|
-
flag you can flip back) → one sentence of rationale is enough. Say what
|
|
36
|
-
you're doing and why, then move to leo:writing-plans or straight to
|
|
37
|
-
implementation per the routing table.
|
|
38
|
-
- **Wide blast radius, hard to reverse, or new surface** (public API, schema
|
|
39
|
-
or data-model change, cross-service contract, anything users or other
|
|
40
|
-
systems will come to depend on) → full gate: genuine alternatives with
|
|
41
|
-
trade-offs, written down, before any code.
|
|
42
|
-
|
|
43
|
-
When unsure which bucket, treat it as the wider one — the cost of one extra
|
|
44
|
-
paragraph is nothing next to the cost of an unreversible wrong turn.
|
|
45
|
-
|
|
46
|
-
## Alternatives must be viable
|
|
47
|
-
|
|
48
|
-
Every alternative in a full gate has to be something a reasonable engineer
|
|
49
|
-
could actually ship and defend, not a strawman stood up to make the first
|
|
50
|
-
idea look good by comparison. If you can't articulate a real reason someone
|
|
51
|
-
would pick alternative B, it isn't an alternative — go find one that's
|
|
52
|
-
actually competing for the job, or drop down to the one-sentence gate because
|
|
53
|
-
there's really only one sane approach.
|
|
54
|
-
|
|
55
|
-
Test: could you argue for this option in front of Leo without a "but
|
|
56
|
-
obviously we won't do this" tone? If not, it's a strawman — cut it.
|
|
57
|
-
|
|
58
|
-
## Generation method
|
|
59
|
-
|
|
60
|
-
To surface genuinely different options, vary along a different axis each
|
|
61
|
-
time rather than producing three cosmetic variants of the same idea:
|
|
62
|
-
|
|
63
|
-
1. **Data model vs. control flow vs. boundary/interface** — would this
|
|
64
|
-
problem look different if you moved the complexity into the data shape,
|
|
65
|
-
into how execution flows, or into where the interface/boundary sits?
|
|
66
|
-
2. **Prior art in the repo** — grep for how this repo already solved a
|
|
67
|
-
similar problem (via explore, not inline digging) and steal that pattern
|
|
68
|
-
before inventing a new one. Consistency with existing structure is a real
|
|
69
|
-
trade-off, not a tie-breaker of last resort.
|
|
70
|
-
3. **The 10x-simpler version** — what would this look like with one-tenth
|
|
71
|
-
the code/config/moving parts? Even when you don't ship it, it's usually
|
|
72
|
-
the sharpest lens on what the "proper" version is paying for.
|
|
73
|
-
|
|
74
|
-
## Output
|
|
75
|
-
|
|
76
|
-
- Contained/reversible: one sentence of rationale, folded into the plan or
|
|
77
|
-
the commit itself.
|
|
78
|
-
- Full gate: the chosen approach plus the trade-offs record — a paragraph for
|
|
79
|
-
a medium decision, a short doc for a genuinely high-stakes one. Sized to
|
|
80
|
-
the gate, not padded to look thorough.
|
|
81
|
-
|
|
82
|
-
Either way, the output is a decision, not code. Hand it to
|
|
83
|
-
leo:writing-plans for the actual plan; brainstorming never slides into
|
|
84
|
-
implementation itself.
|
|
85
|
-
|
|
86
|
-
## Self-talk to catch
|
|
87
|
-
|
|
88
|
-
- "I'll just list two options so it looks considered" — if you can't defend
|
|
89
|
-
both, that's a strawman, not a gate.
|
|
90
|
-
- "This is a big change but I already know the answer" — blast radius and
|
|
91
|
-
reversibility decide the gate size, not your confidence.
|
|
92
|
-
- "I'll sketch the plan while I'm at it" — that's leo:writing-plans' job;
|
|
93
|
-
stop at the chosen approach.
|
|
94
|
-
- "One sentence feels thin for something this exciting" — excitement isn't
|
|
95
|
-
blast radius; if it's contained and reversible, one sentence is correct.
|
|
96
|
-
|
|
97
|
-
## Escalation
|
|
98
|
-
|
|
99
|
-
Planning-tier work runs at Opus per the routing table (plan mode in an Opus
|
|
100
|
-
session, or the `planner` subagent otherwise). Escalate per the standard
|
|
101
|
-
ladder: two failed passes at reaching a defensible set of alternatives step
|
|
102
|
-
up a tier; a genuine deadlock between two Opus-tier framings goes to
|
|
103
|
-
`expert`, announced in one line, never silently.
|
|
104
|
-
|
|
105
|
-
## Works with
|
|
106
|
-
|
|
107
|
-
- leo:writing-plans — takes the chosen approach and turns it into an
|
|
108
|
-
executable plan.
|
|
109
|
-
- investigator — for questions that need evidence before a design question
|
|
110
|
-
can even be framed.
|
|
111
|
-
- explore — cheap prior-art search feeding the generation method above.
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: debugging
|
|
3
|
-
description: >
|
|
4
|
-
Root-cause-before-fix loop for bugs, failing tests, crashes, and surprising
|
|
5
|
-
behavior. Five named phases — Reproduce, Localize, Hypothesize, Prove, Fix —
|
|
6
|
-
each with an exit criterion, so a fix never lands before the cause is
|
|
7
|
-
pinned to file:line. Diagnosis is read-only judge work (investigator); the
|
|
8
|
-
fix happens separately, at the routed tier. Use when a bug, failure, crash,
|
|
9
|
-
or surprising behavior needs diagnosis. Do not use for planned features,
|
|
10
|
-
reviewing a diff, or post-fix completion verification.
|
|
11
|
-
when_to_use: >
|
|
12
|
-
Any bug report, failing test, crash, stack trace, or "why does X happen"
|
|
13
|
-
before proposing a fix — used by the investigator agent and by the main
|
|
14
|
-
loop ahead of any edit that touches broken behavior. NOT for planned
|
|
15
|
-
feature work with no defect (that's planner), NOT for judging someone
|
|
16
|
-
else's diff (that's reviewer), and NOT a substitute for leo:verification
|
|
17
|
-
after the fix lands — this skill ends at Fix, verification is separate.
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
# debugging
|
|
21
|
-
|
|
22
|
-
Core rule: no fix before the cause is REPRODUCED and LOCATED at file:line. A
|
|
23
|
-
symptom going away is not proof — it's a coincidence until the loop below
|
|
24
|
-
says otherwise.
|
|
25
|
-
|
|
26
|
-
## When it fires
|
|
27
|
-
|
|
28
|
-
Bug reports, failing tests, crashes, stack traces, flaky behavior, "this
|
|
29
|
-
should work but doesn't." Route the diagnosis itself through `investigator`
|
|
30
|
-
(Opus, read-only) per the model-routing table — this skill is its loop.
|
|
31
|
-
Doesn't fire for greenfield feature work (no defect exists yet) or for
|
|
32
|
-
diffing someone else's change (that's `reviewer`).
|
|
33
|
-
|
|
34
|
-
## The five phases
|
|
35
|
-
|
|
36
|
-
Named exactly, run in order, each with an exit criterion. Do not skip a
|
|
37
|
-
phase because the bug "looks obvious" — obvious bugs are exactly the ones
|
|
38
|
-
where a wrong guess ships fastest.
|
|
39
|
-
|
|
40
|
-
| Phase | Exit criterion |
|
|
41
|
-
|---|---|
|
|
42
|
-
| **Reproduce** | The failure fires on command — a test, a script, a repro sequence — not "worked once." No stable repro yet is itself a finding: report it, don't guess past it. |
|
|
43
|
-
| **Localize** | The failure is traced to a specific **file:line**, not a subsystem or a vibe ("something in auth"). Read the actual code path the repro exercises; don't infer from names or docs. |
|
|
44
|
-
| **Hypothesize** | One sentence: "X happens because file:line does Y instead of Z." One hypothesis at a time — write it down before touching anything. |
|
|
45
|
-
| **Prove** | The smallest evidence that the hypothesis IS the cause, not just correlated with it. Where the surface is testable, that's a failing test written per `leo:test-first` — red on the bug, and its assertion names the file:line from Localize. Where nothing is testable (infra, timing, external system), the next-smallest evidence: a log line, a debugger break, a minimal repro script. |
|
|
46
|
-
| **Fix** | The change that makes Prove's evidence pass. Happens at the routed tier (`executor` for mechanical, `implementer` for real changes) — never by the same pass that diagnosed it. |
|
|
47
|
-
|
|
48
|
-
Reproduce and Localize can compress into one step for a trivial case (a
|
|
49
|
-
crash with a one-frame stack trace pointing straight at the bug) — but
|
|
50
|
-
Hypothesize and Prove never collapse into Fix. If you catch yourself editing
|
|
51
|
-
code before you've written the hypothesis sentence, stop and back up.
|
|
52
|
-
|
|
53
|
-
## One hypothesis, one change
|
|
54
|
-
|
|
55
|
-
Test one hypothesis at a time. If Fix doesn't clear Prove's evidence, the
|
|
56
|
-
hypothesis was wrong — REVERT the change before forming the next one. Never
|
|
57
|
-
stack a second speculative edit on top of a first that didn't pan out; you
|
|
58
|
-
lose the ability to tell which change did what, and the diff stops being
|
|
59
|
-
reviewable. Revert, re-enter Hypothesize with what the failed attempt taught
|
|
60
|
-
you, and go again.
|
|
61
|
-
|
|
62
|
-
## Stuck: the ladder
|
|
63
|
-
|
|
64
|
-
After two failures on the same cause (two hypotheses tried and reverted, still
|
|
65
|
-
no Prove), step up one tier rather than retrying at the same one — investigator
|
|
66
|
-
explore findings feed a full investigator, and investigator itself steps to a
|
|
67
|
-
second, more evidence-fed pass, capped at Opus. A genuine deadlock, or two
|
|
68
|
-
Opus verdicts on the same cause that disagree → `expert`, announced in one
|
|
69
|
-
line ("escalating to expert: <question>") before it's invoked, never silent.
|
|
70
|
-
Don't loop a third time at the same tier hoping the next guess lands — that's
|
|
71
|
-
the same failure mode as skipping Prove, just slower.
|
|
72
|
-
|
|
73
|
-
## Diagnosis and fix stay separate
|
|
74
|
-
|
|
75
|
-
The phase that reaches the verdict (Reproduce through Prove) is read-only
|
|
76
|
-
judge work — no edits, no reverts-of-other-people's-code, just evidence and a
|
|
77
|
-
file:line. Whoever ran that pass hands the hypothesis and its proof to the
|
|
78
|
-
executing tier for Fix. This mirrors why `reviewer` never patches what it
|
|
79
|
-
finds: the same pass that wants to be right about the cause is a bad judge of
|
|
80
|
-
whether it actually is. After Fix lands, `leo:verification` (or a plain
|
|
81
|
-
`reviewer` pass on the diff) is the separate check that the fix is real and
|
|
82
|
-
didn't just make Prove's specific probe go quiet.
|
|
83
|
-
|
|
84
|
-
## Self-talk to catch
|
|
85
|
-
|
|
86
|
-
- "It's obviously the timeout" — obvious is not file:line; go Localize it.
|
|
87
|
-
- "Passing now, good enough" — passing isn't Prove; did you write the
|
|
88
|
-
failing-first check, or did the symptom just stop reproducing?
|
|
89
|
-
- "I'll patch this and see if it helps" — that's skipping Hypothesize; name
|
|
90
|
-
the mechanism before touching code.
|
|
91
|
-
- "One more tweak on top, I'm close" — that's the stacked-edit trap; revert
|
|
92
|
-
first.
|
|
93
|
-
- "Third guess this tier, one more won't hurt" — it's the two-failures
|
|
94
|
-
trigger; escalate instead.
|
|
95
|
-
|
|
96
|
-
## Works with
|
|
97
|
-
|
|
98
|
-
`leo:test-first` for writing Prove's failing test. `leo:verification` for
|
|
99
|
-
the post-Fix check. `investigator` runs this loop; `reviewer` judges the
|
|
100
|
-
resulting diff once Fix is applied.
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: delegation
|
|
3
|
-
description: >
|
|
4
|
-
Operational mechanics for dispatching subagents — a single spawn or a large
|
|
5
|
-
fan-out — the companion to the policy's "Delegate the labor" section.
|
|
6
|
-
Covers brief construction, model/effort pinning, the four-state return
|
|
7
|
-
contract, and ledger-backed progress tracking for long multi-agent runs. Use
|
|
8
|
-
when dispatching any subagent or fan-out. Do not use to choose a task's tier.
|
|
9
|
-
when_to_use: >
|
|
10
|
-
Any time work is routed to a subagent (explore, investigator, executor,
|
|
11
|
-
implementer, reviewer, expert) rather than done inline — single dispatch or
|
|
12
|
-
fan-out. NOT for deciding *which* tier a task belongs in (that's the
|
|
13
|
-
routing table in the injected leo:using-leo policy); this skill covers what
|
|
14
|
-
to do once the tier is already chosen.
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# delegation
|
|
18
|
-
|
|
19
|
-
Core rule: a subagent gets one shot at the brief and no session history. If
|
|
20
|
-
the brief doesn't stand alone, the dispatch is already broken.
|
|
21
|
-
|
|
22
|
-
## Writing the brief
|
|
23
|
-
|
|
24
|
-
Every dispatch is self-contained: goal, constraints, exact file paths, the
|
|
25
|
-
checks to run, and what the return must contain. Write it as if for a
|
|
26
|
-
stranger who will never see this conversation — because that's what a
|
|
27
|
-
subagent is. A brief missing a file path or a check produces a report that
|
|
28
|
-
looks done and isn't.
|
|
29
|
-
|
|
30
|
-
Bad: "fix the flaky auth test." Good: "`tests/auth/session_test.py::test_expiry`
|
|
31
|
-
fails intermittently (repro: run it 20x, ~1 in 8 fails). Fix the race, keep
|
|
32
|
-
the test's intent unchanged, don't touch other tests in the file. Run
|
|
33
|
-
`pytest tests/auth/session_test.py -x` 20 times clean before reporting done.
|
|
34
|
-
Return: files touched, the race you found, the check output." The second
|
|
35
|
-
version needs no follow-up question; the first invites three.
|
|
36
|
-
|
|
37
|
-
## Pin model and effort
|
|
38
|
-
|
|
39
|
-
Every dispatch pins **model AND effort** from the routing table — opus for
|
|
40
|
-
judges (reviewer, investigator), sonnet for normal implementation
|
|
41
|
-
(implementer), haiku for mechanical work (executor). expert
|
|
42
|
-
never appears in a fan-out — one at a time, never fanned. An unpinned call
|
|
43
|
-
silently inherits the session's tier: in an opus session that means every
|
|
44
|
-
executor spawn quietly runs at opus, and a ten-item fan-out burns
|
|
45
|
-
opus-fan-out money for haiku-shaped work. Pin both fields on every spawn, not
|
|
46
|
-
just the ones that "obviously" need it.
|
|
47
|
-
|
|
48
|
-
## The four-state return contract
|
|
49
|
-
|
|
50
|
-
A subagent's report must resolve to exactly one of four states. Don't accept
|
|
51
|
-
a report that hedges across two of them.
|
|
52
|
-
|
|
53
|
-
| State | Means | Your response |
|
|
54
|
-
|---|---|---|
|
|
55
|
-
| `done` | Work finished, matches the brief | Verify against artifacts — see leo:verification — never take the self-report at face value |
|
|
56
|
-
| `concerns` | Finished, but flags something worth a second look | Read the concerns before accepting; they're often the real finding |
|
|
57
|
-
| `needs-context` | Blocked on missing information you can supply | Send the missing piece to the same agent (`SendMessage` on Claude Code, `followup_task` on Codex — elsewhere see the *Follow-up to a live agent* row of your mapping, and where none is established, cold re-dispatch with the context restated is the whole mechanism) so it keeps the context it already built. Either way **once** — a second needs-context on the same gap means the brief itself is broken, escalate the tier |
|
|
58
|
-
| `blocked` | Blocked on something you can't hand over inline | Resolve the blocker, or escalate per the ladder — never a silent same-tier retry |
|
|
59
|
-
|
|
60
|
-
`needs-context` and `blocked` look similar; the test is whether the missing
|
|
61
|
-
piece is something *you* hold (needs-context — a file path, a decision, a
|
|
62
|
-
credential) or something neither of you can supply without more work
|
|
63
|
-
(blocked — a failing external service, a genuinely ambiguous requirement).
|
|
64
|
-
|
|
65
|
-
Each role's own prompt carries the state line it must emit, so the contract
|
|
66
|
-
is enforced at both ends. Two roles are deliberately narrowed: `reviewer`
|
|
67
|
-
emits only `done` / `needs-context` (severity already lives in
|
|
68
|
-
`blocking`/`non-blocking`, and the diff's own verdict in
|
|
69
|
-
`approved`/`needs-changes`), and `expert` never emits `blocked` — it is the
|
|
70
|
-
ceiling, so there is nothing left to escalate to. `status` is a separate axis
|
|
71
|
-
from `confidence`: status routes your next move, confidence rates the work.
|
|
72
|
-
|
|
73
|
-
## Long multi-agent runs: the ledger
|
|
74
|
-
|
|
75
|
-
A run spanning many dispatches survives context compaction only if progress
|
|
76
|
-
is persisted outside the conversation. Use
|
|
77
|
-
`${CLAUDE_PLUGIN_ROOT}/scripts/state.py` (get / merge / path — flock-guarded,
|
|
78
|
-
atomic writes, keyed per repo) as the ledger, not ad hoc notes in the
|
|
79
|
-
transcript. Each entry: item id, status (one of the four states above, plus
|
|
80
|
-
`pending` / `in-progress`), artifact path (branch name, file, or diff). On
|
|
81
|
-
resume, read the ledger first — anything already `done` or `concerns` is not
|
|
82
|
-
re-dispatched; anything `blocked` is reported, not silently retried.
|
|
83
|
-
|
|
84
|
-
A ledger entry is small — `{"items": {"<id>": {"status": "done", "artifact":
|
|
85
|
-
"branch:fix/eng-123-slug"}}}` merged via `python3 "${CLAUDE_PLUGIN_ROOT}/scripts/state.py"
|
|
86
|
-
merge <skill-name> <owner/repo> '<patch>'` — but it's the only thing standing between a
|
|
87
|
-
compaction mid-run and forty items silently re-dispatched from item 1.
|
|
88
|
-
Update it after every dispatch resolves, not in a batch at the end: a crash
|
|
89
|
-
between "agent finished" and "ledger written" is exactly the gap this
|
|
90
|
-
exists to close.
|
|
91
|
-
|
|
92
|
-
`${CLAUDE_PLUGIN_ROOT}` above is the Claude Code spelling of the plugin root,
|
|
93
|
-
and it is substituted into this text only there. Codex exposes `$PLUGIN_ROOT`
|
|
94
|
-
and Cursor `$CURSOR_PLUGIN_ROOT`. Hermes and OpenCode expose no root variable;
|
|
95
|
-
their injected policy substitutes an absolute payload path into the `state.py`
|
|
96
|
-
and `memory.py` commands, which is the discoverable source to reuse. Do not
|
|
97
|
-
invent an environment variable where the harness exposes none.
|
|
98
|
-
|
|
99
|
-
For a batch of independent, well-scoped fixes, don't hand-roll this loop —
|
|
100
|
-
the reusable workflow at `${CLAUDE_PLUGIN_ROOT}/workflows/cost-tiered-fix.js`
|
|
101
|
-
(Workflow tool, `scriptPath`) already implements plan → tiered execute →
|
|
102
|
-
opus verify with escalation built in, including its own progress tracking.
|
|
103
|
-
Reach for it before writing a bespoke fan-out loop; write the ledger
|
|
104
|
-
approach above only when the run doesn't fit that workflow's shape (e.g. one
|
|
105
|
-
dispatch at a time inside a larger interactive flow, not a clean batch).
|
|
106
|
-
That workflow needs Claude Code's Workflow tool; on every other harness the
|
|
107
|
-
ledger above is the whole mechanism, so use it directly rather than looking
|
|
108
|
-
for a runner that isn't there.
|
|
109
|
-
|
|
110
|
-
## Parallel dispatch: own your files
|
|
111
|
-
|
|
112
|
-
Fan-out is safe only when each spawn writes to **disjoint** files — no two
|
|
113
|
-
concurrent dispatches touching the same path. If the work can't be split
|
|
114
|
-
into disjoint file sets (one coherent change that happens to span many
|
|
115
|
-
files, like a single ticket fix), don't fan out — either run it sequentially
|
|
116
|
-
in one dispatch, or give each spawn its own isolated tree via leo:worktrees
|
|
117
|
-
so parallel edits can't collide even when the file sets overlap.
|
|
118
|
-
|
|
119
|
-
## Self-talk to catch
|
|
120
|
-
|
|
121
|
-
- "I'll skip pinning effort, model is enough" — no; an unpinned effort on an
|
|
122
|
-
opus judge still runs at opus prices, at auto effort, which is not what
|
|
123
|
-
the routing table costed out.
|
|
124
|
-
- "The brief is short, they'll infer the rest" — a subagent infers nothing;
|
|
125
|
-
it has this brief and nothing else.
|
|
126
|
-
- "It said needs-context, I'll just re-ask the same way" — re-dispatching
|
|
127
|
-
with the identical brief reproduces the identical gap; either add the
|
|
128
|
-
missing piece or step up a tier. And prefer messaging the same agent over
|
|
129
|
-
a fresh spawn: a cold re-dispatch pays again for the context it already
|
|
130
|
-
built and can rediscover the same gap from a different angle.
|
|
131
|
-
- "Two spawns editing the same file will probably be fine, they touch
|
|
132
|
-
different functions" — same file is not disjoint; sequence them or
|
|
133
|
-
isolate with a worktree.
|
|
134
|
-
- "This ten-item fan-out is basically cost-tiered-fix, I'll just write the
|
|
135
|
-
loop myself" — the workflow already handles escalation and orphan
|
|
136
|
-
tracking; reinventing it inline drops that for no reason.
|
|
137
|
-
|
|
138
|
-
## Works with
|
|
139
|
-
|
|
140
|
-
- leo:verification — how a `done` report gets checked against real
|
|
141
|
-
artifacts, not trusted as stated.
|
|
142
|
-
- leo:worktrees — file isolation for parallel dispatches that can't be made
|
|
143
|
-
disjoint by scope alone.
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: executing-plans
|
|
3
|
-
description: >
|
|
4
|
-
Checkpoint discipline for carrying out a written plan — batch execution
|
|
5
|
-
with a check at every batch boundary, plan-intent-wins-on-architecture /
|
|
6
|
-
reality-wins-on-mechanics arbitration, and one fix-then-re-review cycle
|
|
7
|
-
before stopping to report. Used by the implementer agent, or the main loop
|
|
8
|
-
when it executes a plan directly. Use when a written plan is about to become
|
|
9
|
-
code. Do not use for open-ended work without a plan or for reviewing a diff.
|
|
10
|
-
when_to_use: >
|
|
11
|
-
A written plan (from planner, an issue, or Leo's own outline) is about to
|
|
12
|
-
be turned into code. NOT for open-ended implementation with no plan
|
|
13
|
-
(normal execute-then-review flow) and NOT for the review step itself
|
|
14
|
-
(the reviewer agent judges the diff; this skill only carries out the plan).
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# executing-plans
|
|
18
|
-
|
|
19
|
-
Core rule: a plan is executed in checkpointed batches, never as one long
|
|
20
|
-
uninterrupted run. Each checkpoint is a place execution is allowed to stop
|
|
21
|
-
without having made things worse.
|
|
22
|
-
|
|
23
|
-
## Before edit one
|
|
24
|
-
|
|
25
|
-
Sanity-check the plan against the tree it's about to touch:
|
|
26
|
-
|
|
27
|
-
- Base ref matches what the plan assumed — `git rev-parse HEAD` against the
|
|
28
|
-
base the plan was written against. Drifted → say so before touching
|
|
29
|
-
anything; the plan may already be stale.
|
|
30
|
-
- Files/symbols the plan names actually exist at the paths/shapes it
|
|
31
|
-
describes. A plan step that references a function that moved or a file
|
|
32
|
-
that's gone is a stop-and-report, not a guess-and-proceed.
|
|
33
|
-
|
|
34
|
-
This is cheap — a few Read/Grep calls — and skipping it is how a plan
|
|
35
|
-
written against yesterday's tree silently corrupts today's.
|
|
36
|
-
|
|
37
|
-
## Execute in batches
|
|
38
|
-
|
|
39
|
-
Break the plan into batches along its own natural seams (usually: one
|
|
40
|
-
plan-step or one cohesive file group per batch). At each batch boundary:
|
|
41
|
-
|
|
42
|
-
1. Finish the batch's edits.
|
|
43
|
-
2. Run the narrowest relevant checks for what that batch touched — the
|
|
44
|
-
touched test file, a targeted typecheck, not the full suite every time.
|
|
45
|
-
3. Green → advance to the next batch. Red → stop the batch right there; fix
|
|
46
|
-
it or report it. Never carry a red check into the next batch hoping it
|
|
47
|
-
resolves itself — a checkpoint exists precisely to catch this before the
|
|
48
|
-
failure compounds across three more batches of edits built on top of it.
|
|
49
|
-
|
|
50
|
-
This is the same shape as leo:delegation's tiering: cheap, frequent checks
|
|
51
|
-
bound the blast radius so the expensive step (review) isn't debugging a
|
|
52
|
-
pile of unrelated regressions.
|
|
53
|
-
|
|
54
|
-
## Plan intent wins on architecture; reality wins on mechanical detail
|
|
55
|
-
|
|
56
|
-
Two different kinds of mismatch between plan and tree call for two different
|
|
57
|
-
responses:
|
|
58
|
-
|
|
59
|
-
- **Mechanical drift** (a renamed variable, a moved file, a slightly
|
|
60
|
-
different function signature than the plan assumed) — reality wins. Adapt
|
|
61
|
-
the mechanics silently and keep going; that's normal execution, not a
|
|
62
|
-
deviation worth flagging.
|
|
63
|
-
- **Architectural disagreement** (the plan's approach doesn't fit the actual
|
|
64
|
-
structure, a step contradicts how the system actually works, following it
|
|
65
|
-
as written would build on a wrong premise) — the plan's intent still wins
|
|
66
|
-
over improvising a fix, but only the plan's author can resolve a real
|
|
67
|
-
conflict. Stop and report the disagreement; never silently redesign around
|
|
68
|
-
it. Silent redesign is worse than executing a flawed plan, because it
|
|
69
|
-
hides the disagreement instead of surfacing it.
|
|
70
|
-
|
|
71
|
-
When genuinely unsure which kind of mismatch it is, treat it as
|
|
72
|
-
architectural and stop — reporting an unnecessary pause costs a message;
|
|
73
|
-
silently redesigning costs trust.
|
|
74
|
-
|
|
75
|
-
## Behavior changes still default to test-first, done still means verification
|
|
76
|
-
|
|
77
|
-
A plan step that changes behavior doesn't get a pass on process because it's
|
|
78
|
-
already written down. Default to leo:test-first for those steps, and treat
|
|
79
|
-
"the plan is implemented" and "the plan is done" as different states — done
|
|
80
|
-
still means the change clears leo:verification, not just that every step got
|
|
81
|
-
executed.
|
|
82
|
-
|
|
83
|
-
## One fix-then-re-review cycle
|
|
84
|
-
|
|
85
|
-
Once all batches are in, this hands off to the standard review gate — spawn
|
|
86
|
-
`reviewer` on the actual diff against the recorded base ref,
|
|
87
|
-
with the plan text as the original request. If it comes back with blocking
|
|
88
|
-
findings: fix at the executing tier, then re-review only the fix. That's
|
|
89
|
-
**one fix-then-re-review cycle**, full stop. A second block on the same
|
|
90
|
-
findings means stop the loop and report to Leo with options, expert
|
|
91
|
-
arbitration (the `expert` agent) among them — never a third pass, never quietly
|
|
92
|
-
loosening what counts as blocking to escape the loop.
|
|
93
|
-
|
|
94
|
-
## Delegation and workspace boundaries
|
|
95
|
-
|
|
96
|
-
Executing a written plan is `implementer`'s job per leo:delegation — the
|
|
97
|
-
main loop only executes inline when it's already the implementer context or
|
|
98
|
-
the touch is genuinely trivial. If the plan spans a branch of nontrivial
|
|
99
|
-
size, it runs on a dedicated branch per leo:worktrees, and finishing it
|
|
100
|
-
follows leo:finishing-a-branch rather than improvising a merge/cleanup
|
|
101
|
-
sequence at the end.
|
|
102
|
-
|
|
103
|
-
## Self-talk to catch
|
|
104
|
-
|
|
105
|
-
- "The plan says step 4, I'll just push through to step 7 before checking
|
|
106
|
-
anything" — that's skipping checkpoints, not saving time; a break at step
|
|
107
|
-
5 now costs one batch's rework instead of three.
|
|
108
|
-
- "This isn't quite what the plan says but it's obviously what they meant" —
|
|
109
|
-
if it's mechanical, fine; if it's architectural, that's the silent
|
|
110
|
-
redesign this skill exists to block. Report it instead.
|
|
111
|
-
- "The re-review still isn't clean but it's close enough" — close enough on
|
|
112
|
-
a second block is the definition of stop-and-report, not a third fix.
|
|
113
|
-
|
|
114
|
-
## Works with
|
|
115
|
-
|
|
116
|
-
leo:test-first, leo:verification, leo:delegation, leo:worktrees,
|
|
117
|
-
leo:finishing-a-branch — plus the `reviewer` and `expert` agents.
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: finishing-a-branch
|
|
3
|
-
description: >
|
|
4
|
-
End-of-branch state machine: what happens once implementation on a
|
|
5
|
-
branch/worktree is complete. Gates on a clean review verdict, then offers
|
|
6
|
-
a closed set of next steps — merge / PR / keep / discard — routes the
|
|
7
|
-
chosen path through the right ordering (land the work before removing the
|
|
8
|
-
worktree, remove the worktree before deleting the branch), and leaves the
|
|
9
|
-
repo clean. Use when reviewed implementation on a branch/worktree needs a
|
|
10
|
-
terminal disposition. Do not use to manage a worktree mid-task or replace
|
|
11
|
-
the review cycle.
|
|
12
|
-
when_to_use: >
|
|
13
|
-
A branch or worktree has reached "implementation done" and Leo needs to
|
|
14
|
-
decide what happens to it. Fires after execute-then-review completes, or
|
|
15
|
-
when Leo says finish/wrap up/close out/clean up this branch. NOT for
|
|
16
|
-
starting or managing a worktree mid-task (that's leo:worktrees) and NOT a
|
|
17
|
-
substitute for the review cycle itself (that's execute-then-review) — this
|
|
18
|
-
skill starts only once a review verdict already exists.
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
# finishing-a-branch
|
|
22
|
-
|
|
23
|
-
Core rule: a branch doesn't get disposed of by momentum. It reaches one of
|
|
24
|
-
four terminal states, each chosen explicitly, and destructive ones require
|
|
25
|
-
saying out loud what gets lost.
|
|
26
|
-
|
|
27
|
-
## Precondition: review verdict, not vibes
|
|
28
|
-
|
|
29
|
-
Do not enter this skill's decision step without a clean **review verdict**
|
|
30
|
-
on the final diff. "Implementation looks done" is not a review verdict.
|
|
31
|
-
|
|
32
|
-
- If review hasn't run yet, or the last verdict was `needs-changes`: stop
|
|
33
|
-
here, go run/finish the review cycle (see execute-then-review), come back.
|
|
34
|
-
- If review is `approved`: proceed.
|
|
35
|
-
- Never offer merge/PR on unreviewed or still-blocked work. "It's a small
|
|
36
|
-
change" or "I already read through it" does not substitute for the
|
|
37
|
-
reviewer's verdict — those are exactly the rationalizations this gate
|
|
38
|
-
exists to block.
|
|
39
|
-
|
|
40
|
-
## The option set is closed
|
|
41
|
-
|
|
42
|
-
Once the gate passes, present exactly these four options — never an
|
|
43
|
-
open-ended "what would you like to do next?":
|
|
44
|
-
|
|
45
|
-
- **merge** — into the target branch, locally or via `gh pr merge`
|
|
46
|
-
- **PR** — open a pull request and stop (no local merge)
|
|
47
|
-
- **keep** — leave the branch/worktree exactly as-is, decide later
|
|
48
|
-
- **discard** — delete the branch and its worktree, work is gone
|
|
49
|
-
|
|
50
|
-
State the branch name, commit count ahead of the target, and the review
|
|
51
|
-
verdict when you present the set. Leo picks one; do not infer a choice from
|
|
52
|
-
silence, from a prior unrelated "yes," or from tone.
|
|
53
|
-
|
|
54
|
-
## Ordering (prevents self-referential failures)
|
|
55
|
-
|
|
56
|
-
Regardless of which path Leo picks, sequence matters — doing this out of
|
|
57
|
-
order breaks the tools that need the worktree or branch to still exist:
|
|
58
|
-
|
|
59
|
-
1. **cd out of the worktree first.** A shell sitting inside the worktree
|
|
60
|
-
directory blocks its own removal.
|
|
61
|
-
2. **Merge (or push for a PR) BEFORE removing the worktree.** Land or
|
|
62
|
-
publish the commits while the worktree still exists to operate from.
|
|
63
|
-
3. **Remove the worktree BEFORE deleting the branch.** Deleting the branch
|
|
64
|
-
out from under a live worktree leaves the worktree metadata dangling and
|
|
65
|
-
git in an inconsistent state.
|
|
66
|
-
4. Mechanics of steps 1–3 (which git worktree commands, how to prune) are
|
|
67
|
-
owned by `leo:worktrees` — call into it rather than hand-rolling worktree
|
|
68
|
-
surgery here. This skill decides *what* happens and *in what order*;
|
|
69
|
-
`leo:worktrees` executes *how*.
|
|
70
|
-
|
|
71
|
-
Per option:
|
|
72
|
-
|
|
73
|
-
| Option | Sequence |
|
|
74
|
-
|---|---|
|
|
75
|
-
| merge | merge locally or `gh pr merge` → remove worktree (`leo:worktrees`) → delete local branch |
|
|
76
|
-
| PR | push branch → open PR → **stop** (worktree and branch stay; nothing is merged yet.) |
|
|
77
|
-
| keep | do nothing destructive; leave worktree and branch as-is |
|
|
78
|
-
| discard | typed confirmation (below) → remove worktree (`leo:worktrees`) → force-delete branch |
|
|
79
|
-
|
|
80
|
-
## Destructive paths require a typed confirmation
|
|
81
|
-
|
|
82
|
-
`discard`, and any force-delete of a branch with unmerged commits, requires
|
|
83
|
-
Leo to type back a confirmation that **names exactly what will be lost** —
|
|
84
|
-
not a plain "yes" or "go ahead". Prompt with the specific string, e.g.:
|
|
85
|
-
|
|
86
|
-
> Type `discard` to delete branch `feature/foo`, 4 commits, no PR — this
|
|
87
|
-
> cannot be undone.
|
|
88
|
-
|
|
89
|
-
- An implied or inferred yes never triggers deletion — silence, "sounds
|
|
90
|
-
good," or approval of some *other* step in the conversation does not
|
|
91
|
-
count.
|
|
92
|
-
- If Leo's typed text doesn't match what was asked for, ask again; don't
|
|
93
|
-
guess at intent.
|
|
94
|
-
- `keep` never needs this — it's non-destructive by construction.
|
|
95
|
-
- If the branch is already merged, force-delete is not "destructive" in the
|
|
96
|
-
data-loss sense (git still warns) — a plain confirmation is enough since
|
|
97
|
-
nothing unmerged is at risk; use the typed-confirmation form when in doubt.
|
|
98
|
-
|
|
99
|
-
## Leave the repo clean
|
|
100
|
-
|
|
101
|
-
After any path except `keep`:
|
|
102
|
-
|
|
103
|
-
- Prune worktree metadata (`leo:worktrees` handles this as part of removal
|
|
104
|
-
— don't leave a stale entry in `git worktree list`).
|
|
105
|
-
- Confirm `git status` is clean from the directory you're now in.
|
|
106
|
-
- Note the outcome (merged / PR opened + link / kept / discarded) in the
|
|
107
|
-
done report per `leo:verification` — the report's job is to make the
|
|
108
|
-
terminal state legible later, not just at the moment it happened.
|
|
109
|
-
|
|
110
|
-
## Self-talk to catch
|
|
111
|
-
|
|
112
|
-
- "The diff was tiny, I basically reviewed it while writing it" — that's
|
|
113
|
-
not a review verdict; go get one.
|
|
114
|
-
- "Leo said 'sounds good' earlier, close it out" — sounds-good is not a
|
|
115
|
-
typed confirmation naming what's lost.
|
|
116
|
-
- "I'll just clean up the worktree now and merge after" — wrong order,
|
|
117
|
-
breaks the merge step; land first.
|
|
118
|
-
- "Discard is obviously right here, I'll skip the prompt to save a round
|
|
119
|
-
trip" — the option set is closed and explicit for a reason; present it.
|
|
120
|
-
|
|
121
|
-
## Works with
|
|
122
|
-
|
|
123
|
-
- `leo:worktrees` — owns worktree creation/removal mechanics.
|
|
124
|
-
- `leo:verification` — owns the shape of the done report this skill feeds
|
|
125
|
-
its outcome line into.
|