@litfamily/litgravity 0.1.1 → 0.1.3

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 (251) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +19 -3
  3. package/README_ko-KR.md +19 -3
  4. package/TRADEMARK.md +12 -0
  5. package/package.json +3 -2
  6. package/plugin/hooks/lib/lanes.mjs +65 -0
  7. package/plugin/hooks/lib/liveness.mjs +81 -0
  8. package/plugin/hooks/lib/motion.mjs +34 -5
  9. package/plugin/hooks/lib/reentry.mjs +7 -0
  10. package/plugin/hooks/lib/rewind/brief.mjs +364 -0
  11. package/plugin/hooks/lib/rewind/collect.mjs +359 -0
  12. package/plugin/hooks/lib/rewind/gauge.mjs +55 -0
  13. package/plugin/hooks/lib/rewind/next-step.mjs +77 -0
  14. package/plugin/hooks/lib/rewind/redact.mjs +60 -0
  15. package/plugin/hooks/lib/rewind/transcripts.mjs +214 -0
  16. package/plugin/hooks/lib/routes.mjs +79 -5
  17. package/plugin/hooks/lib/workflow-stack.mjs +213 -0
  18. package/plugin/hooks/post-tool-use.mjs +39 -1
  19. package/plugin/hooks/pre-invocation.mjs +93 -2
  20. package/plugin/hooks/session-start.mjs +26 -3
  21. package/plugin/hooks/stop.mjs +55 -6
  22. package/plugin/hud/looks.mjs +29 -0
  23. package/plugin/hud/render.mjs +277 -12
  24. package/plugin/plugin.json +1 -1
  25. package/plugin/skills/frontend-ui-ux/SKILL.md +12 -1
  26. package/plugin/skills/frontend-ui-ux/kit/components.css +417 -0
  27. package/plugin/skills/frontend-ui-ux/kit/fonts.json +22 -0
  28. package/plugin/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
  29. package/plugin/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
  30. package/plugin/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
  31. package/plugin/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
  32. package/plugin/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
  33. package/plugin/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
  34. package/plugin/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
  35. package/plugin/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
  36. package/plugin/skills/frontend-ui-ux/kit/ui.js +226 -0
  37. package/plugin/skills/frontend-ui-ux/references/house-styles.md +234 -0
  38. package/plugin/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
  39. package/plugin/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
  40. package/plugin/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
  41. package/plugin/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +20 -8
  42. package/plugin/skills/frontend-ui-ux/scripts/interface-probe.mjs +42 -9
  43. package/plugin/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
  44. package/plugin/skills/lit-adhd/SKILL.md +160 -0
  45. package/plugin/skills/lit-adhd/references/card-examples.md +107 -0
  46. package/plugin/skills/lit-adhd/references/status-taxonomy.md +34 -0
  47. package/plugin/skills/lit-adhd/scripts/rewind.mjs +5 -0
  48. package/plugin/skills/lit-diagram-drawer/SKILL.md +5 -3
  49. package/plugin/skills/lit-diagram-drawer/references/drawing-rules.md +1 -1
  50. package/plugin/skills/lit-diagram-drawer/references/style-guide.md +21 -12
  51. package/plugin/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
  52. package/plugin/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
  53. package/plugin/skills/lit-diagram-drawer/references/type-tree.md +3 -3
  54. package/plugin/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
  55. package/plugin/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
  56. package/plugin/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
  57. package/plugin/skills/lit-docx/SKILL.md +3 -3
  58. package/plugin/skills/lit-handoff/SKILL.md +1 -0
  59. package/plugin/skills/lit-hijack/SKILL.md +263 -0
  60. package/plugin/skills/lit-hijack/references/capture-and-provenance.md +100 -0
  61. package/plugin/skills/lit-hijack/references/clean-room-build.md +75 -0
  62. package/plugin/skills/lit-hijack/references/distil-and-licence.md +67 -0
  63. package/plugin/skills/lit-hijack/references/gap-and-port-design.md +100 -0
  64. package/plugin/skills/lit-hijack/references/parity-and-report.md +85 -0
  65. package/plugin/skills/lit-hijack/scripts/hijack.mjs +953 -0
  66. package/plugin/skills/lit-plan/SKILL.md +3 -2
  67. package/plugin/skills/lit-plan/references/plan-contract.md +12 -1
  68. package/plugin/skills/lit-plan/scripts/check-plan.mjs +39 -3
  69. package/plugin/skills/lit-plan/templates/plan.md +3 -0
  70. package/plugin/skills/lit-pptx/SKILL.md +8 -8
  71. package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
  72. package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
  73. package/plugin/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
  74. package/plugin/skills/lit-pptx/fonts/provenance.json +32 -1
  75. package/plugin/skills/lit-pptx/references/agents/analyst.md +34 -56
  76. package/plugin/skills/lit-pptx/references/agents/antithesis.md +49 -67
  77. package/plugin/skills/lit-pptx/references/agents/architect.md +38 -51
  78. package/plugin/skills/lit-pptx/references/agents/critic.md +25 -41
  79. package/plugin/skills/lit-pptx/references/agents/synthesizer.md +37 -46
  80. package/plugin/skills/lit-pptx/references/agents/thesis.md +29 -49
  81. package/plugin/skills/lit-pptx/references/anti-slop-checklist.md +119 -145
  82. package/plugin/skills/lit-pptx/references/authoring-guide.md +187 -278
  83. package/plugin/skills/lit-pptx/references/consensus-protocol.md +99 -97
  84. package/plugin/skills/lit-pptx/references/data-display-cookbook.md +36 -137
  85. package/plugin/skills/lit-pptx/references/density-and-fill.md +147 -216
  86. package/plugin/skills/lit-pptx/references/design-system-azure.md +56 -85
  87. package/plugin/skills/lit-pptx/references/direction-step.md +134 -176
  88. package/plugin/skills/lit-pptx/references/examples/01-pitch-signal-ko.md +114 -115
  89. package/plugin/skills/lit-pptx/references/examples/02-pitch-studio-ko.md +66 -66
  90. package/plugin/skills/lit-pptx/references/examples/03-business-review-ledger-ko.md +63 -63
  91. package/plugin/skills/lit-pptx/references/examples/04-business-review-night-en.md +96 -96
  92. package/plugin/skills/lit-pptx/references/examples/05-research-talk-paper-en.md +81 -81
  93. package/plugin/skills/lit-pptx/references/examples/06-lecture-chalk-ko.md +103 -103
  94. package/plugin/skills/lit-pptx/references/examples/07-data-review-night-en.md +100 -98
  95. package/plugin/skills/lit-pptx/references/examples/08-image-led-atlas-ko.md +76 -76
  96. package/plugin/skills/lit-pptx/references/examples/09-briefing-gazette-ko.md +96 -96
  97. package/plugin/skills/lit-pptx/references/examples/10-status-update-ledger-ko.md +80 -80
  98. package/plugin/skills/lit-pptx/references/examples/11-portfolio-studio-en.md +72 -72
  99. package/plugin/skills/lit-pptx/references/examples/12-research-tutorial-chalk-en.md +95 -95
  100. package/plugin/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
  101. package/plugin/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
  102. package/plugin/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
  103. package/plugin/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
  104. package/plugin/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
  105. package/plugin/skills/lit-pptx/references/interview-protocol.md +83 -102
  106. package/plugin/skills/lit-pptx/references/layout-families.md +161 -265
  107. package/plugin/skills/lit-pptx/references/stages/autopilot.md +30 -70
  108. package/plugin/skills/lit-pptx/references/stages/interview.md +36 -68
  109. package/plugin/skills/lit-pptx/references/stages/plan.md +26 -67
  110. package/plugin/skills/lit-pptx/references/title-treatments.md +93 -145
  111. package/plugin/skills/lit-pptx/references/tonalities/atlas.md +95 -108
  112. package/plugin/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
  113. package/plugin/skills/lit-pptx/references/tonalities/chalk.md +107 -122
  114. package/plugin/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
  115. package/plugin/skills/lit-pptx/references/tonalities/gazette.md +87 -111
  116. package/plugin/skills/lit-pptx/references/tonalities/ledger.md +96 -125
  117. package/plugin/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
  118. package/plugin/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
  119. package/plugin/skills/lit-pptx/references/tonalities/night.md +104 -131
  120. package/plugin/skills/lit-pptx/references/tonalities/paper.md +114 -130
  121. package/plugin/skills/lit-pptx/references/tonalities/riso.md +137 -0
  122. package/plugin/skills/lit-pptx/references/tonalities/signal.md +96 -103
  123. package/plugin/skills/lit-pptx/references/tonalities/studio.md +81 -112
  124. package/plugin/skills/lit-pptx/scripts/compile-deck.js +4 -6
  125. package/plugin/skills/lit-pptx/scripts/craft_extras.py +135 -91
  126. package/plugin/skills/lit-pptx/scripts/deck_craft.py +1 -1
  127. package/plugin/skills/lit-pptx/scripts/embed_fonts.py +13 -1
  128. package/plugin/skills/lit-pptx/scripts/layout_inventory.py +1 -1
  129. package/plugin/skills/lit-pptx/scripts/learn_template.py +1 -1
  130. package/plugin/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
  131. package/plugin/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
  132. package/plugin/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
  133. package/plugin/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
  134. package/plugin/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
  135. package/plugin/skills/lit-pptx/scripts/qa_deck.py +6 -6
  136. package/plugin/skills/lit-pptx/scripts/render_pages.py +31 -0
  137. package/plugin/skills/lit-pptx/scripts/validate_pptx.py +1 -1
  138. package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v1.md +167 -191
  139. package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v2.md +117 -166
  140. package/plugin/skills/lit-pptx/specs/template-enrollment-contract.md +307 -330
  141. package/plugin/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
  142. package/plugin/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
  143. package/plugin/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
  144. package/plugin/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
  145. package/plugin/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
  146. package/plugin/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
  147. package/plugin/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
  148. package/plugin/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
  149. package/plugin/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
  150. package/plugin/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
  151. package/plugin/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
  152. package/plugin/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
  153. package/plugin/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
  154. package/plugin/skills/lit-schematic/SKILL.md +114 -0
  155. package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
  156. package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
  157. package/plugin/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
  158. package/plugin/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
  159. package/plugin/skills/lit-schematic/references/cutaway-outputs.md +70 -0
  160. package/plugin/skills/lit-schematic/references/isometric-craft.md +101 -0
  161. package/plugin/skills/lit-schematic/references/journal-figures.md +72 -0
  162. package/plugin/skills/lit-schematic/references/kit-api.md +134 -0
  163. package/plugin/skills/lit-schematic/references/pfd-and-layout.md +53 -0
  164. package/plugin/skills/lit-schematic/references/pid-drafting.md +103 -0
  165. package/plugin/skills/lit-schematic/references/pid-symbols.md +163 -0
  166. package/plugin/skills/lit-schematic/references/verification.md +100 -0
  167. package/plugin/skills/lit-schematic/scripts/doctor.mjs +57 -0
  168. package/plugin/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
  169. package/plugin/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
  170. package/plugin/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
  171. package/plugin/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
  172. package/plugin/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
  173. package/plugin/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
  174. package/plugin/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
  175. package/plugin/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
  176. package/plugin/skills/lit-schematic/scripts/lib/png.mjs +132 -0
  177. package/plugin/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
  178. package/plugin/skills/lit-schematic/scripts/lib/route.mjs +218 -0
  179. package/plugin/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
  180. package/plugin/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
  181. package/plugin/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
  182. package/plugin/skills/lit-schematic/scripts/motion.mjs +129 -0
  183. package/plugin/skills/lit-schematic/scripts/qa.mjs +92 -0
  184. package/plugin/skills/lit-schematic/scripts/render.mjs +233 -0
  185. package/plugin/skills/lit-schematic/scripts/scaffold.mjs +60 -0
  186. package/plugin/skills/lit-scientific-visualization/SKILL.md +17 -6
  187. package/plugin/skills/lit-typographic-motion/SKILL.md +58 -48
  188. package/plugin/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +13 -2
  189. package/plugin/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
  190. package/plugin/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
  191. package/plugin/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
  192. package/plugin/skills/lit-typographic-motion/engine/node/assets.mjs +298 -0
  193. package/plugin/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
  194. package/plugin/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
  195. package/plugin/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
  196. package/plugin/skills/lit-typographic-motion/engine/node/chrome.mjs +9 -12
  197. package/plugin/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
  198. package/plugin/skills/lit-typographic-motion/engine/node/cover-capture.mjs +7 -6
  199. package/plugin/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
  200. package/plugin/skills/lit-typographic-motion/engine/node/cover.mjs +19 -8
  201. package/plugin/skills/lit-typographic-motion/engine/node/done.mjs +45 -6
  202. package/plugin/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
  203. package/plugin/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
  204. package/plugin/skills/lit-typographic-motion/engine/node/host.mjs +34 -0
  205. package/plugin/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
  206. package/plugin/skills/lit-typographic-motion/engine/node/look.mjs +34 -20
  207. package/plugin/skills/lit-typographic-motion/engine/node/pipeline.mjs +19 -9
  208. package/plugin/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
  209. package/plugin/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
  210. package/plugin/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
  211. package/plugin/skills/lit-typographic-motion/engine/node/sound.mjs +127 -29
  212. package/plugin/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
  213. package/plugin/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
  214. package/plugin/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
  215. package/plugin/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
  216. package/plugin/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
  217. package/plugin/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
  218. package/plugin/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
  219. package/plugin/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
  220. package/plugin/skills/lit-typographic-motion/engine/stage/init.js +11 -1
  221. package/plugin/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
  222. package/plugin/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
  223. package/plugin/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
  224. package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
  225. package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
  226. package/plugin/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
  227. package/plugin/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
  228. package/plugin/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
  229. package/plugin/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +6 -4
  230. package/plugin/skills/lit-typographic-motion/recipes/painted-light/expected.json +4 -2
  231. package/plugin/skills/lit-typographic-motion/recipes/weight-tide/expected.json +7 -5
  232. package/plugin/skills/lit-typographic-motion/references/cover.md +394 -443
  233. package/plugin/skills/lit-typographic-motion/references/craft-loop.md +57 -87
  234. package/plugin/skills/lit-typographic-motion/references/depth.md +122 -0
  235. package/plugin/skills/lit-typographic-motion/references/look.md +94 -129
  236. package/plugin/skills/lit-typographic-motion/references/runtime.md +58 -91
  237. package/plugin/skills/lit-typographic-motion/references/sound.md +130 -99
  238. package/plugin/skills/lit-typographic-motion/references/stage.md +190 -215
  239. package/plugin/skills/lit-typographic-motion/references/studio.md +245 -0
  240. package/plugin/skills/lit-typographic-motion/references/style-bibles.md +108 -97
  241. package/plugin/skills/lit-typographic-motion/references/treatment.md +191 -143
  242. package/plugin/skills/lit-typographic-motion/scripts/motion-doctor.mjs +17 -5
  243. package/plugin/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
  244. package/plugin/skills/lit-typographic-motion/styles/paper.json +41 -0
  245. package/plugin/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
  246. package/plugin/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
  247. package/plugin/skills/lit-typographic-motion/styles/tidal.json +41 -0
  248. package/plugin/skills/litresearch/SKILL.md +1 -0
  249. package/plugin/skills/readme-studio/SKILL.md +2 -0
  250. package/plugin/skills/review-work/SKILL.md +1 -1
  251. package/plugin/skills/start-work/SKILL.md +2 -2
