@litfamily/litclaude 1.0.44 → 1.0.46

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 (36) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +8 -8
  3. package/README_ko-KR.md +8 -8
  4. package/bin/litclaude-ai.js +173 -4
  5. package/docs/assets/readme/badge-version.svg +1 -1
  6. package/package.json +1 -1
  7. package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
  8. package/plugins/litclaude/bin/litclaude-ai +1 -0
  9. package/plugins/litclaude/bin/litclaude-hook.js +21 -7
  10. package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
  11. package/plugins/litclaude/hooks/hooks.json +1 -1
  12. package/plugins/litclaude/lib/agent-file/apply.mjs +150 -0
  13. package/plugins/litclaude/lib/agent-file/attribution.mjs +62 -0
  14. package/plugins/litclaude/lib/agent-file/block.md +12 -0
  15. package/plugins/litclaude/lib/agent-file/cli.mjs +71 -0
  16. package/plugins/litclaude/lib/agent-file/managed-block.mjs +82 -0
  17. package/plugins/litclaude/lib/agent-file/project-block.md +9 -0
  18. package/plugins/litclaude/lib/canonical-skill-resources.mjs +14 -14
  19. package/plugins/litclaude/lib/mark.mjs +23 -6
  20. package/plugins/litclaude/lib/mod/state.mjs +12 -0
  21. package/plugins/litclaude/lib/mod/view.mjs +9 -3
  22. package/plugins/litclaude/lib/rewind/brief.mjs +12 -2
  23. package/plugins/litclaude/lib/rewind/collect.mjs +31 -9
  24. package/plugins/litclaude/lib/rewind/next-step.mjs +21 -3
  25. package/plugins/litclaude/lib/start-work-lifecycle.mjs +4 -2
  26. package/plugins/litclaude/skills/lit-adhd/SKILL.md +5 -4
  27. package/plugins/litclaude/skills/lit-init/SKILL.md +12 -0
  28. package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +1 -1
  29. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +1 -1
  30. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +1 -0
  31. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +126 -4
  32. package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +5 -1
  33. package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/init.js +13 -0
  34. package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/stage-kit.js +40 -1
  35. package/plugins/litclaude/skills/lit-typographic-motion/references/stage.md +43 -2
  36. package/plugins/litclaude/skills/readme-studio/templates/hyperframes-cover/package-lock.json +4 -4
