@litfamily/litmuse 0.1.14 → 0.1.15

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +8 -7
  3. package/README_ko-KR.md +8 -7
  4. package/bin/litmuse.mjs +1 -1
  5. package/lib/stage-card.mjs +4 -12
  6. package/package.json +1 -1
  7. package/plugin/.muse-plugin/plugin.json +16 -16
  8. package/plugin/commands/lit-status.md +1 -1
  9. package/plugin/commands/lit.md +6 -5
  10. package/plugin/hooks/lib/goal.mjs +165 -0
  11. package/plugin/hooks/lib/routes.mjs +27 -10
  12. package/plugin/hooks/lib/skill-plan.mjs +199 -0
  13. package/plugin/hooks/lib/stage.mjs +4 -1
  14. package/plugin/hooks/lib/workflow-stack.mjs +1 -1
  15. package/plugin/hooks/post-tool-use.mjs +39 -0
  16. package/plugin/hooks/pre-tool-use.mjs +34 -1
  17. package/plugin/hooks/session-start.mjs +4 -0
  18. package/plugin/hooks/stop.mjs +53 -3
  19. package/plugin/hooks/user-prompt-submit.mjs +161 -9
  20. package/plugin/lib/rewind/collect.mjs +93 -15
  21. package/plugin/lib/rewind/rainbow.mjs +13 -0
  22. package/plugin/lib/rewind/verdict.mjs +258 -0
  23. package/plugin/skills/autoconference/SKILL.md +1 -1
  24. package/plugin/skills/autoconference/modes/core.md +1 -1
  25. package/plugin/skills/browser-drive/scripts/capability-probe.mjs +25 -11
  26. package/plugin/skills/lit-adhd/SKILL.md +56 -32
  27. package/plugin/skills/lit-brainstorm/SKILL.md +1 -0
  28. package/plugin/skills/lit-comprehend/SKILL.md +4 -3
  29. package/plugin/skills/lit-crucible/SKILL.md +1 -0
  30. package/plugin/skills/lit-handoff/SKILL.md +3 -2
  31. package/plugin/skills/lit-init/SKILL.md +1 -1
  32. package/plugin/skills/lit-plan/SKILL.md +8 -4
  33. package/plugin/skills/lit-plan/scripts/goal-propose.mjs +50 -0
  34. package/plugin/skills/lit-plan/templates/plan.md +4 -0
  35. package/plugin/skills/lit-team/SKILL.md +97 -64
  36. package/plugin/skills/lit-team/references/team-orchestration.md +6 -4
  37. package/plugin/skills/litgoal/SKILL.md +3 -1
  38. package/plugin/skills/litresearch/SKILL.md +1 -0
  39. package/plugin/skills/litwork/SKILL.md +6 -6
  40. package/plugin/skills/review-work/SKILL.md +1 -0
  41. package/plugin/skills/start-work/SKILL.md +1 -1
  42. package/plugin/skills/ultra-brainstorm/SKILL.md +107 -0
  43. package/plugin/skills/ultra-brainstorm/references/lenses.md +38 -0
  44. package/plugin/skills/ultra-brainstorm/references/workflow-script.md +169 -0
  45. package/plugin/skills/ultra-brainstorm/scripts/estimate.mjs +57 -0
  46. package/plugin/skills/wikify/SKILL.md +2 -2
  47. package/plugin/skills/wikify/modes/init.md +1 -1
  48. package/plugin/skills/lit-recap/SKILL.md +0 -232
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: lit-handoff
3
3
  description: "Write a verified handoff in .litmuse/handoff: done, checked, left, and exact resume steps."
4
+ goal: never
4
5
  ---
5
6
 
6
7
  # lit-handoff
@@ -34,7 +35,7 @@ drafting. Never modify those files and never write generated output into the ski
34
35
  - A lit-loop, litwork or start-work run stops before its goal is met.
35
36
  - A multi-session task reached a natural break point where a new agent is likely to continue.
36
37
 
37
- Does not apply to: a status answer with no file (load `lit-recap`), a summary, changelog, commit message, PR
38
+ Does not apply to: a status answer with no file (run `lit adhd recap`), a summary, changelog, commit message, PR
38
39
  description or release note (those have their own formats; a request for one of them is not automatically a handoff),
39
40
  or ongoing work with no transition. If the user only asks to inspect an existing handoff, read it and live state, report
40
41
  the discrepancies, and write nothing.
@@ -69,7 +70,7 @@ not a destination override.
69
70
  | non-git workspace | root `HANDOFF.md` | create or update at the workspace root |
70
71
 
71
72
  Muse mirror: every manual handoff also writes the identical content to `.litmuse/handoff/YYYY-MM-DD-HHMM.md` (time from
72
- `date +%F-%H%M`) and then to `.litmuse/handoff/latest.md`. The mirror is what `lit-recap`, the session-start re-inject
73
+ `date +%F-%H%M`) and then to `.litmuse/handoff/latest.md`. The mirror is what `lit adhd`, the session-start re-inject
73
74
  and the next `lit-handoff` look for; it is local working state inside the project and counts as part of the single
74
75
  resolved destination set, never a second competing packet. Write the dated copy first so history is never lost.
75
76
 
