@litfamily/litclaude 1.0.44 → 1.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +8 -8
  3. package/README_ko-KR.md +8 -8
  4. package/bin/litclaude-ai.js +173 -4
  5. package/docs/assets/readme/badge-version.svg +1 -1
  6. package/package.json +1 -1
  7. package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
  8. package/plugins/litclaude/bin/litclaude-ai +1 -0
  9. package/plugins/litclaude/bin/litclaude-hook.js +21 -7
  10. package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
  11. package/plugins/litclaude/hooks/hooks.json +1 -1
  12. package/plugins/litclaude/lib/agent-file/apply.mjs +150 -0
  13. package/plugins/litclaude/lib/agent-file/attribution.mjs +62 -0
  14. package/plugins/litclaude/lib/agent-file/block.md +12 -0
  15. package/plugins/litclaude/lib/agent-file/cli.mjs +71 -0
  16. package/plugins/litclaude/lib/agent-file/managed-block.mjs +82 -0
  17. package/plugins/litclaude/lib/agent-file/project-block.md +9 -0
  18. package/plugins/litclaude/lib/canonical-skill-resources.mjs +8 -8
  19. package/plugins/litclaude/lib/mark.mjs +23 -6
  20. package/plugins/litclaude/lib/rewind/brief.mjs +12 -2
  21. package/plugins/litclaude/lib/rewind/collect.mjs +25 -7
  22. package/plugins/litclaude/lib/rewind/next-step.mjs +21 -3
  23. package/plugins/litclaude/lib/start-work-lifecycle.mjs +4 -2
  24. package/plugins/litclaude/skills/lit-adhd/SKILL.md +5 -4
  25. package/plugins/litclaude/skills/lit-init/SKILL.md +12 -0
  26. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +4 -1
  27. package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/init.js +13 -0
  28. package/plugins/litclaude/skills/readme-studio/templates/hyperframes-cover/package-lock.json +4 -4
@@ -4,7 +4,9 @@
4
4
  // 2. a paused start-work boundary -> approve-boundary (shown only, never automatic)
5
5
  // 3. an active start-work of this session -> continue-work
6
6
  // 4. a single open plan with no work running -> start-plan (`/litclaude:start-work <plan>`)
7
- // 5. otherwise -> none
7
+ // and no other lane at work
8
+ // 5. other lanes still at work -> none, with `wait` (the brief says not to type `go`)
9
+ // 6. otherwise -> none
8
10
 
