@litfamily/litclaude 1.0.53 → 1.0.55

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 (71) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +15 -9
  3. package/README_ko-KR.md +15 -9
  4. package/bin/litclaude-ai.js +1 -1
  5. package/docs/assets/readme/badge-version.svg +1 -1
  6. package/docs/assets/skills/ultra-brainstorm.webp +0 -0
  7. package/docs/hooks.md +42 -23
  8. package/docs/migration.md +8 -8
  9. package/package.json +1 -1
  10. package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
  11. package/plugins/litclaude/bin/litclaude-hook.js +190 -35
  12. package/plugins/litclaude/bin/litclaude-hud.js +4 -1
  13. package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
  14. package/plugins/litclaude/commands/lit-adhd.md +13 -15
  15. package/plugins/litclaude/commands/lit-comprehend.md +1 -1
  16. package/plugins/litclaude/commands/lit-loop.md +3 -5
  17. package/plugins/litclaude/commands/lit-plan.md +5 -4
  18. package/plugins/litclaude/commands/lit-recap.md +17 -30
  19. package/plugins/litclaude/commands/lit-rewind.md +13 -15
  20. package/plugins/litclaude/commands/litgoal.md +3 -5
  21. package/plugins/litclaude/commands/start-work.md +2 -2
  22. package/plugins/litclaude/commands/ultra-brainstorm.md +96 -0
  23. package/plugins/litclaude/commands/wikify.md +1 -1
  24. package/plugins/litclaude/hooks/lit-mod.mjs +76 -3
  25. package/plugins/litclaude/lib/canonical-runtime-commitments.mjs +6 -6
  26. package/plugins/litclaude/lib/canonical-skill-catalog.mjs +1 -1
  27. package/plugins/litclaude/lib/canonical-skill-resources.mjs +18 -14
  28. package/plugins/litclaude/lib/goal-pipeline.mjs +112 -0
  29. package/plugins/litclaude/lib/hud-ignition.mjs +3 -1
  30. package/plugins/litclaude/lib/mod/frame.mjs +32 -7
  31. package/plugins/litclaude/lib/mod/goal.mjs +92 -0
  32. package/plugins/litclaude/lib/mod/motion.mjs +24 -3
  33. package/plugins/litclaude/lib/mod/skills.mjs +1 -1
  34. package/plugins/litclaude/lib/mod/state.mjs +2 -1
  35. package/plugins/litclaude/lib/mod/timeline.mjs +38 -1
  36. package/plugins/litclaude/lib/mod/view.mjs +18 -7
  37. package/plugins/litclaude/lib/mod/workflow.mjs +1 -0
  38. package/plugins/litclaude/lib/native-goal-binding.mjs +1 -1
  39. package/plugins/litclaude/lib/rewind/collect.mjs +100 -13
  40. package/plugins/litclaude/lib/rewind/verdict.mjs +268 -0
  41. package/plugins/litclaude/lib/skill-plan.mjs +234 -0
  42. package/plugins/litclaude/lib/start-work-lifecycle.mjs +2 -1
  43. package/plugins/litclaude/lib/workflow-check.mjs +1 -1
  44. package/plugins/litclaude/lib/workflow-stack.mjs +8 -1
  45. package/plugins/litclaude/scripts/goal-propose.mjs +57 -0
  46. package/plugins/litclaude/scripts/scaffold-plan.mjs +4 -0
  47. package/plugins/litclaude/skills/autoconference/SKILL.md +1 -1
  48. package/plugins/litclaude/skills/browser-drive/SKILL.md +4 -0
  49. package/plugins/litclaude/skills/browser-drive/scripts/capability-probe.mjs +189 -42
  50. package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +3 -1
  51. package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe.mjs +5 -2
  52. package/plugins/litclaude/skills/lit-adhd/SKILL.md +47 -16
  53. package/plugins/litclaude/skills/lit-brainstorm/SKILL.md +1 -0
  54. package/plugins/litclaude/skills/lit-code/SKILL.md +3 -3
  55. package/plugins/litclaude/skills/lit-comprehend/SKILL.md +3 -2
  56. package/plugins/litclaude/skills/lit-handoff/SKILL.md +1 -0
  57. package/plugins/litclaude/skills/lit-loop/SKILL.md +2 -5
  58. package/plugins/litclaude/skills/lit-plan/SKILL.md +16 -8
  59. package/plugins/litclaude/skills/lit-team/SKILL.md +94 -56
  60. package/plugins/litclaude/skills/litgoal/SKILL.md +3 -8
  61. package/plugins/litclaude/skills/litresearch/SKILL.md +1 -0
  62. package/plugins/litclaude/skills/litwork/SKILL.md +1 -4
  63. package/plugins/litclaude/skills/review-work/SKILL.md +3 -2
  64. package/plugins/litclaude/skills/start-work/SKILL.md +7 -9
  65. package/plugins/litclaude/skills/ultra-brainstorm/SKILL.md +180 -0
  66. package/plugins/litclaude/skills/ultra-brainstorm/references/lenses.md +38 -0
  67. package/plugins/litclaude/skills/ultra-brainstorm/references/workflow-script.md +78 -0
  68. package/plugins/litclaude/skills/ultra-brainstorm/scripts/estimate.mjs +39 -0
  69. package/plugins/litclaude/skills/wikify/SKILL.md +3 -3
  70. package/docs/assets/skills/lit-recap.webp +0 -0
  71. package/plugins/litclaude/skills/lit-recap/SKILL.md +0 -175
