@mmnto/cli 1.109.0 → 1.110.0

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.
@@ -54,7 +54,7 @@ export declare const BARE_REF_REGEX_SOURCE = "(?<!\\b[\\w-]+/[\\w-]+)#(\\d+)(?![
54
54
  * both templates start with it, so the constant stays the single source of truth.
55
55
  */
56
56
  export declare const SESSION_START_MARKER = "// [totem] auto-generated";
57
- export declare const GEMINI_SESSION_START = "// [totem] auto-generated \u2014 Gemini CLI SessionStart hook\n// Runs `totem describe` at the start of every Gemini CLI session to emit\n// the project-orientation banner (\"[Describe] Project: ... Lessons: N\n// Targets: N Hooks: ...\"). Matches the family-canonical pattern used by\n// totem-strategy, totem-substrate, arhgap11, and totem-status, and\n// matches the Claude-side SessionStart hook scaffolded by this same init\n// pass (mmnto-ai/totem#1884).\nconst { execSync } = require('child_process');\n\n// totem-status refresh-gh \u2014 GH-federation snapshot refresh (mmnto-ai/totem-status#127\n// C3 residual; tracking mmnto-ai/totem#2556). Spawn-and-forget, detached+unref, and\n// fired BEFORE the synchronous describe/orient briefings so it overlaps them: session\n// start must never block on it (mmnto-ai/totem#2059 measured ~3s of synchronous gh\n// calls here). The verb's exit-0-or-nothing contract (single-flight, atomic rename,\n// no-clobber when gh is missing) makes blind firing safe. ENOENT = the sidecar is not\n// adopted in this repo (the common non-cohort case) \u2014 zero noise; any other spawn\n// failure keeps a non-fatal stderr breadcrumb.\n// PRIMARY checkout only (.git must be a DIRECTORY): in a linked worktree .git is a\n// pointer FILE, and a detached child inheriting the worktree cwd holds a Windows\n// directory lock that breaks worktree removal; the primary's hooks + the daemon\n// cover the workspace-level snapshot (single-flight makes extra fires redundant).\n// A non-git cwd has no refresh moment at all. The stat is cwd-anchored, not a\n// walk-up: both host runtimes launch session hooks with cwd = project root, so a\n// subdirectory cwd (which would skip) does not occur in practice \u2014 and adding a\n// git walk would cost a synchronous process on the very path this block keeps free.\ntry {\n const nodePath = require('path');\n const { statSync } = require('fs');\n let primaryCheckout = false;\n try {\n primaryCheckout = statSync(nodePath.join(process.cwd(), '.git')).isDirectory();\n } catch {\n // not a git checkout (or .git unreadable) \u2014 no refresh moment here\n }\n if (primaryCheckout) {\n const { spawn } = require('child_process');\n const refresh = spawn('totem-status', ['refresh-gh'], {\n detached: true,\n stdio: 'ignore',\n });\n refresh.on('error', (err) => {\n if (err && err.code === 'ENOENT') return;\n process.stderr.write('[SessionStart] totem-status refresh-gh spawn failed (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n });\n refresh.unref();\n }\n} catch (err) {\n process.stderr.write('[SessionStart] totem-status refresh-gh unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n\ntry {\n execSync('totem describe', {\n timeout: 30000,\n stdio: ['ignore', 'inherit', 'inherit'],\n });\n} catch (err) {\n process.stdout.write('[Totem] Briefing unavailable: ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n\n// totem orient --session \u2014 live derived in-flight state, ADDITIVE to describe\n// (mmnto-ai/totem#2044 PR-3). Own try/catch; orient --session is itself boot-safe.\ntry {\n execSync('totem orient --session', {\n timeout: 30000,\n stdio: ['ignore', 'inherit', 'inherit'],\n });\n} catch (err) {\n // Boot-safe: orient is additive to describe; a failure never blocks session start \u2014\n // surface a NON-fatal breadcrumb (matches the Claude-side hook) rather than swallow.\n process.stderr.write('[SessionStart] orient briefing unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n// [totem] end auto-generated\n";
57
+ export declare const GEMINI_SESSION_START = "// [totem] auto-generated \u2014 Gemini CLI SessionStart hook\n// Runs `totem describe` at the start of every Gemini CLI session to emit\n// the project-orientation banner (\"[Describe] Project: ... Lessons: N\n// Targets: N Hooks: ...\"). Matches the family-canonical pattern used by\n// totem-strategy, totem-substrate, arhgap11, and totem-status, and\n// matches the Claude-side SessionStart hook scaffolded by this same init\n// pass (mmnto-ai/totem#1884).\nconst { execSync } = require('child_process');\n\n// totem-status refresh-gh \u2014 GH-federation snapshot refresh (mmnto-ai/totem-status#127\n// C3 residual; tracking mmnto-ai/totem#2556). Spawn-and-forget, detached+unref, and\n// fired BEFORE the synchronous describe/orient briefings so it overlaps them: session\n// start must never block on it (mmnto-ai/totem#2059 measured ~3s of synchronous gh\n// calls here). The verb's exit-0-or-nothing contract (single-flight, atomic rename,\n// no-clobber when gh is missing) makes blind firing safe. ENOENT = the sidecar is not\n// adopted in this repo (the common non-cohort case) \u2014 zero noise; any other spawn\n// failure keeps a non-fatal stderr breadcrumb.\n// PRIMARY checkout only (.git must be a DIRECTORY): in a linked worktree .git is a\n// pointer FILE, and a detached child inheriting the worktree cwd holds a Windows\n// directory lock that breaks worktree removal; the primary's hooks + the daemon\n// cover the workspace-level snapshot (single-flight makes extra fires redundant).\n// A non-git cwd has no refresh moment at all. The stat is cwd-anchored, not a\n// walk-up: both host runtimes launch session hooks with cwd = project root, so a\n// subdirectory cwd (which would skip) does not occur in practice \u2014 and adding a\n// git walk would cost a synchronous process on the very path this block keeps free.\ntry {\n const nodePath = require('path');\n const { statSync } = require('fs');\n let primaryCheckout = false;\n try {\n primaryCheckout = statSync(nodePath.join(process.cwd(), '.git')).isDirectory();\n } catch {\n // not a git checkout (or .git unreadable) \u2014 no refresh moment here\n }\n if (primaryCheckout) {\n const { spawn } = require('child_process');\n // Observability leg (mmnto-ai/totem#2570, routed from the status seat's\n // 2026-08-03 silent no-write): under stdio:'ignore' plus the verb's\n // exit-0-or-nothing contract, a reaped or dying child leaves NO trace\n // (Windows detached is not job-object breakaway \u2014 a hook-harness\n // tree-kill takes the child mid-run). Each firing stamps a workspace-root\n // log and hands the child the same fd, so the verb's own success line\n // lands after the stamp; a stamp with nothing after it means the child\n // never finished. Log failures degrade to the previous blind firing \u2014\n // the stamp must never block or break the spawn.\n const { openSync, closeSync, appendFileSync, existsSync, writeFileSync } = require('fs');\n // REPO-LOCAL log, inside .git (falsification round: the primary-checkout\n // gate just proved .git is a directory; never tracked, dies with the\n // clone, writable wherever git itself writes, and per-repo so concurrent\n // firings from sibling repos never interleave). A workspace-parent path\n // would grow an un-gitignorable file OUTSIDE the repo tree for every\n // consumer of these published templates \u2014 including non-adopters, whose\n // ENOENT firing still stamps.\n const logPath = nodePath.join(process.cwd(), '.git', 'totem-status-refresh-hook.log');\n // Control characters are scrubbed from path-derived fields before they\n // reach the log (terminal-injection guideline: a crafted checkout path\n // must not forge stamp lines or inject terminal controls).\n const scrub = (v) => String(v).replace(/[\\x00-\\x1f\\x7f]/g, '?');\n let stdio = 'ignore';\n let logFd = null;\n try {\n try {\n // 1 MiB self-cap: the log truncates rather than growing forever.\n if (statSync(logPath).size > 1048576) writeFileSync(logPath, '');\n } catch {\n // no log yet \u2014 nothing to cap\n }\n appendFileSync(logPath, '[' + new Date().toISOString() + '] gemini spawn cwd=' + scrub(process.cwd()) + ' path-has-go-bin=' + /go[\\\\/]bin/i.test(process.env.PATH || '') + ' cwd-shadow-exe=' + existsSync(nodePath.join(process.cwd(), 'totem-status.exe')) + '\\n');\n logFd = openSync(logPath, 'a');\n stdio = ['ignore', logFd, logFd];\n } catch {\n // log unavailable \u2014 refresh still fires blind, as before\n }\n const refresh = spawn('totem-status', ['refresh-gh'], {\n detached: true,\n stdio,\n });\n refresh.on('error', (err) => {\n try {\n appendFileSync(logPath, '[' + new Date().toISOString() + '] gemini spawn-error code=' + ((err && err.code) || 'unknown') + '\\n');\n } catch {\n // log write failed \u2014 fall through to the stderr breadcrumb\n }\n if (err && err.code === 'ENOENT') return;\n process.stderr.write('[SessionStart] totem-status refresh-gh spawn failed (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n });\n refresh.unref();\n // The child holds its own copy of the fd from spawn time; release the parent's.\n if (logFd !== null) {\n try {\n closeSync(logFd);\n } catch {\n // nothing to release\n }\n }\n }\n} catch (err) {\n process.stderr.write('[SessionStart] totem-status refresh-gh unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n\ntry {\n execSync('totem describe', {\n timeout: 30000,\n stdio: ['ignore', 'inherit', 'inherit'],\n });\n} catch (err) {\n process.stdout.write('[Totem] Briefing unavailable: ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n\n// totem orient --session \u2014 live derived in-flight state, ADDITIVE to describe\n// (mmnto-ai/totem#2044 PR-3). Own try/catch; orient --session is itself boot-safe.\ntry {\n execSync('totem orient --session', {\n timeout: 30000,\n stdio: ['ignore', 'inherit', 'inherit'],\n });\n} catch (err) {\n // Boot-safe: orient is additive to describe; a failure never blocks session start \u2014\n // surface a NON-fatal breadcrumb (matches the Claude-side hook) rather than swallow.\n process.stderr.write('[SessionStart] orient briefing unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n// [totem] end auto-generated\n";
58
58
  export declare const GEMINI_BEFORE_TOOL: string;
