@litfamily/litclaude 1.0.38 → 1.0.40

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 (55) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +8 -8
  3. package/README_ko-KR.md +8 -8
  4. package/docs/assets/readme/badge-version.svg +1 -1
  5. package/docs/hooks.md +11 -6
  6. package/package.json +1 -1
  7. package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
  8. package/plugins/litclaude/bin/litclaude-hook.js +31 -13
  9. package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
  10. package/plugins/litclaude/commands/lit-adhd.md +12 -8
  11. package/plugins/litclaude/commands/lit-rewind.md +12 -8
  12. package/plugins/litclaude/lib/canonical-skill-resources.mjs +26 -25
  13. package/plugins/litclaude/lib/interface-probe-gate.mjs +4 -5
  14. package/plugins/litclaude/lib/lit-plan-persistence.mjs +4 -5
  15. package/plugins/litclaude/lib/litgoal/autoloop.mjs +4 -5
  16. package/plugins/litclaude/lib/litgoal/cli.mjs +4 -5
  17. package/plugins/litclaude/lib/litgoal/ledger.mjs +4 -5
  18. package/plugins/litclaude/lib/litgoal/state.mjs +4 -6
  19. package/plugins/litclaude/lib/mod/frame.mjs +87 -20
  20. package/plugins/litclaude/lib/mod/svg-card.mjs +64 -22
  21. package/plugins/litclaude/lib/mod/timeline.mjs +4 -3
  22. package/plugins/litclaude/lib/mod/view.mjs +53 -13
  23. package/plugins/litclaude/lib/motion-render-gate.mjs +4 -5
  24. package/plugins/litclaude/lib/project-state-root.mjs +44 -2
  25. package/plugins/litclaude/lib/rewind/brief.mjs +373 -0
  26. package/plugins/litclaude/lib/rewind/collect.mjs +55 -25
  27. package/plugins/litclaude/lib/rewind/gauge.mjs +28 -8
  28. package/plugins/litclaude/lib/rewind/next-step.mjs +4 -5
  29. package/plugins/litclaude/lib/rewind/redact.mjs +28 -8
  30. package/plugins/litclaude/lib/rewind/suggest.mjs +56 -0
  31. package/plugins/litclaude/lib/rewind/transcripts.mjs +18 -3
  32. package/plugins/litclaude/lib/start-work-lifecycle.mjs +6 -9
  33. package/plugins/litclaude/lib/workflow-stack.mjs +4 -5
  34. package/plugins/litclaude/skills/frontend-ui-ux/SKILL.md +8 -1
  35. package/plugins/litclaude/skills/frontend-ui-ux/references/production-interview.md +1 -1
  36. package/plugins/litclaude/skills/lit-adhd/SKILL.md +45 -28
  37. package/plugins/litclaude/skills/lit-adhd/references/card-examples.md +114 -58
  38. package/plugins/litclaude/skills/lit-adhd/scripts/rewind.mjs +1 -1
  39. package/plugins/litclaude/skills/lit-diagram-drawer/SKILL.md +12 -1
  40. package/plugins/litclaude/skills/lit-docx/SKILL.md +6 -1
  41. package/plugins/litclaude/skills/lit-docx/references/direction-step.md +8 -4
  42. package/plugins/litclaude/skills/lit-handoff/SKILL.md +1 -0
  43. package/plugins/litclaude/skills/lit-hijack/references/capture-and-provenance.md +7 -0
  44. package/plugins/litclaude/skills/lit-hijack/references/distil-and-licence.md +5 -0
  45. package/plugins/litclaude/skills/lit-hijack/scripts/hijack.mjs +87 -15
  46. package/plugins/litclaude/skills/lit-pptx/SKILL.md +6 -1
  47. package/plugins/litclaude/skills/lit-pptx/references/direction-step.md +4 -2
  48. package/plugins/litclaude/skills/lit-recap/SKILL.md +1 -0
  49. package/plugins/litclaude/skills/lit-schematic/SKILL.md +12 -1
  50. package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +10 -6
  51. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/assets.mjs +80 -13
  52. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +13 -3
  53. package/plugins/litclaude/skills/lit-typographic-motion/references/treatment.md +9 -7
  54. package/plugins/litclaude/skills/readme-studio/SKILL.md +10 -0
  55. package/plugins/litclaude/skills/readme-studio/references/production-interview.md +2 -0
@@ -8,10 +8,10 @@
8
8
  // anything the hook cannot read are not clean. The block
9
9
  // counter is the loop brake: at most INTERFACE_PROBE_MAX_BLOCKS blocks per turn, then the stop
10
10
  // passes with a warning. Any unreadable state fails SAFE (allow).
