Skip to content

A self-organizing Obsidian vault that gives AI coding agents persistent memory.

fix: stop SessionStart from flashing Obsidian app on macOS, close ExperimentalWarning stderr leak (#83) (#87)

Brenno Ferrari36829a6303f5
diff --git a/.claude/scripts/lib/qmd-refresh.ts b/.claude/scripts/lib/qmd-refresh.ts
index d698d77..ae6f671 100644
--- a/.claude/scripts/lib/qmd-refresh.ts
+++ b/.claude/scripts/lib/qmd-refresh.ts
@@ -42,11 +42,17 @@ const SKIP_SEGMENTS: readonly string[] = [
* normalized so Windows paths (`C:\\vault\\note.md`) are handled the same
* as Unix paths.
*
+ * Parameter is typed `unknown` because the production caller pulls it
+ * from a hook JSON payload (`tool_input.file_path` is `unknown` at the
+ * type boundary), so the runtime narrowing here is the type guard for
+ * downstream code — tests pass `null` / `undefined` directly to lock the
+ * defensive path without needing an `as any` escape.
+ *
* Over-triggering is harmless (qmd update is idempotent and silent on
* no-op); under-triggering is the failure mode we optimize against, so
* the filter is deliberately permissive beyond the three skip segments.
*/
-export function shouldRefreshForPath(filePath: string): boolean {
+export function shouldRefreshForPath(filePath: unknown): boolean {
if (typeof filePath !== "string" || filePath === "") return false;
if (!filePath.toLowerCase().endsWith(".md")) return false;
const normalized = "/" + filePath.replaceAll("\\", "/");
@@ -180,7 +186,11 @@ function touchSentinel(sentinelPath: string): void {
function spawnDetachedWorker(workerPath: string, logPrefix: string): void {
const child = spawn(
process.execPath,
- ["--experimental-strip-types", workerPath],
+ [
+ "--disable-warning=ExperimentalWarning",
+ "--experimental-strip-types",
+ workerPath,
+ ],
{
detached: true,
stdio: "ignore",
diff --git a/.claude/scripts/lib/qmd.ts b/.claude/scripts/lib/qmd.ts
index bc15d23..9096348 100644
--- a/.claude/scripts/lib/qmd.ts
+++ b/.claude/scripts/lib/qmd.ts
@@ -41,7 +41,13 @@ export function resolveQmdEntry(): string | null {
// Fallback for global npm installs that aren't on this package's resolution
// path — ask npm directly where global packages live. Bounded timeout so a
// hung npm process can't block a fire-and-forget hook indefinitely.
- const npmRoot = spawnSync("npm", ["root", "-g"], {
+ //
+ // Single-string command with `shell: true` rather than args+shell so this
+ // stays clean on Node 24, which emits DEP0190 when args are passed with
+ // shell:true (the args get concatenated into the shell command unescaped,
+ // a real injection risk in the general case). Our command is a literal
+ // constant — no user input — so the concatenated form is safe.
+ const npmRoot = spawnSync("npm root -g", {
shell: true,
encoding: "utf8",
timeout: 3000,
@@ -62,6 +68,14 @@ export function resolveQmdEntry(): string | null {
* entrypoint resolves, `process.execPath` runs it directly with no shell
* (identical on every platform). When it doesn't, fall back to `qmd` via
* the platform shell — best-effort for non-npm installs.
+ *
+ * The shell-fallback path returns the whole invocation in `cmd` with an
+ * empty `args` so callers spawn it as a single shell command, not as
+ * `args` concatenated with `shell:true` — which Node 24 deprecates
+ * (DEP0190) because args+shell concatenation is an injection risk in
+ * the general case. Our subcommand args are typically literal constants,
+ * but we route through the safe form everywhere so a future caller can't
+ * accidentally introduce a shell-injection vector.
*/
export function buildQmdCommand(
entry: string | null,
@@ -77,5 +91,9 @@ export function buildQmdCommand(
args: [entry, ...subcommandArgs],
shell: false,
}
- : { cmd: "qmd", args: [...subcommandArgs], shell: true };
+ : {
+ cmd: ["qmd", ...subcommandArgs].join(" "),
+ args: [],
+ shell: true,
+ };
}
diff --git a/.claude/scripts/lib/session-start.ts b/.claude/scripts/lib/session-start.ts
index 4fd4d7b..f891d62 100644
--- a/.claude/scripts/lib/session-start.ts
+++ b/.claude/scripts/lib/session-start.ts
@@ -198,6 +198,114 @@ export function qmdArgsWithIndex(
: ["--index", index, ...subcommandArgs];
}
+/**
+ * True if a directory-entry name has a `.md` extension. Compared case-
+ * insensitively so files saved as `.MD` or `.Md` (legal on case-insensitive
+ * filesystems like NTFS and APFS, and produced by editors that preserve
+ * pasted casing) are still recognized as markdown.
+ */
+export function isMarkdownFilename(name: string): boolean {
+ return name.toLowerCase().endsWith(".md");
+}
+
+/**
+ * Extract the root-level entries from `vault-manifest.json`'s `infrastructure`
+ * list — files like CLAUDE.md, README.*.md, Home.md that aren't user content
+ * and therefore shouldn't be scanned for open tasks. Glob patterns with `/`
+ * (e.g. `.claude/**`) are excluded because they target subdirectories.
+ *
+ * Returns the raw patterns; matching against filenames is the caller's job
+ * via {@link isInfraFilename}.
+ */
+export function parseInfraRootFilenames(
+ manifestJson: string | null,
+): readonly string[] {
+ if (manifestJson === null) return [];
+ let parsed: unknown;
+ try {
+ parsed = JSON.parse(manifestJson);
+ } catch {
+ return [];
+ }
+ if (parsed === null || typeof parsed !== "object") return [];
+ const infra = (parsed as Record<string, unknown>)["infrastructure"];
+ if (!Array.isArray(infra)) return [];
+ return infra.filter(
+ (e): e is string => typeof e === "string" && !e.includes("/"),
+ );
+}
+
+/**
+ * True if `filename` matches any of the given root-level infrastructure
+ * patterns. Patterns are literal filenames (`CLAUDE.md`) or globs with `*`
+ * wildcards (`README.*.md`). Other regex metacharacters are escaped so a
+ * pattern like `foo.md` matches `foo.md`, not `fooXmd`.
+ */
+export function isInfraFilename(
+ filename: string,
+ patterns: readonly string[],
+): boolean {
+ for (const p of patterns) {
+ if (!p.includes("*")) {
+ if (filename === p) return true;
+ continue;
+ }
+ const re = new RegExp(
+ "^" +
+ p.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") +
+ "$",
+ );
+ if (re.test(filename)) return true;
+ }
+ return false;
+}
+
+/**
+ * Aggregate unchecked Markdown tasks (`- [ ] …`) across multiple files and
+ * format them as one string grouped by source. Tasks are taken in input
+ * order — the caller decides which sources matter most (e.g. work/active
+ * before vault root) and what counts as a "file". Returns "(no open tasks)"
+ * when nothing matches. Caps total tasks at `limit` so a single noisy file
+ * can't drown the section; non-positive `limit` returns "(no open tasks)".
+ *
+ * Source paths are sanitised before they become group headers — newlines
+ * and carriage returns in a filename (legal on POSIX, possible via shared
+ * drives) would otherwise corrupt the line-based output format and let
+ * downstream parsers mis-attribute tasks to the wrong source.
+ *
+ * Output shape:
+ *
+ * work/active/project-x.md
+ * - [ ] task one
+ * - [ ] task two
+ *
+ * 2026-05-18.md
+ * - [ ] daily task
+ */
+export function collectOpenTasks(
+ sources: readonly { readonly path: string; readonly content: string }[],
+ limit: number,
+): string {
+ const groups: string[] = [];
+ let collected = 0;
+ for (const { path, content } of sources) {
+ if (collected >= limit) break;
+ const lines = content
+ .split(/\r?\n/)
+ .filter((line) => /^\s*- \[ \]/.test(line));
+ if (lines.length === 0) continue;
+ const taken = lines.slice(0, limit - collected);
+ // Collapse any CR/LF run (POSIX-only filename oddity) to a literal
+ // `\n` escape — bare \r alone would otherwise slip past a /\r?\n/
+ // regex but still corrupt the line-based output on consumers that
+ // treat \r as a line separator (older macOS, some viewers).
+ const safePath = path.replace(/[\r\n]+/g, "\\n");
+ groups.push(`${safePath}\n${taken.join("\n")}`);
+ collected += taken.length;
+ }
+ return groups.length > 0 ? groups.join("\n\n") : "(no open tasks)";
+}
+
/**
* Format the "Brain Topics" section — one line per brain/ note with its
* description from frontmatter, so Claude sees what topic notes exist
diff --git a/.claude/scripts/qmd-mcp.mjs b/.claude/scripts/qmd-mcp.mjs
index fda5237..5b49de3 100644
--- a/.claude/scripts/qmd-mcp.mjs
+++ b/.claude/scripts/qmd-mcp.mjs
@@ -67,7 +67,12 @@ export function resolveQmdEntry() {
// Fallback for global npm installs that aren't on this package's resolution
// path — ask npm directly where global packages live. Bounded timeout so a
// hung npm process can't block MCP server startup indefinitely.
- const npmRoot = spawnSync("npm", ["root", "-g"], {
+ //
+ // Single-string command with shell:true rather than args+shell so this
+ // stays clean on Node 24 (DEP0190 — args concatenated with shell:true is
+ // an injection risk in the general case; our command is a literal
+ // constant so the concatenated form is safe).
+ const npmRoot = spawnSync("npm root -g", {
shell: true,
encoding: "utf8",
timeout: 3000,
@@ -146,13 +151,17 @@ export function resolveIndexSqlitePath(indexName, env, home) {
* When `qmdIndex` is a non-empty string, `--index <name>` is prepended to
* the mcp subcommand; otherwise the invocation matches the pre-per-vault
* shape for backward compatibility.
+ *
+ * The shell-fallback path folds args into a single command string so the
+ * spawn site uses shell:true WITHOUT args, dodging Node 24's DEP0190
+ * deprecation of the args+shell concatenation pattern.
*/
export function buildLaunchCommand(entry, extraArgs = [], qmdIndex = null) {
const mcpArgs = qmdIndex ? ["--index", qmdIndex, "mcp"] : ["mcp"];
const qmdArgs = [...mcpArgs, ...extraArgs];
return entry
? { cmd: process.execPath, args: [entry, ...qmdArgs], shell: false }
- : { cmd: "qmd", args: qmdArgs, shell: true };
+ : { cmd: ["qmd", ...qmdArgs].join(" "), args: [], shell: true };
}
function readManifestRaw() {
diff --git a/.claude/scripts/session-start.ts b/.claude/scripts/session-start.ts
index 9dd9538..63fc8ac 100644
--- a/.claude/scripts/session-start.ts
+++ b/.claude/scripts/session-start.ts
@@ -3,8 +3,9 @@
* SessionStart hook — inject vault context into the agent's first turn.
*
* Emits a markdown block on stdout with: date header, North Star excerpt,
- * recent git changes (last 48h), open tasks (via Obsidian CLI if available),
- * active work listing, and a full vault markdown file listing.
+ * brain-topics index, recent git changes (last 48h), open tasks aggregated
+ * from work/active/ and the vault root, active work listing, and a full
+ * vault markdown file listing.
*
* Also persists VAULT_PATH to CLAUDE_ENV_FILE when Claude Code provides it.
*/
@@ -29,6 +30,10 @@ import {
hasBrainContent,
parseQmdIndex,
qmdArgsWithIndex,
+ parseInfraRootFilenames,
+ isInfraFilename,
+ isMarkdownFilename,
+ collectOpenTasks,
} from "./lib/session-start.ts";
import { buildQmdCommand, resolveQmdEntry } from "./lib/qmd.ts";
@@ -57,6 +62,13 @@ if (envFile) {
}
}
+// Manifest is read once and reused: QMD's named index, the infrastructure
+// allowlist for openTasks(), and any future manifest-driven sections all
+// derive from the same source. Both helpers tolerate a null source so a
+// missing/malformed manifest degrades quietly.
+const manifestJson = readManifestRaw();
+const infraRootFilenames = parseInfraRootFilenames(manifestJson);
+
// Incremental QMD re-index. Fire-and-forget; ignore failures (qmd is optional).
// Scope to this vault's named index when the manifest declares one, so vaults
// sharing a machine don't blend results in QMD's default global index. Falls
@@ -65,7 +77,7 @@ if (envFile) {
// Route through `buildQmdCommand` so the same shim-bypass logic that fixes
// the MCP wrapper applies here too — `node qmd.js update` runs identically
// on Windows, macOS, and Linux; no platform conditionals.
-const qmdIndex = parseQmdIndex(readManifestRaw());
+const qmdIndex = parseQmdIndex(manifestJson);
const qmdUpdate = buildQmdCommand(
resolveQmdEntry(),
qmdArgsWithIndex(qmdIndex, ["update"]),
@@ -102,9 +114,9 @@ function runCmd(
function northStar(): string {
- // Prefer Obsidian CLI when available (authoritative for wikilink resolution)
- const cli = runCmd("obsidian", ["read", "file=North Star"]);
- if (cli.kind === "ok") return take(cli.stdout, 30);
+ // Filesystem-only: the path is fixed by template convention, so there's no
+ // wikilink-resolution value worth a CLI hop — and `spawnSync("obsidian", …)`
+ // launches the Electron app on macOS when no instance is running (#83).
try {
return take(readFileSync("brain/North Star.md", { encoding: "utf-8" }), 30);
} catch {
@@ -123,11 +135,53 @@ function recentChanges(): string {
return formatRecentChanges(r.stdout, 15);
}
+function readMarkdownSource(
+ path: string,
+): { path: string; content: string } | null {
+ try {
+ return { path, content: readFileSync(path, { encoding: "utf-8" }) };
+ } catch {
+ return null;
+ }
+}
+
+function listMarkdownSources(
+ dir: string,
+ pathFor: (name: string) => string,
+ skip: (name: string) => boolean = () => false,
+): { path: string; content: string }[] {
+ let entries: Dirent[];
+ try {
+ entries = readdirSync(dir, { withFileTypes: true });
+ } catch {
+ return [];
+ }
+ const sources: { path: string; content: string }[] = [];
+ for (const e of entries) {
+ if (!e.isFile() || !isMarkdownFilename(e.name) || skip(e.name)) continue;
+ const src = readMarkdownSource(pathFor(e.name));
+ if (src !== null) sources.push(src);
+ }
+ return sources;
+}
+
function openTasks(): string {
- const r = runCmd("obsidian", ["tasks", "daily", "todo"]);
- if (r.kind === "missing") return "(Obsidian CLI not available)";
- if (r.kind === "failed") return "(CLI timed out)";
- return take(r.stdout, 10);
+ // Filesystem scan, not `obsidian tasks daily todo` (#83 — that CLI flashes
+ // the Electron app on macOS). Order matters: project tasks in work/active/
+ // surface first, then vault-root notes (which is where daily notes live by
+ // Obsidian's default — empirically the dominant task store in user vaults).
+ // Infra files (CLAUDE.md, README.*.md, …) are excluded so the section is
+ // user content only. Paths use forward slashes so the output reads the same
+ // in Claude's context on any OS.
+ const sources = [
+ ...listMarkdownSources("work/active", (name) => `work/active/${name}`),
+ ...listMarkdownSources(
+ ".",
+ (name) => name,
+ (name) => isInfraFilename(name, infraRootFilenames),
+ ),
+ ];
+ return collectOpenTasks(sources, 10);
}
function brainIndex(): string {
diff --git a/.claude/scripts/tests/_helpers.ts b/.claude/scripts/tests/_helpers.ts
index 2e08a2a..b061515 100644
--- a/.claude/scripts/tests/_helpers.ts
+++ b/.claude/scripts/tests/_helpers.ts
@@ -2,9 +2,12 @@
* Shared helpers for hook-entry integration tests.
*
* runScript spawns the hook entry point the same way settings.json does:
- * `node --experimental-strip-types <script>` with JSON on stdin. Used by
- * classify-message.test.ts and validate-write.test.ts to exercise the
- * full stdin → stdout pipeline under the real runtime.
+ * `node --disable-warning=ExperimentalWarning --experimental-strip-types
+ * <script>` with JSON on stdin. The disable-warning flag mirrors the
+ * production hook command exactly so stderr-cleanliness assertions don't
+ * trip on Node's type-stripping warning (which is unrelated to the hook
+ * under test). Used by classify-message.test.ts and validate-write.test.ts
+ * to exercise the full stdin → stdout pipeline under the real runtime.
*
* hostPath normalizes POSIX-style literal test paths (e.g. `"/Users/x/foo"`)
* to the host platform via path.resolve. Needed on Windows, where the raw
@@ -38,7 +41,11 @@ export function runScript(
: JSON.stringify(stdin);
const proc = spawnSync(
process.execPath,
- ["--experimental-strip-types", scriptPath],
+ [
+ "--disable-warning=ExperimentalWarning",
+ "--experimental-strip-types",
+ scriptPath,
+ ],
{
input,
encoding: "utf-8",
diff --git a/.claude/scripts/tests/classify-message.test.ts b/.claude/scripts/tests/classify-message.test.ts
index 1f4cfca..e042af6 100644
--- a/.claude/scripts/tests/classify-message.test.ts
+++ b/.claude/scripts/tests/classify-message.test.ts
@@ -338,8 +338,13 @@ describe("classify-message (subprocess)", () => {
});
test("empty stdin", () => {
- const { code } = runScript(null);
+ // Regression guard: empty stdin must short-circuit AND keep stderr
+ // clean. Without the `--disable-warning=ExperimentalWarning` flag
+ // in _helpers.ts, Node's type-stripping warning would leak here.
+ const { code, stdout, stderr } = runScript(null);
assert.equal(code, 0);
+ assert.equal(stdout.trim(), "");
+ assert.equal(stderr, "");
});
test("empty prompt string", () => {
diff --git a/.claude/scripts/tests/qmd-mcp.test.ts b/.claude/scripts/tests/qmd-mcp.test.ts
index e2f9a4e..95c70f0 100644
--- a/.claude/scripts/tests/qmd-mcp.test.ts
+++ b/.claude/scripts/tests/qmd-mcp.test.ts
@@ -76,16 +76,21 @@ describe("buildLaunchCommand", () => {
]);
});
- test("falls back to bare `qmd` with shell: true when resolution returns null", () => {
+ test("falls back to a single-string shell command when resolution returns null", () => {
+ // Single-string command with shell:true (not args+shell) so Node 24
+ // doesn't fire DEP0190. Args fold into the cmd string at build time
+ // so the spawn site can't accidentally reintroduce the deprecated
+ // args+shell pattern.
const { cmd, args, shell } = buildLaunchCommand(null, []);
- assert.equal(cmd, "qmd");
- assert.deepEqual(args, ["mcp"]);
+ assert.equal(cmd, "qmd mcp");
+ assert.deepEqual(args, []);
assert.equal(shell, true);
});
- test("fallback path still forwards extra argv", () => {
- const { args } = buildLaunchCommand(null, ["--debug"]);
- assert.deepEqual(args, ["mcp", "--debug"]);
+ test("fallback path folds extra argv into the cmd string", () => {
+ const { cmd, args } = buildLaunchCommand(null, ["--debug"]);
+ assert.equal(cmd, "qmd mcp --debug");
+ assert.deepEqual(args, []);
});
test("prepends --index <name> when a qmdIndex is provided (resolved branch)", () => {
@@ -99,8 +104,9 @@ describe("buildLaunchCommand", () => {
});
test("prepends --index <name> when a qmdIndex is provided (fallback branch)", () => {
- const { args } = buildLaunchCommand(null, [], "my-vault");
- assert.deepEqual(args, ["--index", "my-vault", "mcp"]);
+ const { cmd, args } = buildLaunchCommand(null, [], "my-vault");
+ assert.equal(cmd, "qmd --index my-vault mcp");
+ assert.deepEqual(args, []);
});
test("qmdIndex + extra argv compose correctly", () => {
diff --git a/.claude/scripts/tests/qmd-refresh.integration.test.ts b/.claude/scripts/tests/qmd-refresh.integration.test.ts
index ca31f7b..421535e 100644
--- a/.claude/scripts/tests/qmd-refresh.integration.test.ts
+++ b/.claude/scripts/tests/qmd-refresh.integration.test.ts
@@ -3,10 +3,10 @@
*
* Exercises the real stdin → decision → sentinel pipeline by spawning
* the hook entry script exactly the way each agent's settings.json
- * would: `node --experimental-strip-types qmd-refresh.ts` with a JSON
- * payload on stdin. The sentinel file is the only observable the hook
- * produces (stdout must stay silent), so each test asserts on sentinel
- * presence / mtime + exit code.
+ * would: `node --disable-warning=ExperimentalWarning --experimental-strip-types
+ * qmd-refresh.ts` with a JSON payload on stdin. The sentinel file is the
+ * only observable the hook produces (stdout AND stderr must stay silent),
+ * so each test asserts on sentinel presence / mtime + exit code.
*
* Deliberately does NOT depend on qmd being installed. The hook's
* short-circuit when `resolveQmdEntry()` returns null means the
@@ -103,77 +103,88 @@ describe("qmd-refresh — silent no-op on ineligible inputs", () => {
});
test("malformed JSON exits 0 silently", () => {
- const { stdout, code } = runHook("not json {{{");
+ const { stdout, stderr, code } = runHook("not json {{{");
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test("missing tool_input exits 0 silently", () => {
- const { stdout, code } = runHook({});
+ const { stdout, stderr, code } = runHook({});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test("null tool_input exits 0 silently", () => {
- const { stdout, code } = runHook({ tool_input: null });
+ const { stdout, stderr, code } = runHook({ tool_input: null });
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test("non-string file_path exits 0 silently", () => {
- const { stdout, code } = runHook({ tool_input: { file_path: 42 } });
+ const { stdout, stderr, code } = runHook({
+ tool_input: { file_path: 42 },
+ });
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test("non-markdown path exits 0 silently", () => {
- const { stdout, code } = runHook({
+ const { stdout, stderr, code } = runHook({
tool_input: { file_path: "/vault/work/active/note.txt" },
});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test(".git path exits 0 silently", () => {
- const { stdout, code } = runHook({
+ const { stdout, stderr, code } = runHook({
tool_input: { file_path: "/vault/.git/HEAD.md" },
});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test(".obsidian path exits 0 silently", () => {
- const { stdout, code } = runHook({
+ const { stdout, stderr, code } = runHook({
tool_input: { file_path: "/vault/.obsidian/workspace.md" },
});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test("node_modules path exits 0 silently", () => {
- const { stdout, code } = runHook({
+ const { stdout, stderr, code } = runHook({
tool_input: {
file_path: "/vault/.claude/scripts/node_modules/foo/README.md",
},
});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
test("Windows-form skip path exits 0 silently", () => {
- const { stdout, code } = runHook({
+ const { stdout, stderr, code } = runHook({
tool_input: { file_path: "C:\\vault\\.git\\info\\note.md" },
});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
assert.equal(sentinelMtime(), null);
});
});
@@ -186,12 +197,13 @@ describe("qmd-refresh — debounce", () => {
const before = sentinelMtime();
assert.ok(before !== null, "sentinel should exist after writeFileSync");
- const { stdout, code } = runHook({
+ const { stdout, stderr, code } = runHook({
tool_input: { file_path: join(VAULT_ROOT, "work/active/note.md") },
});
assert.equal(code, 0);
assert.equal(stdout, "");
+ assert.equal(stderr, "");
// A debounced run must not bump the sentinel mtime; the whole
// point is that a burst of writes only spawns one worker per
// window.
diff --git a/.claude/scripts/tests/qmd-refresh.test.ts b/.claude/scripts/tests/qmd-refresh.test.ts
index 00c95a2..c753331 100644
--- a/.claude/scripts/tests/qmd-refresh.test.ts
+++ b/.claude/scripts/tests/qmd-refresh.test.ts
@@ -62,10 +62,13 @@ describe("shouldRefreshForPath — rejects non-markdown writes", () => {
assert.equal(shouldRefreshForPath(""), false);
});
test("rejects non-string (defensive)", () => {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- assert.equal(shouldRefreshForPath(undefined as any), false);
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- assert.equal(shouldRefreshForPath(null as any), false);
+ // Function takes `unknown` so the runtime narrowing is the type
+ // guard for downstream — no escape hatch needed in callers or tests.
+ assert.equal(shouldRefreshForPath(undefined), false);
+ assert.equal(shouldRefreshForPath(null), false);
+ assert.equal(shouldRefreshForPath(42), false);
+ assert.equal(shouldRefreshForPath({}), false);
+ assert.equal(shouldRefreshForPath([]), false);
});
test("rejects .txt, .json, .ts, .yaml", () => {
assert.equal(shouldRefreshForPath("work/note.txt"), false);
@@ -245,19 +248,27 @@ describe("composeWorkerInvocations", () => {
}
});
- test("falls back to bare `qmd` with shell: true when entry is null", () => {
+ test("falls back to single-string `qmd …` shell command when entry is null", () => {
+ // Args fold into cmd at build time so the spawn site uses shell:true
+ // WITHOUT args — Node 24's DEP0190 only fires on the deprecated
+ // args+shell concatenation pattern.
const invs = composeWorkerInvocations("v", null);
- for (const inv of invs) {
- assert.equal(inv.cmd, "qmd");
+ const subcommands = ["update", "embed", "update"];
+ invs.forEach((inv, i) => {
+ assert.equal(inv.cmd, `qmd --index v ${subcommands[i]}`);
+ assert.deepEqual(inv.args, []);
assert.equal(inv.shell, true);
- }
+ });
});
test("fallback preserves --index threading across all steps", () => {
const invs = composeWorkerInvocations("vault-2", null);
- assert.deepEqual(invs[0]?.args, ["--index", "vault-2", "update"]);
- assert.deepEqual(invs[1]?.args, ["--index", "vault-2", "embed"]);
- assert.deepEqual(invs[2]?.args, ["--index", "vault-2", "update"]);
+ assert.equal(invs[0]?.cmd, "qmd --index vault-2 update");
+ assert.equal(invs[1]?.cmd, "qmd --index vault-2 embed");
+ assert.equal(invs[2]?.cmd, "qmd --index vault-2 update");
+ for (const inv of invs) {
+ assert.deepEqual(inv.args, []);
+ }
});
test("embed gets a longer budget than update (model download slot)", () => {
diff --git a/.claude/scripts/tests/qmd.test.ts b/.claude/scripts/tests/qmd.test.ts
index d977594..1f10f69 100644
--- a/.claude/scripts/tests/qmd.test.ts
+++ b/.claude/scripts/tests/qmd.test.ts
@@ -73,21 +73,28 @@ describe("lib/qmd.buildQmdCommand", () => {
]);
});
- test("falls back to bare `qmd` with shell: true when resolution returns null", () => {
+ test("falls back to a single-string shell command when resolution returns null", () => {
+ // Single-string command with shell:true (not args+shell) so Node 24
+ // doesn't fire DEP0190 about unescaped concatenation. Args fold into
+ // the command string at build time so callers never reintroduce the
+ // deprecated pattern at the spawn site.
const out = buildQmdCommand(null, ["update"]);
- assert.equal(out.cmd, "qmd");
- assert.deepEqual(out.args, ["update"]);
+ assert.equal(out.cmd, "qmd update");
+ assert.deepEqual(out.args, []);
assert.equal(out.shell, true);
});
- test("fallback forwards multi-arg subcommands", () => {
+ test("fallback folds multi-arg subcommands into the single command string", () => {
const out = buildQmdCommand(null, ["--index", "vault-a", "embed"]);
- assert.deepEqual(out.args, ["--index", "vault-a", "embed"]);
+ assert.equal(out.cmd, "qmd --index vault-a embed");
+ assert.deepEqual(out.args, []);
});
- test("returns a fresh args array (does not alias the input)", () => {
+ test("fallback args array is always empty (single-string contract)", () => {
const input = ["update"];
const out = buildQmdCommand(null, input);
+ assert.deepEqual(out.args, []);
+ // And the returned args is its own array, not aliased to the input.
assert.notEqual(out.args, input);
});
});
diff --git a/.claude/scripts/tests/session-start.integration.test.ts b/.claude/scripts/tests/session-start.integration.test.ts
new file mode 100644
index 0000000..70da83c
--- /dev/null
+++ b/.claude/scripts/tests/session-start.integration.test.ts
@@ -0,0 +1,124 @@
+/**
+ * Subprocess integration test for the SessionStart hook.
+ *
+ * Spawns the hook exactly the way each agent's settings.json would:
+ * `node --disable-warning=ExperimentalWarning --experimental-strip-types
+ * session-start.ts` against a synthetic vault. Locks the contracts the
+ * unit-level tests can't reach:
+ *
+ * - Exit code 0 on a minimal vault (no manifest, no work/active/, no git).
+ * - stderr is silent — proves the warning-suppression flag is wired
+ * correctly on this hook, not just on qmd-refresh.
+ * - stdout contains every required section header, in order, so a
+ * regression that drops a section is caught.
+ * - openTasks emits "(no open tasks)" when work/active/ and the vault
+ * root are empty of user content — covers the post-#83 redesign at
+ * the orchestrator level (the pure-helper tests cover the algorithm).
+ * - openTasks emits a task with source attribution when work/active/
+ * contains one.
+ *
+ * Runs identically on Windows, macOS, and Linux. QMD's spawnSync inside
+ * the hook is a graceful no-op when qmd isn't installed; when it is, the
+ * incremental update against a tmp dir is fast and side-effect-free.
+ */
+
+import { test, describe, after, before } from "node:test";
+import assert from "node:assert/strict";
+import { fileURLToPath } from "node:url";
+import { dirname, join, resolve } from "node:path";
+import {
+ mkdtempSync,
+ mkdirSync,
+ rmSync,
+ writeFileSync,
+} from "node:fs";
+import { tmpdir } from "node:os";
+import { runScript as spawnHook } from "./_helpers.ts";
+
+const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
+const SCRIPT = resolve(SCRIPT_DIR, "../session-start.ts");
+
+let TMP_DIR = "";
+
+before(() => {
+ TMP_DIR = mkdtempSync(join(tmpdir(), "session-start-integration-"));
+ mkdirSync(join(TMP_DIR, "brain"));
+ mkdirSync(join(TMP_DIR, "work", "active"), { recursive: true });
+ writeFileSync(
+ join(TMP_DIR, "brain", "North Star.md"),
+ "---\ndescription: test\n---\n\n# North Star\n\n- placeholder\n",
+ );
+});
+
+after(() => {
+ if (TMP_DIR) rmSync(TMP_DIR, { recursive: true, force: true });
+});
+
+const runHook = () => spawnHook(SCRIPT, "", { CLAUDE_PROJECT_DIR: TMP_DIR });
+
+const REQUIRED_SECTIONS = [
+ "### Date",
+ "### North Star (current goals)",
+ "### Brain Topics (read on demand)",
+ "### Recent Changes (last 48h)",
+ "### Open Tasks",
+ "### Active Work",
+ "### Vault File Listing",
+];
+
+describe("session-start — silence contract and structure", () => {
+ test("exits 0 with empty stderr on a minimal vault", () => {
+ const { code, stderr } = runHook();
+ assert.equal(code, 0);
+ assert.equal(
+ stderr,
+ "",
+ "hook must be silent on stderr — the --disable-warning=ExperimentalWarning flag in _helpers.ts is the regression guard for this contract",
+ );
+ });
+
+ test("stdout contains every required section header in order", () => {
+ const { stdout } = runHook();
+ let cursor = 0;
+ for (const header of REQUIRED_SECTIONS) {
+ const idx = stdout.indexOf(header, cursor);
+ assert.notEqual(
+ idx,
+ -1,
+ `section "${header}" missing or out of order in hook output`,
+ );
+ cursor = idx + header.length;
+ }
+ });
+
+ test("openTasks reports '(no open tasks)' for a vault with no user content", () => {
+ // work/active/ is empty and vault root contains no non-infra .md files.
+ const { stdout } = runHook();
+ const open = stdout.split("### Open Tasks\n")[1]?.split("\n### ")[0];
+ assert.ok(open !== undefined, "Open Tasks section should be present");
+ assert.match(open ?? "", /\(no open tasks\)/);
+ });
+});
+
+describe("session-start — openTasks aggregation", () => {
+ test("emits a task with source attribution when work/active/ has one", () => {
+ const projectFile = join(TMP_DIR, "work", "active", "project-x.md");
+ writeFileSync(
+ projectFile,
+ "---\ndescription: test project\n---\n\n## Tasks\n- [ ] do the thing\n- [x] already done\n",
+ );
+ try {
+ const { stdout, stderr, code } = runHook();
+ assert.equal(code, 0);
+ assert.equal(stderr, "");
+ const open = stdout.split("### Open Tasks\n")[1]?.split("\n### ")[0] ?? "";
+ // Forward-slash source path (cross-platform display); only the
+ // unchecked task surfaces; the checked one is filtered.
+ assert.match(open, /work\/active\/project-x\.md/);
+ assert.match(open, /- \[ \] do the thing/);
+ assert.doesNotMatch(open, /already done/);
+ } finally {
+ rmSync(projectFile, { force: true });
+ }
+ });
+});
diff --git a/.claude/scripts/tests/session-start.test.ts b/.claude/scripts/tests/session-start.test.ts
index cef35e7..1e7bbec 100644
--- a/.claude/scripts/tests/session-start.test.ts
+++ b/.claude/scripts/tests/session-start.test.ts
@@ -20,6 +20,10 @@ import {
parseQmdIndex,
qmdArgsWithIndex,
isValidQmdIndex,
+ parseInfraRootFilenames,
+ isInfraFilename,
+ isMarkdownFilename,
+ collectOpenTasks,
} from "../lib/session-start.ts";
describe("take", () => {
@@ -299,6 +303,235 @@ describe("qmdArgsWithIndex", () => {
});
});
+describe("isMarkdownFilename", () => {
+ test("accepts lowercase .md", () => {
+ assert.equal(isMarkdownFilename("note.md"), true);
+ });
+ test("accepts uppercase .MD (case-insensitive filesystem reality)", () => {
+ assert.equal(isMarkdownFilename("PROJECT.MD"), true);
+ });
+ test("accepts mixed-case .Md and .mD", () => {
+ assert.equal(isMarkdownFilename("Daily.Md"), true);
+ assert.equal(isMarkdownFilename("notes.mD"), true);
+ });
+ test("rejects non-markdown extensions", () => {
+ assert.equal(isMarkdownFilename("note.txt"), false);
+ assert.equal(isMarkdownFilename("note.markdown"), false);
+ assert.equal(isMarkdownFilename("note.mdx"), false);
+ });
+ test("rejects bare names without an extension", () => {
+ assert.equal(isMarkdownFilename(""), false);
+ assert.equal(isMarkdownFilename("md"), false);
+ assert.equal(isMarkdownFilename("note"), false);
+ });
+ test("rejects names where .md appears mid-string", () => {
+ assert.equal(isMarkdownFilename("note.md.bak"), false);
+ assert.equal(isMarkdownFilename(".mdrc"), false);
+ });
+});
+
+describe("parseInfraRootFilenames", () => {
+ test("returns empty when manifest is null", () => {
+ assert.deepEqual(parseInfraRootFilenames(null), []);
+ });
+ test("returns empty when JSON is malformed", () => {
+ assert.deepEqual(parseInfraRootFilenames("{ not json"), []);
+ });
+ test("returns empty when parsed value is not an object", () => {
+ assert.deepEqual(parseInfraRootFilenames('"a string"'), []);
+ assert.deepEqual(parseInfraRootFilenames("null"), []);
+ });
+ test("returns empty when infrastructure field is absent", () => {
+ assert.deepEqual(parseInfraRootFilenames(JSON.stringify({})), []);
+ });
+ test("returns empty when infrastructure field is not an array", () => {
+ assert.deepEqual(
+ parseInfraRootFilenames(JSON.stringify({ infrastructure: "CLAUDE.md" })),
+ [],
+ );
+ });
+ test("returns only the root-level entries (filters out anything containing '/')", () => {
+ const manifest = JSON.stringify({
+ infrastructure: [
+ "CLAUDE.md",
+ "README.*.md",
+ ".claude/**",
+ "templates/**",
+ "Home.md",
+ ],
+ });
+ assert.deepEqual(parseInfraRootFilenames(manifest), [
+ "CLAUDE.md",
+ "README.*.md",
+ "Home.md",
+ ]);
+ });
+ test("filters out non-string entries silently", () => {
+ const manifest = JSON.stringify({
+ infrastructure: ["CLAUDE.md", 42, null, "Home.md"],
+ });
+ assert.deepEqual(parseInfraRootFilenames(manifest), [
+ "CLAUDE.md",
+ "Home.md",
+ ]);
+ });
+});
+
+describe("isInfraFilename", () => {
+ // Mirrors the vault-manifest.json shape: literal entries for the canonical
+ // names plus a glob for localized README variants. Both forms must work.
+ const patterns = ["CLAUDE.md", "README.md", "README.*.md", "Home.md"];
+
+ test("matches literal filenames exactly", () => {
+ assert.equal(isInfraFilename("CLAUDE.md", patterns), true);
+ assert.equal(isInfraFilename("README.md", patterns), true);
+ assert.equal(isInfraFilename("Home.md", patterns), true);
+ });
+ test("rejects close-but-not-equal filenames", () => {
+ assert.equal(isInfraFilename("claude.md", patterns), false); // case-sensitive
+ assert.equal(isInfraFilename("CLAUDE.md.bak", patterns), false);
+ assert.equal(isInfraFilename("MY-CLAUDE.md", patterns), false);
+ });
+ test("glob patterns match the localized variants they target", () => {
+ assert.equal(isInfraFilename("README.ja.md", patterns), true);
+ assert.equal(isInfraFilename("README.zh-CN.md", patterns), true);
+ });
+ test("bare * pattern matches every filename — documented footgun", () => {
+ // If a user writes `"infrastructure": ["*"]` in vault-manifest.json,
+ // every root-level file is treated as infra and openTasks empties out.
+ // The behavior is "you asked, you get" — but locked here so a future
+ // stricter parser doesn't silently regress this corner.
+ assert.equal(isInfraFilename("anything.md", ["*"]), true);
+ assert.equal(isInfraFilename("", ["*"]), true);
+ });
+ test("multiple wildcards in one pattern", () => {
+ assert.equal(isInfraFilename("foo.bar.md", ["*.bar.*"]), true);
+ assert.equal(isInfraFilename("foo.qux.md", ["*.bar.*"]), false);
+ });
+ test("escapes regex metacharacters in literal segments of patterns", () => {
+ // `.` in `CLAUDE.md` must not match `CLAUDExmd`
+ assert.equal(isInfraFilename("CLAUDExmd", patterns), false);
+ });
+ test("returns false on empty pattern list", () => {
+ assert.equal(isInfraFilename("CLAUDE.md", []), false);
+ });
+ test("user content files are not infra", () => {
+ assert.equal(isInfraFilename("2026-05-18.md", patterns), false);
+ assert.equal(isInfraFilename("my-project.md", patterns), false);
+ });
+});
+
+describe("collectOpenTasks", () => {
+ test("aggregates tasks grouped by source, preserving input order", () => {
+ const sources = [
+ { path: "work/active/a.md", content: "- [ ] task A1\n- [ ] task A2" },
+ { path: "work/active/b.md", content: "- [ ] task B1" },
+ ];
+ assert.equal(
+ collectOpenTasks(sources, 10),
+ "work/active/a.md\n- [ ] task A1\n- [ ] task A2\n\nwork/active/b.md\n- [ ] task B1",
+ );
+ });
+ test("skips sources with no unchecked tasks", () => {
+ const sources = [
+ { path: "a.md", content: "# Heading\n\nprose only" },
+ { path: "b.md", content: "- [ ] real task" },
+ ];
+ assert.equal(collectOpenTasks(sources, 10), "b.md\n- [ ] real task");
+ });
+ test("ignores checked tasks (both [x] and [X])", () => {
+ const sources = [
+ {
+ path: "a.md",
+ content: "- [ ] open\n- [x] done\n- [X] also done\n- [ ] still open",
+ },
+ ];
+ assert.equal(
+ collectOpenTasks(sources, 10),
+ "a.md\n- [ ] open\n- [ ] still open",
+ );
+ });
+ test("preserves leading indentation on nested tasks", () => {
+ const sources = [
+ { path: "a.md", content: " - [ ] nested\n- [ ] top-level" },
+ ];
+ assert.equal(
+ collectOpenTasks(sources, 10),
+ "a.md\n - [ ] nested\n- [ ] top-level",
+ );
+ });
+ test("handles CRLF line endings", () => {
+ const sources = [{ path: "a.md", content: "- [ ] one\r\n- [ ] two\r\n" }];
+ assert.equal(collectOpenTasks(sources, 10), "a.md\n- [ ] one\n- [ ] two");
+ });
+ test("respects the total limit across multiple sources", () => {
+ const sources = [
+ { path: "a.md", content: "- [ ] a1\n- [ ] a2\n- [ ] a3" },
+ { path: "b.md", content: "- [ ] b1\n- [ ] b2" },
+ ];
+ // limit 4: a1, a2, a3 from a.md (3); then 1 task from b.md
+ assert.equal(
+ collectOpenTasks(sources, 4),
+ "a.md\n- [ ] a1\n- [ ] a2\n- [ ] a3\n\nb.md\n- [ ] b1",
+ );
+ });
+ test("stops emitting groups once limit is fully consumed", () => {
+ const sources = [
+ { path: "a.md", content: "- [ ] a1\n- [ ] a2" },
+ { path: "b.md", content: "- [ ] b1" },
+ ];
+ assert.equal(collectOpenTasks(sources, 2), "a.md\n- [ ] a1\n- [ ] a2");
+ });
+ test("empty source list → '(no open tasks)'", () => {
+ assert.equal(collectOpenTasks([], 10), "(no open tasks)");
+ });
+ test("all sources empty of tasks → '(no open tasks)'", () => {
+ const sources = [
+ { path: "a.md", content: "# Heading\n\nprose" },
+ { path: "b.md", content: "- [x] done" },
+ ];
+ assert.equal(collectOpenTasks(sources, 10), "(no open tasks)");
+ });
+ test("ignores non-task list items like bare bullets and starred lists", () => {
+ const sources = [
+ {
+ path: "a.md",
+ content: "- just a bullet\n- [ ] real task\n* [ ] not a dash",
+ },
+ ];
+ assert.equal(collectOpenTasks(sources, 10), "a.md\n- [ ] real task");
+ });
+ test("limit of 0 yields '(no open tasks)' even when sources are non-empty", () => {
+ const sources = [{ path: "a.md", content: "- [ ] task one" }];
+ assert.equal(collectOpenTasks(sources, 0), "(no open tasks)");
+ });
+ test("negative limit is treated like zero (no group ever emits)", () => {
+ const sources = [{ path: "a.md", content: "- [ ] task one" }];
+ assert.equal(collectOpenTasks(sources, -5), "(no open tasks)");
+ });
+ test("newlines in source path are escaped so they cannot corrupt the line-based output", () => {
+ // readdirSync on POSIX can return filenames containing newlines; if such
+ // a name reached the output unescaped, downstream parsers would split
+ // the path across two lines and misattribute the following task.
+ const sources = [
+ { path: "work/active/oops\nname.md", content: "- [ ] task one" },
+ ];
+ assert.equal(
+ collectOpenTasks(sources, 10),
+ "work/active/oops\\nname.md\n- [ ] task one",
+ );
+ });
+ test("carriage-return in source path is also escaped (Windows network shares)", () => {
+ const sources = [
+ { path: "work/active/odd\rname.md", content: "- [ ] task one" },
+ ];
+ assert.equal(
+ collectOpenTasks(sources, 10),
+ "work/active/odd\\nname.md\n- [ ] task one",
+ );
+ });
+});
+
describe("formatBrainIndex", () => {
test("renders one wikilink + description per entry", () => {
const out = formatBrainIndex([
diff --git a/.claude/scripts/tests/validate-write.test.ts b/.claude/scripts/tests/validate-write.test.ts
index 6644bda..712ad5f 100644
--- a/.claude/scripts/tests/validate-write.test.ts
+++ b/.claude/scripts/tests/validate-write.test.ts
@@ -221,7 +221,12 @@ describe("validate-write — robustness to bad input", () => {
assert.equal(code, 0);
});
test("empty stdin", () => {
- const { code } = runScript(null);
+ // Regression guard: empty stdin must short-circuit AND keep stderr
+ // clean. Without the `--disable-warning=ExperimentalWarning` flag
+ // in _helpers.ts, Node's type-stripping warning would leak here.
+ const { code, stdout, stderr } = runScript(null);
assert.equal(code, 0);
+ assert.equal(stdout, "");
+ assert.equal(stderr, "");
});
});
diff --git a/.claude/settings.json b/.claude/settings.json
index 18b219a..f3557d1 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/session-start.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/session-start.ts\"",
"timeout": 30
}
]
@@ -17,7 +17,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/classify-message.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/classify-message.ts\"",
"timeout": 15
}
]
@@ -29,12 +29,12 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/validate-write.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/validate-write.ts\"",
"timeout": 15
},
{
"type": "command",
- "command": "node --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/qmd-refresh.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/qmd-refresh.ts\"",
"timeout": 15
}
]
@@ -45,7 +45,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/pre-compact.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/pre-compact.ts\"",
"timeout": 30
}
]
@@ -56,7 +56,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/stop-checklist.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CLAUDE_PROJECT_DIR:-.}/.claude/scripts/stop-checklist.ts\"",
"timeout": 5
}
]
diff --git a/.codex/hooks.json b/.codex/hooks.json
index 762e848..90747e4 100644
--- a/.codex/hooks.json
+++ b/.codex/hooks.json
@@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/session-start.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/session-start.ts\"",
"timeout": 30
}
]
@@ -17,7 +17,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/classify-message.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/classify-message.ts\"",
"timeout": 15
}
]
@@ -29,12 +29,12 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/validate-write.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/validate-write.ts\"",
"timeout": 15
},
{
"type": "command",
- "command": "node --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/qmd-refresh.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/qmd-refresh.ts\"",
"timeout": 15
}
]
@@ -45,7 +45,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/stop-checklist.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${CODEX_PROJECT_DIR:-.}/.claude/scripts/stop-checklist.ts\"",
"timeout": 5
}
]
diff --git a/.gemini/settings.json b/.gemini/settings.json
index 6e01cd9..3382bd4 100644
--- a/.gemini/settings.json
+++ b/.gemini/settings.json
@@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/session-start.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/session-start.ts\"",
"timeout": 30000
}
]
@@ -17,7 +17,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/classify-message.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/classify-message.ts\"",
"timeout": 15000
}
]
@@ -29,12 +29,12 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/validate-write.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/validate-write.ts\"",
"timeout": 15000
},
{
"type": "command",
- "command": "node --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/qmd-refresh.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/qmd-refresh.ts\"",
"timeout": 15000
}
]
@@ -45,7 +45,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/pre-compact.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/pre-compact.ts\"",
"timeout": 30000
}
]
@@ -56,7 +56,7 @@
"hooks": [
{
"type": "command",
- "command": "node --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/stop-checklist.ts\"",
+ "command": "node --disable-warning=ExperimentalWarning --experimental-strip-types \"${GEMINI_PROJECT_DIR:-.}/.claude/scripts/stop-checklist.ts\"",
"timeout": 5000
}
]
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 446990c..31c5e16 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -162,7 +162,7 @@ sequenceDiagram
A few specific design choices are worth calling out:
-- **`SessionStart` injects, it does not load.** It builds a ~2K-token briefing (filename listing, North Star excerpt, git summary, open tasks) and hands it to the agent. Full note contents never flow through this hook.
+- **`SessionStart` injects, it does not load.** It builds a ~2K-token briefing (filename listing, North Star excerpt, git summary, open tasks aggregated from `work/active/` and the vault root) and hands it to the agent. Full note contents never flow through this hook. The open-tasks scan is filesystem-only so the hook never spawns the Obsidian CLI — that subprocess flashes the Electron app on macOS when no instance is running (#83).
- **`UserPromptSubmit` classifies, it does not route.** It tags the prompt with hints like `ARCHITECTURE discussion` or `DECISION`; the agent decides where to file. Keeping the hook opinion-free means the routing logic lives in `CLAUDE.md`, which is editable per-user without touching scripts.
- **QMD refresh is shared, debounced, and detached.** Three hook entries fire the same refresh helper — `PostToolUse` (after `.md` writes), `PreCompact` (before transcript backup; writes tend to cluster before compaction), and `Stop` (end of session) — sharing one sentinel file so a burst of events produces at most one worker per debounce window. The actual indexing runs in `.claude/scripts/qmd-refresh-run.ts` as a detached, stdio-silent worker (`qmd update` → `qmd embed` → tail-chase `qmd update`), so the parent hook returns in milliseconds and nothing flows to the agent's context.
- **`PreCompact` also backs up the transcript.** In addition to kicking the QMD refresh, it copies the current session transcript out to `thinking/session-logs/` so long conversations remain recoverable after compaction.
diff --git a/CLAUDE.md b/CLAUDE.md
index 76db81e..abcb8fd 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -97,7 +97,7 @@ obsidian orphans # Unlinked notes
### Starting a Substantial Session
-The `SessionStart` hook automatically injects rich context: vault file listing, North Star goals, active work, recent git changes, open tasks, and triggers a QMD re-index. Most context is already loaded -- you don't need to manually read files.
+The `SessionStart` hook automatically injects rich context: vault file listing, North Star goals, active work, recent git changes, open tasks (aggregated from `work/active/` and the vault root, excluding infrastructure files), and triggers a QMD re-index. Most context is already loaded -- you don't need to manually read files.
**Shortcut**: Run `/om-standup` for a structured morning kickoff that reads everything and presents a summary with suggested priorities.