59
59
  export declare const GEMINI_SKILL = "<!-- [totem] auto-generated \u2014 Totem Architect skill -->\n# Totem Architect\n\nBefore designing, planning, or implementing features, query the project's memory index for relevant context:\n\n1. Use the `search_knowledge` MCP tool with a query describing what you're about to build.\n2. Review returned lessons, specs, and code patterns before writing any code.\n3. If you discover a trap or architectural constraint, factor it into your design.\n\nThis ensures you build on existing knowledge rather than repeating past mistakes.\n";
60
60
  export declare const CLAUDE_SHIELD_GATE = "// [totem] auto-generated \u2014 Claude Code review gate hook\n// Intercepts git push/commit to run `totem review` before proceeding.\nconst { execSync } = require('child_process');\n\nconst input = process.env.TOOL_INPUT || '';\nif (/\bgits+(push|commit)\b/.test(input)) {\n try {\n execSync('totem lint', { encoding: 'utf-8', timeout: 60000, stdio: 'inherit' });\n } catch (err) {\n process.exit(1);\n }\n}\n";
@@ -73,7 +73,7 @@ export declare const CLAUDE_PREWRITESHIELD_ENTRY: {
73
73
  command: string;
74
74
  }[];
75
75
  };
76
- export declare const CLAUDE_SESSION_START = "// [totem] auto-generated \u2014 Claude Code SessionStart hook\n// Runs `@mmnto/cli describe` at the start of every Claude Code session.\n// Mirrors `.gemini/hooks/SessionStart.js`. `.cjs` extension because\n// package.json may have \"type\": \"module\" \u2014 Claude Code execs hooks via\n// plain `node`, which would otherwise treat `.js` as ESM.\n//\n// A.3.a: mints a session UUID, persists to .totem/ledger/.session-id,\n// and appends a `session_start` event to .totem/ledger/events.ndjson\n// BEFORE running `totem describe`. Subsequent MCP calls within the\n// session correlate via session_id (ADR-029 \u00A7 Session Heuristic).\n// Fire-and-forget: any ledger failure must NOT block the briefing.\nconst { spawnSync } = require('child_process');\nconst { existsSync, mkdirSync, writeFileSync, appendFileSync } = require('fs');\nconst { randomUUID } = require('crypto');\nconst { join } = require('path');\n\n// \u2500\u2500\u2500 A.3.a: mint session ID + log session_start event \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ntry {\n const ledgerDir = join(process.cwd(), '.totem', 'ledger');\n mkdirSync(ledgerDir, { recursive: true });\n const sessionId = randomUUID();\n writeFileSync(join(ledgerDir, '.session-id'), sessionId, 'utf-8');\n // Amended ADR-078 (2026-07-15): agent_source is the env-carried seat-id\n // (TOTEM_SELF_AGENT, first non-empty comma entry), never a vendor class\n // ('claude' has no reverse projection to a seat). Omitted entirely when\n // the env var is absent: stamp absence, never guess (Tenet 4). The parse\n // deliberately mirrors deriveSearchLogAttribution (packages/mcp/src/\n // search-log.ts) and parseEnvAgentList (packages/core/src/\n // orchestration-resolver.ts) \u2014 inlined because this rendered .cjs hook\n // runs standalone in consumer repos with no access to those modules; if\n // the shared parse semantics change, change this template in the same PR.\n const selfAgent = (process.env.TOTEM_SELF_AGENT || '')\n .split(',')\n .map((s) => s.trim())\n .find((s) => s.length > 0);\n const event = {\n timestamp: new Date().toISOString(),\n type: 'session_start',\n activity_name: 'SessionStart',\n source: 'bot',\n ...(selfAgent ? { agent_source: selfAgent } : {}),\n justification: '',\n session_id: sessionId,\n };\n appendFileSync(join(ledgerDir, 'events.ndjson'), JSON.stringify(event) + '\\n', 'utf-8');\n} catch (err) {\n // Fire-and-forget; ledger failures must not block the briefing. A lightweight\n // stderr breadcrumb makes hook misconfigurations diagnosable in consumer repos\n // (CR R1 catch \u2014 empty catch suppresses all signal). stderr (not stdout) so\n // the briefing path remains clean for Claude's prompt context.\n process.stderr.write(\n '[SessionStart] Session-start telemetry unavailable (non-fatal): ' +\n (err instanceof Error ? err.message : String(err)) +\n '\\n',\n );\n}\n\n// \u2500\u2500\u2500 totem-status refresh-gh \u2014 GH-federation snapshot refresh \u2500\u2500\u2500\n// (mmnto-ai/totem-status#127 C3 residual; tracking mmnto-ai/totem#2556.)\n// Spawn-and-forget, detached+unref, fired BEFORE the synchronous describe/orient\n// briefings so it overlaps them: session start must never block on it\n// (mmnto-ai/totem#2059 measured ~3s of synchronous gh calls here). The verb's\n// exit-0-or-nothing contract (single-flight, atomic rename, no-clobber when gh\n// is missing) makes blind firing safe. ENOENT = the sidecar is not adopted in\n// this repo (the common non-cohort case) \u2014 zero noise; any other spawn failure\n// keeps a non-fatal stderr breadcrumb.\n// PRIMARY checkout only (.git must be a DIRECTORY): in a linked worktree .git is a\n// pointer FILE, and a detached child inheriting the worktree cwd holds a Windows\n// directory lock that breaks worktree removal; the primary's hooks + the daemon\n// cover the workspace-level snapshot (single-flight makes extra fires redundant).\n// A non-git cwd has no refresh moment at all. The stat is cwd-anchored, not a\n// walk-up: both host runtimes launch session hooks with cwd = project root, so a\n// subdirectory cwd (which would skip) does not occur in practice \u2014 and adding a\n// git walk would cost a synchronous process on the very path this block keeps free.\ntry {\n const nodePath = require('path');\n const { statSync } = require('fs');\n let primaryCheckout = false;\n try {\n primaryCheckout = statSync(nodePath.join(process.cwd(), '.git')).isDirectory();\n } catch {\n // not a git checkout (or .git unreadable) \u2014 no refresh moment here\n }\n if (primaryCheckout) {\n const { spawn } = require('child_process');\n const refresh = spawn('totem-status', ['refresh-gh'], {\n detached: true,\n stdio: 'ignore',\n });\n refresh.on('error', (err) => {\n if (err && err.code === 'ENOENT') return;\n process.stderr.write('[SessionStart] totem-status refresh-gh spawn failed (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n });\n refresh.unref();\n }\n} catch (err) {\n process.stderr.write('[SessionStart] totem-status refresh-gh unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n\n// \u2500\u2500\u2500 totem describe briefing (existing behavior) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ntry {\n const cliPath = join(process.cwd(), 'node_modules', '@mmnto', 'cli', 'dist', 'index.js');\n if (existsSync(cliPath)) {\n const result = spawnSync(process.execPath, [cliPath, 'describe'], {\n encoding: 'utf-8',\n timeout: 30000,\n });\n if (result.error) {\n throw result.error;\n }\n // Totem CLI writes diagnostic output to stderr; route to stdout so the\n // session-start context lands in Claude's prompt rather than user-visible noise.\n process.stdout.write((result.stdout || '') + (result.stderr || ''));\n } else {\n process.stdout.write(\n '[Totem] @mmnto/cli not installed. Run `pnpm install` (or your package manager equivalent) to enable session-start orientation.\\n',\n );\n }\n} catch (err) {\n process.stdout.write(\n '[Totem] Briefing unavailable: ' +\n (err instanceof Error ? err.message : String(err)) +\n '\\n',\n );\n}\n\n// \u2500\u2500\u2500 totem orient --session \u2014 live derived in-flight state (mmnto-ai/totem#2044 PR-3) \u2500\u2500\n// ADDITIVE to describe (Tenet 13: describe = static identity sensor \u2014 scope/tier/\n// counts; orient = live in-flight sensor \u2014 open PRs/issues/board/freeze). Append,\n// never replace. Its OWN try/catch so an orient failure never disturbs the describe\n// briefing or the boot; `orient --session` is itself boot-safe (emits nothing when\n// nothing is high-signal, never exits non-zero, degrades to honest \"could not derive\").\ntry {\n const orientCliPath = join(process.cwd(), 'node_modules', '@mmnto', 'cli', 'dist', 'index.js');\n if (existsSync(orientCliPath)) {\n const orientResult = spawnSync(process.execPath, [orientCliPath, 'orient', '--session'], {\n encoding: 'utf-8',\n timeout: 30000,\n });\n // spawnSync sets .error (it does NOT throw) on a spawn-level failure; re-throw so\n // it surfaces through the catch breadcrumb below rather than writing '' silently.\n if (orientResult.error) {\n throw orientResult.error;\n }\n process.stdout.write((orientResult.stdout || '') + (orientResult.stderr || ''));\n }\n} catch (err) {\n // Boot-safe: orient is additive to describe (already emitted), so a failure never\n // blocks session start \u2014 but surface a NON-fatal breadcrumb to stderr (not stdout,\n // to keep the prompt clean) for debuggability rather than swallowing silently.\n process.stderr.write(\n '[SessionStart] orient briefing unavailable (non-fatal): ' +\n (err instanceof Error ? err.message : String(err)) +\n '\\n',\n );\n}\n// [totem] end auto-generated\n";
76
+ export declare const CLAUDE_SESSION_START = "// [totem] auto-generated \u2014 Claude Code SessionStart hook\n// Runs `@mmnto/cli describe` at the start of every Claude Code session.\n// Mirrors `.gemini/hooks/SessionStart.js`. `.cjs` extension because\n// package.json may have \"type\": \"module\" \u2014 Claude Code execs hooks via\n// plain `node`, which would otherwise treat `.js` as ESM.\n//\n// A.3.a: mints a session UUID, persists to .totem/ledger/.session-id,\n// and appends a `session_start` event to .totem/ledger/events.ndjson\n// BEFORE running `totem describe`. Subsequent MCP calls within the\n// session correlate via session_id (ADR-029 \u00A7 Session Heuristic).\n// Fire-and-forget: any ledger failure must NOT block the briefing.\nconst { spawnSync } = require('child_process');\nconst { existsSync, mkdirSync, writeFileSync, appendFileSync } = require('fs');\nconst { randomUUID } = require('crypto');\nconst { join } = require('path');\n\n// \u2500\u2500\u2500 A.3.a: mint session ID + log session_start event \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ntry {\n const ledgerDir = join(process.cwd(), '.totem', 'ledger');\n mkdirSync(ledgerDir, { recursive: true });\n const sessionId = randomUUID();\n writeFileSync(join(ledgerDir, '.session-id'), sessionId, 'utf-8');\n // Amended ADR-078 (2026-07-15): agent_source is the env-carried seat-id\n // (TOTEM_SELF_AGENT, first non-empty comma entry), never a vendor class\n // ('claude' has no reverse projection to a seat). Omitted entirely when\n // the env var is absent: stamp absence, never guess (Tenet 4). The parse\n // deliberately mirrors deriveSearchLogAttribution (packages/mcp/src/\n // search-log.ts) and parseEnvAgentList (packages/core/src/\n // orchestration-resolver.ts) \u2014 inlined because this rendered .cjs hook\n // runs standalone in consumer repos with no access to those modules; if\n // the shared parse semantics change, change this template in the same PR.\n const selfAgent = (process.env.TOTEM_SELF_AGENT || '')\n .split(',')\n .map((s) => s.trim())\n .find((s) => s.length > 0);\n const event = {\n timestamp: new Date().toISOString(),\n type: 'session_start',\n activity_name: 'SessionStart',\n source: 'bot',\n ...(selfAgent ? { agent_source: selfAgent } : {}),\n justification: '',\n session_id: sessionId,\n };\n appendFileSync(join(ledgerDir, 'events.ndjson'), JSON.stringify(event) + '\\n', 'utf-8');\n} catch (err) {\n // Fire-and-forget; ledger failures must not block the briefing. A lightweight\n // stderr breadcrumb makes hook misconfigurations diagnosable in consumer repos\n // (CR R1 catch \u2014 empty catch suppresses all signal). stderr (not stdout) so\n // the briefing path remains clean for Claude's prompt context.\n process.stderr.write(\n '[SessionStart] Session-start telemetry unavailable (non-fatal): ' +\n (err instanceof Error ? err.message : String(err)) +\n '\\n',\n );\n}\n\n// \u2500\u2500\u2500 totem-status refresh-gh \u2014 GH-federation snapshot refresh \u2500\u2500\u2500\n// (mmnto-ai/totem-status#127 C3 residual; tracking mmnto-ai/totem#2556.)\n// Spawn-and-forget, detached+unref, fired BEFORE the synchronous describe/orient\n// briefings so it overlaps them: session start must never block on it\n// (mmnto-ai/totem#2059 measured ~3s of synchronous gh calls here). The verb's\n// exit-0-or-nothing contract (single-flight, atomic rename, no-clobber when gh\n// is missing) makes blind firing safe. ENOENT = the sidecar is not adopted in\n// this repo (the common non-cohort case) \u2014 zero noise; any other spawn failure\n// keeps a non-fatal stderr breadcrumb.\n// PRIMARY checkout only (.git must be a DIRECTORY): in a linked worktree .git is a\n// pointer FILE, and a detached child inheriting the worktree cwd holds a Windows\n// directory lock that breaks worktree removal; the primary's hooks + the daemon\n// cover the workspace-level snapshot (single-flight makes extra fires redundant).\n// A non-git cwd has no refresh moment at all. The stat is cwd-anchored, not a\n// walk-up: both host runtimes launch session hooks with cwd = project root, so a\n// subdirectory cwd (which would skip) does not occur in practice \u2014 and adding a\n// git walk would cost a synchronous process on the very path this block keeps free.\ntry {\n const nodePath = require('path');\n const { statSync } = require('fs');\n let primaryCheckout = false;\n try {\n primaryCheckout = statSync(nodePath.join(process.cwd(), '.git')).isDirectory();\n } catch {\n // not a git checkout (or .git unreadable) \u2014 no refresh moment here\n }\n if (primaryCheckout) {\n const { spawn } = require('child_process');\n // Observability leg (mmnto-ai/totem#2570, routed from the status seat's\n // 2026-08-03 silent no-write): under stdio:'ignore' plus the verb's\n // exit-0-or-nothing contract, a reaped or dying child leaves NO trace\n // (Windows detached is not job-object breakaway \u2014 a hook-harness\n // tree-kill takes the child mid-run). Each firing stamps a workspace-root\n // log and hands the child the same fd, so the verb's own success line\n // lands after the stamp; a stamp with nothing after it means the child\n // never finished. Log failures degrade to the previous blind firing \u2014\n // the stamp must never block or break the spawn.\n const { openSync, closeSync, appendFileSync, existsSync, writeFileSync } = require('fs');\n // REPO-LOCAL log, inside .git (falsification round: the primary-checkout\n // gate just proved .git is a directory; never tracked, dies with the\n // clone, writable wherever git itself writes, and per-repo so concurrent\n // firings from sibling repos never interleave). A workspace-parent path\n // would grow an un-gitignorable file OUTSIDE the repo tree for every\n // consumer of these published templates \u2014 including non-adopters, whose\n // ENOENT firing still stamps.\n const logPath = nodePath.join(process.cwd(), '.git', 'totem-status-refresh-hook.log');\n // Control characters are scrubbed from path-derived fields before they\n // reach the log (terminal-injection guideline: a crafted checkout path\n // must not forge stamp lines or inject terminal controls).\n const scrub = (v) => String(v).replace(/[\\x00-\\x1f\\x7f]/g, '?');\n let stdio = 'ignore';\n let logFd = null;\n try {\n try {\n // 1 MiB self-cap: the log truncates rather than growing forever.\n if (statSync(logPath).size > 1048576) writeFileSync(logPath, '');\n } catch {\n // no log yet \u2014 nothing to cap\n }\n appendFileSync(logPath, '[' + new Date().toISOString() + '] claude spawn cwd=' + scrub(process.cwd()) + ' path-has-go-bin=' + /go[\\\\/]bin/i.test(process.env.PATH || '') + ' cwd-shadow-exe=' + existsSync(nodePath.join(process.cwd(), 'totem-status.exe')) + '\\n');\n logFd = openSync(logPath, 'a');\n stdio = ['ignore', logFd, logFd];\n } catch {\n // log unavailable \u2014 refresh still fires blind, as before\n }\n const refresh = spawn('totem-status', ['refresh-gh'], {\n detached: true,\n stdio,\n });\n refresh.on('error', (err) => {\n try {\n appendFileSync(logPath, '[' + new Date().toISOString() + '] claude spawn-error code=' + ((err && err.code) || 'unknown') + '\\n');\n } catch {\n // log write failed \u2014 fall through to the stderr breadcrumb\n }\n if (err && err.code === 'ENOENT') return;\n process.stderr.write('[SessionStart] totem-status refresh-gh spawn failed (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n });\n refresh.unref();\n // The child holds its own copy of the fd from spawn time; release the parent's.\n if (logFd !== null) {\n try {\n closeSync(logFd);\n } catch {\n // nothing to release\n }\n }\n }\n} catch (err) {\n process.stderr.write('[SessionStart] totem-status refresh-gh unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');\n}\n\n// \u2500\u2500\u2500 totem describe briefing (existing behavior) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ntry {\n const cliPath = join(process.cwd(), 'node_modules', '@mmnto', 'cli', 'dist', 'index.js');\n if (existsSync(cliPath)) {\n const result = spawnSync(process.execPath, [cliPath, 'describe'], {\n encoding: 'utf-8',\n timeout: 30000,\n });\n if (result.error) {\n throw result.error;\n }\n // Totem CLI writes diagnostic output to stderr; route to stdout so the\n // session-start context lands in Claude's prompt rather than user-visible noise.\n process.stdout.write((result.stdout || '') + (result.stderr || ''));\n } else {\n process.stdout.write(\n '[Totem] @mmnto/cli not installed. Run `pnpm install` (or your package manager equivalent) to enable session-start orientation.\\n',\n );\n }\n} catch (err) {\n process.stdout.write(\n '[Totem] Briefing unavailable: ' +\n (err instanceof Error ? err.message : String(err)) +\n '\\n',\n );\n}\n\n// \u2500\u2500\u2500 totem orient --session \u2014 live derived in-flight state (mmnto-ai/totem#2044 PR-3) \u2500\u2500\n// ADDITIVE to describe (Tenet 13: describe = static identity sensor \u2014 scope/tier/\n// counts; orient = live in-flight sensor \u2014 open PRs/issues/board/freeze). Append,\n// never replace. Its OWN try/catch so an orient failure never disturbs the describe\n// briefing or the boot; `orient --session` is itself boot-safe (emits nothing when\n// nothing is high-signal, never exits non-zero, degrades to honest \"could not derive\").\ntry {\n const orientCliPath = join(process.cwd(), 'node_modules', '@mmnto', 'cli', 'dist', 'index.js');\n if (existsSync(orientCliPath)) {\n const orientResult = spawnSync(process.execPath, [orientCliPath, 'orient', '--session'], {\n encoding: 'utf-8',\n timeout: 30000,\n });\n // spawnSync sets .error (it does NOT throw) on a spawn-level failure; re-throw so\n // it surfaces through the catch breadcrumb below rather than writing '' silently.\n if (orientResult.error) {\n throw orientResult.error;\n }\n process.stdout.write((orientResult.stdout || '') + (orientResult.stderr || ''));\n }\n} catch (err) {\n // Boot-safe: orient is additive to describe (already emitted), so a failure never\n // blocks session start \u2014 but surface a NON-fatal breadcrumb to stderr (not stdout,\n // to keep the prompt clean) for debuggability rather than swallowing silently.\n process.stderr.write(\n '[SessionStart] orient briefing unavailable (non-fatal): ' +\n (err instanceof Error ? err.message : String(err)) +\n '\\n',\n );\n}\n// [totem] end auto-generated\n";
77
77
  export declare const CLAUDE_SESSION_START_ENTRY: {
78
78
  hooks: {
79
79
  type: string;
@@ -1 +1 @@
1
- {"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../../src/commands/init-templates.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMpE,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,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IAChB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,4BAA4B,EAAE,aAAa,CAAC,iBAAiB,CAQzE,CAAC;AAwBF,eAAO,MAAM,kBAAkB,+BAA+B,CAAC;AAC/D,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAE3D,eAAO,MAAM,qBAAqB,QAwDjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,63FAoBhC,CAAC;AAEF,eAAO,MAAM,0BAA0B,6uIA8EtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,4+HAwCrC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAK5B,CAAC;AAIX,wBAAsB,cAAc,CAClC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAyCjB;AAoDD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhD"}
@@ -187,15 +187,65 @@ try {
187
187
  }
188
188
  if (primaryCheckout) {
189
189
  const { spawn } = require('child_process');
190
+ // Observability leg (mmnto-ai/totem#2570, routed from the status seat's
191
+ // 2026-08-03 silent no-write): under stdio:'ignore' plus the verb's
192
+ // exit-0-or-nothing contract, a reaped or dying child leaves NO trace
193
+ // (Windows detached is not job-object breakaway — a hook-harness
194
+ // tree-kill takes the child mid-run). Each firing stamps a workspace-root
195
+ // log and hands the child the same fd, so the verb's own success line
196
+ // lands after the stamp; a stamp with nothing after it means the child
197
+ // never finished. Log failures degrade to the previous blind firing —
198
+ // the stamp must never block or break the spawn.
199
+ const { openSync, closeSync, appendFileSync, existsSync, writeFileSync } = require('fs');
200
+ // REPO-LOCAL log, inside .git (falsification round: the primary-checkout
201
+ // gate just proved .git is a directory; never tracked, dies with the
202
+ // clone, writable wherever git itself writes, and per-repo so concurrent
203
+ // firings from sibling repos never interleave). A workspace-parent path
204
+ // would grow an un-gitignorable file OUTSIDE the repo tree for every
205
+ // consumer of these published templates — including non-adopters, whose
206
+ // ENOENT firing still stamps.
207
+ const logPath = nodePath.join(process.cwd(), '.git', 'totem-status-refresh-hook.log');
208
+ // Control characters are scrubbed from path-derived fields before they
209
+ // reach the log (terminal-injection guideline: a crafted checkout path
210
+ // must not forge stamp lines or inject terminal controls).
211
+ const scrub = (v) => String(v).replace(/[\\x00-\\x1f\\x7f]/g, '?');
212
+ let stdio = 'ignore';
213
+ let logFd = null;
214
+ try {
215
+ try {
216
+ // 1 MiB self-cap: the log truncates rather than growing forever.
217
+ if (statSync(logPath).size > 1048576) writeFileSync(logPath, '');
218
+ } catch {
219
+ // no log yet — nothing to cap
220
+ }
221
+ appendFileSync(logPath, '[' + new Date().toISOString() + '] gemini spawn cwd=' + scrub(process.cwd()) + ' path-has-go-bin=' + /go[\\\\/]bin/i.test(process.env.PATH || '') + ' cwd-shadow-exe=' + existsSync(nodePath.join(process.cwd(), 'totem-status.exe')) + '\\n');
222
+ logFd = openSync(logPath, 'a');
223
+ stdio = ['ignore', logFd, logFd];
224
+ } catch {
225
+ // log unavailable — refresh still fires blind, as before
226
+ }
190
227
  const refresh = spawn('totem-status', ['refresh-gh'], {
191
228
  detached: true,
192
- stdio: 'ignore',
229
+ stdio,
193
230
  });
194
231
  refresh.on('error', (err) => {
232
+ try {
233
+ appendFileSync(logPath, '[' + new Date().toISOString() + '] gemini spawn-error code=' + ((err && err.code) || 'unknown') + '\\n');
234
+ } catch {
235
+ // log write failed — fall through to the stderr breadcrumb
236
+ }
195
237
  if (err && err.code === 'ENOENT') return;
196
238
  process.stderr.write('[SessionStart] totem-status refresh-gh spawn failed (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');
197
239
  });
198
240
  refresh.unref();
241
+ // The child holds its own copy of the fd from spawn time; release the parent's.
242
+ if (logFd !== null) {
243
+ try {
244
+ closeSync(logFd);
245
+ } catch {
246
+ // nothing to release
247
+ }
248
+ }
199
249
  }
200
250
  } catch (err) {
201
251
  process.stderr.write('[SessionStart] totem-status refresh-gh unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');
@@ -776,15 +826,65 @@ try {
776
826
  }
777
827
  if (primaryCheckout) {
778
828
  const { spawn } = require('child_process');
829
+ // Observability leg (mmnto-ai/totem#2570, routed from the status seat's
830
+ // 2026-08-03 silent no-write): under stdio:'ignore' plus the verb's
831
+ // exit-0-or-nothing contract, a reaped or dying child leaves NO trace
832
+ // (Windows detached is not job-object breakaway — a hook-harness
833
+ // tree-kill takes the child mid-run). Each firing stamps a workspace-root
834
+ // log and hands the child the same fd, so the verb's own success line
835
+ // lands after the stamp; a stamp with nothing after it means the child
836
+ // never finished. Log failures degrade to the previous blind firing —
837
+ // the stamp must never block or break the spawn.
838
+ const { openSync, closeSync, appendFileSync, existsSync, writeFileSync } = require('fs');
839
+ // REPO-LOCAL log, inside .git (falsification round: the primary-checkout
840
+ // gate just proved .git is a directory; never tracked, dies with the
841
+ // clone, writable wherever git itself writes, and per-repo so concurrent
842
+ // firings from sibling repos never interleave). A workspace-parent path
843
+ // would grow an un-gitignorable file OUTSIDE the repo tree for every
844
+ // consumer of these published templates — including non-adopters, whose
845
+ // ENOENT firing still stamps.
846
+ const logPath = nodePath.join(process.cwd(), '.git', 'totem-status-refresh-hook.log');
847
+ // Control characters are scrubbed from path-derived fields before they
848
+ // reach the log (terminal-injection guideline: a crafted checkout path
849
+ // must not forge stamp lines or inject terminal controls).
850
+ const scrub = (v) => String(v).replace(/[\\x00-\\x1f\\x7f]/g, '?');
851
+ let stdio = 'ignore';
852
+ let logFd = null;
853
+ try {
854
+ try {
855
+ // 1 MiB self-cap: the log truncates rather than growing forever.
856
+ if (statSync(logPath).size > 1048576) writeFileSync(logPath, '');
857
+ } catch {
858
+ // no log yet — nothing to cap
859
+ }
860
+ appendFileSync(logPath, '[' + new Date().toISOString() + '] claude spawn cwd=' + scrub(process.cwd()) + ' path-has-go-bin=' + /go[\\\\/]bin/i.test(process.env.PATH || '') + ' cwd-shadow-exe=' + existsSync(nodePath.join(process.cwd(), 'totem-status.exe')) + '\\n');
861
+ logFd = openSync(logPath, 'a');
862
+ stdio = ['ignore', logFd, logFd];
863
+ } catch {
864
+ // log unavailable — refresh still fires blind, as before
865
+ }
779
866
  const refresh = spawn('totem-status', ['refresh-gh'], {
780
867
  detached: true,
781
- stdio: 'ignore',
868
+ stdio,
782
869
  });
783
870
  refresh.on('error', (err) => {
871
+ try {
872
+ appendFileSync(logPath, '[' + new Date().toISOString() + '] claude spawn-error code=' + ((err && err.code) || 'unknown') + '\\n');
873
+ } catch {
874
+ // log write failed — fall through to the stderr breadcrumb
875
+ }
784
876
  if (err && err.code === 'ENOENT') return;
785
877
  process.stderr.write('[SessionStart] totem-status refresh-gh spawn failed (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');
786
878
  });
787
879
  refresh.unref();
880
+ // The child holds its own copy of the fd from spawn time; release the parent's.
881
+ if (logFd !== null) {
882
+ try {
883
+ closeSync(logFd);
884
+ } catch {
885
+ // nothing to release
886
+ }
887
+ }
788
888
  }
789
889
  } catch (err) {
790
890
  process.stderr.write('[SessionStart] totem-status refresh-gh unavailable (non-fatal): ' + (err instanceof Error ? err.message : String(err)) + '\\n');
@@ -1 +1 @@
1
- {"version":3,"file":"init-templates.js","sourceRoot":"","sources":["../../src/commands/init-templates.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,qEAAqE;AAMrE,6DAA6D;AAC7D,+EAA+E;AAC/E,sEAAsE;AAEtE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,6BAA6B,CAAC;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAE1E,MAAM,CAAC,MAAM,eAAe,GAAG;EAC7B,YAAY;8BACgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C1C,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,+BAA+B,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,MAAc;IAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,MAAc,EAAE,SAAiB;IACnF,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,GA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1149
1149
  expect(CLAUDE_SESSION_START).toContain("err.code === 'ENOENT'");
1150
1150
  expect(CLAUDE_SESSION_START).toContain('refresh-gh spawn failed (non-fatal)');
1151
1151
  });
1152
+ it('#2570: stamps a repo-local log and hands the child the same fd (observability leg)', () => {
1153
+ // Routed from the status seat's 2026-08-03 silent no-write: under
1154
+ // stdio:'ignore' + exit-0-or-nothing, a reaped or dying child left NO
1155
+ // trace. The stamp carries the discriminating fields; the child inherits
1156
+ // the SAME fd so the verb's success line lands after the stamp — a stamp
1157
+ // with nothing after it = the child never finished.
1158
+ // Repo-local pin: the log must live INSIDE .git — a workspace-parent path
1159
+ // would grow an un-gitignorable file outside the repo tree for every
1160
+ // consumer of the published template (falsification round, MAJOR 2/4).
1161
+ expect(CLAUDE_SESSION_START).toContain("'.git', 'totem-status-refresh-hook.log'");
1162
+ expect(CLAUDE_SESSION_START).toContain("'] claude spawn cwd='");
1163
+ expect(CLAUDE_SESSION_START).toContain('path-has-go-bin=');
1164
+ expect(CLAUDE_SESSION_START).toContain('cwd-shadow-exe=');
1165
+ expect(CLAUDE_SESSION_START).toContain("stdio = ['ignore', logFd, logFd]");
1166
+ // A spawn error stamps too (discriminates reap from spawn failure)…
1167
+ expect(CLAUDE_SESSION_START).toContain("'] claude spawn-error code='");
1168
+ // …the log must never gate the spawn (blind fallback precedes it)…
1169
+ expect(CLAUDE_SESSION_START.indexOf("let stdio = 'ignore'")).toBeLessThan(CLAUDE_SESSION_START.indexOf("spawn('totem-status'"));
1170
+ // …and the parent releases its fd copy after spawn (the child holds its own).
1171
+ expect(CLAUDE_SESSION_START).toContain('closeSync(logFd)');
1172
+ });
1152
1173
  });