9
11
  import { closeSync, constants, fstatSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
10
12
  import { dirname, join } from "node:path";
@@ -12,15 +14,31 @@ import { dirname, join } from "node:path";
12
14
  import { ignitionFileName } from "../mod/state.mjs";
13
15
  import { requireStateDir, STATE_WRITE_FLAG } from "../project-state-root.mjs";
14
16
 
17
+ // A lane is another live session here (working or waiting on the user) or a herdr agent working or
18
+ // blocked in this workspace or project; one lane seen both ways counts once.
19
+ const busyLanes = (data) => {
20
+ const lanes = new Set((data.sessions ?? [])
21
+ .filter((session) => !session.self && ["active", "waiting-on-user"].includes(session.status))
22
+ .map((session) => session.id8));
23
+ for (const agent of data.herdr?.agents ?? []) {
24
+ if (!agent.self && ["working", "blocked"].includes(agent.status)) lanes.add(agent.id8 ?? agent.pane);
25
+ }
26
+ return lanes.size;
27
+ };
28
+
29
+ // While another lane works, nothing that resumes or starts work here is offered: only an approval,
30
+ // which is the user's call either way.
15
31
  export const chooseNextStep = (data, sessionId) => {
32
+ const lanes = busyLanes(data);
16
33
  const ownStack = data.workflows.find((frame) => frame.sessionId === sessionId && frame.role === "spine" && frame.status === "paused");
17
- if (sessionId && ownStack) {
34
+ if (sessionId && ownStack && !lanes) {
18
35
  return { kind: "resume-frame", target: { skill: ownStack.skill, stage: ownStack.stage, progress: ownStack.progress.gauge }, say: "lit continue" };
19
36
  }
20
37
  const paused = data.startWork.find((work) => work.status === "paused" && work.pendingBoundary);
21
38
  if (paused) {
22
39
  return { kind: "approve-boundary", target: { workId: paused.workId, plan: paused.plan, ...paused.pendingBoundary }, say: "lit approve", automatic: false };
23
40
  }
41
+ if (lanes) return { kind: "none", target: null, wait: { lanes } };
24
42
  const own = data.startWork.find((work) => work.status === "active" && sessionId && work.sessionId === sessionId);
25
43
  if (own) return { kind: "continue-work", target: { workId: own.workId, plan: own.plan }, say: "go" };
26
44
  const running = data.startWork.some((work) => ["active", "paused"].includes(work.status));
@@ -28,7 +46,7 @@ export const chooseNextStep = (data, sessionId) => {
28
46
  if (!running && open.length === 1) {
29
47
  return { kind: "start-plan", target: { plan: open[0].plan }, say: "go", command: `/litclaude:start-work ${open[0].plan}` };
30
48
  }
31
- return { kind: "none", target: null };
49
+ return lanes ? { kind: "none", target: null, wait: { lanes } } : { kind: "none", target: null };
32
50
  };
33
51
 
34
52
  export const nextStepPath = (stateRoot, sessionId) => join(stateRoot, ".litclaude", "adhd", `next-${ignitionFileName(sessionId)}`);
@@ -179,7 +179,9 @@ const canonicalDirectory = (path, label) => {
179
179
  }
180
180
  if (stats.isSymbolicLink()) throw new StartWorkLifecycleError(`${label} must not be a symbolic link`);
181
181
  if (!stats.isDirectory()) throw new StartWorkLifecycleError(`${label} must be a directory`);
182
- return realpathSync(requested).normalize("NFC");
182
+ // Keep the on-disk spelling: ext4 does not fold Unicode normalization, so an NFC copy of an NFD
183
+ // folder name opens nothing there. Comparisons normalize on their own (rootCovers).
184
+ return realpathSync(requested);
183
185
  };
184
186
 
185
187
  const canonicalTarget = (path, label) => {
@@ -1728,7 +1730,7 @@ export const recordStartWorkSubagentStart = (root, input) => {
1728
1730
  started_at: nowIso(),
1729
1731
  };
1730
1732
  work.lanes[agentId] = lane;
1731
- if (canonicalWorktreePath !== canonicalRoot) {
1733
+ if (canonicalWorktreePath.normalize("NFC") !== canonicalRoot.normalize("NFC")) {
1732
1734
  work.worktrees[worktreePath] = {
1733
1735
  path: worktreePath,
1734
1736
  owner: "claude",
@@ -58,7 +58,7 @@ The collector draws the brief in Markdown (`lib/rewind/brief.mjs`), so its shape
58
58
  - ▶ what is next for that session: answer the question it asked, resume its paused frame, approve its boundary, its plan's current item, or what it is doing now (its last tool call: `Bash “Run the gates”`, for an active session only). A done session names the plan its run finished; an idle or done session's last tool call is never offered as its next step.
59
59
  3. **Ended sessions, one table row each.** A `### ⚪ Ended · N` table (id, where, goal, ended, done), at most 8 rows and a count of the rest.
60
60
  4. **Roadmap timeline.** A `### 🗺️` heading with this worktree's roadmap gauge, then ✓ finished commits with their dates and branch, ▶ the current item of each open plan of this worktree and of plans another worktree changed inside the window (with its worktree name) with its gauge, ○ the items after it, then litgoal objectives. Stale plans elsewhere, unfilled plan scaffolds and another worktree's finished objectives are left out.
61
- 5. **One recommended next step** in a box, from `next`, with the word to type (`go`, `lit continue` or `lit approve`), then one line: "Type `go` to continue." When nothing can run on `go`, the box still recommends a real step from the records: first the first item under `## Next` or `## Next Steps` in this worktree's own `HANDOFF*.md`, then a session waiting on the user, a paused workflow, an open plan item, the latest active session, then the newest listed session that is not running (review what a done one finished, or pick up an idle or ended one). Only a window with no session and no plan says there is nothing to start. It says that nothing runs on its own, and a HANDOFF step never carries a word to type.
61
+ 5. **One recommended next step** in a box, from `next`, with the word to type (`go`, `lit continue` or `lit approve`), then one line: "Type `go` to continue." When nothing can run on `go`, the box still recommends a real step from the records: first the first item under `## Next` or `## Next Steps` in this worktree's own `HANDOFF*.md` that is not already marked done (✅, ✓, `[x]`, struck through, DONE or SHIPPED), then a session waiting on the user, a paused workflow, an open plan item, the latest active session, then the newest listed session that is not running (review what a done one finished, or pick up an idle or ended one). Only a window with no session and no plan says there is nothing to start. It says that nothing runs on its own, and a HANDOFF step never carries a word to type.
62
62
 
63
63
  **Progress gauges (D9), required.** A gauge appears only when both numbers are real, in the form `[▉▉▉░░] 3/5` (filled `▉` done, light `░` remaining, then done/total). An unknown total has no gauge: the card states what is known in words instead. Never a question-mark gauge, never a guess, never an estimate, never a gauge of your own.
64
64
 
@@ -111,7 +111,7 @@ The collector (`plugins/litclaude/lib/rewind/collect.mjs`, served as `litclaude-
111
111
  | `.litclaude/workflow-stack/*.json` | running and paused disciplines with stage and k/n | `workflowStack: unknown` |
112
112
  | `.litclaude/boulder.json` | active start-work, its plan progress and any boundary waiting for approval; completed runs from its history | `startWork: unknown` |
113
113
  | `.litclaude/liveness/*.json` | each session's last hook event (`alive`, `idle`, `ended`), written by PostToolUse, Stop and SessionEnd | the transcript time alone decides |
114
- | `herdr agent list` (only when `HERDR_ENV=1`) | agent panes | `herdr: unknown` |
114
+ | `herdr agent list` (only when `HERDR_ENV=1`) | agent panes of this herdr workspace or this repo: agent, status, pane, session | `herdr: unknown` |
115
115
 
116
116
  Plans, litgoal, handoffs, workflow stacks and start-work are read first, then transcripts, so a busy transcript folder never crowds out the plans; a plan met after the budget ran out is counted and the brief says how many were not read. Transcripts are read head (64 KiB) and tail (256 KiB) only, under one 8 MiB budget for the whole run, through descriptors opened without following links; subagent transcripts and sidechain lines are skipped. The slug is the session's absolute cwd with every character outside `[A-Za-z0-9]` turned into `-`; a folder whose slug is missing is found by the `cwd` its newest transcript records. Every string is redacted before it leaves the collector: credential shapes, `NAME=value` with a secret-like name, URI userinfo, any current environment value of eight or more characters, and the home directory (shown as `~`).
117
117
 
@@ -133,8 +133,9 @@ Sessions waiting on the user come first, then active ones, then idle and done on
133
133
  1. This session's own paused spine frame: resume it. Say `lit continue`.
134
134
  2. A start-work paused at a boundary: show what it wants to reach. Say `lit approve` or `lit deny`. This is never automatic.
135
135
  3. This session's own active start-work: keep going. Say `go`.
136
- 4. Exactly one open plan in this worktree and no work running: start it. Say `go`, which runs `/litclaude:start-work plans/<plan>.md`.
137
- 5. Otherwise `none`: say so.
136
+ 4. Exactly one open plan in this worktree, no work running and no other lane at work: start it. Say `go`, which runs `/litclaude:start-work plans/<plan>.md`.
137
+ 5. Another lane still at work: a live session of this repo other than this one (working or waiting on the user), or a herdr agent working or blocked in this herdr workspace or inside this repo. One lane seen both ways counts once. There is no step for `go`: the box says to wait for the lanes (or to answer the one that asked something) and the last line says not to type `go` until they finish, so a parallel lane is never raced by a second run.
138
+ 6. Otherwise `none`: say so.
138
139
 
139
140
  ## Continuing with go
140
141
 
@@ -268,6 +268,17 @@ ANTI-PATTERNS). Wait for all. Mark "generate" completed.
268
268
  Mark "review" in_progress. For each generated file: remove generic advice, remove parent duplicates,
269
269
  trim to the size limits, verify telegraphic style. Mark "review" completed.
270
270
 
271
+ ## Phase 5 — LitFamily project block
272
+
273
+ After the review, run `litclaude-ai agent-file project --dir <repo root>` once. It adds the short
274
+ LitFamily project block (plans, handoff, approval and evidence conventions) between
275
+ `<!-- litfamily:litclaude:start … -->` and `<!-- litfamily:litclaude:end -->` markers at the end of
276
+ the root `AGENTS.md`, so the hand-written knowledge base above stays yours and the block is refreshed
277
+ in place on the next run. When the repo has no `CLAUDE.md`, it writes one containing `@AGENTS.md` so
278
+ Claude Code loads the same file; an existing `CLAUDE.md` is left alone, and the command prints the
279
+ line to add. Never edit text between the markers by hand, and never copy the block into subdirectory
280
+ files. Report the `AGENT_FILE:` lines it prints in the final report.
281
+
271
282
  ## Final report
272
283
 
273
284
  ```
@@ -276,6 +287,7 @@ Mode: {update | create-new}
276
287
  Files: [OK] ./AGENTS.md (root, {N} lines) · [OK] ./src/hooks/AGENTS.md ({N} lines)
277
288
  Dirs analyzed: {N} · Created: {N} · Updated: {N}
278
289
  Hierarchy: ./AGENTS.md └── src/hooks/AGENTS.md
290
+ LitFamily block: {AGENT_FILE lines from `agent-file project`}
279
291
  ```
280
292
 
281
293
  ## Anti-patterns
@@ -133,7 +133,10 @@ async function openOnRung({ label, ctx }) {
133
133
  else if (!error && !(spec.duration > 0)) error = fail("the page's duration must be a positive number of seconds");
134
134
  if (!error && state.webglMissing) error = new BlockedError(EXIT.BLOCKED_NO_WEBGL2, `BLOCKED_NO_WEBGL2: the page asked for a WebGL context and the ${ctx.rung} rung gave none`);
135
135
  if (!error && browser.prepared?.failedFaces?.length) log(`warning: faces that did not load: ${browser.prepared.failedFaces.join(", ")}`);
136
- if (error && !(ctx.rung === "gpu" && error.code === EXIT.BLOCKED_NO_WEBGL2)) {
136
+ // A 3D page usually throws when its WebGL context comes back null (three.js does), so on the GPU
137
+ // rung a missing context outranks the contract error it causes: openChecked retries on SwiftShader.
138
+ // Linux CI Chrome has no GPU, so `--use-angle=gl` gives no WebGL there.
139
+ if (error && !(ctx.rung === "gpu" && state.webglMissing)) {
137
140
  await browser.close();
138
141
  throw error;
139
142
  }
@@ -183,6 +183,19 @@
183
183
  const born = new Map();
184
184
  const finished = new Set();
185
185
  const svgBorn = new Map();
186
+ // An animation the page script starts is paused at once on the virtual clock. Left to the sweep in
187
+ // step(), it would play on the wall clock while the page loads, and on a slow host a short one
188
+ // finished, resolved `finished` and moved its chained successor before frame 0.
189
+ const nativeAnimate = Element.prototype.animate;
190
+ Element.prototype.animate = function animate(...args) {
191
+ const a = nativeAnimate.apply(this, args);
192
+ if (!born.has(a)) {
193
+ a.pause();
194
+ born.set(a, V.ms / 1000);
195
+ a.currentTime = 0;
196
+ }
197
+ return a;
198
+ };
186
199
  const drainMicrotasks = async () => {
187
200
  for (let i = 0; i < 8; i++) await Promise.resolve();
188
201
  };
@@ -466,16 +466,16 @@
466
466
  }
467
467
  },
468
468
  "node_modules/@hono/node-server": {
469
- "version": "2.1.1",
470
- "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz",
471
- "integrity": "sha512-ELuehkj5VCBdgEw9zs+ivkKwyzzUCSQuE96YmiPvn1ECBoZCczbFXJLeEGMTYjphP6gydh4pHMqEYPVMYUVgQg==",
469
+ "version": "2.1.5",
470
+ "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.5.tgz",
471
+ "integrity": "sha512-MgP/I06GdvsilDspMk/qmRzpk8LOUStP6jFAbSRi40W09DhoyUn+Mj7eyKICPqeYKybOjVFLVIAQzvu1bfIa7Q==",
472
472
  "dev": true,
473
473
  "license": "MIT",
474
474
  "engines": {
475
475
  "node": ">=20"
476
476
  },
477
477
  "peerDependencies": {
478
- "hono": "^4"
478
+ "hono": "^4 || ^5.0.0-0"
479
479
  }
480
480
  },
481
481
  "node_modules/@img/colour": {