@@ -30,7 +30,7 @@ The deeper mapping rules (boundary, discovery packet, location decision, hierarc
30
30
  - A newly inherited or unfamiliar repository is about to receive real work and nobody has mapped it.
31
31
 
32
32
  It does not apply to: changing product code, writing README or user documentation, editing personal guidance
33
- files outside the repository, or summarising a session (`lit-recap`, `lit-handoff`).
33
+ files outside the repository, or summarising a session (`lit adhd recap`, `lit-handoff`).
34
34
 
35
35
  ## Inputs and state
36
36
 
@@ -113,7 +113,11 @@ If the question cannot be asked in this turn but a human is present, write the p
113
113
 
114
114
  ### Phase 3: bind the goal text
115
115
 
116
- The plan carries a `Goal` block: one outcome sentence and two to six criteria, each naming the command or surface that proves it. This is the text `litgoal` sets when execution begins. The planning turn leaves `create_goal` and `update_goal` alone, since the route policy refuses them and a plan is not supposed to create runtime state. `get_goal` is allowed: call it once and, if a different active goal exists, say so in the plan's Bootstrap section so the executor keeps that goal intact. Execution runs toward the goal with `lit-loop` or `start-work`; the plan supplies the finish line.
116
+ The plan carries a `Goal` block (one outcome sentence and two to six criteria, each naming the command or surface that proves it) and a machine-readable `## Done when` block with exactly one line `- check: \`<command>\``: the one allowlisted test command whose exit 0, together with every row ticked, means the plan is done (`npm test`, `npm run <script>`, `node --test …`, `pytest …`, `cargo test`, `go test …`, `make test|check|verify`, or `bash scripts/<name>.sh` for a long plan that needs a check script). Judgment words ("works", "looks good", "잘 동작") and outward actions (push, publish, release) are not checks. A plan that should never become a goal says `goal: never` on its own line instead.
117
+
118
+ After the plan file exists, run `node <skill-dir>/scripts/goal-propose.mjs plans/<slug>.md` once (the planning guard allows exactly this command). It compiles the block into one Muse goal objective, `Every row in plans/<slug>.md is ticked and \`<check>\` exits 0 [lit:<id>]` (at most 500 characters), lints it, runs the check once to prove the objective is false right now, and prints the closing approval question: `Approve plan, start work and set goal: /goal <objective>? (yes / edit / no)`. When no goal is possible (no Done when block, `goal: never`, a refused check, an objective that is already true), it prints `Approve plan and start work? (yes / no)` and under it the one `No goal set: <reason>` line. End the reply with what it printed, unchanged.
119
+
120
+ The planning turn itself sets nothing: `create_goal` and `update_goal` are refused here. Only the session that was asked can answer: PostToolUse stamps this session on the question when goal-propose runs, and a `yes` typed in any other session, or on a question no session was stamped on, starts nothing and shows `Approval not recorded for this session. Run: lit start plans/<slug>.md`. In `muse exec` or another one-shot run nobody can answer in that session, so the question is printed and the user starts the plan later with `lit start plans/<slug>.md`, or types `yes` after resuming that same session (`muse resume`). The user's exact `yes` on the next prompt of this session does it all in one step: the LitMuse prompt hook approves the plan, starts `start-work` on it (the same start as a typed `lit start plans/<slug>.md`, with the same grants) and arms the goal, telling the model to call `create_goal` with that exact objective (PreToolUse admits a `[lit:…]` objective only then). When the start is refused (another live session already runs start-work on the plan, or the plan has no open row), nothing starts, no goal is armed, and the hook shows `Work not started and no goal set: <reason>`. `edit` re-opens the plan and asks again, `no` starts nothing and sets no goal, and anything else leaves the question open for 30 minutes. `get_goal` is allowed here: call it once, and when another goal is active, say so in the plan's Bootstrap section, because a session holds one goal and LitMuse never replaces the user's own.
117
121
 
118
122
  ### Phase 4: write the plan
119
123
 
@@ -288,7 +292,7 @@ When the target repository is a Muse plugin bundle (LitMuse itself or another),
288
292
 
289
293
  ### Capability-gated native surfaces
290
294
 
291
- Plans distinguish desired behavior from observed capability. Native goal binding is the clearest case: a plan may include `get_goal`, `create_goal` and `update_goal` steps only as capability-gated actions for the executor, with the degraded path spelled out (record the criteria in `.litmuse/goals/<slug>.json` and report that the native goal tool was unavailable). The acceptance criterion is "the native goal was updated" only when the tool is exposed and the executor can prove it; otherwise it is "the fallback was reported honestly and local evidence was maintained". Workflow, child agents, cron, monitor and image generation get the same treatment: use them when the task is broad, risky or parallel, and include a local fallback for sessions without them. Hooks and agent definitions run once `muse plugins approve litmuse:hook:<id>` or `litmuse:agent_definition:litmuse/<name>` has been run, so a plan that depends on them says so and assumes nothing.
295
+ Plans distinguish desired behavior from observed capability. The native goal is bound through the Done when pipeline above, never through ad-hoc `create_goal` steps in rows: a row may say "close the goal" only as `update_goal` with status complete after the check exits 0. Workflow, child agents, cron, monitor and image generation are listed when the task is broad, risky or parallel, each with a local path for a session that refuses them (policy, headless, sandbox), and the acceptance criterion names which path was proven. Hooks and agent definitions run once `muse plugins approve litmuse:hook:<id>` or `litmuse:agent_definition:litmuse/<name>` has been run, so a plan that depends on them says so and assumes nothing.
292
296
 
293
297
  ### Evidence wording for the ledger
294
298
 
@@ -329,7 +333,7 @@ The PreToolUse hook enforces this table while the route is active. A tool that i
329
333
  | Skills, memory, state | `read_skill`, `read_memory`, `work_status`, `work_list`, `get_goal`, `cron_list` | read-only |
330
334
  | Ask the user | `request_user_input` | may be withheld headless; see the defaults rule |
331
335
  | Write the plan and notes | `write_file`, `edit_file` | only under `plans/` and `.litmuse/`; `apply_patch` and `delete_file` follow the same path rule, and a write whose target is unclear is held |
332
- | Inspect | `bash` | one plain read-only command: `ls`, `cat -n`, `head`, `tail`, `wc`, `rg`, `git log`, `git status`, `git diff`, `git show` with listed flags and no `;`, `&`, `\|`, `<`, `>`, backtick, `$` or line break; `bash_input` is refused |
336
+ | Inspect | `bash` | one plain read-only command: `ls`, `cat -n`, `head`, `tail`, `wc`, `rg`, `git log`, `git status`, `git diff`, `git show` with listed flags and no `;`, `&`, `\|`, `<`, `>`, backtick, `$` or line break, plus the one `node <skill-dir>/scripts/goal-propose.mjs plans/<slug>.md` run; `bash_input` is refused |
333
337
  | Children | `subagent_spawn` | `subagent_type` is a read-only `litmuse/*` agent: `lit-planner`, `librarian-researcher`, `lit-verifier`, `quality-reviewer` or a Korean prose agent; `lit-executor`, `qa-runner` and general-purpose children are refused |
334
338
  | Manage children | `subagent_status`, `subagent_wait`, `subagent_read_result`, `subagent_cancel` | `subagent_send_message` is refused here, so a follow-up goes out as a new brief |
335
339
 
@@ -348,7 +352,7 @@ Refused on this route: `create_goal`, `update_goal`, `write_todos`, `add_memory`
348
352
 
349
353
  Stop when the plan file is written and passes the checklist, or when a missing answer blocks every useful task (then the plan carries the question as row 1 and the reply says `BLOCKED: <question>`). After two failed attempts at one section, surface what you tried and ask.
350
354
 
351
- Reply in reader form: the plan path, the TL;DR, the number of tasks, any assumption the user should confirm, and the next action. End the reply with this line, plan name filled in: "Type `go` within 30 minutes to start `plans/<slug>.md` with start-work, or run `/start-work` later." The Stop hook records the saved plan for this session only, so `go` from another session, or after 30 minutes, starts nothing. Approval covers plan generation; implementation, commit, push, versioning and publishing each need their own go-ahead. Keep logs, lane verdicts and command lists in the draft and ledger unless the user asks for them.
355
+ Reply in reader form: the plan path, the TL;DR, the number of tasks, any assumption the user should confirm, and the next action. End the reply with what goal-propose printed (`yes` then approves the plan, starts the work and, when the question names one, sets the goal). Only when goal-propose could not run, end with this line instead, plan name filled in: "Type `go` within 30 minutes to start `plans/<slug>.md` with start-work, or run `/start-work` later." The Stop hook records the saved plan for this session only, so `go` from another session, or after 30 minutes, starts nothing. Approval covers plan generation; implementation, commit, push, versioning and publishing each need their own go-ahead. Keep logs, lane verdicts and command lists in the draft and ledger unless the user asks for them.
352
356
 
353
357
  ## Pitfalls
354
358
 
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ // `node <skill-dir>/scripts/goal-propose.mjs plans/<slug>.md`: lit-plan runs this once, after the plan is written, and
3
+ // puts what it prints into the approval question. It compiles the plan's `## Done when` block into one Muse goal
4
+ // objective, lints it, runs the check once to prove the objective is false now, and records the question in
5
+ // `.litmuse/goal/consent.json` under the project's state root. It prints the question that starts the work and sets the
6
+ // goal, or, when no goal is possible, the start-only question and the one `No goal set: <reason>` line. An unreadable
7
+ // plan prints that reason alone. It never starts work or sets a goal; only the user's exact `yes` does both. The lit-plan write guard allows
8
+ // this one command during a planning turn.
9
+ import { readFileSync } from 'node:fs';
10
+ import { isAbsolute, relative, resolve } from 'node:path';
11
+ import { pathToFileURL } from 'node:url';
12
+ import { GOAL_STATUS, compileCondition, conditionHash, consentKey, falsify, lintCondition, parseDoneWhen, writeGoalRecord } from '../../../hooks/lib/goal.mjs';
13
+ import { resolveProjectStateRoot } from '../../../hooks/lib/workflow-stack.mjs';
14
+
15
+ export function proposeGoal({ cwd, planArg, now = Date.now(), timeoutMs, run, sessionId = null } = {}) {
16
+ const planPath = resolve(cwd, String(planArg ?? ''));
17
+ const plan = relative(cwd, planPath);
18
+ if (!planArg || isAbsolute(plan) || plan.startsWith('..') || !/^plans\/[\w.-]+\.md$/u.test(plan)) return { line: GOAL_STATUS.skipped('give the plan as plans/<slug>.md inside this project') };
19
+ let planText;
20
+ try {
21
+ planText = readFileSync(planPath, 'utf8');
22
+ } catch {
23
+ return { line: GOAL_STATUS.skipped(`${plan} cannot be read`) };
24
+ }
25
+ const askedAt = new Date(now).toISOString();
26
+ // No goal is possible: the question still approves the plan and starts the work, and names why there is no goal.
27
+ const startOnly = (reason) => {
28
+ const consent = { version: 1, goal: false, plan, reason, sessionId, askedAt };
29
+ consent.hash = conditionHash(consentKey(consent));
30
+ writeGoalRecord(resolveProjectStateRoot(cwd), 'consent', consent);
31
+ return { line: `${GOAL_STATUS.askedStart}\n${GOAL_STATUS.skipped(reason)}`, consent };
32
+ };
33
+ if (/^goal:\s*never\s*$/mu.test(planText)) return startOnly('this plan is marked goal: never');
34
+ const done = parseDoneWhen(planText);
35
+ if (!done.ok) return startOnly(done.reason);
36
+ const built = compileCondition({ plan, check: done.check });
37
+ if (!built.ok) return startOnly(built.reason);
38
+ const lint = lintCondition(built.condition, done.check);
39
+ if (!lint.ok) return startOnly(lint.reasons.join('; '));
40
+ const dry = falsify({ cwd, plan, planText, check: done.check, ...(timeoutMs ? { timeoutMs } : {}), ...(run ? { run } : {}) });
41
+ if (!dry.ok) return startOnly(dry.reason);
42
+ const consent = { version: 1, goal: true, condition: built.condition, hash: conditionHash(built.condition), id: built.id, plan, check: done.check, sessionId, askedAt };
43
+ writeGoalRecord(resolveProjectStateRoot(cwd), 'consent', consent);
44
+ return { line: GOAL_STATUS.asked(built.condition), consent };
45
+ }
46
+
47
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
48
+ const { line } = proposeGoal({ cwd: process.cwd(), planArg: process.argv[2] });
49
+ process.stdout.write(`${line}\n`);
50
+ }
@@ -52,6 +52,10 @@ Your next move: <fill: approve, steer, or ask for a high-accuracy review>.
52
52
  - Manual-QA channel per criterion: <shell | http | browser | muse exec>