1153
1174
  describe('GEMINI_SESSION_START template', () => {
1154
1175
  // Locks the family-canonical convergence on `totem describe` per
@@ -1201,6 +1222,16 @@ describe('GEMINI_SESSION_START template', () => {
1201
1222
  // Code-anchored ordering (see the Claude twin above for the mutant rationale).
1202
1223
  expect(GEMINI_SESSION_START.indexOf("spawn('totem-status'")).toBeLessThan(GEMINI_SESSION_START.indexOf("'totem describe'"));
1203
1224
  });
1225
+ it('#2570: stamps a repo-local log and hands the child the same fd, matching the Claude twin', () => {
1226
+ expect(GEMINI_SESSION_START).toContain("'.git', 'totem-status-refresh-hook.log'");
1227
+ expect(GEMINI_SESSION_START).toContain("'] gemini spawn cwd='");
1228
+ expect(GEMINI_SESSION_START).toContain('path-has-go-bin=');
1229
+ expect(GEMINI_SESSION_START).toContain('cwd-shadow-exe=');
1230
+ expect(GEMINI_SESSION_START).toContain("stdio = ['ignore', logFd, logFd]");
1231
+ expect(GEMINI_SESSION_START).toContain("'] gemini spawn-error code='");
1232
+ expect(GEMINI_SESSION_START.indexOf("let stdio = 'ignore'")).toBeLessThan(GEMINI_SESSION_START.indexOf("spawn('totem-status'"));
1233
+ expect(GEMINI_SESSION_START).toContain('closeSync(logFd)');
1234
+ });
1204
1235
  });
