claude-code-session-manager 0.94.0 → 0.96.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.
Files changed (122) hide show
  1. package/dist/assets/{DataModel-B0LDnnSL.js → DataModel-T0D00BpK.js} +1 -1
  2. package/dist/assets/History-DuAovTr7.js +2 -0
  3. package/dist/assets/{Hooks-CwLnp0Z_.js → Hooks-CgP9jsAN.js} +3 -3
  4. package/dist/assets/{HostBilko-CwEHEKYk.js → HostBilko-DHfz3Mxa.js} +1 -1
  5. package/dist/assets/{Library-BU9np05E.js → Library--poVP-d1.js} +1 -1
  6. package/dist/assets/{MarkdownEditor-B74ogK2f.js → MarkdownEditor-C56-Pc4c.js} +1 -1
  7. package/dist/assets/{McpServers-BLM3ftzP.js → McpServers-D-ykP4Vi.js} +2 -2
  8. package/dist/assets/Memory-BrkJjRL8.js +8 -0
  9. package/dist/assets/{Permissions-3pGLJmxQ.js → Permissions-BMpAaxJu.js} +3 -3
  10. package/dist/assets/Plugins-OuEe5S_T.js +2 -0
  11. package/dist/assets/{ProvenanceBadge-BnjBQiV9.js → ProvenanceBadge-4eNbDYe8.js} +1 -1
  12. package/dist/assets/{SaveBar-Zq2NfcPf.js → SaveBar-BQ8y9Lkv.js} +1 -1
  13. package/dist/assets/Scheduler-DcMT5sT_.js +16 -0
  14. package/dist/assets/{ScopeSwitcher-Cnojv22D.js → ScopeSwitcher-XdxtVKP-.js} +1 -1
  15. package/dist/assets/Settings-FdaPUq2t.js +3 -0
  16. package/dist/assets/{SkillReferenceGraph-BRDiE6Hv.js → SkillReferenceGraph-CJzvvc0_.js} +1 -1
  17. package/dist/assets/Skills-Wvm9OE1e.js +3 -0
  18. package/dist/assets/{SystemPrompt-tFr19Od6.js → SystemPrompt--LYw_69j.js} +1 -1
  19. package/dist/assets/TagLibrary-Be6HbMMx.js +1 -0
  20. package/dist/assets/{TiptapBody-DGzSg3BO.js → TiptapBody-DzFlWMgO.js} +1 -1
  21. package/dist/assets/{Toggle-DzoROibf.js → Toggle-BxtAFE1i.js} +1 -1
  22. package/dist/assets/index-XkrLB67D.js +3079 -0
  23. package/dist/assets/{settingsSchema-BYKVe1WM.js → settingsSchema-BIvDZ1Cj.js} +1 -1
  24. package/dist/index.html +1 -1
  25. package/package.json +10 -2
  26. package/plugins/CLAUDE.md +3 -3
  27. package/plugins/session-manager-dev/skills/develop/SKILL.md +83 -67
  28. package/plugins/session-manager-dev/skills/develop/standards.md +5 -11
  29. package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +5 -15
  30. package/scripts/README.md +4 -0
  31. package/scripts/hooks/guard-destructive-git.cjs +9 -374
  32. package/scripts/hooks/guard-inline-implementation.cjs +9 -128
  33. package/scripts/hooks/guard-prd-writes.cjs +9 -74
  34. package/scripts/hooks/guard-self-schedule.cjs +9 -61
  35. package/scripts/hooks/lib/guard-destructive-git-policy.cjs +410 -0
  36. package/scripts/hooks/lib/guard-inline-implementation-policy.cjs +159 -0
  37. package/scripts/hooks/lib/guard-prd-writes-policy.cjs +100 -0
  38. package/scripts/hooks/lib/guard-self-schedule-policy.cjs +89 -0
  39. package/scripts/scheduler-mcp-server.cjs +8 -1
  40. package/src/main/__tests__/configWriteBoundaryOwners.test.cjs +59 -0
  41. package/src/main/__tests__/exchanges.test.cjs +41 -96
  42. package/src/main/__tests__/exchangesPromptId.test.cjs +16 -25
  43. package/src/main/__tests__/files-reject-credentials.test.cjs +1 -1
  44. package/src/main/__tests__/health-credentials.test.cjs +81 -0
  45. package/src/main/__tests__/health-tick-liveness.test.cjs +12 -0
  46. package/src/main/__tests__/memoryAggregate.test.cjs +40 -1
  47. package/src/main/__tests__/opsErrorLogTelemetryTap.test.cjs +1 -1
  48. package/src/main/__tests__/planValidator.test.cjs +71 -0
  49. package/src/main/__tests__/prdCreate.test.cjs +3 -1
  50. package/src/main/__tests__/prdSizing.test.cjs +106 -0
  51. package/src/main/__tests__/queue-starvation-dispatch-driver.test.cjs +46 -0
  52. package/src/main/__tests__/reconcileFlatPrdSweep.test.cjs +10 -0
  53. package/src/main/__tests__/scheduler-looks-done.test.cjs +40 -0
  54. package/src/main/__tests__/scheduler-notify-originating-tab.test.cjs +81 -0
  55. package/src/main/__tests__/scheduler-rate-limit-pause.test.cjs +15 -0
  56. package/src/main/__tests__/scheduler-shard-quarantine.test.cjs +6 -1
  57. package/src/main/__tests__/scheduler-utilization-hold.test.cjs +89 -0
  58. package/src/main/__tests__/schedulerStateSidecarRestore.test.cjs +110 -0
  59. package/src/main/__tests__/seedAgentPersonas.test.cjs +19 -1
  60. package/src/main/__tests__/seedValidatorPersona.test.cjs +116 -0
  61. package/src/main/__tests__/telemetryClient.test.cjs +2 -2
  62. package/src/main/__tests__/telemetryContract.test.cjs +2 -2
  63. package/src/main/__tests__/usageSingleFlight.test.cjs +10 -0
  64. package/src/main/__tests__/validationSentinels.test.cjs +84 -0
  65. package/src/main/build-info.json +4 -4
  66. package/src/main/config.cjs +26 -14
  67. package/src/main/crashDiagnostics.cjs +9 -0
  68. package/src/main/exchanges.cjs +26 -21
  69. package/src/main/health.cjs +91 -5
  70. package/src/main/index.cjs +1 -1
  71. package/src/main/ipcSchemas.cjs +5 -1
  72. package/src/main/lib/__tests__/crashTelemetry.test.cjs +1 -1
  73. package/src/main/lib/__tests__/credentials-futile-refresh.test.cjs +115 -0
  74. package/src/main/lib/__tests__/epicWorktreeProjectConfig.test.cjs +85 -27
  75. package/src/main/lib/__tests__/gitWorktree.test.cjs +21 -27
  76. package/src/main/lib/__tests__/guardShims.test.cjs +10 -3
  77. package/src/main/lib/__tests__/loadGate.test.cjs +44 -1
  78. package/src/main/lib/__tests__/loopDelay.test.cjs +68 -0
  79. package/src/main/lib/__tests__/opsOwnership.test.cjs +14 -0
  80. package/src/main/lib/__tests__/telemetryBacklog.test.cjs +4 -4
  81. package/src/main/lib/__tests__/telemetryConsent.test.cjs +2 -2
  82. package/src/main/lib/__tests__/telemetryCountersMetadataColumn.test.cjs +1 -1
  83. package/src/main/lib/__tests__/usageCircuit.test.cjs +86 -17
  84. package/src/main/lib/agentModelResolve.cjs +1 -0
  85. package/src/main/lib/credentials.cjs +62 -0
  86. package/src/main/lib/cwdClassify.cjs +15 -0
  87. package/src/main/lib/definitionOfDone.cjs +9 -13
  88. package/src/main/lib/effectiveModelInfo.cjs +2 -9
  89. package/src/main/lib/epicWorktreeProjectConfig.cjs +75 -31
  90. package/src/main/lib/loadGate.cjs +29 -5
  91. package/src/main/lib/loopDelay.cjs +44 -0
  92. package/src/main/lib/opsOwnership.cjs +23 -0
  93. package/src/main/lib/planValidator.cjs +28 -0
  94. package/src/main/lib/prdCreate.cjs +8 -4
  95. package/src/main/lib/prdSizing.cjs +83 -0
  96. package/src/main/lib/runLogRetention.cjs +2 -8
  97. package/src/main/lib/telemetryBacklog.cjs +9 -3
  98. package/src/main/lib/telemetryClient.cjs +12 -3
  99. package/src/main/lib/telemetrySettings.cjs +8 -2
  100. package/src/main/lib/usageCircuit.cjs +40 -12
  101. package/src/main/lib/validationSentinels.cjs +29 -0
  102. package/src/main/memoryAggregate.cjs +36 -11
  103. package/src/main/otelSettings.cjs +8 -2
  104. package/src/main/scheduler.cjs +264 -34
  105. package/src/main/seedAgentPersonas.cjs +1 -1
  106. package/src/main/sessionsStore.cjs +8 -2
  107. package/src/main/supervisor.cjs +3 -3
  108. package/src/main/templates/PRD_AUTHORING.md +9 -9
  109. package/src/main/usage.cjs +9 -1
  110. package/src/main/voiceSettings.cjs +8 -2
  111. package/src/preload/api.d.ts +20 -5
  112. package/src/preload/index.cjs +5 -5
  113. package/src/seed/agents/dev-lead.md +24 -15
  114. package/src/seed/agents/validator.md +33 -0
  115. package/dist/assets/History-C685Kytt.js +0 -2
  116. package/dist/assets/Memory-DAP1t8bA.js +0 -8
  117. package/dist/assets/Plugins-Q1KoLEzn.js +0 -2
  118. package/dist/assets/Scheduler-D488ebKm.js +0 -16
  119. package/dist/assets/Settings-D5Lhj7ga.js +0 -3
  120. package/dist/assets/Skills-BQDqp-EN.js +0 -3
  121. package/dist/assets/TagLibrary-BjyrnaRE.js +0 -1
  122. package/dist/assets/index-CCl4tz-u.js +0 -3079
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * validationSentinels.cjs — parses the `VALIDATION: <slug> VERIFIED` /
5
+ * `VALIDATION: <slug> REFUTED — <reason>` lines a plan-level validator job
6
+ * (persona `validator`, PRD 1405) emits, one per PRD it checked, at the end
7
+ * of its run. Pure text-in/array-out; no filesystem or scheduler knowledge.
8
+ */
9
+
10
+ const SENTINEL_RE = /^VALIDATION:\s+(\S+)\s+(VERIFIED|REFUTED)(?:\s*[—–-]+\s*(.*))?\s*$/gm;
11
+
12
+ /**
13
+ * parseValidationSentinels(text) → Array<{ slug, verdict, reason }>
14
+ *
15
+ * `verdict` is lowercased ('verified' | 'refuted'); `reason` is '' when
16
+ * absent. Last matching line per slug wins, but the ORDER of the returned
17
+ * array follows each slug's first appearance in `text`, not its last.
18
+ */
19
+ function parseValidationSentinels(text) {
20
+ if (!text) return [];
21
+ const bySlug = new Map();
22
+ for (const match of text.matchAll(SENTINEL_RE)) {
23
+ const [, slug, verdict, reason] = match;
24
+ bySlug.set(slug, { slug, verdict: verdict.toLowerCase(), reason: reason || '' });
25
+ }
26
+ return Array.from(bySlug.values());
27
+ }
28
+
29
+ module.exports = { parseValidationSentinels };
@@ -8,9 +8,10 @@
8
8
  * owns) and, via a single cost-gated `claude -p` pass, organizes them into