53
53
  - Evidence: `.litmuse/evidence/{{slug}}/task-<N>.<ext>`
54
54
 
55
+ ## Done when
56
+ <!-- One allowlisted test command. goal-propose.mjs compiles it into the Muse goal asked for at approval. Write `goal: never` on its own line instead when this plan must not become a goal. -->
57
+ - check: `<npm test | npm run <script> | node --test … | pytest … | bash scripts/<name>.sh>`
58
+
55
59
  ### Goal (set by litgoal when execution starts)
56
60
  - Objective: <one outcome sentence, true for a user when done>
57
61
  - Criteria:
@@ -1,29 +1,48 @@
1
1
  ---
2
2
  name: lit-team
3
- description: "Coordinate 2+ child agents behind a durable team packet: owned slices, evidence reports, archive receipt."
3
+ description: "Type lit team <goal>: this session orchestrates the team, picks how to split it, merges and verifies."
4
4
  ---
5
5
 
6
- # lit-team: cooperating members behind one durable packet
6
+ # lit-team: this session becomes the orchestrator
7
7
 
8
- Coordinated work by two or more members, each a Muse child agent that owns a distinct slice, behind a local packet
9
- that survives compaction: who the members are, what each owns, which agent runs it, which have reported with
10
- evidence, and whether the team was cleaned up. The root Muse session is the leader and the only writer of the
11
- packet; members never touch it.
8
+ Type `lit team <goal>`; this session becomes the orchestrator and runs the team for you. It decides how to split the
9
+ goal, says in one line how it will distribute the work, writes the durable team packet, launches the members,
10
+ watches them, wakes a stalled one, merges what they return, verifies the assembled result itself, and comes back with
11
+ one short report: what is done, what is risky, and what needs you. It asks nothing up front, except one question when
12
+ the goal itself is unclear.
12
13
 
