@litfamily/litclaude 1.0.59 → 1.0.61

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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.61 - 2026-11-24
4
+
5
+ - Install, doctor and help open with the synthwave LIT mark, and the HUD, card and status line show
6
+ a gradient LIT pill.
7
+ - A request that ends with the activation word (`fix the login redirect lit`, `… 부탁해 lit`) now asks
8
+ the goal question, using the words before `lit` as the objective. A trailing `lit-loop`, `litwork`
9
+ or `lit-hijack` routes the same as the leading word; before, a trailing `lit-loop` activated nothing.
10
+ A leading `lit-hijack <task>` no longer puts `-hijack` at the start of the goal.
11
+ - A start-work state lock left by a crashed holder (no owner record, a dead contender's takeover claim,
12
+ or a reused pid) is now reclaimed, and no hold lasts longer than 10 minutes. The PreToolUse guard
13
+ reads a state snapshot instead of waiting on the lock, so several sessions on a slow drive no longer
14
+ block every tool call or `lit cancel`. A lock timeout names the lock path and its holder.
15
+
16
+ ## 1.0.60 - 2026-11-22
17
+
18
+ - The goal question now comes with an answer guide, so a first-time user knows what to type. Under
19
+ lit-plan's approval question and lit-loop's goal question, Claude shows a short table of each answer
20
+ (`yes`, `edit`, `no`) and what it does, ending `Type the word alone.` The descriptions follow the
21
+ user's language; the answer words stay the same. The question the prompt hook prints carries the same
22
+ guide as plain lines.
23
+ - A whole prompt of `lit handoff` now opens the handoff the same way `handoff` does.
24
+ `lit deep interview <idea>`, `lit deep-interview <idea>` and `lit interview <idea>` start the
25
+ clarifying interview. `litclaude-ai why` reports both routes as the prompt hook takes them.
26
+ - The English and Korean READMEs, on GitHub and on npm, open with a plain one-line pitch and a "Two ways
27
+ to use it" section: the easy way, with `lit` added to an ordinary request, and the full step-by-step
28
+ workflow from brainstorm to handoff.
29
+
3
30
  ## 1.0.59 - 2026-11-21
4
31
 
5
32
  - A test command at the end of a leading `&&` chain keeps its own exit in the receipt when a pipe or
package/README.md CHANGED
@@ -1,20 +1,47 @@
1
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: seven armored robots power on one by one, the LitClaude robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
1
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: seven armored robots power on one by one, the LitClaude robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
2
2
 
3
3
  <h1 align="center">LitClaude</h1>
4
4
  <p align="center"><strong>Keep the work lit.</strong></p>
5
- <p align="center">A Claude Code plugin that helps every session plan the work, build it, check it, and leave a note the next session can pick up.</p>
5
+ <p align="center">LitClaude is an add-on for Claude Code. It makes Claude check its own work before it says "done", and leaves a note so the next session starts where this one stopped.</p>
6
6
  <p align="center">
7
- <img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/readme/badge-version.svg" alt="1.0.59" />
8
- <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
7
+ <img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/readme/badge-version.svg" alt="1.0.61" />
8
+ <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
9
9
  </p>
10
10
  <p align="center">
11
- <a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/README_ko-KR.md">한국어</a>
11
+ <a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/README_ko-KR.md">한국어</a>
12
12
  </p>
13
13
 
14
- Add `lit` to a Claude Code prompt and Claude pins the goal, writes a failing test first,
15
- checks the real result and leaves a record in your project. Type `handoff` when you stop, and
16
- the next session reads that record and picks up where this one left off. It suits people who
17
- use Claude Code on real projects and want proof before "done".
14
+ You ask Claude 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 LitClaude you add `lit` to the same request. Claude first writes down what "finished" means for this
18
+ task, adds a test that fails, makes it pass, and ends by telling you what it checked and what it could not.
19
+ When you stop, type `handoff`. Claude saves a note, and the next session reads it and carries on.
20
+
21
+ ## Two ways to use it
22
+
23
+ **The easy way.** Write your request as usual and put `lit` at the start or at the end:
24
+
25
+ ```text
26
+ fix the date parsing bug in src/dates.js lit
27
+ ```
28
+
29
+ Claude sets the goal, writes a failing test, fixes the bug, checks the result and tells you what it checked.
30
+ Most tasks need nothing more.
31
+
32
+ **The full workflow.** For a bigger job, go one step at a time. Each step leaves a file the next step reads,
33
+ and you can skip any step you do not need.
34
+
35
+ | Step | Type | What happens |
36
+ | --- | --- | --- |
37
+ | 1. Explore | `/litclaude:lit-brainstorm <question>` | Many options, scored, cut to a short list |
38
+ | 2. Clarify | `/litclaude:deep-interview <idea>` | Claude asks questions until the goal is clear |
39
+ | 3. Plan | `lit-crucible <approach>` or `/litclaude:lit-plan <task>` | Crucible attacks the approach first, then plans; lit-plan writes the steps and waits for your yes |
40
+ | 4. Build | `yes` to the plan, or `/litclaude:lit-loop <task>` | Claude works through it with tests and checks |
41
+ | 5. Review | `/litclaude:review-work` | A review in five lanes, findings first |
42
+ | 6. Hand off | `handoff` | Decisions and the next step, saved to a file |
43
+
44
+ Install with one line (the next section has the details), then start Claude Code in your project.
18
45
 
19
46
  ## Install
20
47
 
@@ -83,7 +110,7 @@ the `/plugin` menu.
83
110
  ## More
84
111
 