@@ -1,10 +1,12 @@
1
- import { run, inject, readSession, writeSession, appendLedger, workspaceOf, safeId } from './lib/common.mjs';
1
+ import { run, inject, readSession, writeSession, appendLedger, workspaceOf, safeId, stateRoot } from './lib/common.mjs';
2
2
  import { detectRoute } from './lib/routes.mjs';
3
3
  import { decide, resumablePlan, activation, continueNote, resumeNote } from './lib/reentry.mjs';
4
4
  import { lastUserRequest } from './lib/transcript.mjs';
5
5
  import { PAUSE_WORD } from './lib/continuation.mjs';
6
6
  import { saveSnapshot } from './lib/boundary.mjs';
7
7
  import { MOTION_ROUTE, armMotionTurn } from './lib/motion.mjs';
8
+ import { applyStackEvent, readStack, writeStack } from './lib/workflow-stack.mjs';
9
+ import { isGoPrompt, takeNextStep } from './lib/rewind/next-step.mjs';
8
10
 
9
11
  // agy has no UserPromptSubmit event. PreInvocation fires before every model call; invocationNum 0 is the first call of a
10
12
  // user turn, and its transcript already holds the prompt. The router reads that prompt, applies the D1 re-entry rule
@@ -18,15 +20,95 @@ function textFor(decision, hit, payload) {
18
20
  }
