@litfamily/litmuse 0.1.16 → 0.1.17
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/CHANGELOG.md +6 -0
- package/README.md +37 -4
- package/README_ko-KR.md +31 -4
- package/package.json +1 -1
- package/plugin/.muse-plugin/plugin.json +11 -11
- package/plugin/hooks/lib/goal.mjs +26 -4
- package/plugin/hooks/stop.mjs +1 -1
- package/plugin/hooks/user-prompt-submit.mjs +1 -1
- package/plugin/skills/lit-loop/SKILL.md +2 -2
- package/plugin/skills/lit-plan/SKILL.md +2 -2
- package/plugin/skills/lit-plan/scripts/goal-propose.mjs +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.17 — 2026-11-22
|
|
4
|
+
|
|
5
|
+
- Both READMEs now open with a plain one-line pitch, a short before-and-after story and a "Two ways to use it" section: the easy way is your usual request with `lit` at the start or the end; the full workflow is a six-step table (explore, clarify, plan, build, review, hand off) with the line to type for each step, followed by the one install line.
|
|
6
|
+
- Every goal question now comes with an answer guide under it, so a first-time user sees what to type and what each answer does. The question line itself and the accepted answers are unchanged. `goal-propose.mjs` prints the guide after a blank line, and the prompt hook passes it with the lit-loop question; it is a short Markdown block: a title, the goal, one row per answer (`yes` / `edit` / `no` for a plan with a goal, `yes` / `no` for start only and for a lit-loop) and `Type the word alone.` The model words it in your language and keeps the answer words in English. Muse shows no hook text, so the guide, like the question, depends on the model repeating it.
|
|
7
|
+
- The hook code changed, so Muse asks you to approve the LitMuse hooks again after the update.
|
|
8
|
+
|
|
3
9
|
## 0.1.16 — 2026-11-21
|
|
4
10
|
|
|
5
11
|
- A lit-loop or litwork run with no plan can now get a Muse goal too, asked once. When the project has a test command (`npm test`, `pytest`, `cargo test` or `go test ./...`) and the prompt names an objective, the prompt hook records one question at the run's first activation and tells the model to end its first reply with `Set goal for this lit-loop: /goal <check> exits 0 and this is done: <objective>? (yes / no)`. Muse shows no hook text, so that is the model's job and cannot be forced. An exact `yes` arms the goal, and the model sets it with `create_goal` the way a plan's goal is set, but starts no start-work; `no`, `edit` or any other prompt drops the question. With no test command the model asks after its failing check through `goal-propose.mjs --loop --check "<check>" <objective>`, which runs the check once and prints `No goal set: <reason>` when it already passes, cannot run or is not an allowlisted test command. A repeat of `lit`, `lit goal`, a plan, and a session that already holds an open goal or a pending question ask nothing.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<h1 align="center">LitMuse</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
|
|
6
|
-
<p align="center">LitMuse
|
|
6
|
+
<p align="center">LitMuse is an add-on for Muse Code. It makes Muse check its own work before it says "done", and leaves a note so the next session starts where this one stopped.</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a href="https://www.npmjs.com/package/@litfamily/litmuse"><img src="https://img.shields.io/npm/v/@litfamily/litmuse?color=FF6337&label=npm" alt="npm version" /></a>
|
|
@@ -11,11 +11,44 @@
|
|
|
11
11
|
<a href="https://github.com/wjgoarxiv/litmuse/stargazers"><img src="https://img.shields.io/github/stars/wjgoarxiv/litmuse?style=flat" alt="GitHub stars" /></a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
+
You ask Muse for a feature. It writes the code and says it is finished, and a day later you find the tests
|
|
15
|
+
never ran. You open a new session and explain the whole project again.
|
|
16
|
+
|
|
17
|
+
With LitMuse you add `lit` to the same request. Muse first writes down what "finished" means for this task,
|
|
18
|
+
adds a test that fails, makes it pass, and ends by telling you what it checked and what it could not. When you
|
|
19
|
+
stop, type `lit handoff`. Muse saves a note, and in the next session `lit adhd` reads it and tells you where to
|
|
20
|
+
pick up.
|
|
21
|
+
|
|
14
22
|
<p align="center"><a href="#inside-one-lit-turn">How it works</a> <a href="#in-the-muse-app-too">Muse app</a> <a href="#install">Install</a> <a href="#quick-start">Quick start</a> <a href="#the-status-card">Status card</a> <a href="#automatic-handoff">Handoff</a> <a href="#safety">Safety</a> <a href="./README_ko-KR.md">한국어</a></p>
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
## Two ways to use it
|
|
25
|
+
|
|
26
|
+
**The easy way.** Write your request as usual and put `lit` at the start or at the end:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
fix the date parsing bug in src/dates.js lit
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Muse sets the goal, writes a failing test, fixes the bug, checks the result and tells you what it checked.
|
|
33
|
+
Most tasks need nothing more.
|
|
34
|
+
|
|
35
|
+
**The full workflow.** For a bigger job, go one step at a time. Each step leaves a file the next step reads,
|
|
36
|
+
and you can skip any step you do not need.
|
|
37
|
+
|
|
38
|
+
| Step | Type | What happens |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| 1. Explore | `lit brainstorm <question>` | Many options, scored, cut to a short list |
|
|
41
|
+
| 2. Clarify | `lit interview <idea>` | Muse asks questions until the goal is clear |
|
|
42
|
+
| 3. Plan | `lit crucible <approach>` or `lit plan <task>` | Crucible attacks the approach first, then plans; lit-plan writes `plans/<slug>.md` and asks for your yes |
|
|
43
|
+
| 4. Build | `yes` to the plan, or `/start-work` | Muse works through the plan row by row with tests; with no plan, `lit <task>` runs lit-loop |
|
|
44
|
+
| 5. Review | `lit review` | A review in five lanes, findings first |
|
|
45
|
+
| 6. Hand off | `lit handoff` | What was built, how it was checked and what is left, saved to a file |
|
|
46
|
+
|
|
47
|
+
Install with one line, then open Muse in your project ([Quick start](#quick-start) has the full first run):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx @litfamily/litmuse install
|
|
51
|
+
```
|
|
19
52
|
|
|
20
53
|
## Pick your path
|
|
21
54
|
|
package/README_ko-KR.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<h1 align="center">LitMuse</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
|
|
6
|
-
<p align="center">LitMuse는
|
|
6
|
+
<p align="center">LitMuse는 Muse Code에 붙이는 추가 기능입니다. Muse가 "다 됐어요"라고 말하기 전에 자기 작업을 직접 확인하게 하고, 다음 세션이 이번에 멈춘 자리에서 시작하도록 기록을 남기게 합니다.</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a href="https://www.npmjs.com/package/@litfamily/litmuse"><img src="https://img.shields.io/npm/v/@litfamily/litmuse?color=FF6337&label=npm" alt="npm version" /></a>
|
|
@@ -11,11 +11,38 @@
|
|
|
11
11
|
<a href="https://github.com/wjgoarxiv/litmuse/stargazers"><img src="https://img.shields.io/github/stars/wjgoarxiv/litmuse?style=flat" alt="GitHub stars" /></a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
+
Muse에게 기능을 하나 부탁하면 코드를 쓰고 끝났다고 합니다. 그런데 다음 날 보니 테스트는 한 번도 돌지 않았습니다. 새 세션을 열면 프로젝트 설명을 처음부터 다시 해야 합니다.
|
|
15
|
+
|
|
16
|
+
LitMuse를 쓰면 같은 요청에 `lit`만 붙이면 됩니다. Muse는 먼저 이 작업에서 "끝났다"가 무슨 뜻인지 적어 두고, 실패하는 테스트를 추가해 통과시킨 뒤, 무엇을 확인했고 무엇은 확인하지 못했는지 알려 줍니다. 작업을 멈출 때 `lit handoff`라고 치면 Muse가 기록을 남깁니다. 다음 세션에서 `lit adhd`를 치면 그 기록을 읽고 어디서 이어 가면 되는지 알려 줍니다.
|
|
17
|
+
|
|
14
18
|
<p align="center"><a href="#lit-한-턴의-안쪽">동작 방식</a> <a href="#muse-앱에서도">Muse 앱</a> <a href="#설치">설치</a> <a href="#빠른-시작">빠른 시작</a> <a href="#상태-카드">상태 카드</a> <a href="#자동-핸드오프">핸드오프</a> <a href="#안전">안전</a> <a href="./README.md">English</a></p>
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
## 두 가지 사용법
|
|
21
|
+
|
|
22
|
+
**간단하게.** 평소처럼 요청을 쓰고, 앞이나 끝에 `lit`을 붙입니다.
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
src/dates.js의 날짜 파싱 버그 고쳐줘 lit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Muse가 목표를 정하고, 실패하는 테스트를 쓰고, 버그를 고치고, 결과를 확인한 뒤 무엇을 확인했는지 알려 줍니다. 웬만한 작업은 이것으로 충분합니다.
|
|
29
|
+
|
|
30
|
+
**본격적으로.** 큰 작업은 한 단계씩 밟아 갑니다. 단계마다 남긴 파일을 다음 단계가 읽고, 필요 없는 단계는 건너뛰어도 됩니다.
|
|
31
|
+
|
|
32
|
+
| 단계 | 입력 | 하는 일 |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| 1. 넓게 보기 | `lit brainstorm <질문>` | 선택지를 많이 낸 뒤 점수를 매겨 몇 개로 추립니다 |
|
|
35
|
+
| 2. 구체화 | `lit interview <아이디어>` | 목표가 분명해질 때까지 Muse가 질문합니다 |
|
|
36
|
+
| 3. 계획 | `lit crucible <접근법>` 또는 `lit plan <작업>` | crucible은 접근법의 약점부터 파고든 뒤 계획으로 넘기고, lit-plan은 `plans/<slug>.md`에 단계를 적고 승인을 묻습니다 |
|
|
37
|
+
| 4. 실행 | 계획에 `yes`, 또는 `/start-work` | 계획을 한 줄씩 테스트와 함께 진행합니다. 계획 없이 바로 하려면 `lit <작업>`이 lit-loop를 돌립니다 |
|
|
38
|
+
| 5. 검토 | `lit review` | 다섯 갈래로 검토하고 발견한 문제부터 알려 줍니다 |
|
|
39
|
+
| 6. 넘겨주기 | `lit handoff` | 만든 것, 확인한 방법, 남은 일을 파일로 남깁니다 |
|
|
40
|
+
|
|
41
|
+
설치는 한 줄입니다. 그다음 프로젝트에서 Muse를 여세요(처음 써 보는 전체 과정은 [빠른 시작](#빠른-시작)에 있습니다).
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx @litfamily/litmuse install
|
|
45
|
+
```
|
|
19
46
|
|
|
20
47
|
## 길 고르기
|
|
21
48
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "litmuse",
|
|
4
4
|
"displayName": "LitMuse",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.17",
|
|
6
6
|
"description": "LitFamily workflows for Muse Code: bare lit activation, planning, evidence-bound execution, review, research, handoff and Korean prose care.",
|
|
7
7
|
"compat": {
|
|
8
8
|
"source": "native",
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
"node",
|
|
252
252
|
"hooks/session-start.mjs",
|
|
253
253
|
"--digest",
|
|
254
|
-
"
|
|
254
|
+
"6baae3557423277e"
|
|
255
255
|
],
|
|
256
256
|
"timeoutMs": 5000
|
|
257
257
|
},
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
"node",
|
|
263
263
|
"hooks/user-prompt-submit.mjs",
|
|
264
264
|
"--digest",
|
|
265
|
-
"
|
|
265
|
+
"e7d8c7705a91f519"
|
|
266
266
|
],
|
|
267
267
|
"timeoutMs": 5000,
|
|
268
268
|
"statusMessage": "LitMuse route check"
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
"node",
|
|
275
275
|
"hooks/pre-tool-use.mjs",
|
|
276
276
|
"--digest",
|
|
277
|
-
"
|
|
277
|
+
"e23e84f0ffaf73fe"
|
|
278
278
|
],
|
|
279
279
|
"timeoutMs": 5000
|
|
280
280
|
},
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
"node",
|
|
286
286
|
"hooks/post-tool-use.mjs",
|
|
287
287
|
"--digest",
|
|
288
|
-
"
|
|
288
|
+
"ceb33d84bc6c9357"
|
|
289
289
|
],
|
|
290
290
|
"timeoutMs": 5000
|
|
291
291
|
},
|
|
@@ -296,7 +296,7 @@
|
|
|
296
296
|
"node",
|
|
297
297
|
"hooks/post-tool-use-failure.mjs",
|
|
298
298
|
"--digest",
|
|
299
|
-
"
|
|
299
|
+
"b42aa0bd4e6042e5"
|
|
300
300
|
],
|
|
301
301
|
"timeoutMs": 5000
|
|
302
302
|
},
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"node",
|
|
308
308
|
"hooks/stop.mjs",
|
|
309
309
|
"--digest",
|
|
310
|
-
"
|
|
310
|
+
"9ad346f20cf126ac"
|
|
311
311
|
],
|
|
312
312
|
"timeoutMs": 5000
|
|
313
313
|
},
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
"node",
|
|
319
319
|
"hooks/subagent-start.mjs",
|
|
320
320
|
"--digest",
|
|
321
|
-
"
|
|
321
|
+
"73ed706b85ac24ad"
|
|
322
322
|
],
|
|
323
323
|
"timeoutMs": 5000
|
|
324
324
|
},
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
"node",
|
|
330
330
|
"hooks/subagent-stop.mjs",
|
|
331
331
|
"--digest",
|
|
332
|
-
"
|
|
332
|
+
"da71a8f32db174c2"
|
|
333
333
|
],
|
|
334
334
|
"timeoutMs": 5000
|
|
335
335
|
},
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
"node",
|
|
341
341
|
"hooks/session-end.mjs",
|
|
342
342
|
"--digest",
|
|
343
|
-
"
|
|
343
|
+
"4094a21bac5cdef7"
|
|
344
344
|
],
|
|
345
345
|
"timeoutMs": 5000
|
|
346
346
|
},
|
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
"node",
|
|
352
352
|
"hooks/pre-compact.mjs",
|
|
353
353
|
"--digest",
|
|
354
|
-
"
|
|
354
|
+
"5062dd39ae09db34"
|
|
355
355
|
],
|
|
356
356
|
"timeoutMs": 5000
|
|
357
357
|
}
|
|
@@ -27,14 +27,36 @@ export const CONSENT_TTL_MS = 30 * 60 * 1000;
|
|
|
27
27
|
export const FALSIFY_TIMEOUT_MS = 120_000;
|
|
28
28
|
export const LIT_TAG = /\[lit:([0-9a-f]{8})\]\s*$/u;
|
|
29
29
|
|
|
30
|
+
// The answers each goal question accepts, with what each one does. The question's `(yes / …)` suffix and the answer
|
|
31
|
+
// guide under it are both built from this one list, so they cannot drift apart.
|
|
32
|
+
export const GOAL_ANSWERS = Object.freeze({
|
|
33
|
+
plan: { title: 'approve plan · start work · set goal', answers: [['yes', 'Starts the work now and sets this goal'], ['edit', "Change the plan or the goal's check first, then you are asked again"], ['no', 'Nothing starts and no goal is set']] },
|
|
34
|
+
start: { title: 'approve plan · start work', answers: [['yes', 'Starts the work now, with no goal'], ['no', 'Nothing starts']] },
|
|
35
|
+
loop: { title: 'set goal for this lit-loop', answers: [['yes', 'Sets this goal; the loop goes on'], ['no', 'The loop goes on without a goal']] },
|
|
36
|
+
});
|
|
37
|
+
const choices = (kind) => `(${GOAL_ANSWERS[kind].answers.map(([word]) => word).join(' / ')})`;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The answer guide the model renders under a goal question, as a Markdown block quote: Muse shows no hook text, so every
|
|
41
|
+
* goal question reaches the user inside a model-written reply. The model words the descriptions in the user's language;
|
|
42
|
+
* the answer words stay English because the prompt hook matches them exactly. A condition holding a backtick is fenced
|
|
43
|
+
* with double backticks.
|
|
44
|
+
*/
|
|
45
|
+
export function answerGuide(kind, cond) {
|
|
46
|
+
const { title, answers } = GOAL_ANSWERS[kind];
|
|
47
|
+
const goal = cond === undefined ? [] : [`> Goal: \`\`/goal ${cond}\`\``, '>'];
|
|
48
|
+
return [`> **▶ Answer: ${title}**`, '>', ...goal, '> | Type | What happens |', '> |---|---|',
|
|
49
|
+
...answers.map(([word, effect]) => `> | **\`${word}\`** | ${effect} |`), '>', '> Type the word alone.'].join('\n');
|
|
50
|
+
}
|
|
51
|
+
|
|
30
52
|
// Fixed status lines, one per outcome. Hooks and the propose script print these and nothing else.
|
|
31
53
|
export const GOAL_STATUS = Object.freeze({
|
|
32
|
-
asked: (cond) => `Approve plan, start work and set goal: /goal ${cond}? (
|
|
33
|
-
askedStart:
|
|
54
|
+
asked: (cond) => `Approve plan, start work and set goal: /goal ${cond}? ${choices('plan')}`,
|
|
55
|
+
askedStart: `Approve plan and start work? ${choices('start')}`,
|
|
34
56
|
declined: 'Nothing started and no goal set: you said no',
|
|
35
57
|
notStarted: (why) => `Work not started and no goal set: ${why}`,
|
|
36
58
|
notRecorded: (plan) => `Approval not recorded for this session. Run: lit start ${plan}`,
|
|
37
|
-
loopAsked: (cond) => `Set goal for this lit-loop: /goal ${cond}? (
|
|
59
|
+
loopAsked: (cond) => `Set goal for this lit-loop: /goal ${cond}? ${choices('loop')}`,
|
|
38
60
|
skipped: (reason) => `No goal set: ${reason}`,
|
|
39
61
|
set: (id) => `LitMuse goal set [lit:${id}]`,
|
|
40
62
|
yours: 'Your own goal is active; LitMuse left it alone.',
|
|
@@ -150,7 +172,7 @@ export function buildLoopConsent({ cwd, check, objective, now = Date.now(), time
|
|
|
150
172
|
const dry = falsifyNow ? falsifyLoop({ cwd, check: command, ...(timeoutMs ? { timeoutMs } : {}), ...(run ? { run } : {}) }) : { ok: true };
|
|
151
173
|
if (!dry.ok) return { line: GOAL_STATUS.skipped(dry.reason) };
|
|
152
174
|
const consent = { version: 1, kind: 'loop', goal: true, condition: built.condition, hash: conditionHash(built.condition), id: built.id, plan: null, check: command, objective: goal, sessionId, askedAt: new Date(now).toISOString() };
|
|
153
|
-
return { line: GOAL_STATUS.loopAsked(built.condition), consent };
|
|
175
|
+
return { line: GOAL_STATUS.loopAsked(built.condition), guide: answerGuide('loop', built.condition), consent };
|
|
154
176
|
}
|
|
155
177
|
|
|
156
178
|
const openRows = (planText) => String(planText ?? '').split('\n').filter((line) => /^- \[ \] (?:\d+|F\d+)\. /u.test(line)).length;
|
package/plugin/hooks/stop.mjs
CHANGED
|
@@ -40,7 +40,7 @@ function goalQuestionMissing(cwd, saved) {
|
|
|
40
40
|
if (text === null || !/^##\s+Done when\s*$/imu.test(text) || /^goal:\s*never\s*$/mu.test(text)) return null;
|
|
41
41
|
const consent = readGoalRecord(resolveProjectStateRoot(cwd), 'consent');
|
|
42
42
|
if (consent && consent.plan === saved && Date.parse(consent.askedAt) >= statSync(join(cwd, saved)).mtimeMs - 1000) return null;
|
|
43
|
-
return `LitMuse lit-plan gate: ${saved} has a \`## Done when\` block but no goal question yet. Run \`node ${join(PLUGIN_ROOT, 'skills', 'lit-plan', 'scripts', 'goal-propose.mjs')} ${saved}\` once and
|
|
43
|
+
return `LitMuse lit-plan gate: ${saved} has a \`## Done when\` block but no goal question yet. Run \`node ${join(PLUGIN_ROOT, 'skills', 'lit-plan', 'scripts', 'goal-propose.mjs')} ${saved}\` once and end the reply with what it prints (the approval question, then its answer guide), then end the turn.`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// At turn end the goal LitMuse owns is checked the only way a 5 s hook can: when every row of its plan is ticked, the
|
|
@@ -333,7 +333,7 @@ function loopGoalNote(hit, payload) {
|
|
|
333
333
|
const offer = buildLoopConsent({ cwd, check, objective, falsifyNow: false, sessionId: payload.session_id });
|
|
334
334
|
if (!offer.consent) return null;
|
|
335
335
|
writeGoalRecord(root, 'consent', offer.consent);
|
|
336
|
-
return `Native goal: LitMuse recorded one goal question for this run. End your first reply with exactly this line, as its
|
|
336
|
+
return `Native goal: LitMuse recorded one goal question for this run. End your first reply with exactly this line, asked once, and under it this answer guide as Markdown, its descriptions in the user's language and the answer words in English:\n${offer.line}\n\n${offer.guide}\nNever type or send /goal yourself. Do not call create_goal for this run before the user's exact \`yes\` on a later prompt; the hook then gives you the objective. Until then keep the ledger authoritative.`;
|
|
337
337
|
} catch {
|
|
338
338
|
return null;
|
|
339
339
|
}
|
|
@@ -95,8 +95,8 @@ Durable path: create or reuse the record per `litgoal` (`read_skill` id `plugin:
|
|
|
95
95
|
|
|
96
96
|
Native goal for a loop with no plan: LitMuse asks one question per run and the user's exact `yes` arms it, the way a plan's approval does but without starting `start-work`.
|
|
97
97
|
|
|
98
|
-
- When the project has a test command (`npm test`, `pytest`, `cargo test`, `go test ./...`) and the prompt names an objective, the prompt hook records the question at the loop's first activation and its context hands you the line. Muse shows no hook text, so end your first reply with exactly `Set goal for this lit-loop: /goal <condition>? (yes / no)`, once, with the condition the hook gave (`` `<check>` exits 0 and this is done: <objective> [lit:<id>] ``). Do not ask it again later.
|
|
99
|
-
- Without a test command, run `node <skill-dir-of-lit-plan>/scripts/goal-propose.mjs --loop --check "<check>" <objective>` once a failing check proves the objective (after the RED step) and end that reply with the line it
|
|
98
|
+
- When the project has a test command (`npm test`, `pytest`, `cargo test`, `go test ./...`) and the prompt names an objective, the prompt hook records the question at the loop's first activation and its context hands you the line. Muse shows no hook text, so end your first reply with exactly `Set goal for this lit-loop: /goal <condition>? (yes / no)`, once, with the condition the hook gave (`` `<check>` exits 0 and this is done: <objective> [lit:<id>] ``), and under it the answer guide the hook gives: a Markdown block quote with a `yes` row and a `no` row saying what each does, closed by `Type the word alone.` Word its title and descriptions in the user's language and keep the answer words in English, because the prompt hook matches only the exact English word. Do not ask it again later.
|
|
99
|
+
- Without a test command, run `node <skill-dir-of-lit-plan>/scripts/goal-propose.mjs --loop --check "<check>" <objective>` once a failing check proves the objective (after the RED step) and end that reply with what it prints: the question line unchanged, then the answer guide under it, rendered the same way. The script runs the check once: a check that already passes, cannot run or is not an allowlisted test command prints `No goal set: <reason>` and records nothing, and you go on without a goal.
|
|
100
100
|
- Only the user's exact `yes` (any case) on the next prompt arms it: the hook then tells you to call `get_goal` and, with no unfinished goal, `create_goal` with that exact objective (PreToolUse refuses any other `[lit:…]` objective), and to call `update_goal` with `complete` once the check exits 0 and the objective is done. `no` or any other prompt, including `edit`, drops the question. Never type `/goal` yourself and never call `create_goal` for this run before that `yes`; a goal the user set by hand stays untouched.
|
|
101
101
|
|
|
102
102
|
For a goal with several units, write a dependency map before delegating:
|
|
@@ -115,7 +115,7 @@ If the question cannot be asked in this turn but a human is present, write the p
|
|
|
115
115
|
|
|
116
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
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,
|
|
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. After a blank line it prints the answer guide, a Markdown block quote with one row per accepted answer (`yes`, `edit`, `no`, or `yes`, `no` for start only) saying what each one does, closed by `Type the word alone.` End the reply with what it printed: the question line exactly as printed, then the answer guide under it, its title and descriptions in the user's language and the answer words in English, because the prompt hook matches only the exact English word. Do not drop the guide: it is how a first-time user learns what to type.
|
|
119
119
|
|
|
120
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.
|
|
121
121
|
|
|
@@ -352,7 +352,7 @@ Refused on this route: `create_goal`, `update_goal`, `write_todos`, `add_memory`
|
|
|
352
352
|
|
|
353
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.
|
|
354
354
|
|
|
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.
|
|
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, the question and its answer guide (`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.
|
|
356
356
|
|
|
357
357
|
## Pitfalls
|
|
358
358
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// puts what it prints into the approval question. It compiles the plan's `## Done when` block into one Muse goal
|
|
4
4
|
// objective, lints it, runs the check once to prove the objective is false now, and records the question in
|
|
5
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
|
|
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
|
|
6
|
+
// goal, or, when no goal is possible, the start-only question and the one `No goal set: <reason>` line; a blank line and
|
|
7
|
+
// the answer guide follow any question, for the model to render under it. An unreadable 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
8
|
// this one command during a planning turn.
|
|
9
9
|
// `node <skill-dir>/scripts/goal-propose.mjs --loop --check "<check>" <objective...>` is the lit-loop form: a run with no
|
|
10
10
|
// plan asks one goal question once its failing check exists (the check must fail now; a check that already passes, cannot
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { readFileSync } from 'node:fs';
|
|
14
14
|
import { isAbsolute, relative, resolve } from 'node:path';
|
|
15
15
|
import { pathToFileURL } from 'node:url';
|
|
16
|
-
import { GOAL_STATUS, buildLoopConsent, compileCondition, conditionHash, consentKey, falsify, lintCondition, parseDoneWhen, writeGoalRecord } from '../../../hooks/lib/goal.mjs';
|
|
16
|
+
import { GOAL_STATUS, answerGuide, buildLoopConsent, compileCondition, conditionHash, consentKey, falsify, lintCondition, parseDoneWhen, writeGoalRecord } from '../../../hooks/lib/goal.mjs';
|
|
17
17
|
import { resolveProjectStateRoot } from '../../../hooks/lib/workflow-stack.mjs';
|
|
18
18
|
|
|
19
19
|
export function proposeGoal({ cwd, planArg, now = Date.now(), timeoutMs, run, sessionId = null } = {}) {
|
|
@@ -32,7 +32,7 @@ export function proposeGoal({ cwd, planArg, now = Date.now(), timeoutMs, run, se
|
|
|
32
32
|
const consent = { version: 1, goal: false, plan, reason, sessionId, askedAt };
|
|
33
33
|
consent.hash = conditionHash(consentKey(consent));
|
|
34
34
|
writeGoalRecord(resolveProjectStateRoot(cwd), 'consent', consent);
|
|
35
|
-
return { line: `${GOAL_STATUS.askedStart}\n${GOAL_STATUS.skipped(reason)}`, consent };
|
|
35
|
+
return { line: `${GOAL_STATUS.askedStart}\n${GOAL_STATUS.skipped(reason)}`, guide: answerGuide('start'), consent };
|
|
36
36
|
};
|
|
37
37
|
if (/^goal:\s*never\s*$/mu.test(planText)) return startOnly('this plan is marked goal: never');
|
|
38
38
|
const done = parseDoneWhen(planText);
|
|
@@ -45,7 +45,7 @@ export function proposeGoal({ cwd, planArg, now = Date.now(), timeoutMs, run, se
|
|
|
45
45
|
if (!dry.ok) return startOnly(dry.reason);
|
|
46
46
|
const consent = { version: 1, goal: true, condition: built.condition, hash: conditionHash(built.condition), id: built.id, plan, check: done.check, sessionId, askedAt };
|
|
47
47
|
writeGoalRecord(resolveProjectStateRoot(cwd), 'consent', consent);
|
|
48
|
-
return { line: GOAL_STATUS.asked(built.condition), consent };
|
|
48
|
+
return { line: GOAL_STATUS.asked(built.condition), guide: answerGuide('plan', built.condition), consent };
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export function proposeLoopGoal({ cwd, check, objective, now = Date.now(), timeoutMs, run, sessionId = null } = {}) {
|
|
@@ -56,8 +56,8 @@ export function proposeLoopGoal({ cwd, check, objective, now = Date.now(), timeo
|
|
|
56
56
|
|
|
57
57
|
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
58
58
|
const [first, ...rest] = process.argv.slice(2);
|
|
59
|
-
const { line } = first === '--loop' && rest[0] === '--check'
|
|
59
|
+
const { line, guide } = first === '--loop' && rest[0] === '--check'
|
|
60
60
|
? proposeLoopGoal({ cwd: process.cwd(), check: rest[1], objective: rest.slice(2).join(' ') })
|
|
61
61
|
: proposeGoal({ cwd: process.cwd(), planArg: first });
|
|
62
|
-
process.stdout.write(`${line}\n`);
|
|
62
|
+
process.stdout.write(guide ? `${line}\n\n${guide}\n` : `${line}\n`);
|
|
63
63
|
}
|