@@ -0,0 +1,150 @@
1
+ // The LitFamily block on disk: the global `CLAUDE.md` that Claude Code reads every session, and a
2
+ // project's `AGENTS.md`. Writes are atomic (temporary file, then rename) and keep the file's mode; a
3
+ // symlinked, non-regular or non-UTF-8 file is refused rather than rewritten; a file system error comes
4
+ // back as `refused-io` instead of stopping the installer. The user's original global file is copied
5
+ // once, the first time a block goes in. The on/off setting is `agentFile` in LitClaude's own
6
+ // config.json; LITCLAUDE_AGENT_FILE overrides it.
7
+
8
+ import { randomUUID } from "node:crypto";
9
+ import { chmodSync, copyFileSync, lstatSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
10
+ import { dirname, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ import { readLitConfigKey, writeLitConfigKey } from "../mark.mjs";
14
+ import { ATTRIBUTION_LINE } from "./attribution.mjs";
15
+ import { inspectBlock, ManagedBlockError, removeBlock, upsertBlock } from "./managed-block.mjs";
16
+
17
+ export const AGENT_FILE_ID = "litclaude";
18
+ export const AGENT_FILE_MODES = Object.freeze(["on", "off"]);
19
+ // The global block is read on every turn of every session, so it stays small.
20
+ export const AGENT_FILE_MAX_BYTES = 1200;
21
+
22
+ const here = dirname(fileURLToPath(import.meta.url));
23
+ const BODIES = { global: "block.md", project: "project-block.md" };
24
+
25
+ /**
26
+ * The shipped block text: `global` for CLAUDE.md, `project` for a repo's AGENTS.md. With attribution
27
+ * `off` it carries the no-attribution line, before the global block's closing off-switch line.
28
+ */
29
+ export const agentFileBody = (kind = "global", { attribution = "keep" } = {}) => {
30
+ const body = readFileSync(join(here, BODIES[kind]), "utf8");
31
+ if (attribution !== "off") return body;
32
+ const offSwitch = body.indexOf("\n- Turn this block off");
33
+ return offSwitch === -1
34
+ ? `${body.replace(/\n*$/u, "\n")}${ATTRIBUTION_LINE}\n`
35
+ : `${body.slice(0, offSwitch + 1)}${ATTRIBUTION_LINE}\n${body.slice(offSwitch + 1)}`;
36
+ };
37
+
38
+ export const readAgentFileMode = ({ env = process.env, litHome }) => {
39
+ const override = String(env.LITCLAUDE_AGENT_FILE ?? "").trim().toLowerCase();
40
+ if (AGENT_FILE_MODES.includes(override)) return override;
41
+ const stored = readLitConfigKey(litHome, "agentFile");
42
+ return AGENT_FILE_MODES.includes(stored) ? stored : "on";
43
+ };
44
+
45
+ export const writeAgentFileMode = (litHome, mode) => {
46
+ if (!AGENT_FILE_MODES.includes(mode)) throw new Error(`agentFile takes one of: ${AGENT_FILE_MODES.join(", ")}`);
47
+ return writeLitConfigKey(litHome, "agentFile", mode);
48
+ };
49
+
50
+ // "missing", "file", "symlink" or "other", without following a link.
51
+ const entryKind = (path) => {
52
+ try {
53
+ const stats = lstatSync(path);
54
+ return stats.isSymbolicLink() ? "symlink" : stats.isFile() ? "file" : "other";
55
+ } catch (error) {
56
+ if (error.code === "ENOENT") return "missing";
57
+ throw error;
58
+ }
59
+ };
60
+
61
+ // The file's text, or null when it is not UTF-8 (a UTF-16 file from Notepad, Latin-1): rewriting
62
+ // those would corrupt the user's bytes outside the markers.
63
+ const readUtf8 = (path) => {
64
+ const bytes = readFileSync(path);
65
+ if (bytes.includes(0) || (bytes[0] === 0xff && bytes[1] === 0xfe) || (bytes[0] === 0xfe && bytes[1] === 0xff)) return null;
66
+ try {
67
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
68
+ } catch {
69
+ return null;
70
+ }
71
+ };
72
+
73
+ // A unique staging name, so a leftover from a crashed run never blocks the next one, removed on failure.
74
+ const writeAtomic = (path, text, { createParent }) => {
75
+ if (createParent) mkdirSync(dirname(path), { recursive: true });
76
+ const staging = `${path}.litfamily-${randomUUID()}.tmp`;
77
+ let mode = null;
78
+ try {
79
+ mode = statSync(path).mode & 0o7777;
80
+ } catch {
81
+ // A new file takes the default mode.
82
+ }
83
+ try {
84
+ writeFileSync(staging, text, { flag: "wx" });
85
+ if (mode !== null) chmodSync(staging, mode);
86
+ renameSync(staging, path);
87
+ } finally {
88
+ try {
89
+ unlinkSync(staging);
90
+ } catch {
91
+ // Renamed into place, or never written.
92
+ }
93
+ }
94
+ };
95
+
96
+ /**
97
+ * Installs or removes block `id` in `path`. Returns `{status, path, backup?, preview?}` with status
98
+ * created | updated | unchanged | removed | absent | dry-run | refused-symlink | refused-not-file |
99
+ * refused-not-utf8 | refused-malformed | refused-io. `backup: false` skips the first-insert copy (a
100
+ * repo's AGENTS.md, where a copy would sit beside tracked files); `createParent: false` never makes
101
+ * the folder.
102
+ */
103
+ export const applyAgentFile = ({ path, id = AGENT_FILE_ID, version, body, action, dryRun = false, now = new Date(), backup = true, createParent = true }) => {
104
+ try {
105
+ const kind = entryKind(path);
106
+ if (kind === "symlink") return { status: "refused-symlink", path };
107
+ if (kind === "other") return { status: "refused-not-file", path };
108
+ const text = kind === "file" ? readUtf8(path) : "";
109
+ if (text === null) return { status: "refused-not-utf8", path };
110
+ let next;
111
+ try {
112
+ next = action === "uninstall" ? removeBlock(text, id) : upsertBlock(text, { id, version, body }, { created: kind === "missing" });
113
+ } catch (error) {
114
+ if (error instanceof ManagedBlockError) return { status: "refused-malformed", path };
115
+ throw error;
116
+ }
117
+ if (!next.changed) return { status: action === "uninstall" ? "absent" : "unchanged", path };
118
+ if (dryRun) return { status: "dry-run", path, preview: next.text };
119
+ if (action === "uninstall") {
120
+ if (next.text === "" && next.created) unlinkSync(path);
121
+ else writeAtomic(path, next.text, { createParent: false });
122
+ return { status: "removed", path };
123
+ }
124
+ let copy;
125
+ if (backup && kind === "file" && inspectBlock(text, id).state === "absent") {
126
+ copy = `${path}.litfamily-backup-${now.toISOString().replace(/[:.]/gu, "-")}`;
127
+ copyFileSync(path, copy);
128
+ }
129
+ writeAtomic(path, next.text, { createParent });
130
+ return { status: kind === "file" ? "updated" : "created", path, ...(copy ? { backup: copy } : {}) };
131
+ } catch (error) {
132
+ return { status: "refused-io", path, error: error?.code ?? error?.message };
133
+ }
134
+ };
135
+
136
+ /**
137
+ * `present v=<x>` (current), `stale v=<x>` (an older install's block), `absent`, `malformed`, or
138
+ * `symlink` / `not-file` / `not-utf8` for a file LitClaude will not write.
139
+ */
140
+ export const agentFileState = ({ path, id = AGENT_FILE_ID, version }) => {
141
+ const kind = entryKind(path);
142
+ if (kind === "missing") return "absent";
143
+ if (kind === "symlink") return "symlink";
144
+ if (kind === "other") return "not-file";
145
+ const text = readUtf8(path);
146
+ if (text === null) return "not-utf8";
147
+ const found = inspectBlock(text, id);
148
+ if (found.state !== "present") return found.state;
149
+ return `${found.version === version ? "present" : "stale"} v=${found.version}`;
150
+ };
@@ -0,0 +1,62 @@
1
+ // The attribution switch. `keep` (the default) leaves Claude Code's own Co-Authored-By trailer and pull
2
+ // request line as the host writes them; `off` hides them through Claude Code's native `attribution`
3
+ // setting and adds one line to the LitFamily block. The object form below hides all three parts on every
4
+ // Claude Code version (`attribution: false` needs 2.1.281, and older versions skip the whole file).
5
+ // Before the first change LitClaude keeps the user's earlier value in its own settings record, and
6
+ // restoring puts exactly that value back.
7
+
8
+ import { readLitConfigKey, writeLitConfigKey } from "../mark.mjs";
9
+
10
+ export const ATTRIBUTION_MODES = Object.freeze(["keep", "off"]);
11
+ export const HIDDEN_ATTRIBUTION = Object.freeze({ commit: "", pr: "", sessionUrl: false });
12
+ export const ATTRIBUTION_LINE = "- Do not add `Co-Authored-By` lines or other AI attribution to commits or pull requests.";
13
+
14
+ /** The stored choice, or undefined when the user never made one. */
15
+ export const storedAttributionMode = (litHome) => {
16
+ const stored = readLitConfigKey(litHome, "attribution");
17
+ return ATTRIBUTION_MODES.includes(stored) ? stored : undefined;
18
+ };
19
+
20
+ export const readAttributionMode = ({ env = process.env, litHome }) => {
21
+ const override = String(env.LITCLAUDE_ATTRIBUTION ?? "").trim().toLowerCase();
22
+ if (ATTRIBUTION_MODES.includes(override)) return override;
23
+ return storedAttributionMode(litHome) ?? "keep";
24
+ };
25
+
26
+ export const writeAttributionMode = (litHome, mode) => {
27
+ if (!ATTRIBUTION_MODES.includes(mode)) throw new Error(`attribution takes one of: ${ATTRIBUTION_MODES.join(", ")}`);
28
+ return writeLitConfigKey(litHome, "attribution", mode);
29
+ };
30
+
31
+ const isHidden = (value) => JSON.stringify(value) === JSON.stringify(HIDDEN_ATTRIBUTION);
32
+
33
+ /**
34
+ * Hides attribution in `settings`; `record` (LitClaude's settings entry) keeps the earlier value once.
35
+ * When LitClaude hid it before and the user has since set their own value, that value wins: nothing is
36
+ * changed and the result is `user-changed` (otherwise `hidden`).
37
+ */
38
+ export const applyAttribution = (settings, record) => {
39
+ if (Object.hasOwn(record, "attributionPrior")) {
40
+ if (Object.hasOwn(settings, "attribution") && !isHidden(settings.attribution)) return "user-changed";
41
+ } else {
42
+ record.attributionPrior = Object.hasOwn(settings, "attribution")
43
+ ? { had: true, value: structuredClone(settings.attribution) }
44
+ : { had: false };
45
+ }
46
+ settings.attribution = { ...HIDDEN_ATTRIBUTION };
47
+ return "hidden";
48
+ };
49
+
50
+ /**
51
+ * Puts back the value `applyAttribution` replaced, but only while the setting still holds what
52
+ * LitClaude wrote; a value the user set since, or one LitClaude never touched, is left alone.
53
+ */
54
+ export const restoreAttribution = (settings, record) => {
55
+ if (!record || !Object.hasOwn(record, "attributionPrior")) return;
56
+ const prior = record.attributionPrior;
57
+ if (isHidden(settings.attribution)) {
58
+ if (prior?.had) settings.attribution = prior.value;
59
+ else delete settings.attribution;
60
+ }
61
+ delete record.attributionPrior;
62
+ };
@@ -0,0 +1,12 @@
1
+ ## LitFamily · LitClaude
2
+
3
+ LitClaude adds the lit workflows to Claude Code (lit-plan, start-work, lit-loop, review-work, lit-adhd,
4
+ litresearch). Its hooks load the full rules on each turn, so this block only sets the ground rules.
5
+
6
+ - `lit` at the start of a prompt is LitClaude's activation word, not the Lit web library.
7
+ - Plans live in `plans/`, the session handoff in `HANDOFF.md`, run state in `.litclaude/`. Read them
8
+ before resuming work in a repo.
9
+ - Never push, publish, tag or bump a version without the user's explicit yes for that action.
10
+ - Call work done only after its tests pass and the changed surface was checked for real.
11
+ - In a new repo, `lit init` writes a short project `AGENTS.md` with these conventions.
12
+ - Turn this block off with `litclaude-ai config agentFile off`.
@@ -0,0 +1,71 @@
1
+ // `agent-file project [--dir <path>]`, shared by the npm CLI and the plugin's in-session `litclaude-ai`
2
+ // (lit-init runs it inside a session): the project block in the repo's AGENTS.md, plus a CLAUDE.md that
3
+ // imports it when the repo has none. An existing CLAUDE.md is the user's and is left alone.
4
+
5
+ import { lstatSync, readFileSync, statSync, writeFileSync } from "node:fs";
6
+ import { dirname, join, resolve } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ import { markLitHome } from "../mark.mjs";
10
+ import { AGENT_FILE_ID, agentFileBody, applyAgentFile } from "./apply.mjs";
11
+ import { readAttributionMode } from "./attribution.mjs";
12
+
13
+ const manifestPath = join(dirname(fileURLToPath(import.meta.url)), "..", "..", ".claude-plugin", "plugin.json");
14
+ const pluginVersion = () => JSON.parse(readFileSync(manifestPath, "utf8")).version;
15
+
16
+ export const agentFileLine = (result) => `AGENT_FILE: ${result.status} ${result.path}${result.backup ? ` (backup: ${result.backup})` : ""}`;
17
+
18
+ /** Returns the exit code; prints `AGENT_FILE:` lines. */
19
+ export const runAgentFileCli = (rest, { cwd = process.cwd(), dryRun = false, out = process.stdout, err = process.stderr } = {}) => {
20
+ const [sub, ...args] = rest;
21
+ if (sub === "--help" || sub === "-h") {
22
+ out.write("Usage: litclaude-ai agent-file project [--dir <path>]\n");
23
+ return 0;
24
+ }
25
+ if (sub !== "project") {
26
+ err.write("Usage: litclaude-ai agent-file project [--dir <path>]\n");
27
+ return 64;
28
+ }
29
+ let dir = cwd;
30
+ for (let index = 0; index < args.length; index += 1) {
31
+ if (args[index] === "--dir" && args[index + 1]) {
32
+ dir = resolve(cwd, args[index + 1]);
33
+ index += 1;
34
+ continue;
35
+ }
36
+ err.write(`Unknown agent-file option: ${args[index]}\n`);
37
+ return 64;
38
+ }
39
+ let isDirectory = false;
40
+ try {
41
+ isDirectory = statSync(dir).isDirectory();
42
+ } catch {
43
+ // Missing: reported below, never created.
44
+ }
45
+ if (!isDirectory) {
46
+ err.write(`agent-file: ${dir} is not an existing folder\n`);
47
+ return 64;
48
+ }
49
+ const body = agentFileBody("project", { attribution: readAttributionMode({ litHome: markLitHome() }) });
50
+ // No backup copy here: in a repo it would sit untracked beside AGENTS.md and could be committed.
51
+ const agents = applyAgentFile({ path: join(dir, "AGENTS.md"), id: AGENT_FILE_ID, version: pluginVersion(), body, action: "install", dryRun, backup: false, createParent: false });
52
+ out.write(`${agentFileLine(agents)}\n`);
53
+ if (agents.status.startsWith("refused")) return 1;
54
+ const claude = join(dir, "CLAUDE.md");
55
+ let claudeKind = "missing";
56
+ try {
57
+ const stats = lstatSync(claude);
58
+ claudeKind = stats.isSymbolicLink() ? "symlink" : stats.isFile() ? "file" : "other";
59
+ } catch {
60
+ // Missing.
61
+ }
62
+ if (claudeKind === "missing") {
63
+ if (!dryRun) writeFileSync(claude, "@AGENTS.md\n", { flag: "wx" });
64
+ out.write(`AGENT_FILE: ${dryRun ? "dry-run" : "created"} ${claude} (imports AGENTS.md)\n`);
65
+ } else if (claudeKind !== "file") {
66
+ out.write(`AGENT_FILE: ${claudeKind === "symlink" ? "refused-symlink" : "refused-not-file"} ${claude}; left as it is\n`);
67
+ } else if (!readFileSync(claude, "utf8").includes("@AGENTS.md")) {
68
+ out.write(`AGENT_FILE: kept ${claude}; add \`@AGENTS.md\` to it so Claude Code loads the project block\n`);
69
+ }
70
+ return 0;
71
+ };
@@ -0,0 +1,82 @@
1
+ // A LitFamily block inside a user-owned instruction file (CLAUDE.md, AGENTS.md): the lines between
2
+ // `<!-- litfamily:<id>:start v=<version> … -->` and `<!-- litfamily:<id>:end -->`. Only those lines are
3
+ // ever written; the user's text before and after them stays byte for byte. The start marker records
4
+ // what was added in front of the block (`pre=`, hex) and whether the file was created for it (`new=1`),
5
+ // so removing the block takes back exactly that and an add-then-remove returns the original bytes,
6
+ // whatever the file's line endings. A start without its end, or two of either, is malformed: it is
7
+ // reported and refused, never guessed at.
8
+
9
+ export class ManagedBlockError extends Error {}
10
+
11
+ const startPrefix = (id) => `<!-- litfamily:${id}:start`;
12
+ const endMarker = (id) => `<!-- litfamily:${id}:end -->`;
13
+ const eolOf = (text) => (text.includes("\r\n") ? "\r\n" : "\n");
14
+ const START_LINE = /^<!-- litfamily:[^:\s]+:start v=(\S+)((?: [a-z]+=[0-9a-f]*)*) -->/u;
15
+
16
+ const occurrences = (text, needle) => {
17
+ const found = [];
18
+ for (let at = text.indexOf(needle); at !== -1; at = text.indexOf(needle, at + needle.length)) found.push(at);
19
+ return found;
20
+ };
21
+
22
+ // The block's span `[start, end)`, end just past the end marker, and its recorded attributes; or null.
23
+ const locate = (text, id) => {
24
+ const starts = occurrences(text, startPrefix(id));
25
+ const ends = occurrences(text, endMarker(id));
26
+ if (starts.length === 0 && ends.length === 0) return null;
27
+ if (starts.length !== 1 || ends.length !== 1 || ends[0] < starts[0]) {
28
+ throw new ManagedBlockError(`malformed LitFamily ${id} block: expected one start and one end marker`);
29
+ }
30
+ const head = START_LINE.exec(text.slice(starts[0]));
31
+ if (!head) throw new ManagedBlockError(`malformed LitFamily ${id} block: unreadable start marker`);
32
+ const attrs = Object.fromEntries(head[2].trim().split(" ").filter(Boolean).map((pair) => pair.split("=")));
33
+ return {
34
+ start: starts[0],
35
+ end: ends[0] + endMarker(id).length,
36
+ version: head[1],
37
+ pre: attrs.pre ? Buffer.from(attrs.pre, "hex").toString("utf8") : "",
38
+ created: attrs.new === "1",
39
+ };
40
+ };
41
+
42
+ const render = ({ id, version, body }, eol, { pre, created }) => [
43
+ `${startPrefix(id)} v=${version}${pre ? ` pre=${Buffer.from(pre, "utf8").toString("hex")}` : ""}${created ? " new=1" : ""} -->`,
44
+ ...String(body).replace(/\r?\n$/u, "").split(/\r?\n/u),
45
+ endMarker(id),
46
+ ].join(eol);
47
+
48
+ /** `{state: "absent" | "present" | "malformed", version, created}` for block `id` in `text`. */
49
+ export const inspectBlock = (text, id) => {
50
+ let span;
51
+ try {
52
+ span = locate(text, id);
53
+ } catch {
54
+ return { state: "malformed", version: null, created: false };
55
+ }
56
+ return span ? { state: "present", version: span.version, created: span.created } : { state: "absent", version: null, created: false };
57
+ };
58
+
59
+ /** Adds or replaces block `id`; `created` marks a file made for the block. Returns `{text, changed}`. */
60
+ export const upsertBlock = (text, block, { created = false } = {}) => {
61
+ const eol = eolOf(text);
62
+ const span = locate(text, block.id);
63
+ if (span) {
64
+ const rendered = render(block, eol, span);
65
+ const next = `${text.slice(0, span.start)}${rendered}${text.slice(span.end)}`;
66
+ return { text: next, changed: next !== text };
67
+ }
68
+ const pre = text === "" ? "" : `${text.endsWith("\n") ? "" : eol}${eol}`;
69
+ return { text: `${text}${pre}${render(block, eol, { pre, created })}${eol}`, changed: true };
70
+ };
71
+
72
+ /** Removes block `id`, the line ending after it and what was added before it; `created` is from its marker. */
73
+ export const removeBlock = (text, id) => {
74
+ const span = locate(text, id);
75
+ if (!span) return { text, changed: false, created: false };
76
+ let before = text.slice(0, span.start);
77
+ let after = text.slice(span.end);
78
+ const eol = after.startsWith("\r\n") ? "\r\n" : after.startsWith("\n") ? "\n" : "";
79
+ after = after.slice(eol.length);
80
+ if (span.pre && before.endsWith(span.pre)) before = before.slice(0, -span.pre.length);
81
+ return { text: `${before}${after}`, changed: true, created: span.created };
82
+ };
@@ -0,0 +1,9 @@
1
+ ## LitFamily · project conventions
2
+
3
+ This repo is worked with LitClaude's lit workflows (lit-plan, start-work, lit-loop, review-work).
4
+
5
+ - Plans live in `plans/`, the session handoff in `HANDOFF.md`, run state in `.litclaude/` (keep it out
6
+ of commits). Read the handoff and the active plan before resuming.
7
+ - Never push, publish, tag or bump a version without the user's explicit yes for that action.
8
+ - Pair every behaviour change with a test that failed first, and check the changed surface for real
9
+ before calling it done.
@@ -11,7 +11,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
11
11
  ["lib/durable-plan.mjs", "33fc7c2ba6305602c73650c8f29e6141e93b8ac32a444f772807e11bf8c22e44"],
12
12
  ["lib/immutable-expected-file-map.mjs", "4061486bc8eda8a53e56b7b346a1e400e7c858c0a682c83362fea460b46dfd4b"],
13
13
  ["lib/lit-mark.mjs", "b6b501e1d6fbf6c8e1797ba87a46b169423f909b039dab0067314d055cec33e7"],
14
- ["lib/mark.mjs", "27520ea62ac74927384dcc3a20dc45aa66e2549cb434a242c546a43234865459"],
14
+ ["lib/mark.mjs", "8f3d1c3ff2c471d264e8d73fca97595c93cf4b43d7935c285d72ee1ddfa8c67c"],
15
15
  ["lib/npm-invocation.mjs", "8d7b98e65836f5400b33163083cfa842fcbbf0659923290b0c680395737d3716"],
16
16
  ["lib/office-runtime-lock/package-lock.json", "16d19b420b410035e9ca6886133368444a2b438121919857b3e8915be280c6a6"],
17
17
  ["lib/office-runtime-lock/package.json", "5e4b0c7ee7bd5ff88c888f7f46152c605caf128cc4e7bfd16423571210925394"],
@@ -25,10 +25,10 @@ export const canonicalSkillResourceManifest = Object.freeze(
25
25
  ["lib/plan-task-rows.mjs", "ca45412631cdfa805102a42dbb3cfc9a43f6f1ecbcdabe1cc5059d2dcb5e58df"],
26
26
  ["lib/rename-aliases.mjs", "3ee93aec10d0dbe785c554ab3040173ee94fde27da1b440a54b0513e5d11a508"],
27
27
  ["lib/render_pages.py", "56312e376659a83a8547f60491ca2eac8ef2f3ddd763132cac0016f4d0cce542"],
28
- ["lib/rewind/brief.mjs", "e21bb31476ea38a87ef0a5042f688bde7ab1028dead61f32d2d7502a9271964f"],
29
- ["lib/rewind/collect.mjs", "b43fdb33d31933386c1e6a3fb3a7648bacf8a4fe6986bf1f94b8e22731fc8eb6"],
28
+ ["lib/rewind/brief.mjs", "11904c66063ff7c66556c22d198be746768ef0b5a31d40e3b4c6988dbf4b537c"],
29
+ ["lib/rewind/collect.mjs", "ffac66406d182a131b79197f4038fc43b205d73da2fc25dce34a10d12781ac91"],
30
30
  ["lib/rewind/gauge.mjs", "347095c1d36492bb996a679b67847261d15388b29962ed2ebaabec3cf0a5d9df"],
31
- ["lib/rewind/next-step.mjs", "c8a7cd99647afd403c35b9f793b410172564090d50158814ff20c41c30725b74"],
31
+ ["lib/rewind/next-step.mjs", "75936e3f80ce3328f0a1487a5001dd73c625c996f14d43e4ffbc07c70b56fdd2"],
32
32
  ["lib/rewind/redact.mjs", "5bff5f69191f2ec07720f2dde20a850730fed884efb47a43f2604d7295a1615a"],
33
33
  ["lib/rewind/transcripts.mjs", "3fe82276cea0c51f4d89868e3a8fc315f2e099bdefcbde193ffceffe16e0325c"],
34
34
  ["lib/rules/constants.mjs", "de97cc08ca834c35ba89a3d384517ae3f24fd52502b8ccd7a3c8227981e3f6c9"],
@@ -135,7 +135,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
135
135
  ["skills/frontend-ui-ux/scripts/search.mjs", "a08531cf2fece7b4cf4a7290cb7afbdbf90b72c0cf6cd0101df86986da86b517"],
136
136
  ["skills/frontend-ui-ux/scripts/source-replay.mjs", "2c24537a8b9f2161c1d06e42e7d5d44ab921b083f41d93d3e44da835cf932fb8"],
137
137
  ["skills/frontend-ui-ux/scripts/validate-design-contract.mjs", "f05997c3836764b9f6326efe457b91fe187ca5735bb0ce10f54f14b5b1ca0e3a"],
138
- ["skills/lit-adhd/SKILL.md", "3a0329fcc1f01d8c95eb9752df2196eba01c214c7a4231701522667a18576c44"],
138
+ ["skills/lit-adhd/SKILL.md", "b56a6fbe36205d58a47c95c515855571a1d26a3b9d023b6b6aa5f21730e95d69"],
139
139
  ["skills/lit-adhd/references/card-examples.md", "7466a0b73ecb9dce5e08cc12362fbc21dce1ef5cdb85c359fec5bfddfc684a62"],
140
140
  ["skills/lit-adhd/references/status-taxonomy.md", "ad647edea7394d8927e68ac5d9dd638285a4e19743cb0371e3b3c9a105ace321"],
141
141
  ["skills/lit-adhd/scripts/rewind.mjs", "23810ec5afaf9b90cfb784d380739d85a752a9405c594052b3dc21af74ecd175"],
@@ -822,7 +822,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
822
822
  ["skills/lit-schematic/scripts/scaffold.mjs", "0934eef6321c69ce06730343ebb48c84494d7e8e28bda3c2dd0cfa14f85088db"],
823
823
  ["skills/lit-team/SKILL.md", "48f67ed6990ab36a9303ea0aa06b488d845b3608c247ba4aa1c07f866b848166"],
824
824
  ["skills/lit-team/scripts/team.mjs", "2c6df317dbe726315676e8632cba0a229653e80a9fe8456eaa617d4185e9577f"],
825
- ["skills/lit-typographic-motion/SKILL.md", "cc742285eeea727fcc3ac3817eb9c430aaa5ab1302422a0f08656ce7be3df6b1"],
825
+ ["skills/lit-typographic-motion/SKILL.md", "80a757ddc97a4abd110a3b980348c7703db8bb678a4c095059d4817b26e8ee36"],
826
826
  ["skills/lit-typographic-motion/engine/NOTICE", "6734178ad953e5f40585d000c13e4803e670d9e8982b7f6ef0395d47a9eedf30"],
827
827
  ["skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES", "886c7e1b43afcb8b0e04d30cd3e941b35f5f03838ad31523ad3607586f877bf1"],
828
828
  ["skills/lit-typographic-motion/engine/audio/beat_grid.py", "bd2b3ab2a522371c4b2ccf65d888c5553b8bce95a78bf2839271622b8f8ec51f"],
@@ -852,7 +852,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
852
852
  ["skills/lit-typographic-motion/engine/node/cover-sheet.mjs", "2be97f3034364bf1bbb8c9ee9257a032f0fed9dda2a77ba4e245476dfa440c92"],
853
853
  ["skills/lit-typographic-motion/engine/node/cover-treatment.mjs", "cae66ea0450f208757d91e6e0272525dcba1e974c692571129f3b644aa0ca97c"],
854
854
  ["skills/lit-typographic-motion/engine/node/cover-worker.mjs", "c2af1efba3f0d1a08331a5dbb23bc4c32ba9449c4472da8140a48c5726d6053b"],
855
- ["skills/lit-typographic-motion/engine/node/cover.mjs", "cc5bd580ee57fbc5c78e5d75f2ca76b0cefa7d9711ca6851c80b657fb77e76d5"],
855
+ ["skills/lit-typographic-motion/engine/node/cover.mjs", "48cac4ea6f891c0c14fdee2462de25ab8f72844945e6e680718ba46f2a3d34f5"],
856
856
  ["skills/lit-typographic-motion/engine/node/coverage.mjs", "1ac00bcb4526dde4318fbf899a4a3633288db335efd1a40e1903a73d0f7b4f2b"],
857
857
  ["skills/lit-typographic-motion/engine/node/done.mjs", "f90ffaa64ac4c77de7158460147c406eb729de1e7fe7edf061392ac6cd36df42"],
858
858
  ["skills/lit-typographic-motion/engine/node/encode.mjs", "29205272e1ec50ff29acfb4b02d92e713e2a3321eea5f01065a8b8c7ef88f799"],
@@ -872,10 +872,10 @@ export const canonicalSkillResourceManifest = Object.freeze(
872
872
  ["skills/lit-typographic-motion/engine/node/sound-cli.mjs", "e262c42f69b6c3ef0272f7c0f3bae9aa4ddcd2bc19f09eaed181b63fe63ace9f"],
873
873
  ["skills/lit-typographic-motion/engine/node/sound.mjs", "9f07961f118176d7a7a3580e02b6d6e17248a305510c28187b1995bc82254254"],
874
874
  ["skills/lit-typographic-motion/engine/node/stage-capture.mjs", "df061c2847a43156edec18a1d6ed54c42b01b42a24575adb32d640c6697a54b7"],
875
- ["skills/lit-typographic-motion/engine/node/stage-gate.mjs", "9c8bc7287cd833d250a35a647a46ef930a45f5394ea37d9ff908a49c55111e92"],
875
+ ["skills/lit-typographic-motion/engine/node/stage-gate.mjs", "3faefb8868446dcff600f69d7cd681966e4f7c2d09f3ec8bf330a221679f9a31"],
876
876
  ["skills/lit-typographic-motion/engine/node/stage-qa.mjs", "409c5fd3dc17bb998647245b6bb2bf58b96d2a6538f96c7d8ca9e2847c5988fe"],
877
- ["skills/lit-typographic-motion/engine/node/stage-serve.mjs", "4c737b2a9bb55873cec8441814e478137def2bbcbee3f024a1014bbf3c8a6a5b"],
878
- ["skills/lit-typographic-motion/engine/node/stage.mjs", "83761db8fdf55858f30f0adb5ccfddf7d265481c42255cd7e2e2b35418f01aa9"],
877
+ ["skills/lit-typographic-motion/engine/node/stage-serve.mjs", "adef6d7c13c38bd111459ccf2a2a39908472358a48d90355f0ae56f0b5af0089"],
878
+ ["skills/lit-typographic-motion/engine/node/stage.mjs", "4387a235dd2ad6158a42dc1242886285d46285390b6ef25eef37cfbb0908fb42"],
879
879
  ["skills/lit-typographic-motion/engine/node/stills.mjs", "be783fa50136be4dcbee7edfac8fcd60e3130ba7aeebb53cb11251a7c49ddbb7"],
880
880
  ["skills/lit-typographic-motion/engine/node/styles.mjs", "16533b7d404781788d25d0d7d0be3d876f0e4b05d13df929d04f871c1c86109b"],
881
881
  ["skills/lit-typographic-motion/engine/node/treatment.mjs", "4cbf449bf7d4611c5803ed21dbd6449b326358bd82a180be78c559bd0e9e8482"],
@@ -884,10 +884,10 @@ export const canonicalSkillResourceManifest = Object.freeze(
884
884
  ["skills/lit-typographic-motion/engine/package-lock.json", "33aeaa044cd7539f591e94cac090c49d54a0e56b84428a947e7bd6ad040cb681"],
885
885
  ["skills/lit-typographic-motion/engine/package.json", "b39e7c72ca63e630caed5a3f4dfd7871c96046aaf2ebbea500556b9a731be8d6"],
886
886
  ["skills/lit-typographic-motion/engine/stage/cover-init.js", "4897e1851d5e8a7b4a761d606d522c8d7f80827cfad518d38651dab00209a30a"],
887
- ["skills/lit-typographic-motion/engine/stage/init.js", "32f005d15b513292c38a4d1fb805dd74a4523eb2a9112d3eee04849c989d93da"],
887
+ ["skills/lit-typographic-motion/engine/stage/init.js", "c5b76f3e3242ab5d4f39abda72eb4040af2e6c8c329c71f8def99ef023d91832"],
888
888
  ["skills/lit-typographic-motion/engine/stage/loop-kit.js", "dd2839c093c20ae1a0deca3a7a7099af2b4700e70ebcd38435d3bf6ff16f121f"],
889
889
  ["skills/lit-typographic-motion/engine/stage/qa.js", "9240b2b2f15955ccaec7b8447b69ce7335ffcea95336ed262323a4392f610b22"],
890
- ["skills/lit-typographic-motion/engine/stage/stage-kit.js", "2b5675cf6356d9168af19dc44c57ba7b13a70e078f9bc5319a9ec4190e89ce07"],
890
+ ["skills/lit-typographic-motion/engine/stage/stage-kit.js", "6edc53b56a0a702150b029a85730dc8942ed92b52d9bcb901b9bc5fa6e9d3f0b"],
891
891
  ["skills/lit-typographic-motion/engine/vendor/three/LICENSE", "4c40a1ef62450b857c3b2aaf294936304cd552d965fbcd9d32d4c5bcf4ba4454"],
892
892
  ["skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js", "85869bdd22f7cf0b22e68dcefe6cb710480af0f5c901a76f7a7764fd07fc8014"],
893
893
  ["skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js", "d20aeaf7077c459a8d952d215738d7b44fba028440bb862d84b622a34f0c80bb"],
@@ -965,7 +965,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
965
965
  ["skills/lit-typographic-motion/references/look.md", "fc0e09d9d2af4841d4490c0c35474275393ca175afab5f6092496f00d3a79568"],
966
966
  ["skills/lit-typographic-motion/references/runtime.md", "c9f3febf0fb86afcd326ecc92e118bc9d82e471c500d6b298563102ef84197d2"],
967
967
  ["skills/lit-typographic-motion/references/sound.md", "7073e16c8a082d36527087614e00b8471feee339061b527e9b392f9a3f78ff3a"],
968
- ["skills/lit-typographic-motion/references/stage.md", "fb3477e552c2995bab1ee4322b88c60f3212fa6974584559891a91222a2b287a"],
968
+ ["skills/lit-typographic-motion/references/stage.md", "6f44235acf220ea463774043acddf8fbc63ec5f2babf5c53e81fa4e63fad7bbd"],
969
969
  ["skills/lit-typographic-motion/references/studio.md", "02e88aa9540057bcd60dfb8adb126110d17e67c7e8dcea55e9c079e2b76f8159"],
970
970
  ["skills/lit-typographic-motion/references/style-bibles.md", "2b7a6117d4774fec7a18cf0cf0d7fb26cf3b642b6688a60169de9336e46836da"],
971
971
  ["skills/lit-typographic-motion/references/treatment.md", "0456ec5d17356be3d3f1b2b28394d723f9ec511a677901191ed6323abd36f548"],
@@ -989,7 +989,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
989
989
  ["skills/readme-studio/templates/cover-source.json", "55f681cf523a94b5403f5ad74b9e437dcaec02245ccba9176c2042c53a05b9c9"],
990
990
  ["skills/readme-studio/templates/hyperframes-cover/index.html", "7ea1282f05b5bde71317a312c028a64f719628f695a04c717d76e0fb34f7a41b"],
991
991
  ["skills/readme-studio/templates/hyperframes-cover/index.motion.json", "bef879ce5abe7810d73cc733ab635884ec807eccd7bc5e1c9bc9900049187249"],
992
- ["skills/readme-studio/templates/hyperframes-cover/package-lock.json", "6f6aad0d9676f04a411ee5484d3d7ef5e6ca8187cd84fa614c77404db996e879"],
992
+ ["skills/readme-studio/templates/hyperframes-cover/package-lock.json", "52240d8136c929bfe7b6102130a5af3c6a1db87588f1d94cb7c739ee42fc7469"],
993
993
  ["skills/readme-studio/templates/hyperframes-cover/package.json", "0993c6f04892f5a318cc99030de653b7c68d3ea6789c69b30b6a2ae80e4120f0"],
994
994
  ["skills/readme-studio/templates/readme-cover-section.md", "1dc4c536f65d3437f12e09a76170a8dc76557225587c7453631a06604a21573d"],
995
995
  ["skills/readme-studio/templates/readme-facts.json", "fb95b8aece0e8591726d3a36e25cc66712b0c6e57835c848db0f07b745e73205"],
@@ -46,23 +46,40 @@ export const readMarkMode = ({ env = process.env, litHome = markLitHome(env) } =
46
46
  return MARK_MODES.includes(stored) ? stored : "on";
47
47
  };
48
48
 
49
- /** Stores the mode, keeping the file's other keys; a symlinked config or home is refused, not followed. */
50
- export const writeMarkMode = (litHome, mode) => {
51
- if (!MARK_MODES.includes(mode)) throw new Error(`mark takes one of: ${MARK_MODES.join(", ")}`);
49
+ /** One key of `<litHome>/config.json`, or undefined when the file or key is unreadable. */
50
+ export const readLitConfigKey = (litHome, key) => readConfig(markConfigPath(litHome))?.[key];
51
+
52
+ /** Stores one key, keeping the file's other keys; a symlinked config or home is refused, not followed. */
53
+ export const writeLitConfigKey = (litHome, key, value) => {
52
54
  const path = markConfigPath(litHome);
53
55
  for (const p of [litHome, path]) {
54
56
  try {
55
- if (lstatSync(p).isSymbolicLink()) throw new Error(`refusing to write the mark setting through a symlink: ${p}`);
57
+ if (lstatSync(p).isSymbolicLink()) throw new Error(`refusing to write the ${key} setting through a symlink: ${p}`);
56
58
  } catch (error) {
57
59
  if (error.code !== "ENOENT") throw error;
58
60
  }
59
61
  }
62
+ let current = {};
63
+ try {
64
+ lstatSync(path);
65
+ current = readConfig(path);
66
+ } catch (error) {
67
+ if (error.code !== "ENOENT") throw error;
68
+ }
69
+ // A config.json that exists but does not read as an object holds the user's other settings.
70
+ if (current === null) throw new Error(`refusing to overwrite ${path}: it is not readable JSON; fix or remove it first`);
60
71
  mkdirSync(litHome, { recursive: true, mode: 0o700 });
61
- const next = { ...(readConfig(path) ?? {}), mark: mode };
72
+ const next = { ...current, [key]: value };
62
73
  const staging = `${path}.${process.pid}.tmp`;
63
74
  writeFileSync(staging, `${JSON.stringify(next, null, 2)}\n`, { flag: STATE_WRITE_FLAG, mode: 0o600 });
64
75
  renameSync(staging, path);
65
- return mode;
76
+ return value;
77
+ };
78
+
79
+ /** Stores the mode, keeping the file's other keys; a symlinked config or home is refused, not followed. */
80
+ export const writeMarkMode = (litHome, mode) => {
81
+ if (!MARK_MODES.includes(mode)) throw new Error(`mark takes one of: ${MARK_MODES.join(", ")}`);
82
+ return writeLitConfigKey(litHome, "mark", mode);
66
83
  };
67
84
 
68
85
  /** `LitClaude <version> · github.com/wjgoarxiv/litclaude`, the version taken from the plugin manifest. */
@@ -222,6 +222,17 @@ export const parseBoulder = (state, sessionId) => {
222
222
  };
223
223
  };
224
224
 
225
+ // Plan file names whose start-work is over: every work of the project that was cancelled or
226
+ // completed, minus any plan a live (active or paused) work runs again. Another session's stack keeps
227
+ // its start-work frame until that session ends, so the card asks boulder.json whether it still runs.
228
+ export const settledPlansOf = (state) => {
229
+ const works = state && state.works && typeof state.works === "object" ? Object.values(state.works) : [];
230
+ const planOf = (work) => (typeof work?.active_plan === "string" ? work.active_plan.split("/").at(-1) : "");
231
+ const live = new Set(works.filter((work) => ["active", "paused"].includes(work?.status)).map(planOf));
232
+ return [...new Set(works.filter((work) => ["cancelled", "completed"].includes(work?.status)).map(planOf))]
233
+ .filter((name) => name && !live.has(name));
234
+ };
235
+
225
236
  const CRITERION_STATUSES = new Set(["pass", "fail", "blocked", "pending"]);
226
237
 
227
238
  export const parseGoals = (state, sessionId) => {
@@ -509,6 +520,7 @@ export const readLitSnapshot = async (io, { cwd, sessionId, env = {} }) => {
509
520
  ignition: parseIgnition(ignition, sessionId),
510
521
  work,
511
522
  completedWorkIds: completed,
523
+ settledPlans: settledPlansOf(boulder),
512
524
  goal: parseGoals(goals, sessionId),
513
525
  autoloop: parseAutoloop(autoloop),
514
526
  litPlan: parseLitPlanTurn(litPlan, sessionId),
@@ -278,6 +278,11 @@ const seenAt = (other) => Math.max(Number.isFinite(other.at) ? other.at : -Infin
278
278
  const STATE_ORDER = { running: 0, idle: 1 };
279
279
  const runningFirst = (a, b) => (STATE_ORDER[a.state] ?? 2) - (STATE_ORDER[b.state] ?? 2) || b.seenAt - a.seenAt;
280
280
 
281
+ // Another session's start-work frame outlives its work: cancelling or finishing the work does not
282
+ // touch that session's stack. A frame whose plan only settled works ran (snapshot.settledPlans, from
283
+ // boulder.json) is over, so the top of another session is its last frame that is not.
284
+ const topLiveFrame = (other, settledPlans) => other?.frames?.findLast((frame) => !(frame.skill === "start-work" && frame.planRef && settledPlans.includes(frame.planRef.split("/").at(-1)))) ?? null;
285
+
281
286
  // herdr lanes of this project: sessions whose hooks ran in a herdr pane (their liveness record keeps
282
287
  // the pane id), drawn as lanes named `<top skill or claude> · <pane>`. This session, and any session
283
288
  // in this session's own pane, are never listed.
@@ -291,7 +296,8 @@ const herdrLanesOf = (snapshot, others, now) => {
291
296
  const other = others.find((candidate) => candidate.sessionId === id);
292
297
  const live = currentLiveness(entry, other?.at);
293
298
  if (live?.state === "ended" || (!live && other?.ended) || now - Math.max(entry.at, other?.at ?? -Infinity) > OTHER_SESSION_MS) return null;
294
- const top = other?.frames?.length ? frameThread(other.frames.at(-1), 0, {}, false, null, now) : { name: "claude", stage: null, done: null, total: null, state: "running", doneAt: null, active: false, elapsedMs: null };
299
+ const topFrame = topLiveFrame(other, snapshot.settledPlans ?? []);
300
+ const top = topFrame ? frameThread(topFrame, 0, {}, false, null, now) : { name: "claude", stage: null, done: null, total: null, state: "running", doneAt: null, active: false, elapsedMs: null };
295
301
  return { ...top, key: `herdr-${entry.herdrPane}`, sessionId: id, name: `${top.name} · ${entry.herdrPane}`, state: otherState(top, live), seenAt: Math.max(entry.at, other?.at ?? -Infinity) };
296
302
  })
297
303
  .filter((thread) => thread && lingering(thread, now))
@@ -332,10 +338,10 @@ const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve }) => {
332
338
  const others = (snapshot.workflow?.others ?? [])
333
339
  .filter((other) => {
334
340
  const live = currentLiveness(other.liveness, other.at);
335
- return (live ? live.state !== "ended" : !other.ended) && !inHerdr.has(other.sessionId) && now - seenAt(other) <= OTHER_SESSION_MS && other.frames?.length;
341
+ return (live ? live.state !== "ended" : !other.ended) && !inHerdr.has(other.sessionId) && now - seenAt(other) <= OTHER_SESSION_MS && topLiveFrame(other, snapshot.settledPlans ?? []);
336
342
  })
337
343
  .map((other) => {
338
- const thread = frameThread(other.frames.at(-1), 0, {}, false, null, now);
344
+ const thread = frameThread(topLiveFrame(other, snapshot.settledPlans ?? []), 0, {}, false, null, now);
339
345
  return { ...thread, key: `session-${other.id8}`, session: other.id8, state: otherState(thread, currentLiveness(other.liveness, other.at)), seenAt: seenAt(other) };
340
346
  })
341
347
  .filter((thread) => lingering(thread, now))