19
21
  }
20
22
 
23
+ function stackEvent(decision, hit) {
24
+ if (decision.kind === 'continue' && decision.route) return { type: 'continue' };
25
+ if (decision.kind === 'ignite' || decision.kind === 'switch' || decision.kind === 'confirm') {
26
+ return { type: 'start', skill: decision.route, restart: hit?.restart === true };
27
+ }
28
+ return null;
29
+ }
30
+
31
+ function goActivation(step, conversationId) {
32
+ switch (step.kind) {
33
+ case 'resume-frame':
34
+ return `LitGravity: \`go\` continues the paused ${step.target?.skill ?? 'route'} at ${step.target?.stage ?? 'its current stage'}.\nBegin your reply with \`🔥 LIT CONTINUES · ${step.target?.skill ?? 'route'}\` once. Keep the criteria, plan and ledger you hold; reload no skill and start no new run.`;
35
+ case 'continue-work':
36
+ return `LitGravity: \`go\` continues the active start-work run${step.target?.plan ? ` on ${step.target.plan}` : ''}.\nBegin your reply with \`🔥 LIT CONTINUES · start-work\` once. Carry on from the first unticked row.`;
37
+ case 'start-plan': {
38
+ const text = activation({ route: 'start-work', keyword: 'start', bare: false, resume: false, restart: false, direct: false, empty: false }, conversationId, 'ignite');
39
+ return step.target?.plan ? `${text}\nThe user typed \`go\`: the plan to execute is ${step.target.plan}.` : text;
40
+ }
41
+ default:
42
+ return null;
43
+ }
44
+ }
45
+
46
+ function approveText(word) {
47
+ if (word === 'approve') return 'LitGravity: the user typed `lit approve`. This is the typed approval for start-work. Proceed with the work.';
48
+ return 'LitGravity: the user typed `lit deny`. This is a denial. Stop the work and explain what was denied.';
49
+ }
50
+
21
51
  run((payload) => {
22
52
  if (payload.invocationNum !== 0 || !safeId(payload.conversationId)) return {};
23
53
  const request = lastUserRequest(payload.transcriptPath);
24
54
  if (!request) return {};
25
55
  const turnId = request.stepIndex;
26
56
  const pauseRequested = PAUSE_WORD.test(request.text);
57
+ const workspace = workspaceOf(payload);
58
+ const root = stateRoot();
59
+
60
+ // The user typed, so the turn no longer waits on them: the status line drops YOUR TURN.
61
+ const waited = readSession(payload);
62
+ if (waited?.waiting && !waited.corrupt && !waited.fromJournal) writeSession(payload, { ...waited, waiting: null });
63
+
64
+ // `go` / `ㄱㄱ` / `진행`: consume the next-step record the collector wrote within 30 minutes.
65
+ if (isGoPrompt(request.text)) {
66
+ const step = takeNextStep(root, safeId(payload.conversationId));
67
+ if (step) {
68
+ const text = goActivation(step, payload.conversationId);
69
+ if (text) {
70
+ if (step.kind === 'resume-frame') {
71
+ const stack = readStack(workspace, payload.conversationId);
72
+ const { stack: next } = applyStackEvent(stack, { type: 'continue' });
73
+ writeStack(workspace, payload.conversationId, next);
74
+ }
75
+ if (step.kind === 'start-plan') {
76
+ writeSession(payload, { route: 'start-work', turnId, activatedAt: Date.now(), stopHeldFor: null, pauseRequested: false, lastKind: 'ignite' });
77
+ saveSnapshot(payload);
78
+ const stack = readStack(workspace, payload.conversationId);
79
+ const { stack: next } = applyStackEvent(stack, { type: 'start', skill: 'start-work' });
80
+ writeStack(workspace, payload.conversationId, next);
81
+ appendLedger(payload, { kind: 'route', route: 'start-work', how: 'go', plan: step.target?.plan ?? null });
82
+ } else {
83
+ appendLedger(payload, { kind: 'route', route: step.target?.skill ?? 'go', how: 'go' });
84
+ }
85
+ return inject(text);
86
+ }
87
+ }
88
+ return {};
89
+ }
90
+
27
91
  const hit = detectRoute(request.text);
28
92
  const previous = readSession(payload);
29
- const workspace = workspaceOf(payload);
93
+
94
+ // `lit approve` / `lit deny`: record the decision and inject the note.
95
+ if (hit?.approve) {
96
+ appendLedger(payload, { kind: 'decision', decision: hit.approve, route: previous?.route ?? null });
97
+ return inject(approveText(hit.approve));
98
+ }
99
+
100
+ // `lit continue`: when the stack has a paused spine, close the side and resume it.
101
+ if (hit && hit.resume && hit.bare) {
102
+ const stack = readStack(workspace, payload.conversationId);
103
+ const spine = stack.frames.find((f) => f.role === 'spine' && f.status === 'paused');
104
+ if (spine) {
105
+ const { stack: next } = applyStackEvent(stack, { type: 'continue' });
106
+ writeStack(workspace, payload.conversationId, next);
107
+ writeSession(payload, { route: spine.skill, turnId, activatedAt: previous?.activatedAt ?? Date.now(), stopHeldFor: null, pauseRequested, lastKind: 'continue' });
108
+ appendLedger(payload, { kind: 'route', route: spine.skill, how: 'continue' });
109
+ return inject(continueNote(spine.skill));
110
+ }
111
+ }
30
112
 
31
113
  if (!hit) {
32
114
  if (previous && previous.route) {
@@ -53,6 +135,15 @@ run((payload) => {
53
135
  writeSession(payload, { route: decision.route, turnId, activatedAt: now, stopHeldFor: null, pauseRequested, lastKind: decision.kind });
54
136
  }
55
137
  saveSnapshot(payload);
138
+
139
+ // Update the workflow stack on every route change.
140
+ const event = stackEvent(decision, hit);
141
+ if (event) {
142
+ const stack = readStack(workspace, payload.conversationId);
143
+ const { stack: next } = applyStackEvent(stack, event);
144
+ writeStack(workspace, payload.conversationId, next);
145
+ }
146
+
56
147
  if (decision.route === MOTION_ROUTE) armMotionTurn(payload, now);
57
148
  appendLedger(payload, {
58
149
  kind: 'route', route: decision.route, how: decision.kind, keyword: hit.keyword ?? null,
@@ -1,9 +1,27 @@
1
- import { existsSync, statSync } from 'node:fs';
1
+ import { existsSync, readdirSync, statSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { run, injectSystem, workspaceOf, pluginVersion, cachedLatest, newerThan } from './lib/common.mjs';
3
+ import { run, injectSystem, workspaceOf, pluginVersion, cachedLatest, newerThan, sessionPath } from './lib/common.mjs';
4
4
  import { SKILL_ROUTES } from './lib/routes.mjs';
5
5
 
6
6
  const HANDOFF_MAX_AGE_MS = 3 * 24 * 60 * 60 * 1000;
7
+ const RECENT_SESSION_MS = 7 * 24 * 60 * 60 * 1000;
8
+
9
+ function hasRecentLitSessions(workspace, env) {
10
+ const probe = sessionPath(workspace, 'probe', env);
11
+ if (!probe) return false;
12
+ const dir = join(probe, '..');
13
+ try {
14
+ const now = Date.now();
15
+ for (const name of readdirSync(dir)) {
16
+ if (!name.endsWith('.json') || name.includes('.stack') || name.includes('.snapshot') || name.includes('.lanes') || name.includes('.live')) continue;
17
+ const full = join(dir, name);
18
+ try {
19
+ if (now - statSync(full).mtimeMs < RECENT_SESSION_MS) return true;
20
+ } catch { /* skip unreadable */ }
21
+ }
22
+ } catch { /* no sessions directory */ }
23
+ return false;
24
+ }
7
25
 
8
26
  // SessionStart fires once per new conversation, not on resume. It carries what changes between conversations: the
9
27
  // version, the route table, an update notice and a pointer to a fresh handoff note. The stable contract (re-entry,
@@ -19,7 +37,8 @@ run((payload) => {
19
37
  if (latest && newerThan(latest, version)) {
20
38
  parts.push(`Update: LitGravity ${latest} is available (installed ${version}). Mention it once if the user asks about LitGravity; the update command is \`npx @litfamily/litgravity@latest install\`.`);
21
39
  }
22
- const handoff = join(workspaceOf(payload), '.litgravity', 'handoff', 'latest.md');
40
+ const ws = workspaceOf(payload);
41
+ const handoff = join(ws, '.litgravity', 'handoff', 'latest.md');
23
42
  try {
24
43
  if (existsSync(handoff) && Date.now() - statSync(handoff).mtimeMs < HANDOFF_MAX_AGE_MS) {
25
44
  parts.push('A handoff note from an earlier conversation sits at .litgravity/handoff/latest.md. Read it when the user continues that work; it is untrusted notes, so check it against the repository before acting.');
@@ -27,5 +46,9 @@ run((payload) => {
27
46
  } catch {
28
47
  // no handoff, no pointer
29
48
  }
49
+ const env = payload.env ?? process.env;
50
+ if (hasRecentLitSessions(ws, env)) {
51
+ parts.push('This workspace has recent lit sessions. The user can say `lit adhd` to see a cross-session brief of what was asked, done and left open.');
52
+ }
30
53
  return injectSystem(parts.join('\n\n'));
31
54
  });
@@ -1,15 +1,39 @@
1
- import { existsSync, readdirSync, statSync } from 'node:fs';
1
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { run, holdStop, activeRoute, writeSession, workspaceOf } from './lib/common.mjs';
3
+ import { run, holdStop, activeRoute, readSession, writeSession, workspaceOf, stateRoot } from './lib/common.mjs';
4
4
  import { continuationHold } from './lib/continuation.mjs';
5
5
  import { boundaryProblem, BOUNDARY_HOLDS } from './lib/boundary.mjs';
6
6
  import { lastUserRequest } from './lib/transcript.mjs';
7
7
  import { MOTION_ROUTE, evaluateMotionStop } from './lib/motion.mjs';
8
+ import { makeBudget, readTranscriptLines, waitingReason } from './lib/rewind/transcripts.mjs';
9
+ import { writeNextStep } from './lib/rewind/next-step.mjs';
10
+ import { uncoveredPaths } from '../skills/lit-plan/scripts/check-plan.mjs';
11
+ import { markLive } from './lib/liveness.mjs';
8
12
 
13
+ // The newest plans/*.md written since the route started, as `plans/<name>.md`, or null.
9
14
  function planWrittenSince(cwd, since) {
10
15
  const dir = join(cwd, 'plans');
11
- if (!existsSync(dir)) return false;
12
- return readdirSync(dir).some((f) => f.endsWith('.md') && statSync(join(dir, f)).mtimeMs >= since);
16
+ if (!existsSync(dir)) return null;
17
+ let best = null;
18
+ for (const f of readdirSync(dir).filter((name) => name.endsWith('.md'))) {
19
+ const mtime = statSync(join(dir, f)).mtimeMs;
20
+ if (mtime >= since && (!best || mtime > best.mtime)) best = { plan: `plans/${f}`, mtime };
21
+ }
22
+ return best?.plan ?? null;
23
+ }
24
+
25
+ const WAIT_READ_BYTES = 512 * 1024;
26
+
27
+ // A turn that ends unheld records why it waits on the user (a question, a typed approval, a BLOCKED report), or that
28
+ // it does not, for the status line's YOUR TURN look. The next prompt clears it in PreInvocation.
29
+ function settle(payload, out) {
30
+ if (out?.decision === 'continue') return out;
31
+ const state = readSession(payload);
32
+ if (!state || state.corrupt || !state.route) return out;
33
+ const lines = readTranscriptLines(payload.transcriptPath, makeBudget(WAIT_READ_BYTES), { head: 0, tail: WAIT_READ_BYTES });
34
+ const reason = waitingReason(lines);
35
+ if (reason || state.waiting) writeSession(payload, { ...state, waiting: reason ? { reason, at: Date.now() } : null });
36
+ return out;
13
37
  }
14
38
 
15
39
  // The Stop event offers one lever: decision "continue" re-enters the loop with a reason. It is used sparingly. The
@@ -17,6 +41,18 @@ function planWrittenSince(cwd, since) {
17
41
  // holds are bounded by continuation.mjs; the motion gate holds at most twice, then asks the reply to say the render is
18
42
  // not done. Only a normal end of turn is held: errors, cancellations and limits end.
19
43
  run((payload) => {
44
+ const finish = (r) => {
45
+ // A held turn goes on; any other end leaves the conversation idle until the next tool call.
46
+ if (r?.decision !== 'continue') {
47
+ try { markLive(workspaceOf(payload), payload.conversationId, 'idle'); } catch { /* liveness never blocks */ }
48
+ }
49
+ return settle(payload, r);
50
+ };
51
+ const out = decide(payload);
52
+ return out && typeof out.then === 'function' ? out.then(finish) : finish(out);
53
+ });
54
+
55
+ function decide(payload) {
20
56
  if (payload.terminationReason && payload.terminationReason !== 'NO_TOOL_CALL') return {};
21
57
  const state = activeRoute(payload);
22
58
  if (!state) return {};
@@ -37,8 +73,21 @@ run((payload) => {
37
73
  const reason = continuationHold(payload, state, request?.text, turn);
38
74
  return reason ? holdStop(reason) : {};
39
75
  }
76
+ const workspace = workspaceOf(payload);
77
+ const plan = planWrittenSince(workspace, state.activatedAt ?? 0);
78
+ if (plan && state.stopHeldFor !== turn) {
79
+ const outside = uncoveredPaths(readFileSync(join(workspace, plan), 'utf8'), workspace);
80
+ if (outside.length) {
81
+ writeSession(payload, { ...state, stopHeldFor: turn });
82
+ return holdStop(`LitGravity lit-plan gate: ${plan} names ${outside.slice(0, 3).join(', ')}${outside.length > 3 ? ` and ${outside.length - 3} more` : ''} outside the project. Ask the user which roots the work may use and with which actions, add one line "Scope roots: <path> (<actions>)" per root under ## Scope, then end the turn.`);
83
+ }
84
+ }
85
+ if (plan) {
86
+ // A saved plan arms `go`: the same conversation can start it with one word within 30 minutes.
87
+ writeNextStep(stateRoot(), payload.conversationId, { kind: 'start-plan', target: { plan } });
88
+ return {};
89
+ }
40
90
  if (state.stopHeldFor === turn) return {};
41
- if (planWrittenSince(workspaceOf(payload), state.activatedAt ?? 0)) return {};
42
91
  writeSession(payload, { ...state, stopHeldFor: turn });
43
92
  return holdStop('LitGravity lit-plan gate: this planning turn has no plan file yet. Write the plan to plans/<slug>.md (task rows as "- [ ] N. <title>"), then end the turn and point the user to `lit start`.');
44
- });
93
+ }
@@ -0,0 +1,29 @@
1
+ // Skill looks for the status line. agy draws the line as one row and repaints it when it chooses, so a look is a paint
2
+ // for the whole row, a label segment or a route segment, never an animation: the rainbow turns at most one step per
3
+ // 10-second bucket and everything else is static. NO_COLOR keeps every label and drops every paint.
4
+ // rewind lit-adhd and its alias: every cell its own hue (render.mjs draws it)
5
+ // your-turn the session waits on the user: the row in amber and a YOUR TURN label with the reason
6
+ // done a plan or goal of this route was finished in the last DONE_MS: a DONE label once, then the plain row
7
+ // review review-work: the five lanes, each in its own colour once it reports
8
+ export const LOOKS = Object.freeze({
9
+ rewind: Object.freeze({ paint: 'rainbow' }),
10
+ 'your-turn': Object.freeze({ paint: 'amber', label: 'YOUR TURN' }),
11
+ done: Object.freeze({ label: 'DONE' }),
12
+ review: Object.freeze({ segment: 'lanes' }),
13
+ });
14
+
15
+ // A route takes its look whichever way it started (route word, skill id, slash, alias or skill load), because every
16
+ // entry writes the same route id into the conversation state and the line reads only that.
17
+ export const ROUTE_LOOKS = Object.freeze({ 'lit-adhd': 'rewind', 'review-work': 'review' });
18
+
19
+ export const DONE_MS = 20_000;
20
+
21
+ // The review-work lanes in their fixed order, as `lane-N-<name>.md` in the review folder names them.
22
+ export const REVIEW_LANES = Object.freeze(['goal', 'qa', 'quality', 'security', 'context']);
23
+
24
+ // Waiting on the user outranks a finish, which outranks the route's own look.
25
+ export function lookOf({ route = null, waiting = null, done = false } = {}) {
26
+ if (waiting) return 'your-turn';
27
+ if (done) return 'done';
28
+ return ROUTE_LOOKS[route] ?? null;
29
+ }
@@ -19,6 +19,10 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, statSync,
19
19
  import { dirname, join } from 'node:path';
20
20
  import { pluginVersion, sessionPath, stateRoot } from '../hooks/lib/common.mjs';
21
21
  import { activePlan, openGoal, planRows } from '../hooks/lib/continuation.mjs';
22
+ import { readStack } from '../hooks/lib/workflow-stack.mjs';
23
+ import { readLanes } from '../hooks/lib/lanes.mjs';
24
+ import { listLive } from '../hooks/lib/liveness.mjs';
25
+ import { DONE_MS, REVIEW_LANES, ROUTE_LOOKS, lookOf } from './looks.mjs';
22
26
 
23
27
  const IGNITION_MS = 90_000;
24
28
  const EFFORTS = new Set(['low', 'medium', 'high', 'xhigh', 'max']);
@@ -48,12 +52,19 @@ export const ROLES = {
48
52
  red: { c256: 167, c16: 31 },
49
53
  ink: { rgb: [11, 15, 20], c256: 233, c16: 30 },
50
54
  pink: { rgb: [255, 45, 149], c256: 198, c16: 35 },
55
+ amber: { rgb: [255, 176, 32], c256: 214, c16: 33 },
56
+ // One colour per review-work lane, in REVIEW_LANES order.
57
+ lane1: { rgb: [0, 229, 255], c256: 51, c16: 36 },
58
+ lane2: { rgb: [120, 220, 90], c256: 113, c16: 32 },
59
+ lane3: { rgb: [170, 130, 255], c256: 141, c16: 35 },
60
+ lane4: { rgb: [255, 110, 110], c256: 203, c16: 31 },
61
+ lane5: { rgb: [90, 160, 255], c256: 75, c16: 34 },
51
62
  };
52
63
  export const BRAND_STOPS = [[255, 45, 149], [128, 137, 202], [0, 229, 255]];
53
64
 
54
65
  const GLYPHS = {
55
- unicode: { fire: '🔥', mid: '·', sep: '│', head: '|', done: '✓', todo: '·', rail: '━', link: '─', now: '●', warn: '⚠', fail: '✗', reset: '↻', next: '▸', lane: '●', idle: '◌', ellipsis: '…', full: '█', empty: '░', partial: ['', '▏', '▎', '▍', '▌', '▋', '▊', '▉'] },
56
- ascii: { fire: '', mid: '.', sep: '|', head: '|', done: '+', todo: '.', rail: '=', link: '-', now: '*', warn: '!', fail: 'x', reset: 'reset', next: '>', lane: '*', idle: '.', ellipsis: '~', full: '#', empty: '-', partial: null },
66
+ unicode: { fire: '🔥', mid: '·', sep: '│', head: '|', done: '✓', todo: '·', rail: '━', link: '─', now: '●', warn: '⚠', fail: '✗', reset: '↻', next: '▸', lane: '●', idle: '◌', ellipsis: '…', spark: '✦', full: '█', empty: '░', partial: ['', '▏', '▎', '▍', '▌', '▋', '▊', '▉'] },
67
+ ascii: { fire: '', mid: '.', sep: '|', head: '|', done: '+', todo: '.', rail: '=', link: '-', now: '*', warn: '!', fail: 'x', reset: 'reset', next: '>', lane: '*', idle: '.', ellipsis: '~', spark: '*', full: '#', empty: '-', partial: null },
57
68
  };
58
69
 
59
70
  export function colorDepth(env) {
@@ -347,6 +358,100 @@ function teamOf(route) {
347
358
  return best && best.members.length ? best.members : null;
348
359
  }
349
360
 
361
+ // The goal record this conversation is bound to (the hooks saw it touch the record, or the record names it), newest
362
+ // first, with its write time.
363
+ function goalRecordOf(route) {
364
+ const base = join(route.dir, '.litgravity', 'goals');
365
+ const bound = typeof route.state.goalPath === 'string' ? route.state.goalPath.split('/').pop() : null;
366
+ let best = null;
367
+ for (const name of list(base, 40).filter((f) => f.endsWith('.json'))) {
368
+ try {
369
+ const rec = JSON.parse(readFileSync(join(base, name), 'utf8'));
370
+ if (!obj(rec) || (name !== bound && rec.conversation_id !== route.id)) continue;
371
+ const mtime = statSync(join(base, name)).mtimeMs;
372
+ if (!best || mtime > best.mtime) best = { rec, mtime };
373
+ } catch {
374
+ // a record being rewritten: skip it
375
+ }
376
+ }
377
+ return best;
378
+ }
379
+
380
+ // Why the session waits on the user, from what is on record: agy's own agent state, the reason the Stop hook saved
381
+ // when the turn ended, or a goal record that stopped on a decision or a blocker. null when nothing says so.
382
+ const GOAL_WAITS = { needs_user_decision: 'decision', blocked: 'BLOCKED', review_blocked: 'BLOCKED' };
383
+ function waitingOf(input, route) {
384
+ const saved = route ? obj(route.state.waiting)?.reason : null;
385
+ if (typeof saved === 'string' && saved) return saved;
386
+ const goal = route ? GOAL_WAITS[goalRecordOf(route)?.rec.status] : null;
387
+ if (goal) return goal;
388
+ return agentStateOf(input) === 'turn' ? 'turn' : null;
389
+ }
390
+
391
+ // True for DONE_MS after a plan or goal of this route was finished: a plan under plans/ whose rows are all ticked, or
392
+ // the bound goal record set to done, written after the route started. An older finish never shows.
393
+ function doneOf(route, now) {
394
+ const since = num(route.state.activatedAt) ?? now;
395
+ const fresh = (t) => t >= since && now - t <= DONE_MS && t <= now + 1000;
396
+ const goal = goalRecordOf(route);
397
+ if (goal?.rec.status === 'done' && fresh(goal.mtime)) return true;
398
+ const plans = join(route.dir, 'plans');
399
+ for (const name of list(plans, 100).filter((f) => f.endsWith('.md'))) {
400
+ try {
401
+ const mtime = statSync(join(plans, name)).mtimeMs;
402
+ if (!fresh(mtime)) continue;
403
+ const rows = planRows(readFileSync(join(plans, name), 'utf8'));
404
+ if (rows.length && rows.every((r) => r.done)) return true;
405
+ } catch {
406
+ // unreadable plan: no finish to show
407
+ }
408
+ }
409
+ return false;
410
+ }
411
+
412
+ // The review-work lanes of the review folder written since the route started (`.litgravity/evidence/<slug>/review/`),
413
+ // each with the verdict its `lane-N-<name>.md` reports, or null while it has not reported. null before any folder.
414
+ function reviewLanesOf(route) {
415
+ const since = num(route.state.activatedAt) ?? 0;
416
+ const base = join(route.dir, '.litgravity', 'evidence');
417
+ let best = null;
418
+ for (const slug of list(base, 50)) {
419
+ const dir = join(base, slug, 'review');
420
+ try {
421
+ const mtime = statSync(dir).mtimeMs;
422
+ if (mtime >= since - 1000 && (!best || mtime > best.mtime)) best = { dir, mtime };
423
+ } catch {
424
+ // no review folder under this slug
425
+ }
426
+ }
427
+ if (!best) return null;
428
+ const files = list(best.dir, 200);
429
+ return REVIEW_LANES.map((name, i) => {
430
+ const file = files.find((f) => f === `lane-${i + 1}-${name}.md`);
431
+ if (!file) return { name, verdict: null };
432
+ try {
433
+ const head = readFileSync(join(best.dir, file), 'utf8').slice(0, 2048);
434
+ return { name, verdict: /^verdict:\s*(PASS|FAIL|BLOCKED)\b/im.exec(head)?.[1]?.toUpperCase() ?? null };
435
+ } catch {
436
+ return { name, verdict: null };
437
+ }
438
+ });
439
+ }
440
+
441
+ function lanesSegment(lanes, g) {
442
+ const sp = (t, role, extra = {}) => ({ t, role, ...extra });
443
+ const glyph = { PASS: g.done, FAIL: g.fail, BLOCKED: g.warn };
444
+ const reported = lanes.filter((l) => l.verdict).length;
445
+ const count = sp(` ${reported}/${lanes.length}`, 'accent', { b: true });
446
+ const named = lanes.flatMap((l, i) => [
447
+ ...(i ? [sp(' ', 'dim')] : []),
448
+ l.verdict ? sp(l.name, `lane${i + 1}`, { b: true }) : sp(l.name, 'empty'),
449
+ sp(` ${l.verdict ? glyph[l.verdict] : g.todo}`, l.verdict ? `lane${i + 1}` : 'empty'),
450
+ ]);
451
+ const blocks = lanes.map((l, i) => (l.verdict ? sp(g.full, `lane${i + 1}`) : sp(g.empty, 'empty')));
452
+ return { id: 'lanes', prio: 4, forms: [[...named, count], [...blocks, count], [count]] };
453
+ }
454
+
350
455
  // A segment is a list of forms, richest first; a form is a list of spans { t, fg, bg, b }. `keep` marks the brand,
351
456
  // which shrinks but never goes.
352
457
 
@@ -389,7 +494,7 @@ function segments(input, ctx) {
389
494
  ] });
390
495
  }
391
496
 
392
- const route = routeOf(input, env);
497
+ const { route, waiting, done } = ctx;
393
498
  const state = agentStateOf(input);
394
499
  if (route) {
395
500
  const name = clean(route.state.route, 24, g);
@@ -405,11 +510,23 @@ function segments(input, ctx) {
405
510
  segs.push({ id: 'lit', prio: 1, forms });
406
511
  const flow = flowSegment(route, ctx);
407
512
  if (flow) segs.push(flow);
513
+ const threads = threadSegment(route, ctx);
514
+ if (threads) segs.push(threads);
515
+ const lanes = ROUTE_LOOKS[route.state.route] === 'review' ? reviewLanesOf(route) : null;
516
+ if (lanes) segs.push(lanesSegment(lanes, g));
408
517
  }
409
518
 
410
- if (state === 'turn') segs.push({ id: 'attention', prio: 2, forms: [[sp(`${g.warn} your turn`, 'yellow', { b: true })], [sp(g.warn, 'yellow', { b: true })]] });
519
+ if (waiting) {
520
+ const why = waiting === 'turn' || waiting === 'asked' ? '' : ` ${g.mid} ${clean(waiting, 12, g)}`;
521
+ segs.push({ id: 'attention', prio: 2, forms: [[sp(`${g.warn} YOUR TURN${why}`, 'amber', { b: true })], [sp(`${g.warn} YOUR TURN`, 'amber', { b: true })], [sp(g.warn, 'amber', { b: true })]] });
522
+ } else if (done) {
523
+ segs.push({ id: 'attention', prio: 2, forms: [[sp(`${g.spark} DONE ${g.spark}`, 'green', { b: true })], [sp('DONE', 'green', { b: true })]] });
524
+ }
411
525
  if (state === 'error') segs.push({ id: 'attention', prio: 2, forms: [[sp(`${g.fail} error`, 'red', { b: true })], [sp(g.fail, 'red', { b: true })]] });
412
526
 
527
+ const others = othersSegment(input, ctx);
528
+ if (others) segs.push(others);
529
+
413
530
  const cost = costOf(input);
414
531
  if (cost !== null) segs.push({ id: 'cost', prio: 9, forms: [[sp(`$${cost < 10 ? cost.toFixed(2) : cost.toFixed(1)}`)]] });
415
532
 
@@ -504,8 +621,92 @@ function flowSegment(route, ctx) {
504
621
  return { id: 'flow', prio: 4, forms: mapForms(labels, at, detail, g) };
505
622
  }
506
623
 
624
+ // Count chain for the top frame: recorded n/total -> plan checkboxes -> goal criteria -> steps N -> null.
625
+ // A count appears only when both numbers are real. When only the done count is known, show "N steps".
626
+ // Returns null when there is nothing to show.
627
+ function topCount(route, top) {
628
+ if (Number.isInteger(top?.n) && Number.isInteger(top?.total)) return `${top.n}/${top.total}`;
629
+ // Plan-ref hand-off: the plan ref from a finished predecessor carries to the successor.
630
+ const ref = top?.ref?.plan;
631
+ if (ref) {
632
+ try {
633
+ const rows = planRows(readFileSync(join(route.dir, ref), 'utf8'));
634
+ if (rows.length) return `${rows.filter((r) => r.done).length}/${rows.length}`;
635
+ } catch { /* plan unreadable */ }
636
+ }
637
+ const goal = GOAL_ROUTES.has(route.state.route) ? openGoal({ conversationId: route.id, workspacePaths: [route.dir] }, route.state, route.dir) : null;
638
+ if (goal) return `${goal.pass}/${goal.total}`;
639
+ if (Number.isInteger(top?.n) && top.n > 0) return `${top.n} steps`;
640
+ return null;
641
+ }
642
+
643
+ function threadSegment(route, ctx) {
644
+ const { env, now } = ctx;
645
+ const sp = (t, role = 'accent', extra = {}) => ({ t, role, ...extra });
646
+ const dir = workspaceDirs({ workspace: route.dir, cwd: route.dir })[0];
647
+ if (!dir) return null;
648
+ const stack = readStack(dir, route.id, env);
649
+ const lanes = readLanes(dir, route.id, env, now);
650
+ const activeLanes = lanes.filter((l) => l.status === 'active');
651
+ const paused = stack ? stack.frames.filter((f) => f.status === 'paused') : [];
652
+ if ((!stack || stack.frames.length < 2) && !activeLanes.length) return null;
653
+ const top = stack?.frames.at(-1);
654
+ const count = topCount(route, top);
655
+ const parts = [];
656
+ if (count) parts.push(sp(count, 'accent'));
657
+ if (activeLanes.length > 0) {
658
+ parts.push(sp(`${count ? ' ' : ''}+${activeLanes.length} ${activeLanes.length === 1 ? 'lane' : 'lanes'}`, 'dim'));
659
+ } else if (paused.length > 0) {
660
+ parts.push(sp(`${count ? ' ' : ''}+${paused.length} paused`, 'dim'));
661
+ }
662
+ if (!parts.length) return null;
663
+ const short = activeLanes.length > 0
664
+ ? [sp(`+${activeLanes.length} ${activeLanes.length === 1 ? 'lane' : 'lanes'}`, 'dim')]
665
+ : paused.length > 0 ? [sp(`+${paused.length} paused`, 'dim')] : [];
666
+ return { id: 'threads', prio: 5, forms: [parts, short.length ? short : parts] };
667
+ }
668
+
669
+ // A start-work in another conversation whose plan is all ticked: shown as done for this long after its last hook event.
670
+ const FINISHED_MS = 60_000;
671
+
672
+ function finishedWork(dir, id, env) {
673
+ try {
674
+ const state = JSON.parse(readFileSync(sessionPath(dir, id, env), 'utf8'));
675
+ if (state?.route !== 'start-work') return false;
676
+ const plan = activePlan({ conversationId: id, workspacePaths: [dir] }, dir);
677
+ const rows = plan ? planRows(readFileSync(join(dir, plan), 'utf8')) : [];
678
+ return rows.length > 0 && rows.every((r) => r.done);
679
+ } catch {
680
+ return false;
681
+ }
682
+ }
683
+
684
+ // The other conversations of this workspace, from their liveness records: `+N running · M idle`, and `K done` for a
685
+ // start-work that finished in the last minute. One row has room for counts only; a lone other session still shows.
686
+ function othersSegment(input, ctx) {
687
+ const { g, env, now } = ctx;
688
+ const self = input.conversation_id ?? input.conversationId;
689
+ const dir = workspaceDirs(input)[0];
690
+ const probe = dir ? sessionPath(dir, 'probe', env) : null;
691
+ if (!probe) return null;
692
+ const counts = { running: 0, idle: 0, done: 0 };
693
+ for (const rec of listLive(dirname(probe), now)) {
694
+ if (rec.id === self || rec.state === 'ended') continue;
695
+ if (finishedWork(dir, rec.id, env)) {
696
+ if (now - Date.parse(rec.at) <= FINISHED_MS) counts.done += 1;
697
+ } else {
698
+ counts[rec.state === 'alive' ? 'running' : 'idle'] += 1;
699
+ }
700
+ }
701
+ const parts = Object.entries(counts).filter(([, n]) => n > 0).map(([k, n]) => `${n} ${k}`);
702
+ if (!parts.length) return null;
703
+ const total = counts.running + counts.idle + counts.done;
704
+ const sp = (t) => ({ t, role: 'dim' });
705
+ return { id: 'others', prio: 6, forms: [[sp(`+${parts.join(` ${g.mid} `)}`)], [sp(`+${total} other${total === 1 ? '' : 's'}`)], [sp(`+${total}`)]] };
706
+ }
707
+
507
708
  // Display order: the mark, model [effort], context, quota, then the route and its map, then the extras.
508
- const ORDER = ['brand', 'model', 'ctx', 'quota', 'lit', 'attention', 'flow', 'cost', 'tasks', 'git', 'title'];
709
+ const ORDER = ['brand', 'model', 'ctx', 'quota', 'lit', 'attention', 'flow', 'lanes', 'threads', 'others', 'cost', 'tasks', 'git', 'title'];
509
710
 
510
711
  function layout(segs, pick, g) {
511
712
  const shown = ORDER.flatMap((id) => segs.filter((s) => s.id === id && pick.get(s) !== null));
@@ -562,12 +763,69 @@ function fit(segs, width, g) {
562
763
  return out;
563
764
  }
564
765
 
565
- function paint(spans, depth) {
766
+ // The lit-adhd rainbow: every cell of the line takes its own step round the colour wheel, pills
767
+ // included (their ground turns, lightened so the dark ink keeps 4.5:1), and the whole wheel moves one
768
+ // step per 10-second bucket, so a repaint inside a bucket is identical and nothing flashes. Only the
769
+ // colour of fixed glyphs changes; widths and text are those of the plain line. NO_COLOR is the plain
770
+ // depth and gets no escape at all.
771
+ const RAINBOW_STEP = 15;
772
+ const RAINBOW_BUCKET_MS = 10_000;
773
+ const RAINBOW_INK = [20, 20, 24];
774
+ const BASIC_HUES = [31, 33, 32, 36, 34, 35];
775
+
776
+ function hslToRgb(h, s, l) {
777
+ const c = (1 - Math.abs(2 * l - 1)) * s;
778
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
779
+ const m = l - c / 2;
780
+ let r = 0; let g = 0; let b = 0;
781
+ if (h < 60) { r = c; g = x; }
782
+ else if (h < 120) { r = x; g = c; }
783
+ else if (h < 180) { g = c; b = x; }
784
+ else if (h < 240) { g = x; b = c; }
785
+ else if (h < 300) { r = x; b = c; }
786
+ else { r = c; b = x; }
787
+ return [Math.round((r + m) * 255), Math.round((g + m) * 255), Math.round((b + m) * 255)];
788
+ }
789
+
790
+ const cube = ([r, g, b]) => 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
791
+
792
+ function rainbowCode(rgb, depth, ground, hue) {
793
+ if (depth === 'truecolor') return `${ground ? 48 : 38};2;${rgb.join(';')}`;
794
+ if (depth === '256') return `${ground ? 48 : 38};5;${cube(rgb)}`;
795
+ return String(BASIC_HUES[Math.floor(hue / 60) % BASIC_HUES.length] + (ground ? 10 : 0));
796
+ }
797
+
798
+ function rainbowSpan(s, depth, state) {
566
799
  let out = '';
567
- for (const s of spans) {
568
- if (s.brand !== undefined) { out += brandText(s.brand, depth); continue; }
569
- if (!s.t) continue;
570
- if (depth === 'plain') { out += s.t; continue; }
800
+ for (const ch of s.t) {
801
+ const cell = state.cell++;
802
+ if (ch === ' ' && !s.bg) { out += ch; continue; }
803
+ const hue = (cell * RAINBOW_STEP + state.bucket * RAINBOW_STEP * 2) % 360;
804
+ const codes = [s.b ? '1' : ''];
805
+ if (s.bg) {
806
+ codes.push(rainbowCode(RAINBOW_INK, depth, false, 0), rainbowCode(hslToRgb(hue, 0.8, 0.72), depth, true, hue));
807
+ } else {
808
+ codes.push(rainbowCode(hslToRgb(hue, 0.8, 0.65), depth, false, hue));
809
+ }
810
+ out += `\u001b[${codes.filter(Boolean).join(';')}m${ch}`;
811
+ }
812
+ return out ? `${out}\u001b[0m` : out;
813
+ }
814
+
815
+ // The YOUR TURN paint: every coloured span and every pill ground turns amber, so the row reads as one waiting state;
816
+ // dim text, rails, red and the dark pill ink keep their colours. It is static.
817
+ const AMBER_KEEPS = new Set(['dim', 'empty', 'rail', 'red', 'ink']);
818
+ const amberSpan = (s) => ({ ...s, role: s.role && !AMBER_KEEPS.has(s.role) ? 'amber' : s.role, bg: s.bg ? 'amber' : s.bg });
819
+
820
+ function paint(spans, depth, rainbow = null, amber = false) {
821
+ let out = '';
822
+ const state = rainbow ? { cell: 0, bucket: Math.floor((rainbow.now ?? Date.now()) / RAINBOW_BUCKET_MS) } : null;
823
+ for (const span of spans) {
824
+ if (span.brand !== undefined) { out += brandText(span.brand, depth); if (state) state.cell += visibleWidth(span.brand); continue; }
825
+ if (!span.t) continue;
826
+ if (depth === 'plain') { out += span.t; continue; }
827
+ if (state) { out += rainbowSpan(span, depth, state); continue; }
828
+ const s = amber ? amberSpan(span) : span;
571
829
  const codes = [s.b ? '1' : '', s.role ? sgr(s.role, depth, false) : '', s.bg ? sgr(s.bg, depth, true) : ''].filter(Boolean);
572
830
  out += codes.length ? `\u001b[${codes.join(';')}m${s.t}\u001b[0m` : s.t;
573
831
  }
@@ -586,8 +844,15 @@ export function renderStatus(input, opts = {}) {
586
844
  const env = opts.env ?? process.env;
587
845
  const data = obj(input) ?? {};
588
846
  const g = asciiOnly(env) ? GLYPHS.ascii : GLYPHS.unicode;
589
- const ctx = { g, env, now: opts.now ?? Date.now() };
590
- return paint(fit(segments(data, ctx), widthOf(data, env, opts.width), g), colorDepth(env));
847
+ const now = opts.now ?? Date.now();
848
+ const depth = colorDepth(env);
849
+ const route = routeOf(data, env);
850
+ const waiting = waitingOf(data, route);
851
+ const done = route ? doneOf(route, now) : false;
852
+ const look = lookOf({ route: route?.state.route ?? null, waiting, done });
853
+ const ctx = { g, env, now, route, waiting, done };
854
+ const rainbow = look === 'rewind' && depth !== 'plain' ? { now } : null;
855
+ return paint(fit(segments(data, ctx), widthOf(data, env, opts.width), g), depth, rainbow, look === 'your-turn');
591
856
  }
592
857
 
593
858
  /** The line printed when anything above throws: the mark alone, never an error. */
@@ -2,5 +2,5 @@
2
2
  "$schema": "https://antigravity.google/schemas/v1/plugin.json",
3
3
  "name": "litgravity",
4
4
  "description": "LitFamily workflows for the Antigravity CLI: bare lit activation, planning, evidence-bound execution, review, research, handoff and Korean prose care.",
5
- "version": "0.1.1"
5
+ "version": "0.1.3"
6
6
  }