1205
1236
  describe('CLAUDE_PREWRITESHIELD template', () => {
1206
1237
  it('contains the totem auto-generated marker', () => {
@@ -1664,12 +1695,75 @@ describe('CLAUDE_SESSION_START runtime behavior (A.3.a ledger write)', () => {
1664
1695
  timeout: HOOK_SPAWN_TIMEOUT_MS,
1665
1696
  });
1666
1697
  expect(result.status).toBe(0);
1698
+ // Wait for CONTENT, not existence — existence alone races the stub's
1699
+ // open-truncate-then-write window (observed CI flake).
1700
+ const deadline = Date.now() + 5000;
1701
+ while (Date.now() < deadline &&
1702
+ !(fs.existsSync(markerPath) && fs.readFileSync(markerPath, 'utf-8').trim() !== '')) {
1703
+ await new Promise((r) => setTimeout(r, 50));
1704
+ }
1705
+ expect(fs.readFileSync(markerPath, 'utf-8').trim()).toBe('refresh-gh');
1706
+ });
1707
+ // #2570 observability-leg behavioral cells (falsification round, MAJOR 3: the
1708
+ // string assertions are satisfiable by mutants that break the runtime
1709
+ // contract — an unguarded stamp or a close-before-spawn both kill the spawn).
1710
+ it.skipIf(process.platform === 'win32')('#2570: the stamp precedes the child verb line in the repo-local log; stderr stays silent', { timeout: 15000 }, async () => {
1711
+ fs.mkdirSync(path.join(tmpDir, '.git'), { recursive: true });
1712
+ const binDir = path.join(tmpDir, 'stub-bin');
1713
+ fs.mkdirSync(binDir, { recursive: true });
1714
+ const markerPath = path.join(tmpDir, 'refresh-fired.marker');
1715
+ fs.writeFileSync(path.join(binDir, 'totem-status'), `#!/bin/sh\necho "$1" > "${markerPath}"\necho "refresh-done"\n`, { mode: 0o755 });
1716
+ const env = { ...process.env };
1717
+ delete env['TOTEM_SELF_AGENT'];
1718
+ env['PATH'] = `${binDir}:${env['PATH'] ?? ''}`;
1719
+ const result = spawnSync(process.execPath, [hookPath], {
1720
+ cwd: tmpDir,
1721
+ env,
1722
+ encoding: 'utf-8',
1723
+ timeout: HOOK_SPAWN_TIMEOUT_MS,
1724
+ });
1725
+ expect(result.status).toBe(0);
1726
+ expect(result.stderr).not.toContain('refresh-gh');
1727
+ // The child inherits the SAME fd, so its stdout lands after the stamp —
1728
+ // a close-before-spawn mutant dies here (EBADF, no verb line).
1729
+ const logPath = path.join(tmpDir, '.git', 'totem-status-refresh-hook.log');
1730
+ const deadline = Date.now() + 5000;
1731
+ while (Date.now() < deadline &&
1732
+ !(fs.existsSync(logPath) && fs.readFileSync(logPath, 'utf-8').includes('refresh-done'))) {
1733
+ await new Promise((r) => setTimeout(r, 50));
1734
+ }
1735
+ const log = fs.readFileSync(logPath, 'utf-8');
1736
+ expect(log).toContain('] claude spawn cwd=');
1737
+ expect(log.indexOf('claude spawn cwd=')).toBeLessThan(log.indexOf('refresh-done'));
1738
+ });
1739
+ it.skipIf(process.platform === 'win32')('#2570: an unwritable log never gates the spawn and never leaks to stderr (blind fallback)', { timeout: 15000 }, async () => {
1740
+ // A DIRECTORY at the log path makes every log write fail — the spawn
1741
+ // must still fire (blind, as before the leg) with zero stderr noise. An
1742
+ // unguarded-stamp mutant dies here (EISDIR aborts the block and prints
1743
+ // the unavailable breadcrumb).
1744
+ fs.mkdirSync(path.join(tmpDir, '.git', 'totem-status-refresh-hook.log'), {
1745
+ recursive: true,
1746
+ });
1747
+ const binDir = path.join(tmpDir, 'stub-bin');
1748
+ fs.mkdirSync(binDir, { recursive: true });
1749
+ const markerPath = path.join(tmpDir, 'refresh-fired.marker');
1750
+ fs.writeFileSync(path.join(binDir, 'totem-status'), `#!/bin/sh\necho "$1" > "${markerPath}"\n`, { mode: 0o755 });
1751
+ const env = { ...process.env };
1752
+ delete env['TOTEM_SELF_AGENT'];
1753
+ env['PATH'] = `${binDir}:${env['PATH'] ?? ''}`;
1754
+ const result = spawnSync(process.execPath, [hookPath], {
1755
+ cwd: tmpDir,
1756
+ env,
1757
+ encoding: 'utf-8',
1758
+ timeout: HOOK_SPAWN_TIMEOUT_MS,
1759
+ });
1760
+ expect(result.status).toBe(0);
1761
+ expect(result.stderr).not.toContain('refresh-gh');
1667
1762
  const deadline = Date.now() + 5000;
1668
1763
  while (Date.now() < deadline && !fs.existsSync(markerPath)) {
1669
1764
  await new Promise((r) => setTimeout(r, 50));
1670
1765
  }
1671
1766
  expect(fs.existsSync(markerPath)).toBe(true);
1672
- expect(fs.readFileSync(markerPath, 'utf-8').trim()).toBe('refresh-gh');
1673
1767
  });
1674
1768
  it('omits agent_source when TOTEM_SELF_AGENT is empty or comma/whitespace noise', () => {
1675
1769
  for (const value of ['', ' ', ' , ,']) {