13
- Use a plain `subagent_spawn` instead when the task is one isolated lookup, review or edit; a packet around a single
14
- delegation buys nothing. Use `lit-plan` first when the objective is still unclear: splitting an unclear objective
15
- makes every member build the wrong thing in parallel. Use `autoconference` when the lanes are competing researchers
16
- who must face an adversarial reviewer rather than cooperating owners.
14
+ Each member is a Muse child that owns a distinct slice. The packet under `.litmuse/team/<team-id>/` survives
15
+ compaction and records who the members are, what each owns, how each was launched, which ones reported with evidence,
16
+ and whether the team was cleaned up. The orchestrator is the only writer of the packet; members never touch it.
17
+
18
+ A single isolated lookup, review or edit is one plain `subagent_spawn`, and a packet around it buys nothing. An
19
+ objective nobody can state yet goes to `lit-plan` first, since splitting an unclear goal makes every member build the
20
+ wrong thing in parallel. Competing researchers who must face an adversarial reviewer are `autoconference`.
17
21
 
18
22
  ## When this applies
19
23
 
20
- - The user types `lit team`, `lit team mode`, `lit teammates`, `/lit-team`, or asks for team mode, a team of agents,
21
- coordinated parallel work, member briefs, team state, or team cleanup. The LitMuse hook inlines this skill for a
22
- leading bare `lit team …`; the hook activates the skill and never spawns anything itself.
23
- - There are at least two slices that can progress independently and that can be given non-overlapping ownership
24
- (areas of the product, disjoint files or modules, or read-only perspectives on the same artifact).
25
- - If fewer than two genuinely distinct slices exist, say so in one line and use a single child. Splitting work that
26
- does not divide is slower than not splitting it, and two members on one slice is one worker plus coordination cost.
24
+ - The user types `lit team <goal>`, `lit team mode`, `/lit-team`, or asks for team mode, a team of agents, coordinated
25
+ parallel work, member briefs, team state or team cleanup. The LitMuse prompt hook routes a leading `lit team …`
26
+ here; the hook activates the skill and never spawns anything itself.
27
+ - At least two slices can progress independently with non-overlapping ownership: areas of the product, disjoint files
28
+ or modules, many similar items, or read-only perspectives on one artifact.
29
+ - With fewer than two genuinely distinct slices, say so in one line and do the work with a single child. Splitting
30
+ work that does not divide is slower than not splitting it.
31
+
32
+ ### Picking the distribution
33
+
34
+ The orchestrator picks one distribution from the slices themselves and states it in one line before launching, for
35
+ example `Team: 3 subagents (api, ui, docs), shared checkout.` The first row that fits wins.
36
+
37
+ | The slices are | Distribution | Muse surface |
38
+ |---|---|---|
39
+ | 2 to 6 independent slices, each with its own files | subagents | one `subagent_spawn` per member with `subagent_type`, one brief each (TASK / DELIVERABLE / SCOPE / VERIFY) |
40
+ | many similar items (files to migrate, pages to check), or a review or verify fan-out | Workflow | one `workflow` call whose script fans the items out with `host.parallel([...])`, one request per item (at most 16 run at once, 1000 calls per run) |
41
+ | long-running parallel sessions, another harness, or work the user wants to watch live | herdr panes | only when `HERDR_ENV=1` and `herdr` is on PATH (check with `command -v herdr`); otherwise fall back to subagents and say so |
42
+ | slices that must edit the same files | isolated worktrees | `subagent_spawn` with `worktree_isolation: true` (or the `isolation` field of a Workflow child request, when the live `workflow` ToolSpec offers it); Muse creates the worktree and keeps it when the child leaves changes |
43
+
44
+ Never assign vague job titles. A member needs a concrete focus, a deliverable, in-scope paths, forbidden actions, a
45
+ verification command, real-surface evidence and a cleanup receipt.
27
46
 