85
112
  - [Full guide and skills gallery on GitHub](https://github.com/wjgoarxiv/litclaude#readme)
86
- - [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/privacy.md)
87
- - [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/migration.md)
88
- - [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/CHANGELOG.md)
89
- - [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/LICENSE)
113
+ - [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/privacy.md)
114
+ - [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/migration.md)
115
+ - [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/CHANGELOG.md)
116
+ - [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/LICENSE)
package/README_ko-KR.md CHANGED
@@ -1,20 +1,42 @@
1
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 일곱 로봇 패널이 차례로 켜지고, LitClaude 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
1
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 일곱 로봇 패널이 차례로 켜지고, LitClaude 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
2
2
 
3
3
  <h1 align="center">LitClaude</h1>
4
4
  <p align="center"><strong>Keep the work lit.</strong></p>
5
- <p align="center">Claude Code에서 세션마다 계획하고, 만들고, 확인한 뒤 다음 세션이 이어받을 기록을 남기게 돕는 플러그인입니다.</p>
5
+ <p align="center">LitClaude는 Claude Code에 붙이는 추가 기능입니다. Claude가 "다 됐어요"라고 말하기 전에 자기 작업을 직접 확인하게 하고, 다음 세션이 이어서 시작할 수 있도록 기록을 남기게 합니다.</p>
6
6
  <p align="center">
7
- <img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/readme/badge-version.svg" alt="1.0.59" />
8
- <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
7
+ <img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/readme/badge-version.svg" alt="1.0.61" />
8
+ <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
9
9
  </p>
10
10
  <p align="center">
11
- <a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/README.md">English</a>
11
+ <a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/README.md">English</a>
12
12
  </p>
13
13
 
14
- Claude Code 프롬프트에 `lit`을 붙이면 Claude가 목표를 고정하고, 실패하는 테스트를 먼저 쓰고,
15
- 실제 결과를 확인한 뒤 프로젝트에 기록을 남깁니다. 작업을 멈출 때 `handoff`를 입력하면 다음
16
- 세션이 그 기록을 읽고 이어갑니다. Claude Code로 실제 프로젝트를 하면서 Claude가 "다 됐습니다"라고
17
- 말하기 전에 근거를 보고 싶은 분께 맞습니다.
14
+ Claude에게 기능을 하나 부탁하면 코드를 쓰고 끝났다고 말합니다. 그런데 다음 날 보니 테스트는 한 번도 돌지 않았습니다. 새 세션을 열면 프로젝트 설명을 처음부터 다시 해야 합니다.
15
+
16
+ LitClaude를 쓰면 같은 요청에 `lit`만 붙이면 됩니다. Claude는 먼저 이 작업에서 "끝났다"가 무슨 뜻인지 적고, 실패하는 테스트를 추가해 통과시킨 뒤, 무엇을 확인했고 무엇을 확인하지 못했는지 알려 줍니다. 작업을 멈출 때 `handoff`라고 치면 Claude가 기록을 남기고, 다음 세션이 그 기록을 읽고 이어서 합니다.
17
+
18
+ ## 두 가지 사용법
19
+
20
+ **간단하게.** 평소처럼 요청을 쓰고, 앞이나 끝에 `lit`을 붙입니다.
21
+
22
+ ```text
23
+ src/dates.js의 날짜 파싱 버그 고쳐줘 lit
24
+ ```
25
+
26
+ Claude가 목표를 정하고, 실패하는 테스트를 쓰고, 버그를 고치고, 결과를 확인한 뒤 확인한 내용을 알려 줍니다. 대부분의 작업은 이것으로 충분합니다.
27
+
28
+ **본격적으로.** 큰 작업은 한 단계씩 나아갑니다. 각 단계가 남긴 파일을 다음 단계가 읽고, 필요 없는 단계는 건너뛰면 됩니다.
29
+
30
+ | 단계 | 입력 | 하는 일 |
31
+ | --- | --- | --- |
32
+ | 1. 넓게 보기 | `/litclaude:lit-brainstorm <질문>` | 선택지를 많이 낸 뒤 점수를 매겨 몇 개로 추립니다 |
33
+ | 2. 구체화 | `/litclaude:deep-interview <아이디어>` | 목표가 분명해질 때까지 Claude가 질문합니다 |
34
+ | 3. 계획 | `lit-crucible <접근법>` 또는 `/litclaude:lit-plan <작업>` | crucible은 접근법의 약점을 먼저 찌른 뒤 계획으로 넘기고, lit-plan은 단계를 쓰고 승인을 기다립니다 |
35
+ | 4. 실행 | 계획에 `yes`, 또는 `/litclaude:lit-loop <작업>` | 테스트와 확인을 거치며 작업합니다 |
36
+ | 5. 검토 | `/litclaude:review-work` | 다섯 갈래로 검토하고 발견한 문제부터 알려 줍니다 |
37
+ | 6. 넘겨주기 | `handoff` | 결정과 다음 할 일을 파일로 남깁니다 |
38
+
39
+ 설치는 한 줄입니다(자세한 내용은 바로 아래 설치 절에 있습니다). 그다음 프로젝트에서 Claude Code를 실행하세요.
18
40
 
19
41
  ## 설치
20
42
 
@@ -81,7 +103,7 @@ npx @litfamily/litclaude@latest uninstall
81
103
  ## 더 보기
82
104
 
83
105
  - [전체 안내와 스킬 갤러리 (GitHub)](https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md)
84
- - [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/privacy.md)
85
- - [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/docs/migration.md)
86
- - [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/CHANGELOG.md)
87
- - [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.59/LICENSE)
106
+ - [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/privacy.md)
107
+ - [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/docs/migration.md)
108
+ - [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/CHANGELOG.md)
109
+ - [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.61/LICENSE)
@@ -73,7 +73,8 @@ import { DISCUSSIONS_URL, inviteMessage, recordInvite, shareLine } from "../plug
73
73
  import { resolveProjectStateRoot } from "../plugins/litclaude/lib/project-state-root.mjs";
74
74
  import { runUpdateNotifier } from "./update-notifier.mjs";
75
75
  import { assertInstallPath, assertOwnedTree, assertOwnedPluginTree, assertCurrentPointer, assertOwnedRegistrations, migrateLegacyVendorPaths, planModifiedLegacySkill, preserveModifiedLegacySkill, registeredPluginInstallation, writeOwnershipReceipt, removeEmptyDirectory, clearOwnedTree } from "./install-ownership.mjs";
76
- import { banner, lockup, colorMode, supportsBlocks, terminalRows } from "./litfamily-banner.mjs";
76
+ import { colorMode, supportsBlocks } from "./litfamily-banner.mjs";
77
+ import { SIZES, pickSize, synthwaveRows } from "../plugins/litclaude/lib/synthwave-mark.mjs";
77
78
  import {
78
79
  ICON_FONT,
79
80
  ICON_FONT_QUESTION,
@@ -393,7 +394,7 @@ const formatInstallStep = (label) => {
393
394
  };
394
395
 
395
396
  // Shared LitFamily banner frame (plans/references/installer-choice-contract.md):
396
- // the canonical Ignition B mark plus the existing install plan frame.
397
+ // the Synthwave mark plus the existing install plan frame.
397
398
  const FAMILY_RULE = ` ${"━".repeat(46)}`;
398
399
  // The banner keeps its short tagline; package.json carries the longer npm search description.
399
400
  const BANNER_TAGLINE = "Claude Code-native workflow distribution.";
@@ -413,11 +414,16 @@ const INSTALL_STAGES = [
413
414
  ["04", "Cache", "refresh the compatibility pointer"],
414
415
  ["05", "Verify", "confirm every installed surface"],
415
416
  ];
417
+ // Human-facing Synthwave mark: the size follows the terminal width; no colour gives the glyph-only scene.
418
+ // A pipe (agents, CI logs) gets the one plain line, so tool output never carries rows of art.
419
+ const terminalColumns = () => process.stdout.columns || Number.parseInt(process.env.COLUMNS ?? "", 10) || 80;
416
420
  const renderLitClaudeWordmark = ({ color = shouldColorInstall() } = {}) => {
417
- if (!supportsBlocks()) return ["LIT", `litclaude v${version}`];
418
- return terminalRows(lockup(`claude v${version}`, banner).map((row) => row.trimEnd()), {
419
- mode: color ? colorMode() : "none",
420
- });
421
+ if (!supportsBlocks() || !process.stdout.isTTY) return synthwaveRows({ mode: "plain" }).concat(`litclaude v${version}`);
422
+ const cols = terminalColumns();
423
+ const rows = synthwaveRows({ cols, mode: color ? colorMode() : "mono" });
424
+ const versionLine = `litclaude v${version}`;
425
+ const markWidth = SIZES.find((size) => size.name === pickSize(cols))?.minCols ?? versionLine.length;
426
+ return rows.concat(`${" ".repeat(Math.max(0, Math.floor((markWidth - versionLine.length) / 2)))}${versionLine}`);
421
427
  };
422
428
 
423
429
  const familyBanner = ({ color = shouldColorInstall() } = {}) => [
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.59"><title>release: 1.0.59</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.59</text></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.61"><title>release: 1.0.61</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.61</text></g></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litfamily/litclaude",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "Claude Code plugin: add lit to a prompt and Claude plans, tests, checks and reviews the work, then leaves a handoff for the next session.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "litclaude",
3
3
  "description": "Claude Code-native workflow plugin with a bounded-authority start-work lifecycle.",
4
- "version": "1.0.59",
4
+ "version": "1.0.61",
5
5
  "author": {
6
6
  "name": "LitClaude contributors"
7
7
  },
@@ -68,11 +68,11 @@ import { checkBackDenial, clearTimerStarted, isCheckBackPrompt, takeCheckBack, t
68
68
  import { inviteMessage, parseInvitePrompt, recordInvite, shareLine } from "../lib/invite.mjs";
69
69
  import { claimSessionExtensionsNotice } from "../lib/extensions-notice.mjs";
70
70
  import { buildSkillPlan, installedExtensionPlugins, parseSkillHatch, skillPlanContext, skillPlanIds } from "../lib/skill-plan.mjs";
71
- import { GOAL_STATUS, consentAnswer, consentIsLive } from "../lib/goal-pipeline.mjs";
71
+ import { GOAL_STATUS, consentAnswer, consentIsLive, goalGuidePlain } from "../lib/goal-pipeline.mjs";
72
72
  import { dropGoalFile, goalAskedSinceClose, markGoalAsked, readGoalFile, requestGoalClear, writeGoalFile } from "../lib/goal-files.mjs";
73
73
  import { archiveStaleSessions } from "../lib/session-state.mjs";
74
74
  import { detectCheck, proposeLoopGoal } from "../scripts/goal-propose.mjs";
75
- import { bareLitPattern, containsSlashCommandMention, findWorkflowTrigger, hasLitTrigger, hasReviewModifier, naturalLitCompanions, normalizedTriggerText, rawTriggerText, restartLitPattern, resumeLitPattern, withoutCode } from "../lib/route-match.mjs";
75
+ import { bareLitPattern, containsSlashCommandMention, findWorkflowTrigger, hasLitTrigger, hasReviewModifier, isExactBareHandoff, naturalLitCompanions, normalizedTriggerText, rawTriggerText, restartLitPattern, resumeLitPattern, withoutCode } from "../lib/route-match.mjs";
76
76
  import { planCheckRewrite, recordCheckRun, recordCodeEdit } from "../lib/receipts.mjs";
77
77
  import { evaluateReceiptGate, readReceiptGateMode } from "../lib/receipt-gate.mjs";
78
78
 
@@ -483,7 +483,6 @@ const gitHistoryCommand = /^\s*git\s+(?:commit|rebase|cherry-pick|reset|revert|b
483
483
  const isGitHistoryCommand = (input) =>
484
484
  input?.tool_name === "Bash" && typeof input?.tool_input?.command === "string" && gitHistoryCommand.test(input.tool_input.command);
485
485
 
486
- const isExactBareHandoff = (prompt) => /^\s*handoff\s*$/iu.test(prompt);
487
486
  // The handoff adapter has the same disable-model-invocation shape as the sci-vis adapter below.
488
487
  const isTypedHandoffCommand = (prompt) => /^\s*\/litclaude:lit-handoff(?=$|\s)/u.test(prompt);
489
488
  const isExactBareScientificVisualization = (prompt) => /^\s*lit-scientific-visualization\s*$/iu.test(prompt);
@@ -509,12 +508,12 @@ const handoffContext = ({ typed = false } = {}) => {
509
508
  `HANDOFF MODE ENABLED: ${probeInstruction("lit-handoff")}`,
510
509
  typed
511
510
  ? "The user typed /litclaude:lit-handoff. The adapter and canonical source are below because calling Skill(lit-handoff) only reopens the command; follow them and take the destination, emphasis or auto mode from the command arguments."
512
- : "Treat this exact bare prompt as an explicit request for /litclaude:lit-handoff and Skill(lit-handoff).",
511
+ : "Treat this exact bare prompt (handoff or lit handoff) as an explicit request for /litclaude:lit-handoff and Skill(lit-handoff).",
513
512
  llmContractReference,
514
513
  `Canonical source root: ${inertFilesystemData(canonicalRoot)}. Read and follow the complete canonical source body below; resolve its template, example, and eval resources relative to this absolute installed source root rather than the process cwd or ~/skills.`,
515
514
  typed
516
515
  ? "Prompt safety: the command arguments stay with the command and are never echoed into hook context."
517
- : "Prompt safety: this route accepts only the exact bare word handoff after outer whitespace. Mentions, quoted or fenced text, compound prompts, slash commands, and secret-bearing material remain inert and are never echoed into hook context.",
516
+ : "Prompt safety: this route accepts only the exact whole prompt handoff or lit handoff after outer whitespace. Mentions, quoted or fenced text, compound prompts, slash commands, and secret-bearing material remain inert and are never echoed into hook context.",
518
517
  ...(typed ? staticSkillBodyContext({ skillId: "lit-handoff" }) : []),
519
518
  `<litclaude-canonical-source name="handoff">
520
519
  ${canonicalBody}
@@ -577,15 +576,17 @@ const objectiveTail = (prompt) => {
577
576
  const raw = withoutCode(prompt);
578
577
  const match = /\blit(?:work)?\b\s*(.*)$/isu.exec(raw);
579
578
  const tail = (match?.[1] ?? raw).replace(
580
- /^\s*(?:-loop|-plan|loop|goal|plan|workflow|dynamic\s+workflow|work)\b\s*/iu,
579
+ /^\s*(?:-loop|-plan|-hijack|loop|goal|plan|workflow|dynamic\s+workflow|work)\b\s*/iu,
581
580
  "",
582
581
  );
582
+ // A request that ends with the word (`fix the redirect lit`) carries its objective before it.
583
+ if (match && !tail.trim()) return normalizeGoalObjective(raw.slice(0, match.index));
583
584
  return normalizeGoalObjective(tail);
584
585
  };
585
586
 
586
587
  // A run route gets one question and the mod sets the goal on the user's yes; litgoal, the hand-held
587
588
  // goal tool, keeps its ready-to-paste line.
588
- const LOOP_GOAL_LINE = "Native goal: LitClaude can set /goal for this run. Once one failing check proves the objective (after the RED test), run `node \"${CLAUDE_PLUGIN_ROOT}/scripts/goal-propose.mjs\" --loop --check \"<check>\" <objective>` and ask the line it prints once, as the last line of your reply; only the user's exact `yes` on the next prompt lets the LitClaude mod run /goal when that turn ends. If it prints `No goal set: <reason>`, or no single check proves the objective, go on without a goal and keep the durable `litgoal` ledger authoritative. Never type or send /goal yourself.";
589
+ const LOOP_GOAL_LINE = "Native goal: LitClaude can set /goal for this run. Once one failing check proves the objective (after the RED test), run `node \"${CLAUDE_PLUGIN_ROOT}/scripts/goal-propose.mjs\" --loop --check \"<check>\" <objective>` and end your reply once with what it prints: the question, then its answer guide; only the user's exact `yes` on the next prompt lets the LitClaude mod run /goal when that turn ends. If it prints `No goal set: <reason>`, or no single check proves the objective, go on without a goal and keep the durable `litgoal` ledger authoritative. Never type or send /goal yourself.";
589
590
 
590
591
  const RUN_GOAL_ROUTES = new Set(["lit-loop", "native-workflow", "litwork", "lit-hijack"]);
591
592
 
@@ -978,7 +979,7 @@ const goalConsentTurn = ({ cwd, consent, answer }, sessionId) => {
978
979
  ? ["The user answered no to the plan approval question: start-work did not start. Ask how to go on with the plan in one sentence; start nothing.", "LitClaude plan: not started."]
979
980
  : [`The user answered no to the plan approval question: start-work did not start and no goal is set. Reply with exactly \`${GOAL_STATUS.skipped("you said no")}\` and ask how to go on with the plan; start nothing.`, "LitClaude goal: not set."];
980
981
  }
981
- return [`The user wants to edit the goal. Ask what to change in the plan's \`## Done when\` check (one question), update ${consent.plan}, run \`node "\${CLAUDE_PLUGIN_ROOT}/scripts/goal-propose.mjs" ${consent.plan}\` again and ask its line again. Start and set nothing yourself.`, "LitClaude goal: edit."];
982
+ return [`The user wants to edit the goal. Ask what to change in the plan's \`## Done when\` check (one question), update ${consent.plan}, run \`node "\${CLAUDE_PLUGIN_ROOT}/scripts/goal-propose.mjs" ${consent.plan}\` again and ask its line again with the answer guide it prints under it. Start and set nothing yourself.`, "LitClaude goal: edit."];
982
983
  };
983
984
  // After an approving yes: the start-work the hook just ran decides the goal. A start that holds (new,
984
985
  // already running here on that plan, or taken over) arms it; a refused start arms nothing.
@@ -1497,7 +1498,7 @@ switch (eventName) {
1497
1498
  // A repeat of an already activated discipline carries a new objective, so it asks too; a bare `lit`,
1498
1499
  // `lit continue` or start-work resume (stackHandled) only carries on and never asks.
1499
1500
  const loopGoal = (reentry?.stackHandled ?? false) || trigger.safetyBlock ? null : offerLoopGoal(trigger.discipline, input);
1500
- const systemMessage = loopGoal ? `${activationMessage(effectiveDiscipline)}\n${loopGoal.line}` : activationMessage(effectiveDiscipline);
1501
+ const systemMessage = loopGoal ? `${activationMessage(effectiveDiscipline)}\n${loopGoal.line}\n${goalGuidePlain("loopAsked")}` : activationMessage(effectiveDiscipline);
1501
1502
  let context = reentry?.context ?? (["frontend-ui-ux", "visual-qa"].includes(trigger.discipline)
1502
1503
  ? uiuxActivationContext({ ...trigger, uiMode: interfaceMode(normalizedTriggerText(prompt)) })
1503
1504
  : ["lit-diagram-drawer", "lit-schematic", "lit-typographic-motion", "readme-studio"].includes(trigger.discipline)
@@ -9,7 +9,7 @@ import {
9
9
  } from "../lib/wikify-knowledge.mjs";
10
10
 
11
11
  const protocolVersion = "2024-11-05";
12
- const serverVersion = "1.0.59";
12
+ const serverVersion = "1.0.61";
13
13
 
14
14
  const publicSourceReadTool = {
15
15
  name: "public_source_read",
@@ -90,7 +90,10 @@ The plan must include Claude Code-native bootstrap steps:
90
90
 
91
91
  - End the plan with a `## Done when` block holding one `check: \`<command>\`` line,
92
92
  run `node "${CLAUDE_PLUGIN_ROOT}/scripts/goal-propose.mjs" plans/<slug>.md`, and
93
- add the one line it prints to the approval question. LitClaude sets the native goal itself: lit-plan asks once (`Approve plan, start work and set goal: /goal <cond>? (yes / edit / no)`), and only the user's exact `yes` starts start-work on that plan, with the grants a typed `/litclaude:start-work <plan>` gets, and lets the LitClaude mod run `/goal <cond>` when that turn ends; it clears only the goal it set.
93
+ add the one line it prints to the approval question. Under it, render the answer guide the script
94
+ prints (a quoted `**▶ Answer: …**` block with a `| Type | What happens |` table, one row per answer,
95
+ ending `Type the word alone.`) in the user's language, keeping `yes` / `edit` / `no` as the exact
96
+ words. LitClaude sets the native goal itself: lit-plan asks once (`Approve plan, start work and set goal: /goal <cond>? (yes / edit / no)`), and only the user's exact `yes` starts start-work on that plan, with the grants a typed `/litclaude:start-work <plan>` gets, and lets the LitClaude mod run `/goal <cond>` when that turn ends; it clears only the goal it set.
94
97
  - Add no `/goal` step to the plan itself: start-work's Stop
95
98
  continuation and the ledger carry the run, and `/goal` stays the user's option.
96
99
  - For independent, risky, parallel, or long-running work, include when Claude
@@ -12,7 +12,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
12
12
  ["lib/mark.mjs", "8f3d1c3ff2c471d264e8d73fca97595c93cf4b43d7935c285d72ee1ddfa8c67c"],
13
13
  ["lib/npm-invocation.mjs", "8d7b98e65836f5400b33163083cfa842fcbbf0659923290b0c680395737d3716"],
14
14
  ["lib/output_mark.py", "f6f9a06361f8cf515a19053f59156a1807ddd686632b2f3cccb1e9a0b046d9ae"],
15
- ["lib/owner-lock.mjs", "d70c57b603987f0865add60dad442489acb42541a8dedeb3fe254429f4bfa7b6"],
15
+ ["lib/owner-lock.mjs", "05908fae381c5a04b9f2abc3b9364b14c7840168966f771908479d9b1f84a501"],
16
16
  ["lib/plan-task-rows.mjs", "ca45412631cdfa805102a42dbb3cfc9a43f6f1ecbcdabe1cc5059d2dcb5e58df"],
17
17
  ["lib/rename-aliases.mjs", "3ee93aec10d0dbe785c554ab3040173ee94fde27da1b440a54b0513e5d11a508"],
18
18
  ["lib/rewind/board.mjs", "26e504014d18d77bd7533278a10543d76516cac3300578fe31e6f3b93c4a4f3e"],
@@ -17,7 +17,7 @@ import { createHash } from "node:crypto";
17
17
  import { GOAL_DIR, GOAL_STATUS } from "./mod/goal.mjs";
18
18
  import { parsePlanTaskRows } from "./plan-task-rows.mjs";
19
19
 
20
- export { GOAL_DIR, GOAL_STATUS, STALL_CHECKS, goalStateFromTranscript, goalStep, lastAssistantText, transcriptPathFor } from "./mod/goal.mjs";
20
+ export { GOAL_ANSWERS, GOAL_DIR, GOAL_STATUS, STALL_CHECKS, goalGuideMarkdown, goalGuidePlain, goalStateFromTranscript, goalStep, lastAssistantText, transcriptPathFor } from "./mod/goal.mjs";
21
21
 
22
22
  export const GOAL_MAX_CHARS = 500;
23
23
  export const CONSENT_TTL_MS = 30 * 60 * 1000;
@@ -63,6 +63,8 @@ export const ansi16CodeForAccent = (value) => ({
63
63
  const NEON_BRAND = "LIT";
64
64
  export const NEON_START = Object.freeze([255, 45, 149]); // #ff2d95 hot pink
65
65
  export const NEON_END = Object.freeze([0, 229, 255]); // #00e5ff electric cyan
66
+ const PILL_START = Object.freeze([139, 233, 253]); // #8be9fd, Synthwave chrome stop 1
67
+ const PILL_END = Object.freeze([255, 154, 213]); // #ff9ad5, Synthwave chrome stop 4
66
68
 
67
69
  export const supportsTruecolor = (env = process.env) => {
68
70
  // The portable signal: terminals that export COLORTERM=truecolor|24bit.
@@ -101,15 +103,14 @@ export const litBrandPrefix = (version, { noColor = false, truecolor = false, de
101
103
  // 256-color neon fallback: bright magenta, bold.
102
104
  return `\x1b[0m\x1b[1m\x1b[38;5;201m${label}\x1b[0m`;
103
105
  }
104
- const n = NEON_BRAND.length;
105
- let out = `\x1b[0m\x1b[1m[🔥`;
106
+ // Synthwave badge: the label sits on a cyan-to-rose pill (LitClaude chrome stops) in dark ink.
107
+ const pill = [...` 🔥${NEON_BRAND} v${version} `];
108
+ const n = pill.length;
109
+ let out = "\x1b[0m\x1b[1m\x1b[38;2;11;14;20m";
106
110
  for (let i = 0; i < n; i += 1) {
107
111
  const t = n === 1 ? 0 : i / (n - 1);
108
- const r = Math.round(NEON_START[0] + (NEON_END[0] - NEON_START[0]) * t);
109
- const g = Math.round(NEON_START[1] + (NEON_END[1] - NEON_START[1]) * t);
110
- const b = Math.round(NEON_START[2] + (NEON_END[2] - NEON_START[2]) * t);
111
- out += `\x1b[38;2;${r};${g};${b}m${NEON_BRAND[i]}`;
112
+ const [r, g, b] = PILL_START.map((v, k) => Math.round(v + (PILL_END[k] - v) * t));
113
+ out += `\x1b[48;2;${r};${g};${b}m${pill[i]}`;
112
114
  }
113
- out += `\x1b[38;2;${NEON_END[0]};${NEON_END[1]};${NEON_END[2]}m v${version}]\x1b[0m`;
114
- return out;
115
+ return `${out}\x1b[0m`;
115
116
  };
@@ -7,11 +7,39 @@ export const GOAL_DIR = ".litclaude/goal";
7
7
  export const SESSION_STATE_ID = /^[A-Za-z0-9-]{1,80}$/u;
8
8
  export const sessionGoalDir = (sessionId) => (typeof sessionId === "string" && SESSION_STATE_ID.test(sessionId) ? `.litclaude/sessions/${sessionId}/goal` : null);
9
9
 
10
+ // The answers each goal question takes and what each one does. The question's `(yes / …)` tail and
11
+ // the answer guide shown under it are both built from these lists, so the two cannot drift apart.
12
+ export const GOAL_ANSWERS = Object.freeze({
13
+ asked: [["yes", "starts the work now and sets this goal when this reply ends"], ["edit", "change the goal's check first"], ["no", "nothing starts"]],
14
+ startOnly: [["yes", "starts the work now, with no goal"], ["no", "nothing starts"]],
15
+ loopAsked: [["yes", "set this goal when this turn ends"], ["no", "keep working without a goal"]],
16
+ });
17
+ const GUIDE_TITLES = Object.freeze({ asked: "approve plan · start work · set goal", startOnly: "approve plan · start work", loopAsked: "set goal for this lit-loop" });
18
+ const answerTail = (kind) => `(${GOAL_ANSWERS[kind].map(([word]) => word).join(" / ")})`;
19
+
20
+ /** The guide for plain terminal text (hook systemMessage): aligned lines, no Markdown. */
21
+ export const goalGuidePlain = (kind) => {
22
+ const width = Math.max(...GOAL_ANSWERS[kind].map(([word]) => word.length));
23
+ return [...GOAL_ANSWERS[kind].map(([word, does]) => ` ${word.padEnd(width)} → ${does}`), " Type the word alone."].join("\n");
24
+ };
25
+
26
+ /** The guide for a model-written reply: a quoted Markdown table the model renders under the question. */
27
+ export const goalGuideMarkdown = (kind, cond = null) => [
28
+ `**▶ Answer: ${GUIDE_TITLES[kind]}**`,
29
+ ...(cond ? ["", `Goal: \`\` /goal ${cond} \`\``] : []),
30
+ "",
31
+ "| Type | What happens |",
32
+ "|---|---|",
33
+ ...GOAL_ANSWERS[kind].map(([word, does]) => `| **\`${word}\`** | ${does[0].toUpperCase()}${does.slice(1)} |`),
34
+ "",
35
+ "Type the word alone.",
36
+ ].map((line) => (line ? `> ${line}` : ">")).join("\n");
37
+
10
38
  // Fixed status lines, one per outcome. The mod and the CLI print these and nothing else.
11
39
  export const GOAL_STATUS = Object.freeze({
12
- asked: (cond) => `Approve plan, start work and set goal: /goal ${cond}? (yes / edit / no)`,
13
- startOnly: "Approve plan and start work? (yes / no)",
14
- loopAsked: (cond) => `Set goal for this lit-loop: /goal ${cond}? (yes / no)`,
40
+ asked: (cond) => `Approve plan, start work and set goal: /goal ${cond}? ${answerTail("asked")}`,
41
+ startOnly: `Approve plan and start work? ${answerTail("startOnly")}`,
42
+ loopAsked: (cond) => `Set goal for this lit-loop: /goal ${cond}? ${answerTail("loopAsked")}`,
15
43
  skipped: (reason) => `No goal set: ${reason}`,
16
44
  notStarted: (why) => `No goal set: start-work did not start (${why})`,
17
45
  armed: (id) => `LitClaude goal armed [lit:${id}]; it is set when this turn ends.`,
@@ -22,6 +22,12 @@ import {
22
22
  } from "./secure-path-read.mjs";
23
23
 
24
24
  const MAX_OWNER_BYTES = 4096;
25
+ // No caller holds this lock for more than a moment, so an owner older than this crashed even when its
26
+ // recorded pid now names another live process (pids are reused, often on WSL).
27
+ const OWNER_LOCK_MAX_HOLD_MS = 10 * 60 * 1000;
28
+ // A holder writes its owner record right after it creates the folder, so a folder with no record is
29
+ // only judged once it is this old, whatever stale window the caller passed.
30
+ const OWNERLESS_GRACE_MS = 5_000;
25
31
  const sleepSync = (milliseconds) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds);
26
32
  const monotonicNowMs = () => Number(process.hrtime.bigint()) / 1_000_000;
27
33
 
@@ -213,7 +219,13 @@ const takeoverWinner = (lockDir, incumbent, ownClaim, staleAfter, expectedLockDi
213
219
  for (const name of names) {
214
220
  assertLockDirectory(lockDir, expectedLockDirectory);
215
221
  const claimRecord = readTakeoverClaim(lockDir, name, incumbent.nonce);
216
- if (claimRecord === null) return null;
222
+ if (claimRecord === null) {
223
+ // A claim a contender died while writing can never be read, and would block every takeover.
224
+ const claimStats = lstatSync(join(lockDir, name), { throwIfNoEntry: false });
225
+ if (!claimStats?.isFile() || Date.now() - claimStats.mtimeMs < staleAfter) return null;
226
+ rmSync(join(lockDir, name), { force: true });
227
+ continue;
228
+ }
217
229
  const { claim, identity, text } = claimRecord;
218
230
  const alive = processIsAlive(claim.pid);
219
231
  const oldEnough = Date.now() - claim.acquired_at_ms >= staleAfter;
@@ -249,6 +261,7 @@ export const acquireOwnerLock = (lockDir, { timeoutMs = 500, staleMs = 30_000 }
249
261
  const timeout = Number.isFinite(timeoutMs) ? Math.max(0, timeoutMs) : 500;
250
262
  const staleAfter = Number.isFinite(staleMs) ? Math.max(0, staleMs) : 30_000;
251
263
  const startedAt = monotonicNowMs();
264
+ const arrivedAtMs = Date.now();
252
265
  let takeoverClaim = null;
253
266
 
254
267
  while (true) {
@@ -275,9 +288,21 @@ export const acquireOwnerLock = (lockDir, { timeoutMs = 500, staleMs = 30_000 }
275
288
 
276
289
  lockDirectory = assertLockDirectory(lockDir);
277
290
  const incumbent = readOwnerLock(lockDir);
291
+ if (!incumbent && lockDirectory) {
292
+ // A holder that died between creating the folder and writing its owner record left a lock
293
+ // nobody can judge. One already old when this caller arrived is moved aside and the acquisition
294
+ // retried; one that only aged while we waited is left for the next caller.
295
+ const folder = lstatSync(lockDir, { throwIfNoEntry: false });
296
+ if (folder && arrivedAtMs - folder.mtimeMs >= Math.max(staleAfter, OWNERLESS_GRACE_MS)) {
297
+ const aside = `${lockDir}.stale.ownerless.${randomUUID()}`;
298
+ try {
299
+ if (removeVerifiedPath(lockDir, lockDirectory, undefined, aside, (quarantine) => !readOwnerLock(quarantine))) continue;
300
+ } catch { /* A lock that changed under us is judged again on the next pass. */ }
301
+ }
302
+ }
303
+ const age = incumbent ? Date.now() - incumbent.acquired_at_ms : 0;
278
304
  const stale = incumbent
279
- && Date.now() - incumbent.acquired_at_ms >= staleAfter
280
- && !processIsAlive(incumbent.pid);
305
+ && (age >= OWNER_LOCK_MAX_HOLD_MS || (age >= staleAfter && !processIsAlive(incumbent.pid)));
281
306
  if (stale) {
282
307
  if (takeoverClaim?.owner_nonce !== incumbent.nonce) {
283
308
  takeoverClaim = {
@@ -320,7 +345,10 @@ export const acquireOwnerLock = (lockDir, { timeoutMs = 500, staleMs = 30_000 }
320
345
  }
321
346
  }
322
347
 
323
- if (monotonicNowMs() - startedAt >= timeout) throw new OwnerLockError("state lock timed out");
348
+ if (monotonicNowMs() - startedAt >= timeout) {
349
+ const holder = incumbent ? `held by pid ${incumbent.pid} for ${Math.round(age / 1000)} s` : "with no owner record";
350
+ throw new OwnerLockError(`state lock timed out (${holder}; lock ${lockDir})`);
351
+ }
324
352
  sleepSync(Math.min(20, Math.max(1, timeout)));
325
353
  }
326
354
  }
@@ -254,6 +254,14 @@ const findLeadingBareCommandTrigger = (raw) => {
254
254
  return { ...triggerByToken[match[1]], source: "bare-command" };
255
255
  };
256
256
 
257
+ // The trailing-token table: a run word that ends a request ("fix the login button lit-loop") routes
258
+ // like the same word at the start. A closing question mark keeps "how do I use lit-loop?" unrouted.
259
+ const trailingRunTokenPattern = /(?:^|\s)(lit-loop|litwork|lit-hijack)[\s.!]*$/u;
260
+ const findTrailingRunTokenTrigger = (raw) => {
261
+ const match = trailingRunTokenPattern.exec(raw);
262
+ return match ? { ...triggerByToken[match[1]], source: "bare-command" } : undefined;
263
+ };
264
+
257
265
  // A bare `lit` carries no task. `lit continue` asks to carry on what exists. `lit new` and
258
266
  // `lit restart` ask for a fresh start, so the session's earlier activation does not count.
259
267
  const bareLitPattern = /^\s*lit(?:work)?[\s.!?]*$/u;
@@ -314,6 +322,13 @@ const hasExplicitBrainstormRoute = (normalized) => /\blit(?:work)?\s+(?:brainsto
314
322
  // hijack" and "lit review the hijack ledger" keep their own routes, and the bare word never activates.
315
323
  // `lit ultra-brainstorm <topic>` (the hyphen reads as a space here); ahead of the plain brainstorm route.
316
324
  const hasExplicitUltraBrainstormRoute = (normalized) => /\blit(?:work)?\s+ultra\s?brainstorm(?:ing)?(?=$|[^\w-])/u.test(normalized);
325
+ // `lit deep interview <idea>`, `lit deep-interview <idea>`, `lit interview <idea>`: the clarifying interview
326
+ // before a plan. The route word must sit directly after `lit`, so "lit fix the interview scheduler" stays a
327
+ // loop. Ahead of plan and review: "lit deep interview a plan for the launch" asks to be interviewed.
328
+ const hasExplicitInterviewRoute = (normalized) => /\blit(?:work)?\s+(?:deep\s?interview|interview|인터뷰|딥\s?인터뷰)(?=$|[^\w-])/u.test(normalized);
329
+ // A whole prompt of `handoff` or `lit handoff` (outer whitespace aside). The hook answers it before the
330
+ // cascade below with the handoff payload; explainRoute reports it as `exact:handoff`.
331
+ const isExactBareHandoff = (prompt) => typeof prompt === "string" && /^\s*(?:lit\s+)?handoff\s*$/iu.test(prompt);
317
332
  const hasExplicitHijackRoute = (normalized) => /\blit(?:work)?\s+(?:hijack(?:ing)?|하이재킹|하이잭)(?=$|[^\w-])/u.test(normalized);
318
333
  const hasExplicitTeamRoute = (normalized) => /\blit(?:work)?\s+(?:team(?:\s+mode)?|teammates)\b/u.test(normalized);
319
334
  // A casual one-line request ends with `lit` ("… 조사해줘 lit"), so the research verb is not next to
@@ -522,6 +537,7 @@ const findNaturalLitTrigger = (prompt) => {
522
537
  // Ahead of plan, review and research for the same reason: "lit hijack the review lanes into my plan
523
538
  // skill" names other skills as material, not as the route.
524
539
  if (hasExplicitHijackRoute(normalized)) return { ...triggerByToken["lit-hijack"], source: "natural-language" };
540
+ if (hasExplicitInterviewRoute(normalized)) return { ...triggerByToken["deep-interview"], source: "natural-language" };
525
541
  if (containsPlainWord(normalized, "plan") && hasReviewModifier(prompt)) {
526
542
  return { ...triggerByToken["lit-plan"], source: "natural-language" };
527
543
  }
@@ -586,6 +602,8 @@ const findWorkflowTrigger = (prompt) => {
586
602
  if (adhdPhraseTrigger) return adhdPhraseTrigger;
587
603
  const bareCommandTrigger = findLeadingBareCommandTrigger(raw);
588
604
  if (bareCommandTrigger) return bareCommandTrigger;
605
+ const trailingRunTrigger = findTrailingRunTokenTrigger(raw);
606
+ if (trailingRunTrigger) return trailingRunTrigger;
589
607
  for (const token of ["lit-crucible", "lit-init", "lit-burnoff", "lit-burnoff-file"]) {
590
608
  if (containsCompoundBoundedWord(raw, token)) return { ...triggerByToken[token], source: "bare-command" };
591
609
  const oldId = Object.keys(renameAliases).find((id) => renameAliases[id] === token);
@@ -631,6 +649,7 @@ const ROUTE_RULES = [
631
649
  { id: "phrase:lit-comprehend", match: ({ raw }) => findComprehendPhraseTrigger(raw) },
632
650
  { id: "phrase:lit-adhd", match: ({ raw }) => findAdhdPhraseTrigger(raw) },
633
651
  { id: (trigger) => namedRuleId("bare-command", trigger), match: ({ raw }) => findLeadingBareCommandTrigger(raw) },
652
+ { id: (trigger) => namedRuleId("trailing-command", trigger), match: ({ raw }) => findTrailingRunTokenTrigger(raw) },
634
653
  {
635
654
  id: (trigger) => namedRuleId("token", trigger),
636
655
  match: ({ raw }) => {
@@ -649,6 +668,7 @@ const ROUTE_RULES = [
649
668
  { id: "natural:ultra-brainstorm", lit: true, match: ({ normalized }) => hasExplicitUltraBrainstormRoute(normalized) && routeOf("ultra-brainstorm") },
650
669
  { id: "natural:brainstorm", lit: true, match: ({ normalized }) => hasExplicitBrainstormRoute(normalized) && routeOf("lit-brainstorm") },
651
670
  { id: "natural:hijack", lit: true, match: ({ normalized }) => hasExplicitHijackRoute(normalized) && routeOf("lit-hijack") },
671
+ { id: "natural:deep-interview", lit: true, match: ({ normalized }) => hasExplicitInterviewRoute(normalized) && routeOf("deep-interview") },
652
672
  { id: "natural:plan-review-modifier", lit: true, match: ({ normalized, prompt }) => containsPlainWord(normalized, "plan") && hasReviewModifier(prompt) && routeOf("lit-plan") },
653
673
  { id: "natural:review", lit: true, match: ({ normalized }) => containsPlainWord(normalized, "review") && routeOf("review-work") },
654
674
  { id: "natural:debug", lit: true, match: ({ normalized }) => (containsPlainWord(normalized, "debug") || containsPlainWord(normalized, "debugging")) && routeOf("debugging") },
@@ -679,10 +699,11 @@ const ROUTE_RULES = [
679
699
  // `{route, ruleId, runnerUp, inert}` for one prompt. route is the discipline the hook ignites (null for
680
700
  // none); runnerUp is the next non-fallback rule that matched a different route. inert is true when no
681
701
  // route fired because text was set aside (a fence, inline code, a host block) or a stop rule held.
682
- // Routes the hook decides before this cascade (an exact `handoff`, a `lit +…` skill plan, start-work
683
- // invocations and replies) are outside it.
702
+ // An exact `handoff` / `lit handoff` is reported as the hook answers it. Other routes the hook decides
703
+ // before this cascade (a `lit +…` skill plan, start-work invocations and replies) are outside it.
684
704
  export const explainRoute = (prompt) => {
685
705
  if (typeof prompt !== "string") return { route: null, ruleId: null, runnerUp: null, inert: false };
706
+ if (isExactBareHandoff(prompt)) return { route: "lit-handoff", ruleId: "exact:handoff", runnerUp: null, inert: false };
686
707
  const route = findWorkflowTrigger(prompt)?.discipline ?? null;
687
708
  const raw = rawTriggerText(prompt);
688
709
  const context = { prompt, raw, normalized: normalizedTriggerText(prompt), lit: hasLitTrigger(raw) };
@@ -719,6 +740,7 @@ export {
719
740
  findWorkflowTrigger,
720
741
  hasLitTrigger,
721
742
  hasReviewModifier,
743
+ isExactBareHandoff,
722
744
  naturalLitCompanions,
723
745
  normalizedTriggerText,
724
746
  rawTriggerText,
@@ -108,6 +108,34 @@ const readLockOwner = (root) => {
108
108
  }
109
109
  };
110
110
 
111
+ // No state update holds this lock for more than a moment, so a lock older than this belongs to a
112
+ // crashed holder even when its recorded pid now names another live process (pids are reused, often on WSL).
113
+ const START_WORK_LOCK_MAX_HOLD_MS = 10 * 60 * 1000;
114
+
115
+ // An ownerless lock is a holder that died between creating the folder and writing its owner record.
116
+ // A live holder writes that record at once, so the folder is only judged after this grace, whatever
117
+ // stale window the caller passed; otherwise a contender could move it aside mid-acquisition.
118
+ const OWNERLESS_GRACE_MS = 5_000;
119
+ const lockAgeMs = (lockDir, owner) => {
120
+ if (owner) return Date.now() - owner.acquired_at_ms;
121
+ const stats = lstatSync(lockDir, { throwIfNoEntry: false });
122
+ return stats ? Date.now() - stats.mtimeMs : 0;
123
+ };
124
+
125
+ // A takeover claim whose writer died before finishing the takeover would refuse every later
126
+ // contender (`wx` fails on it), so a claim from a dead or long-gone writer is cleared first.
127
+ const clearDeadTakeoverClaim = (claim, staleMs) => {
128
+ try {
129
+ const stats = lstatSync(claim, { throwIfNoEntry: false });
130
+ if (!stats?.isFile()) return;
131
+ const pid = Number.parseInt(readFileSync(claim, "utf8"), 10);
132
+ if (processIsAlive(pid) && Date.now() - stats.mtimeMs < staleMs) return;
133
+ rmSync(claim, { force: true });
134
+ } catch {
135
+ // A claim that cannot be read or removed leaves the takeover to time out and report it.
136
+ }
137
+ };
138
+
111
139
  export const acquireStartWorkLock = (root, options = {}) => {
112
140
  const lockDir = startWorkLockDir(root);
113
141
  requireStateDir(dirname(lockDir));
@@ -131,15 +159,18 @@ export const acquireStartWorkLock = (root, options = {}) => {
131
159
  } catch (error) {
132
160
  if (error?.code !== "EEXIST") throw new StartWorkLifecycleError("start-work state lock failed");
133
161
  const incumbent = readLockOwner(root);
162
+ const age = lockAgeMs(lockDir, incumbent);
134
163
  const stale = incumbent
135
- && Date.now() - incumbent.acquired_at_ms >= staleMs
136
- && !processIsAlive(incumbent.pid);
164
+ ? age >= START_WORK_LOCK_MAX_HOLD_MS || (age >= staleMs && !processIsAlive(incumbent.pid))
165
+ : age >= Math.max(staleMs, OWNERLESS_GRACE_MS);
137
166
  if (stale) {
138
- const claim = join(lockDir, `.takeover-${incumbent.nonce}`);
139
- const displaced = `${lockDir}.stale.${incumbent.nonce}.${randomUUID()}`;
167
+ const tag = incumbent?.nonce ?? "ownerless";
168
+ const claim = join(lockDir, `.takeover-${tag}`);
169
+ const displaced = `${lockDir}.stale.${tag}.${randomUUID()}`;
140
170
  try {
171
+ clearDeadTakeoverClaim(claim, staleMs);
141
172
  writeFileSync(claim, `${process.pid}\n`, { mode: 0o600, flag: "wx" });
142
- if (readLockOwner(root)?.nonce !== incumbent.nonce) continue;
173
+ if (readLockOwner(root)?.nonce !== incumbent?.nonce) continue;
143
174
  renameSync(lockDir, displaced);
144
175
  rmSync(displaced, { recursive: true, force: true });
145
176
  continue;
@@ -149,7 +180,12 @@ export const acquireStartWorkLock = (root, options = {}) => {
149
180
  }
150
181
  }
151
182
  }
152
- if (Date.now() - started >= timeout) throw new StartWorkLifecycleError("start-work state lock timed out", 75);
183
+ if (Date.now() - started >= timeout) {
184
+ const holder = incumbent
185
+ ? `held by pid ${incumbent.pid} for ${Math.round(age / 1000)} s`
186
+ : "with no owner record";
187
+ throw new StartWorkLifecycleError(`start-work state lock timed out (${holder}; lock ${lockDir})`, 75);
188
+ }
153
189
  sleepSync(Math.min(20, Math.max(1, timeout)));
154
190
  }
155
191
  }
@@ -1630,13 +1666,28 @@ const idleMs = (work, now) => Math.max(0, now - (lastActivityMs(work) || now));
1630
1666
  // A heartbeat for the owner and its lanes (they share its session id): at most one state write a
1631
1667
  // minute, with no ledger event, so a busy run never looks idle to another session.
1632
1668
  const ACTIVITY_WRITE_MS = 60_000;
1633
- const recordToolActivity = (root, state, work, now) => {
1669
+ // It takes the lock only briefly and skips when another writer holds it: a heartbeat is never worth
1670
+ // delaying a tool call, and the next call a minute on writes it instead.
1671
+ const HEARTBEAT_LOCK_WAIT_MS = 200;
1672
+ const recordToolActivity = (root, work, now) => {
1634
1673
  if (now - lastActivityMs(work) < ACTIVITY_WRITE_MS) return;
1635
- work.last_tool_at = new Date(now).toISOString();
1674
+ let owner;
1636
1675
  try {
1676
+ owner = acquireStartWorkLock(root, { timeoutMs: HEARTBEAT_LOCK_WAIT_MS });
1677
+ } catch {
1678
+ return;
1679
+ }
1680
+ try {
1681
+ const state = readState(root);
1682
+ const current = state.works[work.work_id];
1683
+ if (!current || current.root_session_id !== work.root_session_id || !["active", "paused"].includes(current.status)) return;
1684
+ if (now - lastActivityMs(current) < ACTIVITY_WRITE_MS) return;
1685
+ current.last_tool_at = new Date(now).toISOString();
1637
1686
  saveState(root, state);
1638
1687
  } catch {
1639
1688
  // A failed heartbeat must not refuse a call the guard allowed.
1689
+ } finally {
1690
+ releaseStartWorkLock(root, owner);
1640
1691
  }
1641
1692
  };
1642
1693
  const isStale = (work, now) => Boolean(work.root_session_ended_at) || idleMs(work, now) >= START_WORK_STALE_MS;
@@ -1990,25 +2041,32 @@ const cancelNoticeDecision = (root, state, input) => {
1990
2041
  export const handleStartWorkPreToolUse = (root, input, { now = Date.now() } = {}) => {
1991
2042
  const canonicalRoot = canonicalDirectory(root, "cwd root");
1992
2043
  if (!existsSync(startWorkStatePath(canonicalRoot))) return { decision: "allow-normal" };
1993
- return withLock(canonicalRoot, () => {
1994
- const state = readState(canonicalRoot);
1995
- const work = state.active_work_id ? state.works[state.active_work_id] : null;
1996
- const running = Boolean(work && ["active", "paused"].includes(work.status));
1997
- if (!running || work.root_session_id !== input?.session_id) {
1998
- const notice = cancelNoticeDecision(canonicalRoot, state, input);
1999
- if (notice) return notice;
2000
- }
2001
- if (!running) return { decision: "allow-normal" };
2002
- if (typeof input?.session_id !== "string" || input.session_id !== work.root_session_id) {
2003
- return otherSessionDecision(canonicalRoot, work, input, now);
2004
- }
2005
- const decided = ownerToolDecision(canonicalRoot, state, work, input);
2006
- if (decided.decision === "allow-normal") recordToolActivity(canonicalRoot, state, work, now);
2007
- return decided;
2008
- });
2044
+ // The verdict only reads the state, which every writer replaces whole by rename, so it is taken
2045
+ // from a snapshot without the lock. Waiting on the lock here let other sessions' writes of a large
2046
+ // state on a slow drive refuse every tool call. A snapshot that cannot be read is retried under
2047
+ // the lock, which fails closed as before.
2048
+ let state;
2049
+ try {
2050
+ state = readState(canonicalRoot);
2051
+ } catch {
2052
+ state = withLock(canonicalRoot, () => readState(canonicalRoot));
2053
+ }
2054
+ const work = state.active_work_id ? state.works[state.active_work_id] : null;
2055
+ const running = Boolean(work && ["active", "paused"].includes(work.status));
2056
+ if (!running || work.root_session_id !== input?.session_id) {
2057
+ const notice = cancelNoticeDecision(canonicalRoot, state, input);
2058
+ if (notice) return notice;
2059
+ }
2060
+ if (!running) return { decision: "allow-normal" };
2061
+ if (typeof input?.session_id !== "string" || input.session_id !== work.root_session_id) {
2062
+ return otherSessionDecision(canonicalRoot, work, input, now);
2063
+ }
2064
+ const decided = ownerToolDecision(canonicalRoot, state, work, input);
2065
+ if (decided.decision === "allow-normal") recordToolActivity(canonicalRoot, work, now);
2066
+ return decided;
2009
2067
  };
2010
2068
 
2011
- // The owner session's verdict for one tool call, under the lock the caller holds.
2069
+ // The owner session's verdict for one tool call, from the caller's state snapshot.
2012
2070
  const ownerToolDecision = (canonicalRoot, state, work, input) => {
2013
2071
  const executionRoot = canonicalDirectory(typeof input.cwd === "string" ? input.cwd : canonicalRoot, "tool cwd");
2014
2072
  const classified = classifyToolAuthority(executionRoot, input);
@@ -0,0 +1,91 @@
1
+ // Synthwave mark for human-facing CLI output (install, doctor, help). Never for model-visible text.
2
+ import { MONO_ROWS, PIXEL_ROWS, SHARED_COLOURS } from "./synthwave-rows.mjs";
3
+
4
+ export const HOST_LABEL = "claude code";
5
+ // LitClaude chrome: ice blue at the top of each letter, rose at the base.
6
+ export const CHROME_STOPS = Object.freeze(["#e0fbff", "#8be9fd", "#3a6df0", "#ffffff", "#ff9ad5", "#c2185b"]);
7
+ const TAGLINE_STOPS = Object.freeze(["#8be9fd", "#ff2d95", "#ffd23f"]);
8
+ const EDGE = "#ffffff";
9
+ export const SIZES = Object.freeze([
10
+ Object.freeze({ name: "B-L", minCols: 76 }),
11
+ Object.freeze({ name: "B-M", minCols: 44 }),
12
+ Object.freeze({ name: "B-S", minCols: 24 }),
13
+ ]);
14
+
15
+ const rgb = (hex) => [1, 3, 5].map((i) => Number.parseInt(hex.slice(i, i + 2), 16));
16
+ const toHex = (c) => `#${c.map((v) => Math.round(v).toString(16).padStart(2, "0")).join("")}`;
17
+ const sample = (stops, t) => {
18
+ const n = stops.length - 1;
19
+ const i = Math.min(n - 1, Math.floor(t * n));
20
+ const f = t * n - i;
21
+ const a = rgb(stops[i]);
22
+ const b = rgb(stops[i + 1]);
23
+ return toHex(a.map((v, k) => v + (b[k] - v) * f));
24
+ };
25
+ const isChrome = (sym) => sym >= "a" && sym <= "l";
26
+
27
+ function pixelColour(sym) {
28
+ if (sym === " ") return null;
29
+ if (isChrome(sym)) return sample(CHROME_STOPS, (sym.charCodeAt(0) - 97) / 11);
30
+ if (sym === "m") return EDGE;
31
+ return SHARED_COLOURS[sym] ?? null;
32
+ }
33
+
34
+ // xterm 256-colour cube index for a #rrggbb colour.
35
+ const cube = (hex) => {
36
+ const [r, g, b] = rgb(hex).map((v) => Math.round((v / 255) * 5));
37
+ return 16 + 36 * r + 6 * g + b;
38
+ };
39
+ const sgr = (hex, layer, mode) => {
40
+ if (mode === "truecolor") return `${layer === "fg" ? 38 : 48};2;${rgb(hex).join(";")}`;
41
+ return `${layer === "fg" ? 38 : 48};5;${cube(hex)}`;
42
+ };
43
+ const paint = (ch, fg, bg, mode) => {
44
+ const codes = [fg && sgr(fg, "fg", mode), bg && sgr(bg, "bg", mode)].filter(Boolean);
45
+ return codes.length === 0 ? ch : `\x1b[${codes.join(";")}m${ch}\x1b[0m`;
46
+ };
47
+
48
+ /** Largest size that fits `cols` terminal cells, or null when even B-S does not fit. */
49
+ export function pickSize(cols) {
50
+ const width = Number.isFinite(cols) && cols > 0 ? cols : 80;
51
+ return SIZES.find((size) => width >= size.minCols)?.name ?? null;
52
+ }
53
+
54
+ function cellRows(size, mode) {
55
+ const rows = PIXEL_ROWS[size];
56
+ const out = [];
57
+ for (let y = 0; y < rows.length; y += 2) {
58
+ let line = "";
59
+ for (let x = 0; x < rows[y].length; x += 1) {
60
+ const upper = rows[y][x];
61
+ const lower = rows[y + 1][x];
62
+ const top = pixelColour(upper);
63
+ const bottom = pixelColour(lower);
64
+ if (top === bottom) line += top ? paint(" ", null, top, mode) : " ";
65
+ else if (top === null) line += paint("▄", bottom, null, mode);
66
+ else line += paint("▀", top, bottom, mode);
67
+ }
68
+ out.push(line);
69
+ }
70
+ return out;
71
+ }
72
+
73
+ function taglineRow(width, mode) {
74
+ const label = `LIT · ${HOST_LABEL}`;
75
+ const pad = " ".repeat(Math.max(0, Math.floor((width - label.length) / 2)));
76
+ if (mode === "mono") return `${pad}${label}`;
77
+ const glyphs = [...label];
78
+ return pad + glyphs.map((ch, i) => (ch === " " ? ch : paint(ch, sample(TAGLINE_STOPS, i / (glyphs.length - 1)), null, mode))).join("");
79
+ }
80
+
81
+ /**
82
+ * Rows for the mark at the given width.
83
+ * mode: "truecolor" | "256" (coloured), "mono" (no colour, the scene in glyphs), "plain" (one text line).
84
+ */
85
+ export function synthwaveRows({ cols, mode = "mono" } = {}) {
86
+ const size = pickSize(cols);
87
+ if (mode === "plain" || size === null) return [`LIT · ${HOST_LABEL}`];
88
+ const resolved = mode === "truecolor" || mode === "256" ? mode : "mono";
89
+ const art = resolved === "mono" ? [...MONO_ROWS[size]] : cellRows(size, resolved);
90
+ return [...art, taglineRow(PIXEL_ROWS[size][0].length, resolved)];
91
+ }
@@ -0,0 +1,187 @@
1
+ // Synthwave mark data. PIXEL_ROWS: two pixels per terminal cell, one symbol per pixel; ' ' is the
2
+ // terminal background, 'a'..'l' are chrome levels 0..11, 'm' is the white chrome edge, and every other
3
+ // symbol is a colour in SHARED_COLOURS. MONO_ROWS: the same scene for terminals without colour, printed
4
+ // as-is. SPEC_DIGEST pins all of it to the LitFamily visual spec; test/synthwave-mark.test.mjs recomputes it.
5
+ export const SPEC_DIGEST ="f063a0cefb969db40c0fc436742240912d895d43c3013d35782320befc0a2b86";
6
+
7
+ export const SHARED_COLOURS = Object.freeze({
8
+ "0": "#331144",
9
+ "1": "#ff5555",
10
+ "2": "#ff5566",
11
+ "3": "#ff4477",
12
+ "4": "#ff3388",
13
+ "5": "#ffbbee",
14
+ "6": "#ff3399",
15
+ "7": "#110022",
16
+ "8": "#ff4499",
17
+ "9": "#220022",
18
+ "!": "#111122",
19
+ "#": "#88eeff",
20
+ "$": "#111111",
21
+ "%": "#ffffff",
22
+ "&": "#111133",
23
+ "(": "#ffcc44",
24
+ ")": "#221133",
25
+ "*": "#ffbb44",
26
+ "+": "#ffaa33",
27
+ ",": "#ff9933",
28
+ "-": "#ff8833",
29
+ ".": "#ff7733",
30
+ "/": "#ff6633",
31
+ ":": "#ff44aa",
32
+ ";": "#220033",
33
+ "<": "#ff55aa",
34
+ "=": "#ff66bb",
35
+ ">": "#ff6644",
36
+ "?": "#ff4466",
37
+ "@": "#ff77cc",
38
+ "A": "#ffaa44",
39
+ });
40
+
41
+ export const PIXEL_ROWS = Object.freeze({
42
+ "B-L": Object.freeze([
43
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#!!!!!!",
44
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
45
+ "!!!!!!!!!!!!!!!!!!!!!!!!!#!!!!!!!!!!!!!#!!!!!!!!!!!!!!!!!!!!!#!!!!!!!!!!!!!!",
46
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
47
+ "!!!!#!!!!!!!!mmmmmm!!!!!!!!!!!!mmmmmmmmmm!!!!mmmmmmmmmmmmmmmmmm!!!!!!!!!!!!!",
48
+ "!!!!!!!!!!!!!mbbbbb$!!!!!!!!%!!mbbbbbbbbb$!!!mbbbbbbbbbbbbbbbbb$!!!!!!!!!!!!",
49
+ "!!!!!!!!!!!!!mbbbbb$!#!!!!!!!!!mbbbbbbbbb$!!!mbbbbbbbbbbbbbbbbb$!!!!!!!%!!!!",
50
+ "!!!!!!!!!!!!!mccccc$!!!!!!!!!!!mccccccccc$!!!mccccccccccccccccc$!!!!!!!!!!!!",
51
+ "&&&&&&&&&&&&&mccccc$&&&&&&&&&&&&$mccccc$$$&&&mccccccccccccccccc$&&&&&&&&&&&&",
52
+ "&&&&&&&&&&&&&mddddd$&&&&&%&&&&&&&mddddd$&&&&&mddddddddddddddddd$&&&&&&&&&&&&",
53
+ "&&&&&&&&&&&&&mddddd$&&&&&&&&&&&&&mddddd$&&&&&&$$$$$mddddd$$$$$$$&%&&&&&&&&&&",
54
+ "&&&&&&&&&&&&&meeeee$&&&&&&%&&&&&&meeeee$&%&&&&&&&&&meeeee$&&&&&&&&&&&&%&&&&&",
55
+ "&&&&&&&&&&&&&meeeee$&&&&&%&&&&&&&meeeee$((((&&&&&&&meeeee$&&&&&&&&&&&&&&&&&&",
56
+ ")))))))))))))mfffff$)))))))))))**mfffff$******)))))mfffff$))))))))))))))))))",
57
+ ")))))))))))))mfffff$)))))))))++++mfffff$++++++++)))mfffff$))))))))))))))))))",
58
+ "#))))))))))))mggggg$)))))))),,,,,mggggg$,,,,,,,,,))mggggg$))))))))))))))))))",
59
+ ")))))))))))))mggggg$)))))))------mggggg$----------)mggggg$))))))))))))))))))",
60
+ ")))))))))))))mhhhhh$))))))-------mhhhhh$-----------mhhhhh$))))))))))))))))))",
61
+ ")))))))))))))mhhhhh$)))))).......mhhhhh$...........mhhhhh$))))))))))))))))))",
62
+ ")))))))))))))miiiii$)))))////////miiiii$///////////miiiii$))))))))))))))))))",
63
+ ")))))))))))))miiiiimmmmmmmm))))))miiiii$)))))))))))miiiii$))))))))))))))))))",
64
+ "0000000000000mjjjjjjjjjjjjj$11111mjjjjj$11111111111mjjjjj$000000000000000000",
65
+ "0000000000000mjjjjjjjjjjjjj$222mmjjjjjjmm2222222222mjjjjj$000000000000000000",
66
+ "0000000000000mkkkkkkkkkkkkk$000mkkkkkkkkk$000000000mkkkkk$000000000000000000",
67
+ "0000000000000mkkkkkkkkkkkkk$333mkkkkkkkkk$333333333mkkkkk$000000000000000000",
68
+ "0000000000000mlllllllllllll$444mlllllllll$444444444mlllll$000000000000000000",
69
+ "00000000000000$$$$$$$$$$$$$$0000$$$$$$$$$$0000000000$$$$$$000000000000000000",
70
+ "5555555555555555555555555555555555555555555555555555555555555555555555555555",
71
+ "6666666666666666666666666666666666666666666666666666666666666666666666666666",
72
+ "7777777777777777677676776767677676776767677676776767677676776777777777777777",
73
+ "8888888888886886886886886886868868868868868868868688688688688688688888888888",
74
+ "7777777767767776776776777677677677767767767776776776777677677677767767777777",
75
+ "9999699969996996999699969996996999699969996999699699969996999699699969996999",
76
+ "6:::6:::6::::6:::6:::6:::6::::6:::6:::6:::6:::6::::6:::6:::6:::6::::6:::6:::",
77
+ "6999969999699969999699996999969996999969999699969999699996999969996999969999",
78
+ ";;6;;;;6;;;;6;;;;6;;;;6;;;;;6;;;;6;;;;6;;;;6;;;;6;;;;;6;;;;6;;;;6;;;;6;;;;6;",
79
+ ";;;;6;;;;;6;;;;6;;;;;6;;;;;6;;;;6;;;;;6;;;;;6;;;;6;;;;;6;;;;;6;;;;6;;;;;6;;;",
80
+ "<6<<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<6<<<<<<6",
81
+ ";;;;;6;;;;;;6;;;;;6;;;;;;6;;;;;6;;;;;;6;;;;;;6;;;;;6;;;;;;6;;;;;6;;;;;;6;;;;",
82
+ ";;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;;;;;6;;",
83
+ ";6;;;;;;6;;;;;;;6;;;;;;6;;;;;;;6;;;;;;6;;;;;;6;;;;;;;6;;;;;;6;;;;;;;6;;;;;;6",
84
+ ";;;;;;6;;;;;;;6;;;;;;;6;;;;;;;6;;;;;;;6;;;;;;;6;;;;;;;6;;;;;;;6;;;;;;;6;;;;;",
85
+ "====6========6=======6========6=======6=======6========6=======6========6===",
86
+ ";;;6;;;;;;;6;;;;;;;;6;;;;;;;;6;;;;;;;;6;;;;;;;;6;;;;;;;;6;;;;;;;;6;;;;;;;6;;",
87
+ ";6;;;;;;;;6;;;;;;;;6;;;;;;;;;6;;;;;;;;6;;;;;;;;6;;;;;;;;;6;;;;;;;;6;;;;;;;;6",
88
+ ";;;;;;;;;6;;;;;;;;6;;;;;;;;;6;;;;;;;;;6;;;;;;;;;6;;;;;;;;;6;;;;;;;;6;;;;;;;;",
89
+ ]),
90
+ "B-M": Object.freeze([
91
+ "#!!!!!!!!!!!!!!!!!!!!%!!!!%#!!!!!!!!!!%!!!!!",
92
+ "!!!#!!!!!!!!!!%!!!!!!!!!!!!!!!!!%!!!!!!!!!!!",
93
+ "#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
94
+ "!!!#!!!!mmm!!!!!#!mmmmm!!!mmmmmmmmm!!!%#!!!!",
95
+ "!!!!!!!!mbb$!!!!!!mbbbb$!!mbbbbbbbb$!!!!!!!!",
96
+ "&&&&&&&&mcc$&&&&&&&mcc$$&&mcccccccc$&&&&&&&&",
97
+ "&&&&&&&&mdd$&&&&&&*mdd$****$$mdd$$$$&&&&&&&&",
98
+ "))))))))mee$)))))++mee$+++++)mee$)))))))))))",
99
+ "))))))))mgg$))))---mgg$------mgg$)))))))))))",
100
+ "))))))))mhh$)))....mhh$......mhh$)))))))))))",
101
+ "))))))))mii$))>>>>>mii$>>>>>>mii$)))))))))))",
102
+ "))))))))mjjmmmm))))mjj$))))))mjj$)))))))))))",
103
+ "00000000mkkkkkk$??mkkkm??????mkk$00000000000",
104
+ "00000000mllllll$44mllll$44444mll$00000000000",
105
+ "000000000$$$$$$$000$$$$$000000$$$00000000000",
106
+ "55555555555555555555555555555555555555555555",
107
+ "66666666666666666666666666666666666666666666",
108
+ "77776767676767676767676767676767676767676777",
109
+ "6::6:6:6::6:6::6:6::6:6:6::6:6::6:6::6:6:6::",
110
+ "99699699696996996996996996996996996969969969",
111
+ ";;6;;6;;;6;;6;;6;;;6;;6;;6;;;6;;6;;6;;;6;;6;",
112
+ "===6===6===6==6===6===6===6===6==6===6===6==",
113
+ ";6;;;6;;;6;;;6;;;;6;;;6;;;6;;;;6;;;6;;;6;;;6",
114
+ ";;;6;;;;6;;;;6;;;6;;;;6;;;;6;;;6;;;;6;;;;6;;",
115
+ ";6;;;;6;;;;;6;;;;6;;;;6;;;;6;;;;6;;;;;6;;;;6",
116
+ "@@@@@6@@@@@6@@@@6@@@@@6@@@@@6@@@@6@@@@@6@@@@",
117
+ ]),
118
+ "B-S": Object.freeze([
119
+ "!!!!!!!%!!!!#!!!!!!!!!!!",
120
+ "!%!!!!!!!!!!!!!!!!!!!!#!",
121
+ "!!!!mm!!!mmmm!mmmmmm!!!!",
122
+ "&&&&mc$&&&mc$$mccccc$&&&",
123
+ "&&&&me$&&Ame$AA$me$$$&&&",
124
+ "))#)mg$)--mg$---mg$)))))",
125
+ "))))mh$)))mh$)))mh$)))%)",
126
+ "))))mjmm11mj$111mj$)))))",
127
+ "0000mlll$mllm333ml$00000",
128
+ "00000$$$$0$$$$000$$00000",
129
+ "555555555555555555555555",
130
+ "6<66<6<6<66<6<66<6<6<66<",
131
+ "6;6;;6;6;;6;6;6;;6;6;;6;",
132
+ "6@@6@@6@@6@@6@@6@@6@@6@@",
133
+ ]),
134
+ });
135
+
136
+ export const MONO_ROWS = Object.freeze({
137
+ "B-L": Object.freeze([
138
+ " ·",
139
+ " · · ·",
140
+ " · ██████ · ██████████ ██████████████████",
141
+ " ██████ · ██████████ ██████████████████ ·",
142
+ " ██████ · ██████ ██████████████████",
143
+ " ██████ · ██████ · ██████ · ·",
144
+ " ██████ · ░░██████░░░░░░░ ██████",
145
+ "· ██████ ░░░░░██████░░░░░░░░░░ ██████",
146
+ " ██████ ░░░░░░░██████░░░░░░░░░░░░██████",
147
+ " ██████ ░░░░░░░░██████░░░░░░░░░░░░██████",
148
+ " ██████████████░░░░░░██████░░░░░░░░░░░░██████",
149
+ " ██████████████░░░░██████████░░░░░░░░░░██████",
150
+ " ██████████████░░░░██████████░░░░░░░░░░██████",
151
+ "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",
152
+ " ╱ ╱ ╱ ╱ ╱ │╲ ╲ ╲ ╲ ╲",
153
+ "────────────────────────┼──┼──┼─┼──┼──┼─┼──┼─┼──┼──┼────────────────────────",
154
+ " ╱ ╱ ╱ ╱ ╱ │ ╲ ╲ ╲ ╲ ╲",
155
+ "──────────────────┼───┼───┼───┼───┼───┼──┼───┼───┼───┼───┼──────────────────",
156
+ " ╱ ╱ ╱ ╱ ╱ │ ╲ ╲ ╲ ╲ ╲",
157
+ "────────────┼────┼────┼────┼────┼─────┼────┼────┼────┼────┼────┼────────────",
158
+ " ╱ ╱ ╱ ╱ ╱ │ ╲ ╲ ╲ ╲ ╲",
159
+ "──────┼─────┼──────┼─────┼─────┼──────┼─────┼─────┼─────┼──────┼─────┼──────",
160
+ "───┼──────┼──────┼──────┼──────┼──────┼─────┼──────┼──────┼──────┼──────┼───",
161
+ ]),
162
+ "B-M": Object.freeze([
163
+ "· · · · ·· · ·",
164
+ "· · ▄▄▄ · ▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ··",
165
+ " ███ ▀███▀ █████████",
166
+ " ███ ░░███░░░░░░░███",
167
+ " ███ ░░░░███░░░░░░░███",
168
+ " ███▄▄▄▄░░░░███░░░░░░░███",
169
+ " ███████░░░█████░░░░░░███",
170
+ "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",
171
+ " ╱ ╱╱ ╱╱ │╲╲ ╲╲ ╲",
172
+ "───────────┼─┼─┼─┼─┼──┼─┼─┼─┼─┼─┼───────────",
173
+ " ╱ ╱ ╱ ╱ ╱ │ ╲ ╲ ╲ ╲ ╲",
174
+ "─────┼──┼──┼───┼──┼───┼──┼──┼───┼──┼──┼─────",
175
+ "──┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼─",
176
+ ]),
177
+ "B-S": Object.freeze([
178
+ " · · · ·",
179
+ " ██ ▀██▀ ██████",
180
+ " · ██░ ░░██░░░░██░",
181
+ " ██▄▄░░██░░░░██░ ·",
182
+ " ▀▀▀▀ ▀▀▀▀░░░▀▀░",
183
+ "━━━━━━━━━━━━━━━━━━━━━━━━",
184
+ " ╱╱ ╱╱╱ │╲╲╲ ╲╲",
185
+ "─┼─┼─┼─┼─┼──┼─┼─┼─┼─┼─┼─",
186
+ ]),
187
+ });
@@ -12,7 +12,7 @@ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
12
12
  import { pathToFileURL } from "node:url";
13
13
 
14
14
  import { goalWritePath } from "../lib/goal-files.mjs";
15
- import { GOAL_STATUS, compileCondition, compileLoopCondition, conditionHash, falsify, falsifyLoop, lintCondition, parseDoneWhen, startOnlyHash } from "../lib/goal-pipeline.mjs";
15
+ import { GOAL_STATUS, compileCondition, goalGuideMarkdown, compileLoopCondition, conditionHash, falsify, falsifyLoop, lintCondition, parseDoneWhen, startOnlyHash } from "../lib/goal-pipeline.mjs";
16
16
  import { normalizeGoalObjective } from "../lib/native-goal-binding.mjs";
17
17
  import { prepareStateDir, STATE_WRITE_FLAG } from "../lib/project-state-root.mjs";
18
18
 
@@ -40,7 +40,7 @@ export const proposeGoal = ({ cwd, planArg, sessionId = null, now = Date.now(),
40
40
  const startOnly = (reason) => {
41
41
  const consent = { version: 1, condition: null, hash: startOnlyHash(plan), id: null, plan, reason, askedAt };
42
42
  record(cwd, sessionId, consent);
43
- return { line: `${GOAL_STATUS.startOnly}\n${GOAL_STATUS.skipped(reason)}`, consent };
43
+ return { line: `${GOAL_STATUS.startOnly}\n${GOAL_STATUS.skipped(reason)}`, guide: goalGuideMarkdown("startOnly"), consent };
44
44
  };
45
45
  if (/^goal:\s*never\s*$/mu.test(planText)) return startOnly("this plan is marked goal: never");
46
46
  const done = parseDoneWhen(planText);
@@ -53,7 +53,7 @@ export const proposeGoal = ({ cwd, planArg, sessionId = null, now = Date.now(),
53
53
  if (!dry.ok) return startOnly(dry.reason);
54
54
  const consent = { version: 1, condition: built.condition, hash: conditionHash(built.condition), id: built.id, plan, askedAt };
55
55
  record(cwd, sessionId, consent);
56
- return { line: GOAL_STATUS.asked(built.condition), consent };
56
+ return { line: GOAL_STATUS.asked(built.condition), guide: goalGuideMarkdown("asked", built.condition), consent };
57
57
  };
58
58
 
59
59
  // `goal-propose.mjs --loop --check "<cmd>" <objective...>`: lit-loop's question, once its failing check
@@ -85,7 +85,7 @@ export const proposeLoopGoal = ({ cwd, check, objective, sessionId = null, now =
85
85
  if (!dry.ok) return { line: GOAL_STATUS.skipped(dry.reason) };
86
86
  const consent = { version: 1, kind: "loop", condition: built.condition, hash: conditionHash(built.condition), id: built.id, plan: null, objective: goal, askedAt: new Date(now).toISOString() };
87
87
  record(cwd, sessionId, consent);
88
- return { line: GOAL_STATUS.loopAsked(built.condition), consent };
88
+ return { line: GOAL_STATUS.loopAsked(built.condition), guide: goalGuideMarkdown("loopAsked", built.condition), consent };
89
89
  };
90
90
 
91
91
  if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
@@ -93,12 +93,13 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
93
93
  // Claude Code names the session in the Bash tool's environment; without it the shared path is used.
94
94
  const sessionId = process.env.CLAUDE_CODE_SESSION_ID || null;
95
95
  let line;
96
+ let guide;
96
97
  try {
97
- ({ line } = first === "--loop" && rest[0] === "--check"
98
+ ({ line, guide } = first === "--loop" && rest[0] === "--check"
98
99
  ? proposeLoopGoal({ cwd: process.cwd(), sessionId, check: rest[1], objective: rest.slice(2).join(" ") })
99
100
  : proposeGoal({ cwd: process.cwd(), sessionId, planArg: first }));
100
101
  } catch (error) {
101
102
  line = GOAL_STATUS.skipped(error instanceof Error ? error.message : "the question could not be recorded");
102
103
  }
103
- process.stdout.write(`${line}\n`);
104
+ process.stdout.write(guide ? `${line}\n\n${guide}\n` : `${line}\n`);
104
105
  }
@@ -179,7 +179,10 @@ like this:
179
179
  `Set goal for this lit-loop: /goal <cond>? (yes / no)` itself at the loop's first activation; do
180
180
  not ask it again. Without one, once a failing check proves the objective (after the RED step), run
181
181
  `node "${CLAUDE_PLUGIN_ROOT}/scripts/goal-propose.mjs" --loop --check "<check>" <objective>` and end
182
- the reply with the line it prints; a check that already passes, cannot run or is not allowlisted
182
+ the reply with the line it prints and, under it, the answer guide it prints (a quoted table of
183
+ `yes` / `no` and what each does, ending `Type the word alone.`; descriptions in the user's
184
+ language, answer words unchanged). The hook's own question already carries that guide as plain
185
+ lines. A check that already passes, cannot run or is not allowlisted
183
186
  prints `No goal set: <reason>` and records nothing. Either way only the user's exact `yes` on a
184
187
  later prompt arms it, and the LitClaude mod runs `/goal <cond>` when that turn ends.
185
188
  - Without an armed goal, go on in degraded mode with the local evidence ledger. LitClaude never
@@ -315,7 +315,12 @@ unavailable:
315
315
  `Approve plan, start work and set goal: /goal <cond>? (yes / edit / no)`, or, when no goal can
316
316
  be set, `Approve plan and start work? (yes / no)` followed by `No goal set: <reason>`. A start
317
317
  that is refused (another run active, plan gone) arms no goal and prints
318
- `No goal set: start-work did not start (<why>)`. LitClaude sets the native goal itself: lit-plan asks once (`Approve plan, start work and set goal: /goal <cond>? (yes / edit / no)`), and only the user's exact `yes` starts start-work on that plan, with the grants a typed `/litclaude:start-work <plan>` gets, and lets the LitClaude mod run `/goal <cond>` when that turn ends; it clears only the goal it set. If a `ProposeGoal` tool is in your live tool
318
+ `No goal set: start-work did not start (<why>)`.
319
+ - Under the question, render the answer guide the script prints after a blank line: a quoted block
320
+ headed `**▶ Answer: …**`, the `/goal` line when there is one, a `| Type | What happens |` table
321
+ with one row per answer (`yes` / `edit` / `no`, or `yes` / `no` for a start-only question) and
322
+ `Type the word alone.` Translate the descriptions into the user's language but keep the answer
323
+ words exactly `yes`, `edit` and `no`; the question line above it stays unchanged. LitClaude sets the native goal itself: lit-plan asks once (`Approve plan, start work and set goal: /goal <cond>? (yes / edit / no)`), and only the user's exact `yes` starts start-work on that plan, with the grants a typed `/litclaude:start-work <plan>` gets, and lets the LitClaude mod run `/goal <cond>` when that turn ends; it clears only the goal it set. If a `ProposeGoal` tool is in your live tool
319
324
  list, you may call it with `ask_user=true` instead of printing the line; never
320
325
  otherwise. Avoid clobbering a different active goal without explicit replacement.
321
326
  - Write no `/goal` line into the plan: start-work's