@@ -28,13 +28,15 @@ export function ignitionMark(discipline, { markdown = false } = {}) {
28
28
  return markdown ? `🔥 **${label}** 🔥` : `🔥 ${label} 🔥`;
29
29
  }
30
30
 
31
- export function writeIgnitionState({ sessionId, discipline }, env = process.env, now = () => new Date()) {
31
+ export function writeIgnitionState({ sessionId, discipline, plan }, env = process.env, now = () => new Date()) {
32
32
  const root = ignitionStateRoot(env);
33
33
  mkdirSync(root, { recursive: true });
34
34
  const target = ignitionStatePath(sessionId, env);
35
35
  const record = {
36
36
  sessionId: typeof sessionId === "string" ? sessionId : null,
37
37
  discipline: typeof discipline === "string" && discipline ? discipline : null,
38
+ // The skill plan of a bare-lit prompt (lib/skill-plan.mjs), ids only, for the card's chips.
39
+ ...(Array.isArray(plan) && plan.length > 1 ? { plan: plan.filter((id) => typeof id === "string" && /^[a-z0-9][a-z0-9-]{0,63}$/u.test(id)).slice(0, 4) } : {}),
38
40
  at: now().toISOString(),
39
41
  };
40
42
  const staging = `${target}.${process.pid}.tmp`;
@@ -35,7 +35,7 @@
35
35
  import { gauge, knownFacts } from "../rewind/gauge.mjs";
36
36
  import { textWidth, truncateToWidth } from "./layout.mjs";
37
37
  import { CLUB_GLINT, CLUB_GOLD, CLUB_PILL, CLUB_STOPS, LOOKS, laneColor, lookOf } from "./looks.mjs";
38
- import { barCells, gradientAt, lerpColor, rainbowAt } from "./motion.mjs";
38
+ import { barCells, emberColor, gradientAt, lerpColor, rainbowAt } from "./motion.mjs";
39
39
  import { glyphSet } from "./settings.mjs";
40
40
  import { formatDuration } from "./view.mjs";
41
41
 
@@ -395,7 +395,8 @@ const shortLabel = (label) => label.replace(/^[A-Za-z]+/u, (word) => word.slice(
395
395
  // `━` cells by its `rainbow` instead.
396
396
  const railSpans = (model, sample, index, cells, accent, rainbow = null) => {
397
397
  if (cells === 0) return [span(" ")];
398
- const grade = rainbow ?? ((position) => mapColor(accent, position));
398
+ // Idle, the rails behind the current stage keep their grade but sink toward the rail colour.
399
+ const grade = rainbow ?? (model.idle ? (position) => lerpColor(mapColor(accent, position), PILL.rail, 0.6) : (position) => mapColor(accent, position));
399
400
  const { stages } = model.workflow;
400
401
  const last = Math.max(1, stages.length - 1);
401
402
  const at = (cell) => (index - 1 + (cell + 0.5) / cells) / last;
@@ -440,10 +441,15 @@ const mapTrack = (model, sample, { glyphs, accent, rail, short = false, window =
440
441
  let fill = model.idle ? lerpColor(accent, PILL.muted, 0.5) : accent;
441
442
  if (model.ctxWarning) fill = lerpColor(fill, PALETTE.amber, sample.warn);
442
443
  if (sample.ambient && !model.idle) fill = lerpColor(fill, "#ffffff", 0.2 * sample.ambient.breath);
444
+ // The stage just changed: the new stage's pill takes the spring's kick (motion.mjs springKick).
445
+ const kick = model.idle ? 0 : sample.kick ?? 0;
446
+ if (kick > 0) fill = lerpColor(fill, "#ffffff", 0.7 * kick);
447
+ else if (kick < 0) fill = lerpColor(fill, PILL.ink, -0.35 * kick);
443
448
  const sweep = model.idle ? null : sample.ambient?.sweep ?? null;
444
449
  out.push(...pill(litText(revealed.slice(0, label.length).padEnd(label.length), { fg: PILL.ink, bg: fill, bold: true }, sweep), fill, glyphs));
445
450
  } else {
446
- out.push(span(revealed, { fg: stage.state === "done" ? mapColor(accent, index / last) : PALETTE.dim }));
451
+ const done = mapColor(accent, index / last);
452
+ out.push(span(revealed, { fg: stage.state === "done" ? (model.idle ? lerpColor(done, PALETTE.dim, 0.6) : done) : PALETTE.dim }));
447
453
  }
448
454
  });
449
455
  if (window && shown.at(-1) < stages.length - 1) out.push(span(" …", { fg: PALETTE.dim }));
@@ -642,6 +648,9 @@ const threadRows = (model, sample, { inner, glyphs, rainbow }) => {
642
648
  // A wide card spends its room on names, so lanes that share a prefix stay apart.
643
649
  const nameWidth = Math.min(inner >= 90 ? 28 : 18, Math.max(...rows.map(({ name }) => textWidth(name))));
644
650
  const stageWidth = Math.min(10, Math.max(0, ...rows.map(({ stage }) => (stage ? textWidth(stage) : 0))));
651
+ // Every row's stage and gauge start in one column, however deep its branch is drawn, so nested
652
+ // rows and wide (CJK) names never push their bars sideways (card scenario D1-7).
653
+ const leadWidth = Math.max(0, ...lines.filter((line) => line.thread).map((line) => textWidth(line.lead)));
645
654
  const lastIndex = lines.length - 1;
646
655
  const out = lines.map((line, index) => {
647
656
  const tail = index === lastIndex && more > 0 ? [span(`+${more} more`, { fg: PALETTE.dim })] : [];
@@ -656,7 +665,7 @@ const threadRows = (model, sample, { inner, glyphs, rainbow }) => {
656
665
  body = [
657
666
  span(line.lead, { fg: PALETTE.dim }),
658
667
  span(`${glyph} `, { fg: color }),
659
- span(name + " ".repeat(Math.max(0, nameWidth - textWidth(name))), { fg: line.last ? THREAD_NAME.last : THREAD_NAME.mid, bold: thread.active }),
668
+ span(name + " ".repeat(Math.max(0, nameWidth + leadWidth - textWidth(line.lead) - textWidth(name))), { fg: line.last ? THREAD_NAME.last : THREAD_NAME.mid, bold: thread.active }),
660
669
  ...(stageWidth ? [span(` ${(thread.stage ?? "").slice(0, stageWidth).padEnd(stageWidth)}`, { fg: PALETTE.dim })] : []),
661
670
  ...progressSpans(thread, sample, rainbow, index, color),
662
671
  ...(thread.session ? [span(` · other session ${thread.session}`, { fg: PALETTE.dim })] : []),
@@ -708,6 +717,22 @@ const sparkled = (row, inner, sample, rainbow) => {
708
717
  return fitRow([...row, span(" "), ...sky], inner);
709
718
  };
710
719
 
720
+ // The glyph particles of body row `r`, drifting through the cells the row leaves free (two gap
721
+ // cells kept), while LitClaude works. Each is ASCII and moves by its glyph and colour together.
722
+ const embered = (row, inner, sample, model, r) => {
723
+ const particles = model.idle ? null : sample.ambient?.particles;
724
+ const list = particles?.rows[r];
725
+ const spare = inner - rowWidth(row) - 2;
726
+ if (!list || spare < 4) return fitRow(row, inner);
727
+ const sky = Array.from({ length: spare }, () => span(" "));
728
+ for (const { x, age, glyph } of list) {
729
+ const cell = Math.min(spare - 1, Math.floor(x * spare));
730
+ const color = emberColor(age, particles.style.heat);
731
+ if (color !== PALETTE.faint) sky[cell] = span(particles.style.ramp[glyph], { fg: color, bold: age < 0.3 });
732
+ }
733
+ return fitRow([...row, span(" "), ...sky], inner);
734
+ };
735
+
711
736
  // After a break the idle card offers the cross-session brief, in the longest form that fits.
712
737
  const AWAY_HINTS = Object.freeze([[" · back? type ", "lit adhd", " to catch up"], [" · back? ", "lit adhd", ""], [" ", "lit adhd", ""]]);
713
738
  const awayHint = (room, accent) => {
@@ -729,7 +754,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
729
754
  const invite = inviteChip(model, glyphs);
730
755
  if (chips.length === 0) {
731
756
  if (!model.idle && model.next && !model.workflow?.next) return fitRow([span("▸ ", { fg: accent }), span(truncateToWidth(model.next, inner - 2), { fg: PALETTE.white })], inner);
732
- if (!model.idle) return fitRow([span("no LitFamily skill yet in this request", { fg: PALETTE.dim })], inner);
757
+ if (!model.idle) return embered([span("no LitFamily skill yet in this request", { fg: PALETTE.dim })], inner, sample, model, 3);
733
758
  const hints = [
734
759
  [span("no LitFamily skill yet · type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent }), span(" to start one", { fg: PALETTE.dim })],
735
760
  [span("no skill yet · type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent })],
@@ -757,7 +782,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
757
782
  }
758
783
  if (shown < chips.length) row.push(...(row.length ? [span(" ")] : []), ...mutedPill(`+${chips.length - shown}`, glyphs));
759
784
  if (model.away) return fitRow([...row, ...awayHint(inner - rowWidth(row), accent)], inner);
760
- return withChip(row, invite, inner) ?? sparkled(row, inner, sample, rainbow);
785
+ return withChip(row, invite, inner) ?? (rainbow ? sparkled(row, inner, sample, rainbow) : embered(row, inner, sample, model, 3));
761
786
  };
762
787
 
763
788
  const noticeRow = (sample, inner) => {
@@ -835,7 +860,7 @@ const edgeColor = (model, sample, accent, look) => {
835
860
  if (look === "turn") return sample.ambient ? lerpColor(lerpColor(PALETTE.amber, PALETTE.faint, 0.5), PALETTE.amber, sample.ambient.breath) : PALETTE.amber;
836
861
  if (model.warnings.length) return PALETTE.amber;
837
862
  if (look === "club") return CLUB_GOLD;
838
- if (model.idle) return lerpColor(PALETTE.faint, accent, 0.35);
863
+ if (model.idle) return lerpColor(PALETTE.faint, accent, 0.2);
839
864
  return lerpColor(accent, "#ffffff", 0.15 + 0.3 * (sample.ambient?.breath ?? 0));
840
865
  };
841
866
 
@@ -0,0 +1,92 @@
1
+ // The pure half of the native-goal pipeline (S4) that the LitClaude mod runs: the fixed status lines,
2
+ // what the transcript says about goals, and the one step to take at an idle. No Node built-ins, so the
3
+ // mods loader can import it; lib/goal-pipeline.mjs re-exports it for the hook and the CLI.
4
+ export const GOAL_DIR = ".litclaude/goal";
5
+
6
+ // Fixed status lines, one per outcome. The mod and the CLI print these and nothing else.
7
+ export const GOAL_STATUS = Object.freeze({
8
+ asked: (cond) => `Approve plan, start work and set goal: /goal ${cond}? (yes / edit / no)`,
9
+ startOnly: "Approve plan and start work? (yes / no)",
10
+ skipped: (reason) => `No goal set: ${reason}`,
11
+ notStarted: (why) => `No goal set: start-work did not start (${why})`,
12
+ armed: (id) => `LitClaude goal armed [lit:${id}]; it is set when this turn ends.`,
13
+ set: (id) => `LitClaude goal set [lit:${id}]`,
14
+ yours: "Your own goal is active; LitClaude left it alone.",
15
+ notConfirmed: (cond) => `Goal not confirmed. Paste: /goal ${cond}`,
16
+ met: (id) => `Goal met and cleared [lit:${id}]`,
17
+ cleared: (id, why) => `LitClaude goal cleared (${why}) [lit:${id}]`,
18
+ });
19
+
20
+ /**
21
+ * What the transcript says about goals, newest last: the condition of the goal still running (or
22
+ * null), and whether a given condition was met. Reads `goal_status` attachments only.
23
+ */
24
+ export const goalStateFromTranscript = (jsonlText) => {
25
+ let active = null;
26
+ const met = new Set();
27
+ let checks = 0;
28
+ for (const line of String(jsonlText ?? "").split("\n")) {
29
+ if (!line.includes('"goal_status"')) continue;
30
+ let record;
31
+ try {
32
+ record = JSON.parse(line);
33
+ } catch {
34
+ continue;
35
+ }
36
+ const status = record?.attachment;
37
+ if (status?.type !== "goal_status" || typeof status.condition !== "string") continue;
38
+ if (status.met === true) {
39
+ met.add(status.condition);
40
+ if (active === status.condition) active = null;
41
+ } else {
42
+ if (active !== status.condition) checks = 0;
43
+ active = status.condition;
44
+ checks += 1;
45
+ }
46
+ }
47
+ return { active, met, checks };
48
+ };
49
+
50
+ /** The transcript file Claude Code keeps for a session. */
51
+ export const transcriptPathFor = (configDir, cwd, sessionId) => `${configDir}/projects/${String(cwd).replace(/[^A-Za-z0-9]/gu, "-")}/${sessionId}.jsonl`;
52
+
53
+ /** The newest assistant text in a transcript, for the `BLOCKED:` check. */
54
+ export const lastAssistantText = (jsonlText) => {
55
+ const lines = String(jsonlText ?? "").split("\n");
56
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
57
+ if (!lines[index].includes('"assistant"')) continue;
58
+ try {
59
+ const record = JSON.parse(lines[index]);
60
+ if (record?.type !== "assistant" || record.isSidechain) continue;
61
+ const text = (record.message?.content ?? []).filter((part) => part?.type === "text").map((part) => part.text).join("\n").trim();
62
+ if (text) return text;
63
+ } catch {
64
+ // A torn line is skipped.
65
+ }
66
+ }
67
+ return "";
68
+ };
69
+
70
+ export const STALL_CHECKS = 12;
71
+
72
+ /**
73
+ * The mod's decision at an idle, from the records and the transcript alone: arm the goal, confirm or
74
+ * give up on it, or clear it. Pure, so the mod only carries it out.
75
+ */
76
+ export const goalStep = ({ intent, owner, clear, transcript, sessionId }) => {
77
+ const state = goalStateFromTranscript(transcript);
78
+ if (intent && !intent.consumedAt && (!intent.sessionId || intent.sessionId === sessionId)) {
79
+ if (state.active && !/\[lit:[0-9a-f]{8}\]$/u.test(state.active)) return { do: "skip-yours", status: GOAL_STATUS.yours };
80
+ return { do: "set", condition: intent.condition, status: GOAL_STATUS.set(intent.id) };
81
+ }
82
+ if (!owner || owner.closed || owner.sessionId !== sessionId) return { do: "none" };
83
+ if (state.met.has(owner.condition)) return { do: "close", why: "met", status: GOAL_STATUS.met(owner.id) };
84
+ if (!owner.confirmed) {
85
+ return state.active === owner.condition
86
+ ? { do: "confirm" }
87
+ : { do: "close", why: "not confirmed", status: GOAL_STATUS.notConfirmed(owner.condition) };
88
+ }
89
+ if (state.active !== owner.condition) return { do: "close", why: "gone", status: null };
90
+ const why = clear && !clear.consumedAt ? clear.why : /^BLOCKED:/mu.test(lastAssistantText(transcript)) ? "BLOCKED" : state.checks >= STALL_CHECKS ? "stalled" : null;
91
+ return why ? { do: "clear", why, status: GOAL_STATUS.cleared(owner.id, why) } : { do: "none" };
92
+ };
@@ -36,6 +36,7 @@ export const TIMINGS = Object.freeze({
36
36
  clock: 1000,
37
37
  hue: 4800,
38
38
  sparks: 3600,
39
+ kick: 720,
39
40
  // The club look's glint along the top border (full motion only): the first pass waits
40
41
  // `clubGlintRest`, each pass lasts `clubGlint`, and passes start `clubGlintPeriod` apart.
41
42
  clubGlint: 1400,
@@ -49,12 +50,32 @@ export const TIMINGS = Object.freeze({
49
50
  // draws its final frame and starts no frame timer; a clock on the card still ticks each second.
50
51
  export const motionProfile = (mode) => {
51
52
  if (mode === "off") {
52
- return { mode, duration: () => 0, enterEase: EASE.linear, noticeEase: EASE.linear, shimmer: false, embers: false, ambient: null };
53
+ return { mode, duration: () => 0, enterEase: EASE.linear, noticeEase: EASE.linear, shimmer: false, embers: false, ambient: null, particles: null };
53
54
  }
54
55
  if (mode === "subtle") {
55
- return { mode, duration: (ms) => Math.round(ms * 0.75), enterEase: EASE.outCubic, noticeEase: EASE.outCubic, shimmer: false, embers: false, ambient: { sweep: false, comet: false } };
56
+ return { mode, duration: (ms) => Math.round(ms * 0.75), enterEase: EASE.outCubic, noticeEase: EASE.outCubic, shimmer: false, embers: false, ambient: { sweep: false, comet: false }, particles: null };
56
57
  }
57
- return { mode: "full", duration: (ms) => ms, enterEase: EASE.outBack, noticeEase: EASE.outBack, shimmer: true, embers: true, ambient: { sweep: true, comet: true } };
58
+ return { mode: "full", duration: (ms) => ms, enterEase: EASE.outBack, noticeEase: EASE.outBack, shimmer: true, embers: true, ambient: { sweep: true, comet: true }, particles: PARTICLES };
59
+ };
60
+
61
+ // The glyph particles that drift through the card's free cells while LitClaude works (full motion
62
+ // only). Every particle is ASCII, so each change repaints (see frame.mjs). A particle is born as a
63
+ // spinning stroke (`| / - \`), cools into a spark (`* +`) and dies as a dot (`. '`); its colour runs
64
+ // white-hot, flame orange, pink, then fades into the card. `rows` names the body rows that carry
65
+ // them (3 the skills row; the map row's text never moves), `count` how many burn per row, `life` a
66
+ // particle's lifetime in ms and `heat` how bright they burn (0 to 1).
67
+ export const PARTICLES = Object.freeze({ rows: Object.freeze([3]), count: 12, life: 1800, heat: 1, ramp: Object.freeze(["|", "/", "-", "\\", "*", "+", "+", "'", "."]) });
68
+
69
+ // The particle ink by age (0 just born, 1 gone), drawn over the card's background.
70
+ const EMBER_STOPS = Object.freeze(["#fff4e0", "#ffb070", "#ff6337", "#ff2d95", "#30363d"]);
71
+ export const emberColor = (age, heat = 1) => lerpColor("#30363d", gradientAt(EMBER_STOPS, age), heat * Math.sin(Math.PI * Math.min(1, Math.max(0, age)) ** 0.6));
72
+
73
+ // The stage kick `t` ms after the current stage changed: how far the new stage's pill lights
74
+ // toward white (above 0) or dips toward its ink (below 0): a damped spring that overshoots twice
75
+ // and is still by TIMINGS.kick.
76
+ export const springKick = (t) => {
77
+ if (!(t >= 0) || t >= TIMINGS.kick) return 0;
78
+ return Math.exp(-t / 190) * Math.cos((2 * Math.PI * t) / 300);
58
79
  };
59
80
 
60
81
  // The rewind look (plans/lit-adhd.md D7): while lit-adhd runs, the card's border and rails take a
@@ -30,7 +30,6 @@ export const LIT_SKILL_IDS = Object.freeze([
30
30
  "lit-loop",
31
31
  "lit-plan",
32
32
  "lit-pptx",
33
- "lit-recap",
34
33
  "lit-schematic",
35
34
  "lit-scientific-visualization",
36
35
  "lit-team",
@@ -46,6 +45,7 @@ export const LIT_SKILL_IDS = Object.freeze([
46
45
  "rules",
47
46
  "start-work",
48
47
  "structural-search",
48
+ "ultra-brainstorm",
49
49
  "visual-qa",
50
50
  "wikify",
51
51
  ]);
@@ -177,7 +177,8 @@ export const ignitionRoot = (env) => {
177
177
  export const parseIgnition = (record, sessionId) => {
178
178
  if (!record || (record.sessionId !== null && record.sessionId !== sessionId)) return null;
179
179
  const discipline = str(record.discipline, 80);
180
- return discipline ? { discipline, at: time(record.at) } : null;
180
+ const plan = Array.isArray(record.plan) ? record.plan.map((id) => str(id, 64)).filter(Boolean).slice(0, 4) : [];
181
+ return discipline ? { discipline, at: time(record.at), ...(plan.length > 1 ? { plan } : {}) } : null;
181
182
  };
182
183
 
183
184
  const workBelongs = (work, sessionId) =>
@@ -3,7 +3,7 @@
3
3
  // frame (sampleTimeline) and stops its frame timer as soon as nothing moves (timelineBusy). Times are
4
4
  // the surface module's own frame clock in milliseconds; nothing here reads a wall clock.
5
5
 
6
- import { EASE, TIMINGS, isSettled, phase, retarget, sample, still } from "./motion.mjs";
6
+ import { EASE, TIMINGS, isSettled, phase, retarget, sample, springKick, still } from "./motion.mjs";
7
7
 
8
8
  const PHASES = ["plan", "work", "review"];
9
9
  // The count the bar follows: the workflow stage's n/m, else the plan or goal progress.
@@ -23,6 +23,12 @@ const lanesOf = (model, now) => {
23
23
  return times.length ? { base: Math.max(...times), at: now } : null;
24
24
  };
25
25
 
26
+ // The workflow stage that is now, as one key, so the timeline sees the moment it changes.
27
+ const stageKeyOf = (model) => {
28
+ const flow = model.workflow;
29
+ return flow && flow.current >= 0 ? `${flow.family}:${flow.stages[flow.current]?.id}` : null;
30
+ };
31
+
26
32
  const entryEnd = (profile) => 3 * profile.duration(TIMINGS.stagger) + profile.duration(TIMINGS.entry);
27
33
 
28
34
  // One entry per chip: `at` is the firing the model reported, `arrivedAt` when this timeline saw
@@ -70,6 +76,7 @@ export const createTimeline = (model, now, profile) => {
70
76
  leaving: null,
71
77
  completion: model.completion ? { data: model.completion, at: now } : null,
72
78
  chips: chipsOf(model, now),
79
+ stage: { key: stageKeyOf(model), at: null },
73
80
  };
74
81
  };
75
82
 
@@ -97,6 +104,10 @@ export const advanceTimeline = (timeline, model, now, profile) => {
97
104
  next.completion = model.completion ? { data: model.completion, at: now } : null;
98
105
  }
99
106
  next.chips = chipsOf(model, now, timeline.chips);
107
+ const stage = stageKeyOf(model);
108
+ // Only a step inside one workflow kicks; a switch to another family arrives with its chip's light.
109
+ const sameFamily = (key) => Boolean(stage && key && key.split(":")[0] === stage.split(":")[0]);
110
+ if (stage !== (timeline.stage?.key ?? null)) next.stage = { key: stage, at: sameFamily(timeline.stage?.key) ? now : null };
100
111
  next.ambient = ambientOf(model, now, profile, timeline.ambient);
101
112
  next.glint = glintOf(model, now, profile, timeline.glint);
102
113
  next.step = stepOf(model, now);
@@ -156,6 +167,29 @@ const sparksAt = (elapsed) => SPARK_SEEDS.map(({ start, speed, twinkle }) => {
156
167
  // the card (`comet`, 0 to 1: the top rule left to right, then the bottom rule right to left),
157
168
  // where the bright head stands on the rail leaving the current stage (`flow`, 0 to 1), how far the
158
169
  // rewind look's hue has turned (`hue`, 0 to 1 over TIMINGS.hue) and its sparks (`sparks`, full only).
170
+ // The glyph particles of the profile's style: fixed seeds per row (the same LCG idea as the sparks),
171
+ // each burning through its life, reborn at a fresh place every generation. A particle is `x` (0 to
172
+ // 1 across the row's free cells), `age` (0 to 1) and `glyph` (an index into the style's ramp).
173
+ const PARTICLE_SEEDS = (() => {
174
+ let state = 29;
175
+ const next = () => {
176
+ state = (state * 1103515245 + 12345) % 2147483648;
177
+ return state / 2147483648;
178
+ };
179
+ return Object.freeze(Array.from({ length: 24 }, () => Object.freeze({ offset: next(), drift: next() - 0.5, place: next(), pace: 0.75 + 0.5 * next() })));
180
+ })();
181
+ const placeOf = (seed, generation) => {
182
+ const v = Math.sin((seed.place * 977 + generation * 131.7) * 12.9898) * 43758.5453;
183
+ return v - Math.floor(v);
184
+ };
185
+ const particlesAt = (elapsed, style) => Object.fromEntries(style.rows.map((row, r) => [row, PARTICLE_SEEDS.slice(r * 12, r * 12 + style.count).map((seed) => {
186
+ const cycle = (elapsed * seed.pace) / style.life + seed.offset;
187
+ const generation = Math.floor(cycle);
188
+ const age = cycle - generation;
189
+ const x = placeOf(seed, generation) + seed.drift * 0.08 * age;
190
+ return { x: Math.min(0.999, Math.max(0, x)), age, glyph: Math.min(style.ramp.length - 1, Math.floor(age * style.ramp.length)) };
191
+ })]));
192
+
159
193
  const ambientSample = (timeline, now, profile) => {
160
194
  if (!ambientActive(timeline, profile)) return null;
161
195
  const elapsed = Math.max(0, now - timeline.ambient.at);
@@ -168,6 +202,7 @@ const ambientSample = (timeline, now, profile) => {
168
202
  flow: profile.ambient.sweep ? (elapsed % TIMINGS.flow) / TIMINGS.flow : null,
169
203
  hue: (elapsed % TIMINGS.hue) / TIMINGS.hue,
170
204
  sparks: profile.ambient.sweep ? sparksAt(elapsed) : null,
205
+ particles: profile.particles ? { style: profile.particles, rows: particlesAt(elapsed, profile.particles) } : null,
171
206
  };
172
207
  };
173
208
 
@@ -181,6 +216,7 @@ export const timelineBusy = (timeline, now, profile) => {
181
216
  if (timeline.notice && now < timeline.notice.at + d(TIMINGS.noticeIn)) return true;
182
217
  if (timeline.leaving && now < timeline.leaving.at + d(TIMINGS.noticeOut)) return true;
183
218
  if (timeline.completion && now < timeline.completion.at + d(TIMINGS.completion)) return true;
219
+ if (profile.particles && timeline.stage?.at !== null && timeline.stage?.at !== undefined && now < timeline.stage.at + TIMINGS.kick) return true;
184
220
  return Object.values(timeline.chips).some((chip) => (chip.arrivedAt !== null && now < chip.arrivedAt + d(TIMINGS.shimmer))
185
221
  || (chip.from !== chip.state && now < chip.changedAt + d(TIMINGS.crossfade)));
186
222
  };
@@ -251,6 +287,7 @@ export const sampleTimeline = (timeline, now, profile) => {
251
287
  glint: glintAt(timeline, now),
252
288
  step: timeline.step ? { name: timeline.step.name, elapsedMs: timeline.step.base + Math.max(0, now - timeline.step.at) } : null,
253
289
  lanes: timeline.lanes ? { elapsedMs: timeline.lanes.base + Math.max(0, now - timeline.lanes.at) } : null,
290
+ kick: profile.particles && timeline.stage?.at !== null && timeline.stage?.at !== undefined ? springKick(now - timeline.stage.at) : 0,
254
291
  spin: Math.floor(Math.max(0, now) / TIMINGS.spin) % 4,
255
292
  };
256
293
  };
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { lookOf } from "./looks.mjs";
6
6
  import { AUTOLOOP_LIMITS, GATE_LIMITS } from "./state.mjs";
7
- import { REVIEW_LANES, buildWorkflow } from "./workflow.mjs";
7
+ import { DISCIPLINE_ENTRY, REVIEW_LANES, buildWorkflow } from "./workflow.mjs";
8
8
 
9
9
  export const STALL_MS = 10 * 60 * 1000;
10
10
  // An agent the host does not list, quiet this long with no call in flight, no longer counts as
@@ -271,7 +271,10 @@ const lingering = (thread, now) => thread.state !== "done" || !Number.isFinite(t
271
271
  // Another session's row: its liveness record says running (`alive`), `idle` or `ended` (hidden);
272
272
  // without one, a stack written within OTHER_SESSION_MS and not marked ended counts as running.
273
273
  // A stack that moved after the record (a resumed session's first tool call) outranks it.
274
- const otherState = (thread, liveness) => (liveness?.state === "idle" && thread.state === "running" ? "idle" : thread.state);
274
+ // A session killed mid-turn writes no Stop or SessionEnd, so its last word stays `alive`: once it
275
+ // has been quiet for OTHER_QUIET_MS it reads idle (card scenario D1-8).
276
+ export const OTHER_QUIET_MS = 5 * 60 * 1000;
277
+ const otherState = (thread, liveness, quietMs = 0) => (thread.state === "running" && (liveness?.state === "idle" || quietMs > OTHER_QUIET_MS) ? "idle" : thread.state);
275
278
  const currentLiveness = (liveness, stackAt) => (liveness && !(Number.isFinite(stackAt) && stackAt > liveness.at) ? liveness : null);
276
279
  const seenAt = (other) => Math.max(Number.isFinite(other.at) ? other.at : -Infinity, Number.isFinite(other.liveness?.at) ? other.liveness.at : -Infinity);
277
280
  // Running first, then idle, then the rest (paused, done), each newest first.
@@ -317,10 +320,13 @@ const laneCount = (entry, lists, name) => listProgress(entry) ?? ownedProgress(l
317
320
  * active frame and its parents first, then lanes and tasks, then other sessions. `reserve` is the card's thread-row count, never below the
318
321
  * `threadReserve` the caller carried over, so the card does not shrink while threads are live.
319
322
  */
320
- const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve }) => {
323
+ const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve, isWorking = true }) => {
321
324
  const frames = snapshot.workflow?.stack?.frames ?? [];
322
325
  const mainList = listProgress(lists.main);
326
+ // This session's own frame cannot be running while its main turn is over (an Esc, or the turn
327
+ // ended): it reads idle until the next turn starts (card scenario D1-4).
323
328
  const chain = frames.map((frame, index) => frameThread(frame, index, snapshot, index === frames.length - 1, mainList, now, lists.main))
329
+ .map((thread) => (!isWorking && thread.state === "running" ? { ...thread, state: "idle" } : thread))
324
330
  .filter((thread) => lingering(thread, now));
325
331
  const laneThreads = lanes.map((lane, index) => ({
326
332
  key: `lane-${lane.id ?? index}`,
@@ -342,7 +348,7 @@ const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve }) => {
342
348
  })
343
349
  .map((other) => {
344
350
  const thread = frameThread(topLiveFrame(other, snapshot.settledPlans ?? []), 0, {}, false, null, now);
345
- return { ...thread, key: `session-${other.id8}`, session: other.id8, state: otherState(thread, currentLiveness(other.liveness, other.at)), seenAt: seenAt(other) };
351
+ return { ...thread, key: `session-${other.id8}`, session: other.id8, state: otherState(thread, currentLiveness(other.liveness, other.at), now - seenAt(other)), seenAt: seenAt(other) };
346
352
  })
347
353
  .filter((thread) => lingering(thread, now))
348
354
  .sort(runningFirst);
@@ -494,7 +500,12 @@ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVIT
494
500
  const active = Boolean(snapshot.work) || goalIsOpen(goal) || (discipline !== null && isWorking) || liveAgents.length > 0;
495
501
  const lit = skills.some(({ state }) => state === "current");
496
502
  const workflow = buildWorkflow({ snapshot, skills, completion, now });
497
- const title = discipline ?? skills.find(({ state }) => state === "current")?.id ?? lastDiscipline;
503
+ // A workflow skill that already left the stack (a side lit-plan that finished and handed the
504
+ // session back) no longer names the card: the frame the rail draws does.
505
+ const frames = snapshot.workflow?.stack?.frames ?? [];
506
+ const handedBack = discipline && Object.hasOwn(DISCIPLINE_ENTRY, discipline) && frames.length > 0 && !frames.some((frame) => frame.skill === discipline) ? frames.at(-1).skill : null;
507
+ // After a resume the prompt's ignition and the chips are gone, but the stack still draws its frame.
508
+ const title = handedBack ?? discipline ?? skills.find(({ state }) => state === "current")?.id ?? lastDiscipline ?? frames.at(-1)?.skill ?? null;
498
509
  const chosen = selectLook({ snapshot, discipline, skills, workflow, completion, waiting, now, turnStartedAt });
499
510
  // `club` (an inviter recorded and the club option on) dresses only the idle card, and never
500
511
  // shows a band that `band: auto` would hide.
@@ -517,13 +528,13 @@ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVIT
517
528
  progress,
518
529
  next: snapshot.work?.nextTask ?? (goalIsOpen(goal) ? goal.criteria.find(({ status }) => status !== "pass")?.description || goal.objective || null : null),
519
530
  lanes: { count: lanes.length, list: lanes },
520
- threads: threadsOf({ snapshot, lanes, tasks: Object.values(pruneBackgroundTasks(tasks, now)), lists, now, threadReserve }),
531
+ threads: threadsOf({ snapshot, lanes, tasks: Object.values(pruneBackgroundTasks(tasks, now)), lists, now, threadReserve, isWorking }),
521
532
  autoloop,
522
533
  ctxWarning,
523
534
  warnings,
524
535
  gates: gatesOf(snapshot),
525
536
  goal: goalSummaryOf(goal),
526
- skills: skills.map(({ id, at, state }) => ({ id, at, state })),
537
+ skills: skills.length > 0 ? skills.map(({ id, at, state }) => ({ id, at, state })) : frames.map(({ skill, at }) => ({ id: skill, at, state: "recent" })),
527
538
  figures: figuresOf(usage, git),
528
539
  workflow,
529
540
  step: step && isWorking && stepName(step.name) ? { name: stepName(step.name), elapsedMs: Math.max(0, now - step.at) } : null,
@@ -48,6 +48,7 @@ export const WORKFLOW_FRESH_MS = 6 * 60 * 60 * 1000;
48
48
  export const DISCIPLINE_ENTRY = Object.freeze({
49
49
  "deep-interview": { family: "main", stage: "interview" },
50
50
  "lit-brainstorm": { family: "main", stage: "interview" },
51
+ "ultra-brainstorm": { family: "main", stage: "interview" },
51
52
  "lit-crucible": { family: "main", stage: "plan" },
52
53
  "lit-plan": { family: "main", stage: "plan" },
53
54
  "start-work": { family: "main", stage: "work" },
@@ -82,6 +82,6 @@ export const buildNativeGoalBindingGuidance = ({ objective, activeGoal } = {}) =
82
82
  return {
83
83
  status: "blocked-unavailable",
84
84
  ...ready,
85
- message: `${ready.message}\nEvidence: the supported UserPromptSubmit hook surface can add context or block, but does not expose a run-slash-command channel; this session exposes no callable get_goal/create_goal/update_goal tools to LitClaude.`,
85
+ message: `${ready.message}\nEvidence: the supported UserPromptSubmit hook surface can add context or block, but does not expose a run-slash-command channel; only the LitClaude mod sets /goal, after the user's yes to lit-plan's goal question.`,
86
86
  };
87
87
  };