11
- import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
11
+ import { existsSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
12
12
  import { extname, isAbsolute, join } from "node:path";
13
13
 
14
- import { ensureStateDirIgnored, resolveProjectStateRoot } from "./project-state-root.mjs";
14
+ import { requireStateDir, resolveProjectStateRoot, STATE_WRITE_FLAG } from "./project-state-root.mjs";
15
15
 
16
16
  export const INTERFACE_PROBE_MAX_BLOCKS = 2;
17
17
  // start-work is left out: its prompt turn must stay side-effect-free, and the plan rows it runs
@@ -40,10 +40,9 @@ const readTurn = (cwd) => {
40
40
 
41
41
  const writeTurn = (cwd, state) => {
42
42
  const target = interfaceProbeTurnPath(cwd);
43
- mkdirSync(join(target, ".."), { recursive: true });
44
- ensureStateDirIgnored(target);
43
+ requireStateDir(join(target, ".."));
45
44
  const tmp = `${target}.tmp`;
46
- writeFileSync(tmp, JSON.stringify(state));
45
+ writeFileSync(tmp, JSON.stringify(state), { flag: STATE_WRITE_FLAG });
47
46
  renameSync(tmp, target);
48
47
  return state;
49
48
  };
@@ -3,10 +3,10 @@
3
3
  // `plans/*.md` newer than the prompt carries at least one `- [ ] N.` task row. The
4
4
  // block counter is the loop brake: at most LIT_PLAN_MAX_BLOCKS blocks per session,
5
5
  // after which the stop passes with a warning. Any unreadable state fails SAFE (allow).
6
- import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
6
+ import { existsSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
7
7
  import { join, resolve } from "node:path";
8
8
 
9
- import { ensureStateDirIgnored, resolveProjectStateRoot } from "./project-state-root.mjs";
9
+ import { requireStateDir, resolveProjectStateRoot, STATE_WRITE_FLAG } from "./project-state-root.mjs";
10
10
  import { findProjectRoot } from "./rules/discovery.mjs";
11
11
 
12
12
  export const LIT_PLAN_MAX_BLOCKS = 2;
@@ -37,10 +37,9 @@ const readTurn = (cwd) => {
37
37
 
38
38
  const writeTurn = (cwd, state) => {
39
39
  const target = litPlanTurnPath(cwd);
40
- mkdirSync(join(target, ".."), { recursive: true });
41
- ensureStateDirIgnored(target);
40
+ requireStateDir(join(target, ".."));
42
41
  const tmp = `${target}.tmp`;
43
- writeFileSync(tmp, JSON.stringify(state));
42
+ writeFileSync(tmp, JSON.stringify(state), { flag: STATE_WRITE_FLAG });
44
43
  renameSync(tmp, target);
45
44
  return state;
46
45
  };
@@ -3,9 +3,9 @@
3
3
  // stopping only while it can durably increment this counter under the cap. If the
4
4
  // counter cannot be read or written, the hook fails SAFE (allows stopping) rather
5
5
  // than risk a runaway loop. State lives at `.litclaude/litgoal/autoloop.json`.
6
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
+ import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
7
7
  import { join } from "node:path";
8
- import { ensureStateDirIgnored } from "../project-state-root.mjs";
8
+ import { requireStateDir, STATE_WRITE_FLAG } from "../project-state-root.mjs";
9
9
  import { appendLitgoalLedger } from "./ledger.mjs";
10
10
  import { litgoalGoalsPath, litgoalLedgerPath, litgoalLockDir, litgoalStateDir } from "./paths.mjs";
11
11
  import { readLitgoalState, withLitgoalLock, writeLitgoalState } from "./state.mjs";
@@ -40,11 +40,10 @@ export const readAutoloopState = (cwd = process.cwd()) => {
40
40
 
41
41
  export const writeAutoloopState = (cwd, state) => {
42
42
  const dir = litgoalStateDir(cwd);
43
- mkdirSync(dir, { recursive: true });
44
- ensureStateDirIgnored(dir);
43
+ requireStateDir(dir);
45
44
  const target = litgoalAutoloopPath(cwd);
46
45
  const tmp = `${target}.tmp`;
47
- writeFileSync(tmp, JSON.stringify(state));
46
+ writeFileSync(tmp, JSON.stringify(state), { flag: STATE_WRITE_FLAG });
48
47
  renameSync(tmp, target);
49
48
  return state;
50
49
  };
@@ -1,6 +1,6 @@
1
- import { mkdirSync, writeFileSync } from "node:fs";
1
+ import { writeFileSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
- import { ensureStateDirIgnored } from "../project-state-root.mjs";
3
+ import { requireStateDir, STATE_WRITE_FLAG } from "../project-state-root.mjs";
4
4
  import { appendLitgoalLedger } from "./ledger.mjs";
5
5
  import {
6
6
  litgoalBriefPath,
@@ -193,9 +193,8 @@ const createGoals = (cwd, args) => {
193
193
  updatedAt: timestamp,
194
194
  };
195
195
 
196
- mkdirSync(dirname(litgoalBriefPath(cwd)), { recursive: true });
197
- ensureStateDirIgnored(litgoalBriefPath(cwd));
198
- writeFileSync(litgoalBriefPath(cwd), `${brief}\n`);
196
+ requireStateDir(dirname(litgoalBriefPath(cwd)));
197
+ writeFileSync(litgoalBriefPath(cwd), `${brief}\n`, { flag: STATE_WRITE_FLAG });
199
198
  writeLitgoalState(litgoalGoalsPath(cwd), state);
200
199
  // Fresh autoloop run -> reset the durable iteration counter so prior caps don't carry over.
201
200
  if (autoloop) resetAutoloopState(cwd, Date.parse(timestamp) || Date.now());
@@ -1,16 +1,15 @@
1
- import { appendFileSync, closeSync, fsyncSync, mkdirSync, openSync } from "node:fs";
1
+ import { appendFileSync, closeSync, fsyncSync, openSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
3
 
4
- import { ensureStateDirIgnored } from "../project-state-root.mjs";
4
+ import { requireStateDir, STATE_APPEND_FLAG } from "../project-state-root.mjs";
5
5
 
6
6
  export const appendLitgoalLedger = (path, entry) => {
7
- mkdirSync(dirname(path), { recursive: true });
8
- ensureStateDirIgnored(path);
7
+ requireStateDir(dirname(path));
9
8
  const record = {
10
9
  timestamp: new Date().toISOString(),
11
10
  ...entry,
12
11
  };
13
- appendFileSync(path, `${JSON.stringify(record)}\n`);
12
+ appendFileSync(path, `${JSON.stringify(record)}\n`, { flag: STATE_APPEND_FLAG });
14
13
  // Flush the appended record to disk for durability.
15
14
  const fd = openSync(path, "r");
16
15
  fsyncSync(fd);
@@ -1,7 +1,7 @@
1
1
  import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
3
 
4
- import { ensureStateDirIgnored } from "../project-state-root.mjs";
4
+ import { requireStateDir, STATE_WRITE_FLAG } from "../project-state-root.mjs";
5
5
 
6
6
  export class LitgoalStateError extends Error {
7
7
  constructor(message, status = 65) {
@@ -22,10 +22,9 @@ export const readLitgoalState = (path, fallback = {}) => {
22
22
 
23
23
  export const writeLitgoalState = (path, state) => {
24
24
  const dir = dirname(path);
25
- mkdirSync(dir, { recursive: true });
26
- ensureStateDirIgnored(dir);
25
+ requireStateDir(dir);
27
26
  const tmpPath = `${path}.${process.pid}.${Date.now()}.tmp`;
28
- writeFileSync(tmpPath, `${JSON.stringify(state, null, 2)}\n`);
27
+ writeFileSync(tmpPath, `${JSON.stringify(state, null, 2)}\n`, { flag: STATE_WRITE_FLAG });
29
28
  // Flush tmp file data to disk before rename so the rename is durable.
30
29
  const fd = openSync(tmpPath, "r");
31
30
  fsyncSync(fd);
@@ -48,8 +47,7 @@ const sleepSync = (milliseconds) => {
48
47
  };
49
48
 
50
49
  export const withLitgoalLock = (lockDir, fn) => {
51
- mkdirSync(dirname(lockDir), { recursive: true });
52
- ensureStateDirIgnored(lockDir);
50
+ requireStateDir(dirname(lockDir));
53
51
  const startedAt = Date.now();
54
52
  while (true) {
55
53
  try {
@@ -32,7 +32,7 @@
32
32
  // and move by colour alone (a colour change on `─` or `━` repaints), and the live step's spinner
33
33
  // and clock are ASCII.
34
34
 
35
- import { gauge } from "../rewind/gauge.mjs";
35
+ import { gauge, knownFacts } from "../rewind/gauge.mjs";
36
36
  import { textWidth, truncateToWidth } from "./layout.mjs";
37
37
  import { barCells, gradientAt, lerpColor, lookOf, rainbowAt } from "./motion.mjs";
38
38
  import { glyphSet } from "./settings.mjs";
@@ -128,6 +128,19 @@ const pill = (body, fill, glyphs) => (glyphs.capLeft
128
128
  ? [span(glyphs.capLeft, { fg: fill }), ...body, span(glyphs.capRight, { fg: fill })]
129
129
  : [span(" ", { bg: fill }), ...body, span(" ", { bg: fill })]);
130
130
 
131
+ // The rewind look's pills: each cell a step further round the hue wheel, lightened so the dark ink
132
+ // keeps its contrast, with each cap in the colour of the cell beside it.
133
+ const RAINBOW_SPREAD = 0.35;
134
+ const rainbowCell = (rainbow, at) => lerpColor(rainbow(at), "#ffffff", 0.3);
135
+ const rainbowPill = (text, rainbow, from, glyphs, bold = true) => {
136
+ const chars = [...text];
137
+ const at = (i) => from + (chars.length <= 1 ? 0 : (i / (chars.length - 1)) * RAINBOW_SPREAD);
138
+ const body = chars.map((ch, i) => span(ch, { fg: PILL.ink, bg: rainbowCell(rainbow, at(i)), bold }));
139
+ return glyphs.capLeft
140
+ ? [span(glyphs.capLeft, { fg: rainbowCell(rainbow, at(0)) }), ...body, span(glyphs.capRight, { fg: rainbowCell(rainbow, at(chars.length - 1)) })]
141
+ : [span(" ", { bg: rainbowCell(rainbow, at(0)) }), ...body, span(" ", { bg: rainbowCell(rainbow, at(chars.length - 1)) })];
142
+ };
143
+
131
144
  const inkOf = (accent) => ({ done: lerpColor(accent, PALETTE.dim, 0.45), now: accent, todo: PALETTE.dim, warn: PALETTE.amber });
132
145
 
133
146
  // Colour of one phase in this frame: the crossfade from its previous state, then the amber mix for
@@ -204,14 +217,20 @@ const cometOn = (sample, edge, width, look = null) => {
204
217
  };
205
218
 
206
219
  // While LitClaude works the brand pill breathes from its pink toward the flame orange and back.
207
- const brandSpans = (sample, glyphs) => {
220
+ // The rewind look turns it through the rainbow instead, lightened so its dark ink stays readable.
221
+ const brandSpans = (sample, glyphs, rainbow = null) => {
208
222
  const reveal = revealText("🔥 LIT", sample.pills[0]);
209
223
  if (reveal === null) return [];
224
+ if (rainbow) return rainbowPill(reveal, rainbow, 0, glyphs);
210
225
  const fill = sample.ambient ? lerpColor(PILL.brand, PALETTE.orange, 0.85 * sample.ambient.breath) : PILL.brand;
211
226
  return pill(litText(reveal, { fg: PILL.ink, bg: fill, bold: true }, sample.completion?.shimmer ?? null), fill, glyphs);
212
227
  };
213
- const indicatorSpans = (model, sample, glyphs, accent) => {
228
+ // `REWIND <<` while the rewind look is on, each letter a step further round the hue wheel, lightened
229
+ // to keep 4.5:1 on the card; the letters stay put and only their colours move.
230
+ const rewindSpans = (rainbow) => [..."REWIND <<"].map((ch, i) => span(ch, { fg: lerpColor(rainbow(i / 9), "#ffffff", 0.4), bold: true }));
231
+ const indicatorSpans = (model, sample, glyphs, accent, rainbow = null) => {
214
232
  if (sample.completion) return [span(`DONE ${glyphs.done}`, { fg: PALETTE.green, bold: true })];
233
+ if (rainbow) return rewindSpans(rainbow);
215
234
  if (model.idle) return [span("idle", { fg: PALETTE.dim })];
216
235
  const flow = model.workflow;
217
236
  if (flow && flow.current >= 0) {
@@ -228,11 +247,11 @@ const indicatorSpans = (model, sample, glyphs, accent) => {
228
247
 
229
248
  // ╭─ [🔥 LIT] · <discipline> ──── <PHASE ●> ─╮. On a narrow card the phase indicator goes first,
230
249
  // then the discipline shortens, then it goes too.
231
- const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint }) => {
232
- const brand = brandSpans(sample, glyphs);
233
- const right = indicatorSpans(model, sample, glyphs, accent);
250
+ const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rainbow }) => {
251
+ const brand = brandSpans(sample, glyphs, rainbow);
252
+ const right = indicatorSpans(model, sample, glyphs, accent, rainbow);
234
253
  const name = model.title ?? "ready";
235
- const nameStyle = model.idle ? { fg: PALETTE.dim } : { fg: accent, bold: true };
254
+ const nameStyle = model.idle && !rainbow ? { fg: PALETTE.dim } : { fg: accent, bold: true };
236
255
  const title = (text) => (text ? [span(" · ", { fg: PALETTE.dim }), span(text, nameStyle)] : []);
237
256
  const fixed = textWidth("╭─ ") + rowWidth(brand) + 1 + 1;
238
257
  const withRight = fixed + rowWidth(title(name)) + 1 + rowWidth(right) + textWidth(" ─╮");
@@ -298,12 +317,14 @@ const phaseTrack = (model, sample, { glyphs, accent, rail, short, rainbow }) =>
298
317
  const shown = revealText(state === "now" ? label : `${state === "done" ? "●" : "○"} ${label}`, sample.pills[index + 1]);
299
318
  if (shown === null) return;
300
319
  if (out.length) out.push(span(` ${glyphs.rail.repeat(rail)} `, { fg: rainbow ? rainbow(index / PHASES.length) : sample.phases[PHASES[index - 1]].to === "done" ? ink.done : PILL.rail }));
301
- if (state === "now") {
320
+ if (state === "now" && rainbow) {
321
+ out.push(...rainbowPill(shown.slice(0, label.length).padEnd(label.length), rainbow, index / PHASES.length, glyphs));
322
+ } else if (state === "now") {
302
323
  const fill = model.idle ? lerpColor(phaseColor(id, sample, ink), PILL.muted, 0.5) : phaseColor(id, sample, ink);
303
324
  const sweep = model.idle ? null : sample.ambient?.sweep ?? null;
304
325
  out.push(...pill(litText(shown.slice(0, label.length).padEnd(label.length), { fg: PILL.ink, bg: fill, bold: true }, sweep), fill, glyphs));
305
326
  } else {
306
- out.push(span(warned(id, sample) ? shown.replace(/^[●○]/u, glyphs.warn) : shown, { fg: phaseColor(id, sample, ink) }));
327
+ out.push(span(warned(id, sample) ? shown.replace(/^[●○]/u, glyphs.warn) : shown, { fg: rainbow && !warned(id, sample) ? rainbow(index / PHASES.length + 0.15) : phaseColor(id, sample, ink), bold: Boolean(rainbow) }));
307
328
  }
308
329
  });
309
330
  return out;
@@ -532,10 +553,43 @@ const THREAD_NAME = Object.freeze({ mid: PALETTE.white, last: "#d8e0e8" });
532
553
  * └─ ● lit-loop RED [▉░░░] 1/4 running
533
554
  * ┬ 2 lanes · 1 task in parallel
534
555
  * ├─ ● executor [▉▉░] 2/3 running
535
- * ├─ ● reviewer [???] 7/? running
536
- * └─ $ dev server shell [???] ?/? running
556
+ * ├─ ● reviewer ━━━━━ running · 7 steps · 2m · last: Read a.mjs
557
+ * └─ $ dev server shell ━━━━━ running 4m
558
+ *
559
+ * A thread with two real numbers draws its gauge. One without a total never draws a guess: an
560
+ * indeterminate pulse (fixed `━` cells whose light moves by colour while the card animates) and
561
+ * what is known in words. The rewind look turns the gauge cells and the pulse through its rainbow.
537
562
  */
538
- const threadRows = (model, { inner, glyphs }) => {
563
+ const PULSE_CELLS = 5;
564
+ const pulseSpans = (sample, rainbow, index) => {
565
+ const ambient = sample.ambient;
566
+ const at = ambient?.flow ?? (ambient ? ambient.breath : null);
567
+ const head = at === null ? -1 : Math.floor(((at + index * 0.17) % 1) * PULSE_CELLS);
568
+ return Array.from({ length: PULSE_CELLS }, (_, cell) => {
569
+ const base = rainbow ? rainbow(cell / PULSE_CELLS + index * 0.1) : PILL.rail;
570
+ return span("━", { fg: cell === head ? lerpColor(base, "#ffffff", rainbow ? 0.45 : 0.7) : rainbow ? lerpColor(base, PALETTE.faint, 0.35) : base });
571
+ });
572
+ };
573
+ const gaugeSpans = (text, rainbow, index) => {
574
+ if (!rainbow) return [span(text, { fg: PALETTE.white })];
575
+ const [, cells, count] = /^\[([▉░]+)\](.*)$/u.exec(text);
576
+ return [
577
+ span("[", { fg: PALETTE.white }),
578
+ ...[...cells].map((cell, i) => span(cell, { fg: cell === "▉" ? rainbow(i / cells.length + index * 0.1) : PALETTE.dim })),
579
+ span(`]${count}`, { fg: PALETTE.white }),
580
+ ];
581
+ };
582
+ const progressSpans = (thread, sample, rainbow, index, color) => {
583
+ const drawn = gauge(thread.done, thread.total);
584
+ if (drawn) return [span(" "), ...gaugeSpans(drawn, rainbow, index), span(` ${thread.state}`, { fg: color })];
585
+ const facts = knownFacts({ steps: thread.steps, elapsedMs: thread.elapsedMs, last: thread.last, state: thread.state });
586
+ const words = facts.startsWith(thread.state)
587
+ ? [span(facts, { fg: color })]
588
+ : [span(thread.state, { fg: color }), span(` · ${facts}`, { fg: PALETTE.dim })];
589
+ return [span(" "), ...pulseSpans(sample, rainbow, index), span(" "), ...words];
590
+ };
591
+
592
+ const threadRows = (model, sample, { inner, glyphs, rainbow }) => {
539
593
  const { chain, lanes, others, more, reserve } = model.threads;
540
594
  const lines = [];
541
595
  chain.forEach((thread, index) => lines.push({ thread, lead: index === 0 ? "" : `${" ".repeat(index - 1)}└─ `, last: true }));
@@ -571,8 +625,7 @@ const threadRows = (model, { inner, glyphs }) => {
571
625
  span(`${glyph} `, { fg: color }),
572
626
  span(name + " ".repeat(Math.max(0, nameWidth - textWidth(name))), { fg: line.last ? THREAD_NAME.last : THREAD_NAME.mid, bold: thread.active }),
573
627
  ...(stageWidth ? [span(` ${(thread.stage ?? "").slice(0, stageWidth).padEnd(stageWidth)}`, { fg: PALETTE.dim })] : []),
574
- span(` ${gauge(thread.done, thread.total)}`, { fg: PALETTE.white }),
575
- span(` ${thread.state}`, { fg: color }),
628
+ ...progressSpans(thread, sample, rainbow, index, color),
576
629
  ...(thread.session ? [span(` · other session ${thread.session}`, { fg: PALETTE.dim })] : []),
577
630
  ];
578
631
  }
@@ -622,6 +675,13 @@ const sparkled = (row, inner, sample, rainbow) => {
622
675
  return fitRow([...row, span(" "), ...sky], inner);
623
676
  };
624
677
 
678
+ // After a break the idle card offers the cross-session brief, in the longest form that fits.
679
+ const AWAY_HINTS = Object.freeze([[" · back? type ", "lit adhd", " to catch up"], [" · back? ", "lit adhd", ""], [" ", "lit adhd", ""]]);
680
+ const awayHint = (room, accent) => {
681
+ const hint = AWAY_HINTS.find((parts) => textWidth(parts.join("")) <= room);
682
+ return hint ? [span(hint[0], { fg: PALETTE.dim }), span(hint[1], { fg: accent }), ...(hint[2] ? [span(hint[2], { fg: PALETTE.dim })] : [])] : [];
683
+ };
684
+
625
685
  const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
626
686
  const chips = model.skills;
627
687
  if (chips.length === 0) {
@@ -638,7 +698,9 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
638
698
  let shown = 0;
639
699
  for (const chip of chips) {
640
700
  // While LitClaude works the light that crosses the active phase crosses this request's chips too.
641
- const entry = chipSpans(chip, sample.chips?.[chip.id], glyphs, accent, model.idle ? null : sample.ambient?.sweep ?? null);
701
+ const entry = rainbow && lookOf(chip.id) === "rewind"
702
+ ? rainbowPill(`${chip.state === "current" ? glyphs.bolt : glyphs.recentBolt} ${chip.id}`, rainbow, 0.5, glyphs)
703
+ : chipSpans(chip, sample.chips?.[chip.id], glyphs, accent, model.idle ? null : sample.ambient?.sweep ?? null);
642
704
  const gap = row.length ? [span(" ")] : [];
643
705
  const rest = chips.length - shown - 1;
644
706
  const reserve = rest > 0 ? 1 + rowWidth(mutedPill(`+${rest}`, glyphs)) : 0;
@@ -647,6 +709,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
647
709
  shown += 1;
648
710
  }
649
711
  if (shown < chips.length) row.push(...(row.length ? [span(" ")] : []), ...mutedPill(`+${chips.length - shown}`, glyphs));
712
+ if (model.away) return fitRow([...row, ...awayHint(inner - rowWidth(row), accent)], inner);
650
713
  return sparkled(row, inner, sample, rainbow);
651
714
  };
652
715
 
@@ -690,7 +753,7 @@ const levelColor = (percent) => (percent >= 90 ? HUD.red : percent >= 70 ? HUD.y
690
753
 
691
754
  // ╰─ ctx 42% ▰▰▱▱▱ · 5h 31% · 1w 12% · git main ───╯, or a warning first when one is up. The branch goes
692
755
  // first on a narrow card, then the weekly window, the five-hour one and the context bar.
693
- const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint }) => {
756
+ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rainbow }) => {
694
757
  const { context, rates, git } = model.figures;
695
758
  const warning = model.warnings[0];
696
759
  const segments = [];
@@ -699,9 +762,13 @@ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint })
699
762
  segments.push(segment("warning", 0, [span(`${warning.tone === "red" ? glyphs.fail : "⚠"} ${warning.subject}`, { fg: color, bold: true }), span(` ${warning.text}`, { fg: color })], " · "));
700
763
  }
701
764
  if (context !== null) {
702
- segments.push(segment("ctx", 1, [span("ctx ", { fg: PALETTE.dim }), span(`${context}%`, { fg: accent })], " · "));
765
+ segments.push(segment("ctx", 1, [span("ctx ", { fg: PALETTE.dim }), span(`${context}%`, { fg: rainbow ? rainbow(0.8) : accent, bold: Boolean(rainbow) })], " · "));
703
766
  const filled = Math.max(0, Math.min(5, Math.round(context / 20)));
704
- segments.push(segment("ctxbar", 2, [span("▰".repeat(filled), { fg: accent }), span("▱".repeat(5 - filled), { fg: HUD.empty })], " "));
767
+ // The rewind look turns every cell of the bar, filled or not, so even 0% shows the colour.
768
+ const cells = rainbow
769
+ ? [...Array(5)].map((_, i) => span(i < filled ? "▰" : "▱", { fg: i < filled ? rainbow(i / 5) : lerpColor(rainbow(i / 5), HUD.empty, 0.5) }))
770
+ : [span("▰".repeat(filled), { fg: accent }), span("▱".repeat(5 - filled), { fg: HUD.empty })];
771
+ segments.push(segment("ctxbar", 2, cells, " "));
705
772
  }
706
773
  rates.forEach((rate, index) => segments.push(segment(`rate-${rate.label}`, 3 + index * 0.5, [span(`${rate.label} `, { fg: PALETTE.dim }), span(`${rate.percent}%`, { fg: levelColor(rate.percent) })], " · ")));
707
774
  if (git) segments.push(segment("git", 4, [span(`${glyphs.branch} `, { fg: PALETTE.dim }), span(git, { fg: accent })], " · "));
@@ -736,7 +803,7 @@ export const composeBand = (model, sample, { columns, glyphs: glyphMode = "basic
736
803
  const edge = edgeColor(model, sample, accent);
737
804
  // The rewind look's rainbow turns with the ambient hue (still at 0 with motion off). A warning
738
805
  // keeps the border its warning colour; the rails stay rainbow.
739
- const look = model.idle ? null : lookOf(model.discipline);
806
+ const look = model.rewind ? "rewind" : model.idle ? null : lookOf(model.discipline);
740
807
  const hue = sample.ambient?.hue ?? 0;
741
808
  const rainbow = look === "rewind" ? (position) => rainbowAt(position + hue) : null;
742
809
  const painted = rainbow && model.warnings.length === 0;
@@ -755,7 +822,7 @@ export const composeBand = (model, sample, { columns, glyphs: glyphMode = "basic
755
822
  topEdge(model, sample, options),
756
823
  side(model.workflow ? mapRow(model, sample, options) : phaseRow(model, sample, options), 1),
757
824
  side(detailRow(model, sample, options), 2),
758
- ...(model.threads ? threadRows(model, options).map((row) => side(row, 2)) : []),
825
+ ...(model.threads ? threadRows(model, sample, options).map((row) => side(row, 2)) : []),
759
826
  side(middle, 3),
760
827
  bottomEdge(model, sample, options),
761
828
  ],
@@ -20,7 +20,7 @@
20
20
  // Text is set in a monospace face and placed by counted cells (Hangul and emoji as two), so the
21
21
  // layout does not depend on measuring a font the drawing cannot see.
22
22
 
23
- import { gauge } from "../rewind/gauge.mjs";
23
+ import { gauge, knownFacts } from "../rewind/gauge.mjs";
24
24
  import { textWidth, truncateToWidth } from "./layout.mjs";
25
25
  import { TIMINGS, barCells, gradientAt, lookOf, rainbowAt } from "./motion.mjs";
26
26
 
@@ -88,10 +88,12 @@ const run = (x, y, pieces) => {
88
88
  };
89
89
 
90
90
  // A filled pill holding `label`, its left edge at `x`. `sweep` lays the moving light over it.
91
- const pill = (x, y, label, { fill, ink, bold = true, sweep = false, breath = null, breathPeak = 0.85 }) => {
91
+ // `veil` lays white over a rainbow fill so the dark ink keeps its contrast on every hue.
92
+ const pill = (x, y, label, { fill, ink, bold = true, sweep = false, breath = null, breathPeak = 0.85, veil = false }) => {
92
93
  const w = widthOf(label) + 16;
93
94
  const top = y - PILL_H + 6;
94
95
  const parts = [`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="${fill}"/>`];
96
+ if (veil) parts.push(`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="#ffffff" opacity="0.3"/>`);
95
97
  if (breath) parts.push(`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="${breath}" opacity="0"><animate attributeName="opacity" values="0;${breathPeak};0" ${loop(TIMINGS.breath, BREATH_PHASE)}/></rect>`);
96
98
  if (sweep) parts.push(`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="url(#lit-sweep)"/>`);
97
99
  parts.push(text(x + 8, y, label, { fill: ink, bold }));
@@ -111,15 +113,18 @@ const indicatorOf = (model, accent) => {
111
113
  return { label: "LIVE ●", fill: accent };
112
114
  };
113
115
 
114
- const topRow = (model, accent, animate) => {
116
+ // The rewind look draws the LIT pill and a `REWIND <<` indicator in the turning rainbow.
117
+ const topRow = (model, accent, animate, rewind = false) => {
115
118
  const { width, pad } = SVG_CARD;
116
119
  const y = ROW_Y[0];
117
- const brand = pill(pad, y, "🔥 LIT", { fill: C.pink, ink: C.ink, breath: animate.breath ? C.orange : null });
118
- const indicator = indicatorOf(model, accent);
120
+ const brand = rewind
121
+ ? pill(pad, y, "🔥 LIT", { fill: "url(#lit-rainbow)", ink: C.ink, veil: true })
122
+ : pill(pad, y, "🔥 LIT", { fill: C.pink, ink: C.ink, breath: animate.breath ? C.orange : null });
123
+ const indicator = rewind && !model.completion ? { label: "REWIND <<", fill: "url(#lit-rainbow)" } : indicatorOf(model, accent);
119
124
  const right = text(width - pad, y, indicator.label, { fill: indicator.fill, bold: !indicator.plain, anchor: "end" });
120
125
  const room = width - pad - widthOf(indicator.label) - 16 - brand.end - widthOf(" · ");
121
126
  const name = truncateToWidth(model.title ?? "ready", Math.max(4, Math.floor(room / SVG_CARD.cell)));
122
- const title = run(brand.end + 4, y, [[" · ", { fill: C.dim }], [name, model.idle ? { fill: C.dim } : { fill: accent, bold: true }]]);
127
+ const title = run(brand.end + 4, y, [[" · ", { fill: C.dim }], [name, model.idle && !rewind ? { fill: C.dim } : { fill: accent, bold: true }]]);
123
128
  return brand.markup + title.markup + right;
124
129
  };
125
130
 
@@ -298,7 +303,7 @@ const detailRowSvg = (model, accent, animate) => {
298
303
  const TONES = Object.freeze({ pink: [C.pink, "#ff6fae", "🔥"], amber: [C.amber, C.amber, "⚠"], red: [C.red, C.red, "✗"] });
299
304
 
300
305
  // Skill chips, or the notice or the finish while one is up, or the hint while nothing has fired.
301
- const middleRow = (model, accent, animate, shift = 0) => {
306
+ const middleRow = (model, accent, animate, shift = 0, rewind = false) => {
302
307
  const { width, pad } = SVG_CARD;
303
308
  const y = ROW_Y[3] + shift;
304
309
  const room = width - pad;
@@ -328,13 +333,33 @@ const middleRow = (model, accent, animate, shift = 0) => {
328
333
  x = null;
329
334
  return;
330
335
  }
331
- const drawn = pill(x, y, label, { fill: current ? accent : C.muted, ink: current ? C.ink : C.mutedText, bold: current, sweep: current && animate.sweep });
336
+ const tinted = rewind && lookOf(chip.id) === "rewind";
337
+ const drawn = tinted
338
+ ? pill(x, y, label, { fill: "url(#lit-rainbow)", ink: C.ink, veil: true, sweep: animate.sweep })
339
+ : pill(x, y, label, { fill: current ? accent : C.muted, ink: current ? C.ink : C.mutedText, bold: current, sweep: current && animate.sweep });
332
340
  out.push(drawn.markup);
333
341
  x = drawn.end + 8;
334
342
  });
343
+ if (rewind && animate.sweep && x !== null) out.push(sparksSvg(x, width - pad, y));
344
+ if (model.away && x !== null && x + widthOf("back? type lit adhd to catch up") <= room) out.push(run(x, y, [["back? type ", { fill: C.dim }], ["lit adhd", { fill: accent }], [" to catch up", { fill: C.dim }]]).markup);
335
345
  return out.join("");
336
346
  };
337
347
 
348
+ // The rewind look's sparks: ASCII stars drifting right to left through the room the chips leave,
349
+ // each fading in and out on its own slow loop (no faster than TIMINGS.sparks / 4 per twinkle).
350
+ const SPARK_SEEDS = Object.freeze([[0.08, 1.0, "*"], [0.22, 1.3, "+"], [0.37, 0.8, "."], [0.51, 1.1, "*"], [0.66, 0.9, "'"], [0.79, 1.4, "+"], [0.93, 0.7, "*"]]);
351
+ const sparksSvg = (from, to, y) => {
352
+ const span = to - from;
353
+ if (span < 60) return "";
354
+ return SPARK_SEEDS.map(([start, speed, glyph], i) => {
355
+ const x = from + start * span;
356
+ const dur = Math.round(TIMINGS.sparks / speed);
357
+ return `<text class="lit-spark" x="${x.toFixed(1)}" y="${y}" fill="${rainbowAt(start)}" opacity="0.8">${esc(glyph)}`
358
+ + `<animateTransform attributeName="transform" type="translate" values="0 0;${(-start * span).toFixed(1)} 0" ${loop(dur, 0)}/>`
359
+ + `<animate attributeName="opacity" values="0.3;0.9;0.3" ${loop(Math.round(TIMINGS.sparks / 2), i / SPARK_SEEDS.length)}/></text>`;
360
+ }).join("");
361
+ };
362
+
338
363
  // ctx 42% ▰▰▱▱▱ · 5h 31% · 1w 12% · git main, after a warning when one is up.
339
364
  const bottomRow = (model, accent, shift = 0) => {
340
365
  const { width, pad } = SVG_CARD;
@@ -374,16 +399,26 @@ const THREAD_FILL = Object.freeze({ running: ["●", C.green], paused: ["|", C.d
374
399
  const TASK_MARK = Object.freeze({ shell: "$", monitor: "~" });
375
400
  const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
376
401
 
377
- // A gauge whose count is a lane's finished steps moves on every tool call it makes, and each new
378
- // drawing restarts the card's animations; past ten the drawing counts steps by tens.
379
- const threadGauge = ({ done, total, steps }) => (steps && total === null && done >= 10 ? `[???] ${Math.floor(done / 10) * 10}+/?` : gauge(done, total));
402
+ // What a thread with no total says instead of a gauge. Each new drawing restarts the card's
403
+ // animations, so the drawing leaves out the last step (it changes on every tool call) and counts
404
+ // steps by tens past ten.
405
+ const threadFacts = ({ steps, elapsedMs, state }) => knownFacts({ steps: Number.isInteger(steps) && steps >= 10 ? Math.floor(steps / 10) * 10 : steps, elapsedMs, state })
406
+ .replace(/^(\d+0) steps/u, (all, n) => (steps >= 10 ? `${n}+ steps` : all));
407
+ const PULSE = "━━━━━";
408
+ // The indeterminate pulse over a thread with no total: a light that slides along its track, or a
409
+ // still track with motion off.
410
+ const pulseSvg = (x, y, animate, fill) => {
411
+ const w = widthOf(PULSE);
412
+ if (!animate) return "";
413
+ return `<rect x="${x.toFixed(1)}" y="${y - 8}" width="${(w / 3).toFixed(1)}" height="4" rx="2" fill="${fill}" opacity="0.9"><animate attributeName="x" values="${x.toFixed(1)};${(x + (w * 2) / 3).toFixed(1)};${x.toFixed(1)}" ${loop(TIMINGS.flow * 2, 0.25)}/></rect>`;
414
+ };
380
415
 
381
416
  /**
382
417
  * The thread rows (view.mjs threadsOf), as the terminal card lays them out (frame.mjs threadRows):
383
418
  * the stack parent first with each child under it, lanes and background tasks under a fork line
384
419
  * when two or more run, other sessions last, `+N more` on the last row. Returns the markup.
385
420
  */
386
- const threadRowsSvg = (model) => {
421
+ const threadRowsSvg = (model, { animate = false, rewind = false } = {}) => {
387
422
  const { width, pad } = SVG_CARD;
388
423
  const { chain, lanes, others, laneCount = 0, taskCount = 0, more } = model.threads;
389
424
  const lines = [];
@@ -414,13 +449,18 @@ const threadRowsSvg = (model) => {
414
449
  const [stateMark, color] = THREAD_FILL[thread.state] ?? THREAD_FILL.running;
415
450
  const mark = thread.task ? TASK_MARK[thread.task] ?? "$" : stateMark;
416
451
  const name = truncateToWidth(thread.name, nameCells);
452
+ const drawn = gauge(thread.done, thread.total);
453
+ const facts = drawn ? null : threadFacts(thread);
454
+ const progress = drawn
455
+ ? [[` ${drawn}`, { fill: C.white }], [` ${thread.state}`, { fill: color }]]
456
+ : [[" ", {}], [PULSE, { fill: rewind ? "url(#lit-rainbow)" : C.rail, pulse: true }], [" ", {}],
457
+ ...(facts.startsWith(thread.state) ? [[facts, { fill: color }]] : [[thread.state, { fill: color }], [` · ${facts}`, { fill: C.dim }]])];
417
458
  const pieces = [
418
459
  [line.lead, { fill: C.dim }],
419
460
  [`${mark} `, { fill: color, bold: true }],
420
461
  [name + " ".repeat(Math.max(0, nameCells - textWidth(name))), { fill: C.white, bold: thread.active }],
421
462
  ...(stageCells ? [[` ${truncateToWidth(thread.stage ?? "", stageCells).padEnd(stageCells)}`, { fill: C.dim }]] : []),
422
- [` ${threadGauge(thread)}`, { fill: C.white }],
423
- [` ${thread.state}`, { fill: color }],
463
+ ...progress,
424
464
  ...(thread.session ? [[` · other session ${thread.session}`, { fill: C.dim }]] : []),
425
465
  ];
426
466
  // Pieces past the room are cut from the right, as the terminal card clips its rows.
@@ -436,6 +476,8 @@ const threadRowsSvg = (model) => {
436
476
  used += cells;
437
477
  }
438
478
  out.push(run(pad, y, kept).markup);
479
+ const before = kept.findIndex(([, style]) => style.pulse);
480
+ if (before >= 0) out.push(pulseSvg(pad + kept.slice(0, before).reduce((sum, [body]) => sum + widthOf(body), 0), y, animate, rewind ? "#ffffff" : C.white));
439
481
  });
440
482
  return out.join("");
441
483
  };
@@ -461,7 +503,7 @@ const rainbowDefs = (animate) => {
461
503
 
462
504
  /** What the card says, for a reader that cannot see the drawing. */
463
505
  export const svgCardAlt = (model) => {
464
- const parts = [`LIT ${model.idle ? "idle" : "working"}`];
506
+ const parts = [`LIT ${model.rewind ? "rewind" : model.idle ? "idle" : "working"}`];
465
507
  if (model.title) parts.push(model.title);
466
508
  const flow = model.workflow;
467
509
  const current = PHASES.find((id) => model.phases[id] === "now");
@@ -474,7 +516,7 @@ export const svgCardAlt = (model) => {
474
516
  }
475
517
  if (model.step) parts.push(`running ${model.step.name}`);
476
518
  const threads = model.threads ? [...model.threads.chain, ...model.threads.lanes, ...model.threads.others] : [];
477
- if (threads.length) parts.push(`threads ${threads.map((thread) => `${thread.name} ${gauge(thread.done, thread.total)} ${thread.state}`).join(", ")}${model.threads.more ? `, ${model.threads.more} more` : ""}`);
519
+ if (threads.length) parts.push(`threads ${threads.map((thread) => `${thread.name} ${gauge(thread.done, thread.total) ? `${gauge(thread.done, thread.total)} ${thread.state}` : threadFacts(thread)}`).join(", ")}${model.threads.more ? `, ${model.threads.more} more` : ""}`);
478
520
  if (model.skills.length) parts.push(`skills ${model.skills.map(({ id }) => id).join(", ")}`);
479
521
  const { context, rates } = model.figures;
480
522
  if (context !== null) parts.push(`context ${context}%`);
@@ -491,15 +533,15 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
491
533
  // The thread rows sit between the detail line and the chips; the card grows by their reserve.
492
534
  const shift = model.threads ? THREAD_ROW_H * model.threads.reserve : 0;
493
535
  const height = SVG_CARD.height + shift;
494
- const working = !model.idle && motion !== "off";
536
+ const rewind = (model.rewind === true || (!model.idle && lookOf(model.discipline) === "rewind")) && model.warnings.length === 0;
537
+ const working = (!model.idle || rewind) && motion !== "off";
495
538
  const animate = { breath: working, sweep: working && motion === "full", comet: working && motion === "full" };
496
- const rewind = !model.idle && model.warnings.length === 0 && lookOf(model.discipline) === "rewind";
497
539
  const edge = rewind ? "url(#lit-rainbow)" : borderColor(model, accent);
498
540
  const perimeter = 1000;
499
541
  const defs = (rewind ? rainbowDefs(animate.breath) : "") + (animate.sweep
500
542
  ? `<defs><linearGradient id="lit-sweep" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="#fff" stop-opacity="0"/><stop offset="0.5" stop-color="#fff" stop-opacity="0.55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/><animateTransform attributeName="gradientTransform" type="translate" values="-1.2 0;1.2 0" ${loop(TIMINGS.sweep, 0.5)}/></linearGradient></defs>`
501
543
  : "");
502
- const frame = `<rect x="1" y="1" width="${width - 2}" height="${height - 2}" rx="14" fill="${C.bg}" stroke="${edge}" stroke-width="${model.idle ? "1.5" : "2.5"}"${model.idle ? ' stroke-opacity="0.8"' : ""}>`
544
+ const frame = `<rect x="1" y="1" width="${width - 2}" height="${height - 2}" rx="14" fill="${C.bg}" stroke="${edge}" stroke-width="${model.idle && !rewind ? "1.5" : "2.5"}"${model.idle && !rewind ? ' stroke-opacity="0.8"' : ""}>`
503
545
  + (animate.breath && !model.warnings.length ? `<animate attributeName="stroke-opacity" values="0.85;1;0.85" ${loop(TIMINGS.breath, BREATH_PHASE)}/>` : "")
504
546
  + "</rect>";
505
547
  const comet = animate.comet
@@ -507,11 +549,11 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
507
549
  + `<defs><linearGradient id="lit-comet" x1="0" x2="1" y1="0" y2="1"><stop offset="0" stop-color="${C.orange}"/><stop offset="0.6" stop-color="${C.pink}"/><stop offset="1" stop-color="#ffffff"/></linearGradient></defs>`
508
550
  : "";
509
551
  const body = [
510
- topRow(model, accent, animate),
552
+ topRow(model, accent, animate, rewind),
511
553
  model.workflow ? mapRowSvg(model, accent, animate) : phaseRow(model, accent, animate),
512
554
  detailRowSvg(model, accent, animate),
513
- model.threads ? threadRowsSvg(model) : "",
514
- middleRow(model, accent, animate, shift),
555
+ model.threads ? threadRowsSvg(model, { animate: animate.sweep, rewind }) : "",
556
+ middleRow(model, accent, animate, shift, rewind),
515
557
  bottomRow(model, accent, shift),
516
558
  ].join("");
517
559
  const source = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" font-family="${FONT}" font-size="${SVG_CARD.font}">${defs}${frame}${comet}${body}</svg>`;
@@ -37,10 +37,11 @@ const chipsOf = (model, now, previous = null) => Object.fromEntries((model.skill
37
37
  return [chip.id, known];
38
38
  }));
39
39
 
40
- // The ambient loop runs while the card shows LitClaude at work, so motion itself says "active";
41
- // `at` is when the current run of work began, so the loop does not restart on every new model.
40
+ // The ambient loop runs while the card shows LitClaude at work, so motion itself says "active",
41
+ // and while the rewind look lingers after a brief; `at` is when the current run began, so the loop
42
+ // does not restart on every new model.
42
43
  const ambientOf = (model, now, profile, previous = null) => {
43
- const on = Boolean(profile.ambient) && model.visible && !model.idle;
44
+ const on = Boolean(profile.ambient) && model.visible && (!model.idle || model.rewind === true);
44
45
  return { on, at: on && previous?.on ? previous.at : now };
45
46
  };
46
47