28
47
  ### Composition lenses
29
48
 
@@ -33,15 +52,13 @@ who must face an adversarial reviewer rather than cooperating owners.
33
52
  | `ownership` | Disjoint files or modules owned by one member each | `litmuse/lit-executor` with explicit `--paths` |
34
53
  | `perspective` | Read-only reviews of the same artifact from different risk lenses | `litmuse/quality-reviewer`, `litmuse/lit-verifier`, `litmuse/qa-runner` |
35
54
 
36
- Never assign vague job titles. A member needs a concrete focus, a deliverable, in-scope paths, forbidden actions, a
37
- verification command, real-surface evidence and a cleanup receipt.
38
-
39
55
  ## Inputs and state
40
56
 
41
57
  - The objective being split, the current working-tree state (`git status --porcelain`; unrelated dirty files are
42
58
  protected, never reformatted or reverted), the approved plan if one exists (`plans/<slug>.md`), and the authority
43
- the user gave: allowed roots, whether children may edit, whether worktrees may be created, and every forbidden
44
- action (commit, push, tag, publish, deploy, merge, delete).
59
+ the user gave: allowed roots, whether children may edit, and every forbidden action (commit, push, tag, publish,
60
+ deploy, delete). Host isolation (`worktree_isolation`) needs no separate permission; a worktree is created, kept and
61
+ removed by Muse itself.
45
62
  - The packet, `.litmuse/team/<team-id>/`: `team.json` (script-owned), `guide.md` (rewritten on every mutation so a
46
63
  member always reads current state), `artifacts/` (members' notes, diffs and evidence), `archive-receipt.json`
47
64
  after archive, and `.lock/` while a command runs. The `.litmuse/` folder carries its own `.gitignore`, so the packet
@@ -76,45 +93,56 @@ node <skill-dir>/scripts/team.mjs archive --team <id> [--note "<text>"]
76
93
  node <skill-dir>/scripts/team.mjs delete --team <id> [--force]
77
94
  ```
78
95
 
79
- 1. **Decide it is team work.** Two or more independent slices with distinct owners. Otherwise stop and use one child.
80
- Ask for the user's approval of composition, isolation and authority with `request_user_input` when the work edits
81
- files; headless runs log the default as a `decision` ledger line.
82
- 2. **Choose isolation first.** Read-only analysis uses the shared checkout. Disjoint file ownership uses the shared
83
- checkout with explicit `--paths`. Overlapping implementation needs separate worktrees, which only the user may
84
- authorize; `--worktree` and `--cwd` record intent and paths, they do not create, merge, delete or push anything.
85
- Release, secrets and remote settings stay in the leader lane unless explicitly delegated.
86
- 3. **`init`, then `add-member` once per slice.** The script rejects an invalid id, a duplicate id, a duplicate focus,
87
- overlapping `--paths`, a write-capable agent with no owned paths, and a read-only agent that claims write paths.
88
- Do not hand-write or patch `team.json`.
89
- 4. **Take each brief from `prompt`.** It returns the assignment (`TASK`, `DELIVERABLE`, `SCOPE` naming the other
96
+ 1. **Read the goal and split it.** Name the slices, their owners and their paths from the goal, the repository and
97
+ the approved plan when there is one. Ask one question only when the goal itself is unclear (what should exist at
98
+ the end); composition, isolation and distribution are the orchestrator's call, made from the table above.
99
+ 2. **Say the distribution in one line**, then write the packet: `init` (with `--worktree` when slices share files),
100
+ then `add-member` once per slice. The script rejects an invalid id, a duplicate id, a duplicate focus, overlapping
101
+ `--paths`, a write-capable agent with no owned paths, and a read-only agent that claims write paths. Never
102
+ hand-write or patch `team.json`.
103
+ 3. **Take each brief from `prompt`.** It returns the assignment (`TASK`, `DELIVERABLE`, `SCOPE` naming the other
90
104
  members' slices and this member's writable paths, `FORBIDDEN`, `RETURN_MODE`, `VERIFY`, `STOP WHEN`, the
91
- `WORKING:`/`BLOCKED:`/`DONECLAIM:` markers) plus ready-made `spawn_args`. Add current repository facts, protected
92
- dirty state and the expected receipt, then call `subagent_spawn` with those arguments. `--return-mode` defaults to
93
- `reader`; it controls that child's return only and cannot raise the parent's mode.
94
- 5. **Bind what the host returned.** `subagent_spawn` gives a child id; record it with `bind-agent`. Never invent an id,
95
- and never mark a member `active` for a spawn that did not happen. A refused spawn (unapproved agent, no capability)
96
- is a `BLOCKED:` for that member, not a silent fallback.
97
- 6. **Supervise.** Use `subagent_status` and `subagent_wait` while doing independent leader work; a timeout means "no
98
- new message", not failure. Send corrections with `subagent_send_message`; stop a lane with `subagent_cancel`. An
99
- acknowledgement without a deliverable does not satisfy a lane; follow up for the structured `DONECLAIM:`.
100
- 7. **Accept or reject each report.** Read the child's result with `subagent_read_result`, then verify it yourself:
101
- for an implementation member inspect the actual diff in its paths or worktree and rerun the decisive command; for
102
- an analysis member verify the cited paths and reproduce a key search; for a perspective member keep each verdict
103
- independent instead of averaging. If it passes, write `report --evidence <path>` (the path must exist inside the
104
- workspace; the script refuses otherwise). If a member cannot proceed, write `block --reason`. Reject a DoneClaim
105
- that lacks exact evidence, crossed ownership, touched unrelated dirty work, left a process or port running, rests on
106
- a stale artifact, or implies an unauthorized commit, push or release; send the narrow failure back to the same
107
- member or assign a bounded repair.
108
- 8. **Aggregate and verify.** The team is done only when `status` shows `done: true` (every member reported or blocked)
109
- and the leader has verified the assembled result on the real surface, not just each slice. A blocked or
110
- inconclusive member remains blocking unless the approved plan removes that dependency. Run `review-work` over the
111
- combined change set.
112
- 9. **Archive and clean up.** `archive` refuses while any member is neither reported nor blocked and names who is
113
- missing. It writes `archive-receipt.json` (per-member status, evidence, agent id and the digest of the packet it
114
- closed). Cancel remaining children, stop processes and ports, remove temporary directories, handle worktrees only
115
- under explicit Git authority, then compare the packet with live resources. `delete` removes the packet and its
116
- receipt: prefer keeping an archived packet when audit or continuation value remains, copy the receipt out first if
117
- it is needed, and use `--force` only with explicit user authority.
105
+ `WORKING:` / `BLOCKED:` / `DONECLAIM:` markers) plus ready-made `spawn_args`. Add current repository facts, the
106
+ protected dirty state, the member's own scratch directory (`.litmuse/team/<team-id>/artifacts/<member>/`) and the
107
+ expected receipt.
108
+ 4. **Launch.**
109
+ - Subagents: call `subagent_spawn` with the `spawn_args`, all independent members in one block, and record each
110
+ returned child id with `bind-agent`.
111
+ - Workflow: put one request per item in a single `workflow` script (`host.parallel([...])`) with the brief as `input`,
112
+ a `schema` for the receipt and `label: "member-<id>"`; record the run id with `bind-agent --agent-id workflow:<run id>`.
113
+ - Herdr panes: open one pane per member with the host's own herdr commands, start the member's session there with
114
+ its brief, and record the pane id with `bind-agent --agent-id herdr:<pane id>`. Read panes; never type an approval
115
+ into one.
116
+ - Worktrees: add `worktree_isolation: true` to that member's `subagent_spawn`; record the path Muse reports with
117
+ `bind-agent --cwd <path>`.
118
+ Never invent an id and never mark a member `active` for a launch that did not happen. A refused launch (unapproved
119
+ agent, no capability, isolation unavailable outside a Git workspace) is a `BLOCKED:` for that member.
120
+ 5. **Monitor and wake.** Poll with `subagent_status` / `subagent_wait` (a timeout means no new message, not failure),
121
+ the Workflow's own status, or the pane's last output and the modification time of the member's scratch directory.
122
+ A member whose status and scratch files have not moved for ten minutes is stalled: send one short nudge with
123
+ `subagent_send_message` (or the pane's message command) naming what is missing, then wait again. A second silent
124
+ interval marks it `block --reason stalled`. Keep doing independent orchestrator work in between; never block the
125
+ user on one member.
126
+ 6. **Accept or reject each report.** Read the result (`subagent_read_result`, the Workflow's `result.data`, or the
127
+ pane's final output), then verify it yourself: for an implementation member inspect the actual diff in its paths or
128
+ worktree and rerun the decisive command; for an analysis member verify the cited paths and reproduce a key search;
129
+ for a perspective member keep each verdict independent. If it passes, write `report --evidence <path>` (the path
130
+ must exist inside the workspace). If it cannot proceed, write `block --reason`. Reject a DoneClaim that lacks exact
131
+ evidence, crossed ownership, touched unrelated dirty work, left a process or port running, rests on a stale
132
+ artifact, or implies a commit, push or release; send the narrow failure back to the same member once.
133
+ 7. **Merge.** Shared-checkout members already wrote in place. For a retained worktree, bring its change into the main
134
+ checkout as a working-tree diff (`git -C <worktree> diff` applied with `git apply --3way`), one member at a time,
135
+ rerunning that member's check after each apply. A conflict stops the merge and becomes a question for the user.
136
+ Members never commit; the orchestrator never commits either.
137
+ 8. **Re-verify the whole.** The team is done only when `status` shows `done: true` and the orchestrator has exercised
138
+ the assembled result on the real surface, not just each slice. Run `review-work` over the combined change set.
139
+ 9. **Archive and clean up.** `archive` refuses while any member is neither reported nor blocked. It writes
140
+ `archive-receipt.json` (per-member status, evidence, launch id and the digest of the packet it closed). Cancel
141
+ remaining children, close the panes this team opened, stop processes and ports, and let Muse remove clean
142
+ worktrees; a retained dirty one stays until the user says otherwise. `delete` removes the packet and its receipt;
143
+ prefer keeping an archived packet, and use `--force` only with explicit user authority.
144
+ 10. **Report once,** in reader mode: done, risks, what needs the user. Filter every member's return again before it
145
+ reaches the reply; a member cannot raise the reader mode.
118
146
 
119
147
  ## Muse tools and approvals
120
148
 
@@ -136,8 +164,13 @@ node <skill-dir>/scripts/team.mjs delete --team <id> [--force]
136
164
  and acceptance. A member's claim counts only after `subagent_read_result` and your own check.
137
165
  - `read_file`, `search`: verify diffs, cited paths and evidence. `write_file` and `edit_file` belong to the leader
138
166
  only for leader-lane work; the packet itself is written only by `team.mjs`.
139
- - `request_user_input`: composition, isolation, any worktree, any merge decision, `delete --force`. A default chosen
140
- in a headless run is a `decision` ledger line, and never grants approval for commit, push, merge or deletion.
167
+ - `workflow`: the many-similar-items distribution. Children inherit the session model; set `effort` per child only
168
+ when a light item does not need depth.
169
+ - `request_user_input`: one question when the goal is unclear, a merge conflict, `delete --force`. Nothing else is
170
+ asked up front. A default chosen in a headless run is a `decision` ledger line, and never grants approval for
171
+ commit, push, merge or deletion.
172
+ - Herdr: only when `HERDR_ENV=1` and `command -v herdr` succeeds. The orchestrator reads panes and sends messages; it
173
+ never types an approval or a permission answer into a member's pane.
141
174
  - Approvals: this skill needs none. Children of type `litmuse/*` run only after the user approved the agent
142
175
  definitions once; if a spawn is refused for that reason stop with `BLOCKED: agent not approved` and name
143
176
  `muse plugins approve litmuse:agent_definition:litmuse/<name>`. Never run an approve command yourself.
@@ -163,8 +196,8 @@ Terminal status is `PASS`, `FAIL` or `BLOCKED:` plus the archive receipt.
163
196
  `review-work` is clean, and the team is archived with cleanup confirmed.
164
197
  - **FAIL:** a deliverable is wrong or unsupported after the bounded repair, or ownership was breached.
165
198
  - **BLOCKED:** fewer than two distinct slices, no authority to edit, an unapproved or unavailable agent, a member that
166
- cannot proceed and cannot be dropped, a lock that cannot be acquired, corrupt packet state, or a request to commit,
167
- push, tag, publish, merge or create a worktree without separate authority.
199
+ cannot proceed and cannot be dropped, a lock that cannot be acquired, corrupt packet state, a merge conflict the
200
+ user has not settled, or a request to commit, push, tag or publish without separate authority.
168
201
 
169
202
  Reply with the result, material risk (blocked or inconclusive lanes, residual risk), the required action, and
170
203
  retained local state. The reader reply carries no command diary, no routine pass inventory, no timestamps and no child
@@ -21,11 +21,13 @@ command, real-surface evidence and a cleanup receipt.
21
21
  |---|---|
22
22
  | read-only analysis | shared checkout |
23
23
  | disjoint file ownership | shared checkout with explicit `--paths` |
24
- | overlapping implementation | separate worktrees, each authorized by the user |
24
+ | overlapping implementation | Muse-isolated worktrees (`worktree_isolation: true` on the member's `subagent_spawn`) |
25
25
  | release, secrets or remote settings | keep in the leader lane unless explicitly delegated |
26
26
 
27
- The packet records worktree intent and paths. It does not grant permission to create, merge, delete or push a worktree
28
- or branch; apply Git authority separately and ask with `request_user_input`.
27
+ The packet records worktree intent and paths. Muse creates an isolated worktree for the member, removes it when the
28
+ member left it clean, and keeps it when the member left changes. The orchestrator brings a kept worktree's change into
29
+ the main checkout as a working-tree diff, one member at a time; nobody commits, pushes or deletes a branch, and a merge
30
+ conflict is a question for the user.
29
31
 
30
32
  ## 2. Initialize the packet
31
33
 
@@ -132,7 +134,7 @@ node <skill-dir>/scripts/team.mjs archive --team <id> [--note "<receipt note>"]
132
134
 
133
135
  Archive refuses while any member is neither reported nor blocked, writes `archive-receipt.json`, and freezes the
134
136
  packet (later mutations are refused). Cancel running children with `subagent_cancel`, stop processes, release ports,
135
- remove temporary directories and handle worktrees only under explicit Git authority; then compare the durable status
137
+ remove temporary directories and leave kept worktrees to the user once their diff is merged; then compare the durable status
136
138
  with live resources.
137
139
 
138
140
  ```
@@ -120,10 +120,12 @@ Muse keeps one goal per session, driven by three tools whose arguments follow th
120
120
  | no active goal | `create_goal` with `objective` set to the objective sentence | `created` |
121
121
  | active goal with the same objective | adopt it, create nothing | `adopted` |
122
122
  | active goal with a different objective | adopt nothing and overwrite nothing: report the conflict, keep the record, replace the native objective only on the user's explicit word | `conflict` |
123
- | tool absent or refused (older build, headless, policy) | keep the record alone, say so once | `unavailable` |
123
+ | active goal tagged `[lit:<id>]` (set at plan approval) | adopt it; `.litmuse/goal/owner.json` names its plan and check | `adopted` |
124
+ | the call is refused (policy, headless run) | keep the record alone, say so once | `unavailable` |
124
125
 
125
126
  3. `create_goal` runs once at set. `update_goal` runs on each criterion change to refresh `status` (a short word such as active, blocked or complete), `percentComplete`, `currentWork` and `nextWork`, and a final time at the verdict. A second objective for the same work layers criteria onto the existing record through steering.
126
127
  4. The native goal is a convenience for the host. The record decides: `native.state` never overrides what the criteria say.
128
+ 5. A plan-approval goal (`[lit:<id>]`) belongs to the Done when pipeline: it is created only after the user's exact `yes` (PreToolUse refuses any other `[lit:…]` objective), closed with `update_goal` status complete once every row is ticked and the check exits 0, or status blocked on `lit cancel` or a BLOCKED stop. A goal without that tag is the user's own: report it, never close it.
127
129
 
128
130
  ### update (record results)
129
131
 
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: litresearch
3
3
  description: "Research a question across sources down to primary evidence and return a referenced synthesis."
4
+ goal: never
4
5
  ---
5
6
 
6
7
  # litresearch — saturation research orchestrator for Muse Code
@@ -160,11 +160,11 @@ obvious. Pass it the gathered findings (file:line facts, constraints, unknowns).
160
160
  steps, justifies no planner; plan directly in `notes.md`. Planning is never delegated before the discovery wave
161
161
  returns.
162
162
 
163
- **1. Bind the goal with checkable success criteria.** Call `get_goal` if exposed. With a matching active goal, keep
164
- it. With none and `create_goal` exposed, create one from the criteria below. A different active goal stays intact,
165
- and `update_goal` is reserved for verified completion or a genuine blocker. When the native tools are missing, say
166
- once that the run is in degraded mode and keep the `litgoal` record `.litmuse/goals/<slug>.json` authoritative. Do
167
- not invent a goal budget or limit.
163
+ **1. Bind the goal with checkable success criteria.** Call `get_goal` first. With a matching active goal, keep it
164
+ (a `[lit:<id>]` goal from plan approval included). With none, create one from the criteria below with `create_goal`.
165
+ A different active goal stays intact, and `update_goal` is reserved for verified completion or a genuine blocker. When
166
+ a goal call is refused (policy, headless run), say so once and keep the `litgoal` record `.litmuse/goals/<slug>.json`
167
+ authoritative. Do not invent a goal budget or limit.
168
168
 
169
169
  The criteria state, up front:
170
170
 
@@ -462,7 +462,7 @@ state, report the last verified boundary, and wait for a fresh instruction befor
462
462
  leftovers.
463
463
  - `subagent_spawn` (always with `subagent_type`), `subagent_wait`, `subagent_read_result`, `subagent_status`,
464
464
  `subagent_send_message`, `subagent_cancel` for delegation.
465
- - `get_goal`, `create_goal`, `update_goal` for native goal binding when exposed; `write_todos` for the live checklist;
465
+ - `get_goal`, `create_goal`, `update_goal` for native goal binding (Muse's one session goal); `write_todos` for the live checklist;
466
466
  `report_progress` for long runs only.
467
467
  - `request_user_input` when a criterion depends on an intent you cannot infer; in headless runs, ask in the reply
468
468
  and stop at the question, logging any default taken as a `decision`.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: review-work
3
3
  description: "Review a plan before work or a diff after it: five lanes, findings first, PASS/FAIL/BLOCKED."
4
+ goal: never
4
5
  ---
5
6
 
6
7
  # Review Work
@@ -503,7 +503,7 @@ same one-line edit as for ordinary rows.
503
503
  - `subagent_spawn` (always with `subagent_type`), `subagent_wait`, `subagent_read_result`, `subagent_status`,
504
504
  `subagent_send_message`, `subagent_cancel` for delegation: `litmuse/lit-executor` implements, `litmuse/qa-runner`
505
505
  runs surface probes, `litmuse/lit-verifier` and `litmuse/quality-reviewer` review.
506
- - `get_goal`, `create_goal`, `update_goal` for native goal binding, when exposed; `write_todos` for the live checklist.
506
+ - `get_goal`, `create_goal`, `update_goal` for native goal binding. A run started by `yes` at plan approval sets exactly the `[lit:<id>]` objective the hook names, and closes it with `update_goal` status complete once every row is ticked and the plan's check exits 0 (status blocked on a BLOCKED stop); `write_todos` for the live checklist.
507
507
  `report_progress` suits long runs only.
508
508
  - `request_user_input` for plan choice, approvals, scope changes and boundaries. In headless runs the question goes
509
509
  in the reply, a default is logged as a `decision`, and the run stops at the boundary.