9
9
  * named semantic clusters with `[[wikilink]]`-derived connections.
10
10
  *
11
- * Cache: ~/.claude/session-manager/memory-clusters/<workspace>.json
12
- * The `claude -p` call only fires when the caller passes `refresh: true` —
13
- * this is the cost gate; the renderer wires it to an explicit button.
11
+ * Cache: <cwd>/session-manager-operations/memory-clusters/clusters.json (one
12
+ * file per project — see memory-clusters/README.md). The `claude -p` call
13
+ * only fires when the caller passes `refresh: true` — this is the cost gate;
14
+ * the renderer wires it to an explicit button.
14
15
  *
15
16
  * Spawn/capture/timeout pattern mirrors kg.cjs's runClaude (~line 316-351):
16
17
  * stdin closed, model pinned, hard timeout that resolves {ok:false} rather
@@ -26,17 +27,34 @@ const { extractJson } = require('./lib/extractJson.cjs');
26
27
  const { runClaudeP } = require('./lib/runClaudeP.cjs');
27
28
  const { writeJson } = require('./config.cjs');
28
29
  const config = require('./config.cjs');
30
+ const { opsPath } = require('./lib/opsOwnership.cjs');
29
31
  const { MEMORY_SLUG_RE } = require('./lib/memorySlug.cjs');
