@spike1292/claude-memory 0.0.0-stage → 0.14.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.
- package/LICENSE +21 -0
- package/README.md +412 -2
- package/hooks/distill-session.mjs +74 -0
- package/hooks/graph-staleness-check.mjs +25 -0
- package/hooks/hooks.json +94 -0
- package/hooks/insights-surface.mjs +48 -0
- package/hooks/lib/distill-session.mjs +1560 -0
- package/hooks/lib/dupe-report.mjs +61 -0
- package/hooks/lib/env-shell.mjs +92 -0
- package/hooks/lib/graph-staleness-check.mjs +394 -0
- package/hooks/lib/hook-io.mjs +715 -0
- package/hooks/lib/insights-surface.mjs +165 -0
- package/hooks/lib/memory-link-lint.mjs +499 -0
- package/hooks/lib/memory-recall.mjs +219 -0
- package/hooks/lib/omp.mjs +103 -0
- package/hooks/lib/opencode.mjs +231 -0
- package/hooks/lib/paths.mjs +452 -0
- package/hooks/lib/semantic-index-refresh.mjs +155 -0
- package/hooks/lib/validate-note.mjs +218 -0
- package/hooks/lib/vault-env.sh +110 -0
- package/hooks/memory-link-lint.mjs +65 -0
- package/hooks/memory-recall.mjs +251 -0
- package/hooks/semantic-index-refresh.mjs +23 -0
- package/hooks/session-context.mjs +9 -0
- package/hooks/validate-note.mjs +52 -0
- package/hooks/vault-memory-sync.sh +154 -0
- package/omp/index.js +1 -0
- package/opencode/index.js +1 -0
- package/package.json +51 -4
- package/scripts/claude-memory.mjs +31 -0
- package/scripts/doctor-perf.mjs +121 -0
- package/scripts/doctor.sh +558 -0
- package/scripts/env.mjs +6 -0
- package/scripts/lib/claude-memory.mjs +168 -0
- package/scripts/lib/doctor-perf.mjs +434 -0
- package/scripts/lib/hook-stats.mjs +864 -0
- package/scripts/lib/lexical.mjs +85 -0
- package/scripts/lib/memory-adopt.mjs +69 -0
- package/scripts/lib/memory-audit-checks.mjs +344 -0
- package/scripts/lib/memory-eval.mjs +381 -0
- package/scripts/lib/memory-mark.mjs +135 -0
- package/scripts/lib/memory-mcp.mjs +142 -0
- package/scripts/lib/memory-merge.mjs +316 -0
- package/scripts/lib/memory-mine.mjs +108 -0
- package/scripts/lib/memory-promote.mjs +207 -0
- package/scripts/lib/memory-prune.mjs +84 -0
- package/scripts/lib/memory-semantic.mjs +999 -0
- package/scripts/lib/memory-setup.mjs +170 -0
- package/scripts/lib/memory-synth-vault.mjs +538 -0
- package/scripts/lib/model-default.mjs +7 -0
- package/scripts/lib/models.mjs +58 -0
- package/scripts/lib/prune-logs.mjs +130 -0
- package/scripts/lib/recall-stats.mjs +354 -0
- package/scripts/lib/share-modules.mjs +70 -0
- package/scripts/lib/slim-install.mjs +162 -0
- package/scripts/lib/vault-mcp.mjs +405 -0
- package/scripts/memory-adopt.mjs +160 -0
- package/scripts/memory-audit-checks.mjs +375 -0
- package/scripts/memory-eval.mjs +753 -0
- package/scripts/memory-mark.mjs +39 -0
- package/scripts/memory-mcp.mjs +35 -0
- package/scripts/memory-merge.mjs +55 -0
- package/scripts/memory-prune.mjs +44 -0
- package/scripts/memory-semantic.mjs +1192 -0
- package/scripts/memory-setup.mjs +33 -0
- package/scripts/memory-synth-vault.mjs +251 -0
- package/scripts/prune-logs.mjs +42 -0
- package/scripts/share-modules.mjs +79 -0
- package/scripts/slim-install.mjs +55 -0
- package/scripts/vault-mcp.mjs +50 -0
- package/stubs/onnxruntime-web/index.mjs +11 -0
- package/stubs/onnxruntime-web/package.json +12 -0
- package/stubs/sharp/index.mjs +11 -0
- package/stubs/sharp/package.json +12 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SessionStart entry: surface recent L3 Mistakes titles so past errors actually reach context —
|
|
3
|
+
// titles only; full lessons stay in the vault / via /memory:health.
|
|
4
|
+
//
|
|
5
|
+
// Thin on purpose: stdin, cwd, stdout only — see docs/architecture.md's "Entry files are thin
|
|
6
|
+
// wrappers over lib/" invariant (and G1, where the pattern breaks elsewhere).
|
|
7
|
+
import { readStdin, payload, hookCwd, logHook, standDown, sessionContext } from './lib/hook-io.mjs';
|
|
8
|
+
import { surface } from './lib/insights-surface.mjs';
|
|
9
|
+
|
|
10
|
+
// readStdin() and not `new Response(process.stdin)`: the web-streams path costs ~18 ms of runtime
|
|
11
|
+
// bootstrap per hook against ~0.5 ms for one readFileSync(0) — a third of this hook's whole wall
|
|
12
|
+
// time, paid to parse a 100-byte payload. Measured 2026-08-20,
|
|
13
|
+
// docs/decisions/2026-08-20-hook-startup-cost.md.
|
|
14
|
+
const p = payload(readStdin());
|
|
15
|
+
if (standDown('insights-surface', p)) process.exit(0);
|
|
16
|
+
const cwd = hookCwd(p);
|
|
17
|
+
|
|
18
|
+
// A SessionStart hook must never break a session.
|
|
19
|
+
/** @type {import('./lib/hook-io.mjs').HookOutcome} */
|
|
20
|
+
let outcome = 'ran';
|
|
21
|
+
/** @type {string | undefined} */
|
|
22
|
+
let reason;
|
|
23
|
+
/** @type {Record<string, number> | undefined} */
|
|
24
|
+
let extra;
|
|
25
|
+
try {
|
|
26
|
+
const text = surface(cwd);
|
|
27
|
+
if (text) console.log(sessionContext(text));
|
|
28
|
+
reason = text ? 'surfaced' : 'nothing to surface';
|
|
29
|
+
// What this hook COSTS the session, in bytes of context window. Omitted rather than logged as 0
|
|
30
|
+
// when it injects nothing, so "injected nothing" and "was not measuring yet" stay distinguishable
|
|
31
|
+
// — a week of older log files sits in the reader's window.
|
|
32
|
+
if (text) extra = { bytes: Buffer.byteLength(text) };
|
|
33
|
+
} catch (e) {
|
|
34
|
+
outcome = 'error';
|
|
35
|
+
reason = String(/** @type {Error} */ (e)?.message ?? e);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Last, so the duration covers the work — and outside the try for the same reason the catch is
|
|
39
|
+
// there: the log is best-effort, and logHook swallows its own failures.
|
|
40
|
+
logHook({
|
|
41
|
+
hook: 'insights-surface',
|
|
42
|
+
event: String(p.hook_event_name ?? ''),
|
|
43
|
+
cwd,
|
|
44
|
+
session: /** @type {string|undefined} */ (p.session_id),
|
|
45
|
+
outcome,
|
|
46
|
+
reason,
|
|
47
|
+
extra,
|
|
48
|
+
});
|