30
32
 
31
33
  const HOME = os.homedir();
32
- const CLUSTERS_DIR = path.join(HOME, '.claude', 'session-manager', 'memory-clusters');
34
+ const CACHE_WRITER = 'memory-clusters';
33
35
 
34
36
  function memoryDir(workspace) {
35
37
  return path.join(HOME, '.claude', 'projects', workspace, 'memory');
36
38
  }
37
39
 
38
- function cachePath(workspace) {
39
- return path.join(CLUSTERS_DIR, `${workspace}.json`);
40
+ function clustersCachePath(cwd) {
41
+ return opsPath(cwd, 'memory-clusters', 'clusters.json');
42
+ }
43
+
44
+ /**
45
+ * Resolves `cwd` to a real, boundary-checked project root, or null when
46
+ * `cwd` is absent/invalid. Mirrors memoryTool.cjs's stale() cwd handling:
47
+ * an absent/unusable cwd disables the per-project cache entirely rather than
48
+ * throwing — the cache is purely regenerable, so a caller with no cwd (or a
49
+ * cwd this process cannot vouch for) just gets an uncached aggregate.
50
+ */
51
+ function resolveCwd(cwd) {
52
+ if (typeof cwd !== 'string' || !cwd) return null;
53
+ try {
54
+ return config.validatePath(cwd);
55
+ } catch {
56
+ return null;
57
+ }
40
58
  }
41
59
 
42
60
  // System prompt for clustering — sets the role server-side so the CLI treats
@@ -143,17 +161,19 @@ function parseClusters(rawLlmText, slugs) {
143
161
  return { clusters, orphans };
144
162
  }
145
163
 
146
- async function readCache(workspace) {
147
- const r = await config.readText(cachePath(workspace));
164
+ async function readCache(cwd) {
165
+ const realCwd = resolveCwd(cwd);
166
+ if (!realCwd) return null;
167
+ const r = await config.readText(clustersCachePath(realCwd));
148
168
  if (!r.exists) return null;
149
169
  try { return JSON.parse(r.text); } catch { return null; }
150
170
  }
151
171
 
152
- async function aggregate({ workspace, refresh }) {
172
+ async function aggregate({ workspace, refresh, cwd }) {
153
173
  const ws = typeof workspace === 'string' && workspace ? workspace : encodeCwd(null);
154
174
 
155
175
  if (!refresh) {
156
- const cached = await readCache(ws);
176
+ const cached = await readCache(cwd);
157
177
  if (cached) return { ...cached, cached: true };
158
178
  return { workspace: ws, generatedAt: null, clusters: [], orphans: [], cached: false };
159
179
  }
@@ -174,7 +194,11 @@ async function aggregate({ workspace, refresh }) {
174
194
  }
175
195
 
176
196
  const result = { workspace: ws, generatedAt: Date.now(), clusters, orphans };
177
- await writeJson(cachePath(ws), result);
197
+ const realCwd = resolveCwd(cwd);
198
+ if (realCwd) {
199
+ config.addAllowedRoot(realCwd);
200
+ await writeJson(clustersCachePath(realCwd), result, { writer: CACHE_WRITER });
201
+ }
178
202
  return { ...result, cached: false };
179
203
  }
180
204
 
@@ -189,4 +213,5 @@ module.exports = {
189
213
  aggregate,
190
214
  // exported for tests
191
215
  parseFrontmatter,
216
+ clustersCachePath,
192
217
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * otelSettings — persists OTEL telemetry export configuration.
3
3
  *
4
- * Storage: ~/.config/session-manager/otel.json
4
+ * Storage: ~/.claude/session-manager/otel.json
5
5
  * Shape: {
6
6
  * enabled: boolean,
7
7
  * endpoint: string, // OTLP/HTTP traces endpoint
@@ -30,8 +30,14 @@ const DEFAULTS = Object.freeze({
30
30
  schemaVersion: SCHEMA_VERSION,
31
31
  });
32
32
 
33
+ let migrated = false;
33
34
  function storePath() {
34
- return path.join(os.homedir(), '.config', 'session-manager', 'otel.json');
35
+ const p = path.join(os.homedir(), '.claude', 'session-manager', 'otel.json');
36
+ if (!migrated) {
37
+ migrated = true;
38
+ config.migrateLegacyHomeFile(path.join(os.homedir(), '.config', 'session-manager', 'otel.json'), p);
39
+ }
40
+ return p;
35
41
  }
36
42
 
37
43
  function isValid(cfg) {