@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,558 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Diagnose a memory-plugin install. Read-only: reports, never repairs.
|
|
3
|
+
#
|
|
4
|
+
# Every check prints one line: "ok"/"WARN"/"FAIL", what was checked, and — when it fails —
|
|
5
|
+
# the fix. Checks that prove a thing WORKS beat checks that a file exists: a present
|
|
6
|
+
# node_modules/onnxruntime-node whose postinstall was skipped is the exact failure mode this
|
|
7
|
+
# whole command exists for, and a directory test would call it green.
|
|
8
|
+
#
|
|
9
|
+
# Exit 0 always: this is a report, and a non-zero exit inside a slash command reads as the
|
|
10
|
+
# command itself being broken.
|
|
11
|
+
#
|
|
12
|
+
# `--perf` appends the performance report — server RSS, index sizes, disk split, recall round trip.
|
|
13
|
+
# `--stats[=DAYS]` appends the recall analytics report — inject/abstain rates, the reasons, score
|
|
14
|
+
# and latency distributions, and which notes never surface. Unlike every other section here it
|
|
15
|
+
# prints NOTE NAMES from the vault, so it is the one part of this report that is not safe to paste
|
|
16
|
+
# into a public issue.
|
|
17
|
+
# `--hooks[=DAYS]` appends the hook analytics report — per-hook invocation counts, duration
|
|
18
|
+
# percentiles, the outcome breakdown, and how close each hook ran to the timeout hooks.json
|
|
19
|
+
# declares for it. All three are Node (scripts/doctor-perf.mjs), because every line of them loops,
|
|
20
|
+
# and all three are read-only.
|
|
21
|
+
#
|
|
22
|
+
# One entry point rather than a second command: the numbers are only readable next to the wiring
|
|
23
|
+
# checks, and a paste of the whole thing is what an issue wants. Separate FLAGS rather than one
|
|
24
|
+
# because they answer different questions — "why is this slow", "is this helping" and "is this
|
|
25
|
+
# alive" — and combining them would make the common case print a page nobody asked for.
|
|
26
|
+
set -uo pipefail
|
|
27
|
+
|
|
28
|
+
perf=0
|
|
29
|
+
stats=0
|
|
30
|
+
stats_arg=--stats
|
|
31
|
+
hooks=0
|
|
32
|
+
hooks_arg=--hooks
|
|
33
|
+
for arg in "$@"; do
|
|
34
|
+
case "$arg" in
|
|
35
|
+
--perf) perf=1 ;;
|
|
36
|
+
# `--stats=30` widens the window to 30 daily log files. Passed through verbatim rather than
|
|
37
|
+
# parsed here: doctor-perf.mjs already validates it, and a second parser would be a second
|
|
38
|
+
# place for the default to drift.
|
|
39
|
+
--stats) stats=1 ;;
|
|
40
|
+
--stats=*)
|
|
41
|
+
stats=1
|
|
42
|
+
stats_arg="$arg"
|
|
43
|
+
;;
|
|
44
|
+
--hooks) hooks=1 ;;
|
|
45
|
+
--hooks=*)
|
|
46
|
+
hooks=1
|
|
47
|
+
hooks_arg="$arg"
|
|
48
|
+
;;
|
|
49
|
+
*) echo "unknown option: $arg — usage: doctor.sh [--perf] [--stats[=DAYS]] [--hooks[=DAYS]]"; exit 0 ;;
|
|
50
|
+
esac
|
|
51
|
+
done
|
|
52
|
+
|
|
53
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
54
|
+
ROOT="$(cd "$HERE/.." && pwd)"
|
|
55
|
+
. "$ROOT/hooks/lib/vault-env.sh"
|
|
56
|
+
|
|
57
|
+
STATE=$(memory_home)
|
|
58
|
+
VAULT=$(resolve_vault)
|
|
59
|
+
fails=0; warns=0
|
|
60
|
+
|
|
61
|
+
ok() { printf ' ok %s\n' "$1"; }
|
|
62
|
+
warn() { printf ' WARN %s\n → %s\n' "$1" "$2"; warns=$((warns+1)); }
|
|
63
|
+
fail() { printf ' FAIL %s\n → %s\n' "$1" "$2"; fails=$((fails+1)); }
|
|
64
|
+
|
|
65
|
+
echo "memory install: $ROOT"
|
|
66
|
+
echo "state: $STATE"
|
|
67
|
+
echo "vault: $VAULT"
|
|
68
|
+
echo
|
|
69
|
+
|
|
70
|
+
echo "runtime"
|
|
71
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
72
|
+
fail "node not on PATH" "hooks that need node exit silently. Install node >=22.5, or check your fnm/nvm default is on PATH for non-interactive shells."
|
|
73
|
+
else
|
|
74
|
+
nv=$(node -p 'process.versions.node')
|
|
75
|
+
# node:sqlite DatabaseSync landed in 22.5 and is used unguarded by the engine and the
|
|
76
|
+
# recall hook. Below that they fail with an obscure ERR_UNKNOWN_BUILTIN_MODULE.
|
|
77
|
+
if node -e 'const [a,b]=process.versions.node.split(".").map(Number); process.exit((a>22||(a===22&&b>=5))?0:1)'; then
|
|
78
|
+
ok "node $nv (>= 22.5, node:sqlite available)"
|
|
79
|
+
else
|
|
80
|
+
fail "node $nv is below 22.5" "the engine uses the built-in node:sqlite, absent before 22.5. Upgrade node."
|
|
81
|
+
fi
|
|
82
|
+
fi
|
|
83
|
+
# Was a hard fail while every hook was bash and parsed its payload with jq. After the 2026-08-18
|
|
84
|
+
# port that is ONE hook — vault-memory-sync.sh — and it degrades: `jq ... || true` then falls back
|
|
85
|
+
# to $PWD, which at SessionStart is normally the right directory anyway. A warning states the real
|
|
86
|
+
# cost; a failure would send someone installing jq to fix something that is not broken.
|
|
87
|
+
command -v jq >/dev/null 2>&1 && ok "jq" || warn "jq not on PATH" \
|
|
88
|
+
"only vault-memory-sync.sh needs it, to read cwd from the hook payload; without it that hook falls back to \$PWD, which is wrong only when Claude Code reports a cwd different from the shell's. brew install jq"
|
|
89
|
+
command -v claude >/dev/null 2>&1 && ok "claude CLI" \
|
|
90
|
+
|| warn "claude CLI not on PATH" "the distiller and the graph-report refresh shell out to it headlessly; both degrade to no-ops."
|
|
91
|
+
|
|
92
|
+
echo
|
|
93
|
+
echo "optional integrations"
|
|
94
|
+
# Not required; the plugin's own retrieval path does not read from it. Reported so its absence
|
|
95
|
+
# is a known state rather than a mystery, and so what that costs is stated precisely.
|
|
96
|
+
# codebase-memory-mcp is an MCP server, not a CLI, so PATH cannot see it. The Graph layer is the
|
|
97
|
+
# observable evidence: a GRAPH_REPORT.md exists only if the server has run for this project.
|
|
98
|
+
# One fork for the whole report: project_key shells out to node, and three sections need it.
|
|
99
|
+
slug=$(project_key "$PWD")
|
|
100
|
+
if [ -f "$VAULT/Graph/$slug/GRAPH_REPORT.md" ]; then
|
|
101
|
+
ok "codebase-memory-mcp — L4 graph digest present for $slug"
|
|
102
|
+
else
|
|
103
|
+
warn "no L4 graph digest for this project (optional)" \
|
|
104
|
+
"L1-L3 memory is unaffected. If codebase-memory-mcp is configured, run /memory:graph-report to create one; if it is not, skip L4 entirely — nothing else depends on it."
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
echo
|
|
108
|
+
echo "embedding runtime"
|
|
109
|
+
if [ ! -d "$ROOT/node_modules/@huggingface/transformers" ]; then
|
|
110
|
+
fail "@huggingface/transformers not installed" "semantic recall is off; only keyword search answers. Run /memory:install"
|
|
111
|
+
else
|
|
112
|
+
ok "@huggingface/transformers present"
|
|
113
|
+
# The point of this check: Claude Code's plugin auto-install runs `npm ci` but skips
|
|
114
|
+
# lifecycle scripts, so onnxruntime-node's native binary may never have been fetched.
|
|
115
|
+
# Loading it is the only way to tell.
|
|
116
|
+
if (cd "$ROOT" && node --input-type=module -e 'await import("onnxruntime-node")' >/dev/null 2>&1); then
|
|
117
|
+
ok "onnxruntime-node native binding loads"
|
|
118
|
+
else
|
|
119
|
+
fail "onnxruntime-node present but will not load" "its postinstall was skipped. Run /memory:install (npm rebuild onnxruntime-node)"
|
|
120
|
+
fi
|
|
121
|
+
# Same skipped-lifecycle-script gap, different symptom: nothing breaks, the install is just
|
|
122
|
+
# 320 MB of binaries that cannot load here (other platforms, browser WASM, image pipeline).
|
|
123
|
+
# Claude Code keeps every installed version of a plugin — it does not replace the cache on
|
|
124
|
+
# update. Six versions of this plugin measured 381 MB each, 2.2 GB total, on 2026-08-18. The
|
|
125
|
+
# runtime is identical across them, so one shared copy in $STATE is the whole fix.
|
|
126
|
+
if [ -L "$ROOT/node_modules" ]; then
|
|
127
|
+
ok "node_modules shared from $STATE ($(du -shL "$ROOT/node_modules" 2>/dev/null | cut -f1 | tr -d ' '))"
|
|
128
|
+
else
|
|
129
|
+
case "$ROOT" in
|
|
130
|
+
*/plugins/cache/*)
|
|
131
|
+
vers=$(dirname "$ROOT")
|
|
132
|
+
n=$(find "$vers" -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
|
|
133
|
+
tot=$(du -sm "$vers" 2>/dev/null | cut -f1)
|
|
134
|
+
if [ "${n:-1}" -gt 1 ]; then
|
|
135
|
+
warn "$n installed versions, ${tot} MB total — each keeps its own node_modules" \
|
|
136
|
+
"run /memory:install, or: (cd \"$ROOT\" && node scripts/share-modules.mjs)"
|
|
137
|
+
fi
|
|
138
|
+
;;
|
|
139
|
+
esac
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# -L on purpose: once node_modules is a symlink into $STATE, du without it measures the link
|
|
143
|
+
# (0 MB) and this check would pass by measuring nothing.
|
|
144
|
+
nm_mb=$(du -smL "$ROOT/node_modules" 2>/dev/null | cut -f1)
|
|
145
|
+
if [ "${nm_mb:-0}" -gt 150 ]; then
|
|
146
|
+
warn "node_modules is ${nm_mb} MB" "unslimmed. Run /memory:install, or: (cd $ROOT && node scripts/slim-install.mjs)"
|
|
147
|
+
else
|
|
148
|
+
ok "node_modules slimmed (${nm_mb:-?} MB)"
|
|
149
|
+
fi
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
if [ -d "$STATE/models" ] && [ -n "$(ls -A "$STATE/models" 2>/dev/null)" ]; then
|
|
153
|
+
# -L: models/ is the largest thing in $STATE and the one directory the size breakdown below
|
|
154
|
+
# deliberately does not re-walk, so this line is its only measurement. Without -L a symlinked
|
|
155
|
+
# models/ reports 0 here and nothing else would catch it (2026-08-19, review of #24).
|
|
156
|
+
ok "model weights cached in state ($(du -shL "$STATE/models" 2>/dev/null | cut -f1))"
|
|
157
|
+
else
|
|
158
|
+
warn "no model weights in $STATE/models" "first query downloads ~700 MB. Run /memory:install to warm them."
|
|
159
|
+
fi
|
|
160
|
+
# Weights inside the plugin are discarded by the next /plugin update, silently costing a
|
|
161
|
+
# 700 MB re-download. Catch the redirect having failed.
|
|
162
|
+
if [ -d "$ROOT/node_modules/@huggingface/transformers/.cache" ]; then
|
|
163
|
+
warn "weights are cached inside the plugin, not in $STATE/models" \
|
|
164
|
+
"a /plugin update will discard them. The HF cache redirect in hooks/lib/paths.mjs is not taking effect."
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
echo
|
|
168
|
+
echo "state size"
|
|
169
|
+
# Unbounded growth stays invisible until someone trips over it: the 2.2 GB of duplicated
|
|
170
|
+
# node_modules above was found by accident, and everything else under $STATE has exactly the
|
|
171
|
+
# same shape with nothing watching it. -L for the same reason as the node_modules check —
|
|
172
|
+
# once a subdirectory is a symlink into a shared install, du without it measures the link (0)
|
|
173
|
+
# and this section would report a healthy state by measuring nothing (2026-08-18).
|
|
174
|
+
#
|
|
175
|
+
# The total measures $STATE itself, not the sum of the directories below it. Summing a fixed list
|
|
176
|
+
# omits whatever is not on the list — and the first review of this section caught it omitting
|
|
177
|
+
# node_modules/, the one directory the 2.2 GB incident above was actually about. One walk of the
|
|
178
|
+
# real thing cannot drift from what is in there; a hand-maintained list can, and did.
|
|
179
|
+
state_mb=$(du -smL "$STATE" 2>/dev/null | cut -f1)
|
|
180
|
+
# Breakdown of what the total is made of. models/ and node_modules/ are reported above with their
|
|
181
|
+
# own thresholds, so they are not repeated here — du walks them once for the total and that is
|
|
182
|
+
# already the slowest part of this report.
|
|
183
|
+
for d in db logs eval run cache; do
|
|
184
|
+
[ -d "$STATE/$d" ] || continue
|
|
185
|
+
ok "$d/ $(du -shL "$STATE/$d" 2>/dev/null | cut -f1 | tr -d ' ')"
|
|
186
|
+
done
|
|
187
|
+
# What retention actually left behind, beside the size above. The oldest date is the check: the
|
|
188
|
+
# dated files are pruned when a NEW day's file is created, so a machine that stopped writing logs
|
|
189
|
+
# keeps whatever it had, and the only way to see that is to print the date rather than the policy.
|
|
190
|
+
# The date is read from the FILENAME, like every other date in this system.
|
|
191
|
+
if [ -d "$STATE/logs" ]; then
|
|
192
|
+
# The SAME families pruneDatedLogs() deletes, named again because a shell cannot import the
|
|
193
|
+
# constant. A `[a-z-]*` prefix here read a stray `backup-2018-05-05.jsonl` as ours and printed
|
|
194
|
+
# "oldest 2018-05-05" — retention looking eight years broken while working perfectly. `sed -E`:
|
|
195
|
+
# BSD basic regex has no alternation.
|
|
196
|
+
oldest=$(ls "$STATE/logs" 2>/dev/null |
|
|
197
|
+
sed -nE 's/^(recall|hooks|distill)-([0-9]{4}-[0-9]{2}-[0-9]{2})\.jsonl$/\2/p' | sort | head -1)
|
|
198
|
+
# `?` and not the default: in the degraded branch vault-env.sh could not ask node — no node at
|
|
199
|
+
# all, which the runtime section above FAILs on, or a node that ran and failed, which it does not.
|
|
200
|
+
# Either way this line restates no number it did not resolve.
|
|
201
|
+
keep_days=$(log_retention_days)
|
|
202
|
+
ok "logs/ dated files: keep ${keep_days:-?}d, oldest ${oldest:-none}"
|
|
203
|
+
fi
|
|
204
|
+
# ~722 MB of the expected total is the ONNX weights in models/, so the threshold has to sit well
|
|
205
|
+
# above that. Past 2 GB something else grew: eval/ only appends, and db/ keeps one index per model
|
|
206
|
+
# PER PROJECT, so a machine with many repos accumulates indexes nothing ever deletes. logs/ is the
|
|
207
|
+
# one directory that now bounds itself — by size for the free-form logs, by age for the dated ones.
|
|
208
|
+
if [ "${state_mb:-0}" -gt 2048 ]; then
|
|
209
|
+
warn "state is ${state_mb} MB" "db/, models/ and eval/ are not pruned automatically (logs/ is). Run /memory:prune for the vault, then delete db/semantic-*.db for projects you no longer index and old eval/ runs."
|
|
210
|
+
else
|
|
211
|
+
ok "state total ${state_mb:-?} MB"
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
echo
|
|
215
|
+
echo "vault"
|
|
216
|
+
vs=$(vault_source)
|
|
217
|
+
echo " resolved from: $vs"
|
|
218
|
+
case "$vs" in
|
|
219
|
+
# Prefix match, not `=`: vault-env.sh's degraded (no-node) path reports
|
|
220
|
+
# "built-in default (node unavailable)", a second built-in-default source this must also catch.
|
|
221
|
+
built-in\ default*)
|
|
222
|
+
warn "vault has no explicit source" "distillation (SessionEnd/Stop) now aborts and writes nothing instead of using this default — set \$CLAUDE_VAULT or \"vault\" in $(config_file)"
|
|
223
|
+
;;
|
|
224
|
+
esac
|
|
225
|
+
if [ -d "$VAULT" ]; then
|
|
226
|
+
ok "vault exists"
|
|
227
|
+
# #83: informational only — reports "any depth" (nested inside an ambient repo counts), unlike
|
|
228
|
+
# autoCommit() in distill-session.mjs, which requires the vault to be the repo ROOT before it
|
|
229
|
+
# will ever commit, so a vault nested in an unrelated repo never gets written to.
|
|
230
|
+
if command -v git >/dev/null 2>&1 && git -C "$VAULT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
231
|
+
ok "vault kind: git-backed"
|
|
232
|
+
# #116: the local tracking ref only — no fetch, so it works offline and never touches auth.
|
|
233
|
+
if ahead=$(git -C "$VAULT" rev-list --count '@{u}..HEAD' 2>/dev/null); then
|
|
234
|
+
behind=$(git -C "$VAULT" rev-list --count 'HEAD..@{u}' 2>/dev/null || echo 0)
|
|
235
|
+
if [ "$ahead" -gt 0 ] && [ "$behind" -gt 0 ]; then
|
|
236
|
+
warn "vault git: diverged, $ahead ahead and $behind behind upstream" \
|
|
237
|
+
"a push is rejected until the two sides are merged, so nothing pushes again. Run git pull --rebase in $VAULT and fix any conflict (README, \"Pushing a git-backed vault\")."
|
|
238
|
+
elif [ "$ahead" -ge 20 ]; then
|
|
239
|
+
warn "vault git: $ahead commits ahead of upstream" \
|
|
240
|
+
"the plugin never pushes, so these notes exist on this machine only. Push the vault, or add a post-commit push hook (README, \"Pushing a git-backed vault\")."
|
|
241
|
+
else
|
|
242
|
+
ok "vault git: $ahead commits ahead of upstream"
|
|
243
|
+
fi
|
|
244
|
+
else
|
|
245
|
+
ok "vault git: no upstream, not pushed anywhere"
|
|
246
|
+
fi
|
|
247
|
+
else
|
|
248
|
+
ok "vault kind: plain directory"
|
|
249
|
+
fi
|
|
250
|
+
[ -w "$VAULT" ] && ok "vault writable" || fail "vault not writable" "hooks cannot write notes. Check permissions on $VAULT"
|
|
251
|
+
|
|
252
|
+
# "Pointed at the WRONG vault" is the failure that matters, and an existence check
|
|
253
|
+
# cannot see it: on 2026-08-15 a misresolution silently created an empty scaffold at
|
|
254
|
+
# the default path and repointed the memory symlink at it. Everything read as fine.
|
|
255
|
+
# So: count the notes, and if there are none, go looking for a populated vault
|
|
256
|
+
# elsewhere before calling this healthy.
|
|
257
|
+
n=$(find "$VAULT" -type f -name '*.md' 2>/dev/null | wc -l | tr -d ' ')
|
|
258
|
+
if [ "$n" -gt 0 ]; then
|
|
259
|
+
ok "vault holds $n notes"
|
|
260
|
+
else
|
|
261
|
+
other=""
|
|
262
|
+
# ponytail: the CloudStorage glob is macOS-only and matches nothing on Linux, where the
|
|
263
|
+
# recorded previous vault ($STATE/vault) is the only candidate that carries. Add a Linux
|
|
264
|
+
# sync path when someone runs this on Linux and can name a real one — guessing produces
|
|
265
|
+
# candidates that are never hit and never noticed.
|
|
266
|
+
for cand in "$HOME/Documents/ClaudeVault" \
|
|
267
|
+
"$(head -n1 "$STATE/vault" 2>/dev/null)" \
|
|
268
|
+
"$HOME/Library/CloudStorage"/*/*/Claude; do
|
|
269
|
+
[ -n "$cand" ] && [ -d "$cand" ] && [ "$cand" != "$VAULT" ] || continue
|
|
270
|
+
[ "$(find "$cand" -type f -name '*.md' 2>/dev/null | head -1)" ] && { other="$cand"; break; }
|
|
271
|
+
done
|
|
272
|
+
if [ -n "$other" ]; then
|
|
273
|
+
fail "vault is EMPTY but a populated vault exists at $other" \
|
|
274
|
+
"you are pointed at the wrong one — nothing will be recalled and new notes land in the empty one. Fix: set \"vault\": \"$other\" in $(config_file)"
|
|
275
|
+
else
|
|
276
|
+
warn "vault is empty" "expected on a first install; notes appear as you work."
|
|
277
|
+
fi
|
|
278
|
+
fi
|
|
279
|
+
# #138/#140: a leading `-` is legacyKey(), a path slug. Right for a non-git project, and where a
|
|
280
|
+
# deleted worktree's key fell back to. Counted, never named (a slug is a local path) or moved.
|
|
281
|
+
ps=$(find "$VAULT/Memory" "$VAULT/Insights" "$VAULT/Logs" "$VAULT/Graph" -mindepth 1 -maxdepth 1 \
|
|
282
|
+
-type d -name '-*' 2>/dev/null | sed 's|.*/||' | LC_ALL=C sort -u)
|
|
283
|
+
if [ -n "$ps" ]; then
|
|
284
|
+
warn "$(printf '%s\n' "$ps" | wc -l | tr -d ' ') path-shaped project folder(s)" \
|
|
285
|
+
"fine for a non-git project; otherwise its notes fell back from a deleted directory and nothing searches them — refile by hand under the real key. List: find <vault>/{Memory,Insights,Logs,Graph} -mindepth 1 -maxdepth 1 -name '-*'"
|
|
286
|
+
else
|
|
287
|
+
ok "no path-shaped project folders"
|
|
288
|
+
fi
|
|
289
|
+
else
|
|
290
|
+
fail "vault does not exist: $VAULT" "create it, or set \"vault\" in $(config_file)"
|
|
291
|
+
fi
|
|
292
|
+
# Config belongs in the plugin's own file, not in ~/.claude/settings.json `env` — that is
|
|
293
|
+
# the ecosystem convention, and a file is read when the hook runs rather than depending on
|
|
294
|
+
# what the process inherited or when the value was written.
|
|
295
|
+
if [ ! -f "$(config_file)" ]; then
|
|
296
|
+
warn "no config file at $(config_file)" \
|
|
297
|
+
"running on defaults and env vars. Run /memory:install to write one."
|
|
298
|
+
fi
|
|
299
|
+
if [ -f "$ROOT/.claude-plugin/plugin.json" ]; then
|
|
300
|
+
[ -f "$STATE/plugin-root" ] && ok "plugin-root breadcrumb written" \
|
|
301
|
+
|| warn "no $STATE/plugin-root" "written by the SessionStart hook; /memory:* commands fall back to it when CLAUDE_PLUGIN_ROOT is unset or not this plugin. Start a new session."
|
|
302
|
+
fi
|
|
303
|
+
|
|
304
|
+
# Claude Code's own auto memory loads MEMORY.md — the file this plugin's L1 index IS, via the
|
|
305
|
+
# symlink — and keeps only what fits AUTO_MEMORY_CAP (no digits here: the cap lives in
|
|
306
|
+
# hooks/lib/memory-link-lint.mjs and nowhere else). It reports nothing when it drops the rest, and
|
|
307
|
+
# for a file it did not write it checks nothing at all. So this is one of the two places the
|
|
308
|
+
# truncation is ever said out loud (the other is the SessionStart lint).
|
|
309
|
+
# docs/decisions/2026-08-22-auto-memory.md
|
|
310
|
+
echo
|
|
311
|
+
echo "auto memory (Claude Code loads MEMORY.md; what does not fit is dropped silently)"
|
|
312
|
+
# #199: the hook used to link in a `_` folder; Claude Code reads the `-` sibling. Counted, never
|
|
313
|
+
# named (a slug is a local path) or removed.
|
|
314
|
+
orph=0
|
|
315
|
+
for m in "$HOME"/.claude/projects/*_*/memory; do
|
|
316
|
+
[ -L "$m" ] || continue
|
|
317
|
+
d=${m%/memory}; n=${d##*/}
|
|
318
|
+
compgen -G "$d/*.jsonl" >/dev/null && continue
|
|
319
|
+
compgen -G "${d%/*}/${n//_/-}/*.jsonl" >/dev/null && orph=$((orph+1))
|
|
320
|
+
done
|
|
321
|
+
if [ "$orph" -gt 0 ]; then
|
|
322
|
+
warn "$orph memory link(s) in a folder Claude Code never reads" \
|
|
323
|
+
"its sibling with \`-\` for \`_\` holds the transcripts, and the hook now links there. Remove the old folder by hand. List: ls -d ~/.claude/projects/*_*/memory"
|
|
324
|
+
else
|
|
325
|
+
ok "every memory link sits where Claude Code reads"
|
|
326
|
+
fi
|
|
327
|
+
if command -v node >/dev/null 2>&1; then
|
|
328
|
+
# The EXIT STATUS decides, not the output: an import error, a rejected promise or a bad $ROOT all
|
|
329
|
+
# print nothing, and "nothing" is also what an empty vault prints. Reading emptiness as health is
|
|
330
|
+
# the healthy-looking lie the rest of this file exists to avoid.
|
|
331
|
+
# The module path travels in argv, like the graphgen block below — interpolating $ROOT into the
|
|
332
|
+
# JS source puts a filesystem path inside a string literal, and pathToFileURL is needed anyway:
|
|
333
|
+
# import() of a bare absolute path is read as a package specifier.
|
|
334
|
+
if cap_lines=$(node -e '
|
|
335
|
+
import(require("node:url").pathToFileURL(process.argv[1]).href).then((m) =>
|
|
336
|
+
process.stdout.write(m.capReport(process.argv[2], process.argv[3]).join("\n")),
|
|
337
|
+
);' "$ROOT/hooks/lib/memory-link-lint.mjs" "$VAULT" "$slug" 2>/dev/null); then
|
|
338
|
+
if [ -n "$cap_lines" ]; then
|
|
339
|
+
while IFS=$'\t' read -r status msg fix; do
|
|
340
|
+
case "$status" in
|
|
341
|
+
ok) ok "$msg" ;;
|
|
342
|
+
warn) warn "$msg" "$fix" ;;
|
|
343
|
+
fail) fail "$msg" "$fix" ;;
|
|
344
|
+
# A status capReport grows later must not vanish here — silence reading as health is the
|
|
345
|
+
# failure this whole section exists to end.
|
|
346
|
+
*) warn "unrecognised auto-memory status: $status" "$msg" ;;
|
|
347
|
+
esac
|
|
348
|
+
done <<< "$cap_lines"
|
|
349
|
+
else
|
|
350
|
+
ok "no MEMORY.md in the vault yet"
|
|
351
|
+
fi
|
|
352
|
+
else
|
|
353
|
+
fail "could not measure MEMORY.md against the load cap" \
|
|
354
|
+
"node could not read hooks/lib/memory-link-lint.mjs from $ROOT. Truncation of MEMORY.md is silent everywhere else, so this check going quiet is the failure. Re-run: node -e 'import(\"$ROOT/hooks/lib/memory-link-lint.mjs\")'"
|
|
355
|
+
fi
|
|
356
|
+
# #109: what loading it costs per session start, beside whether it fits.
|
|
357
|
+
if cost_lines=$(node -e '
|
|
358
|
+
import(require("node:url").pathToFileURL(process.argv[1]).href).then((m) =>
|
|
359
|
+
process.stdout.write(m.costReport({ vaultDir: process.argv[2], slug: process.argv[3], logDir: process.argv[4] }).join("\n")),
|
|
360
|
+
);' "$ROOT/scripts/lib/hook-stats.mjs" "$VAULT" "$slug" "$STATE/logs" 2>/dev/null); then
|
|
361
|
+
[ -n "$cost_lines" ] && while IFS=$'\t' read -r status msg fix; do
|
|
362
|
+
case "$status" in
|
|
363
|
+
ok) ok "$msg" ;;
|
|
364
|
+
warn) warn "$msg" "$fix" ;;
|
|
365
|
+
*) warn "unrecognised auto-memory cost status: $status" "$msg" ;;
|
|
366
|
+
esac
|
|
367
|
+
done <<< "$cost_lines"
|
|
368
|
+
else
|
|
369
|
+
warn "could not estimate what MEMORY.md costs per session start" \
|
|
370
|
+
"node could not read scripts/lib/hook-stats.mjs from $ROOT. Re-run: node -e 'import(\"$ROOT/scripts/lib/hook-stats.mjs\")'"
|
|
371
|
+
fi
|
|
372
|
+
else
|
|
373
|
+
warn "cannot measure MEMORY.md without node" "install node >= 22.5; nothing else here needs it more."
|
|
374
|
+
fi
|
|
375
|
+
|
|
376
|
+
echo
|
|
377
|
+
echo "cowork auto memory (a separate, global feature — not this plugin, not Claude Code's own auto memory)"
|
|
378
|
+
# A THIRD memory surface, distinct from the autoMemoryDirectory one covered above: one folder for
|
|
379
|
+
# every repo on the machine, with its own typed-note convention. docs/decisions/2026-09-05-cowork-auto-memory.md
|
|
380
|
+
if [ -n "${CLAUDE_COWORK_MEMORY_PATH_OVERRIDE:-}" ]; then
|
|
381
|
+
warn "CLAUDE_COWORK_MEMORY_PATH_OVERRIDE is set: $CLAUDE_COWORK_MEMORY_PATH_OVERRIDE" \
|
|
382
|
+
"repo lessons belong in this vault (Memory/$slug), not there — that folder is global and unrelated to this plugin. See docs/decisions/2026-09-05-cowork-auto-memory.md"
|
|
383
|
+
else
|
|
384
|
+
ok "CLAUDE_COWORK_MEMORY_PATH_OVERRIDE not set"
|
|
385
|
+
fi
|
|
386
|
+
|
|
387
|
+
echo
|
|
388
|
+
echo "index"
|
|
389
|
+
model="${MEMORY_SEMANTIC_MODEL:-bge-m3}"
|
|
390
|
+
db="$STATE/db/semantic-$slug-$model.db"
|
|
391
|
+
echo " project: $slug model: $model"
|
|
392
|
+
if [ -f "$db" ]; then
|
|
393
|
+
if command -v node >/dev/null 2>&1; then
|
|
394
|
+
n=$(node -e '
|
|
395
|
+
const {DatabaseSync}=require("node:sqlite");
|
|
396
|
+
try{const d=new DatabaseSync(process.argv[1],{readOnly:true});
|
|
397
|
+
console.log(d.prepare("select count(*) c from chunks").get().c);}catch(e){console.log("err")}' "$db" 2>/dev/null)
|
|
398
|
+
case "$n" in
|
|
399
|
+
err|"") warn "index unreadable: $(basename "$db")" "run /memory:prune to rebuild, or delete it and let the SessionStart hook re-index." ;;
|
|
400
|
+
0) warn "index is empty" "nothing to recall. Check Memory/$slug exists in the vault, then start a new session." ;;
|
|
401
|
+
*) ok "index has $n chunks" ;;
|
|
402
|
+
esac
|
|
403
|
+
fi
|
|
404
|
+
else
|
|
405
|
+
warn "no index for this project" "recall abstains silently. It builds on the next SessionStart if $VAULT/Memory/$slug exists."
|
|
406
|
+
fi
|
|
407
|
+
# One server per MODEL, serving every project — not per slug+model, which held one ~1.3GB model
|
|
408
|
+
# per indexed repo.
|
|
409
|
+
sock="$STATE/run/search-$model.sock"
|
|
410
|
+
[ -S "$sock" ] && ok "resident search server listening" \
|
|
411
|
+
|| warn "search server not running" "first recall of the session spawns it (~1.5s), then answers take ~60ms. Not an error."
|
|
412
|
+
stale=$(find "$STATE/run" -name 'search-*.sock' ! -name "search-$model.sock" 2>/dev/null | wc -l | tr -d ' ')
|
|
413
|
+
# `|| true`: a false test is the LAST command here, and this script must exit 0 whatever it finds.
|
|
414
|
+
[ "${stale:-0}" -gt 0 ] && warn "$stale leftover socket(s) in run/" \
|
|
415
|
+
"from the per-project scheme or another model. The next server start evicts them." || true
|
|
416
|
+
|
|
417
|
+
# The graph-regen lock (#34). Held = a full re-index is running somewhere on this machine and every
|
|
418
|
+
# other session will nudge instead of starting a second one. Read-only: never reclaim it here.
|
|
419
|
+
lock="$STATE/run/graphgen.lock"
|
|
420
|
+
if [ -f "$lock" ]; then
|
|
421
|
+
lock_pid=$(awk '{print $1}' "$lock" 2>/dev/null)
|
|
422
|
+
lock_at=$(awk '{print $2}' "$lock" 2>/dev/null)
|
|
423
|
+
# Each field validated SEPARATELY before any arithmetic, because a lock truncated mid-write to
|
|
424
|
+
# just "123" leaves a digit-only pid and an empty age — concatenating them hid that, and the age
|
|
425
|
+
# then defaulted to 0 and reported a 56-year-old lock instead of a gone owner. An unusable age
|
|
426
|
+
# zeroes the pid too, so both land on the same verdict lockHolder() reaches via Number.isFinite.
|
|
427
|
+
case "${lock_pid:-}" in (*[!0-9]*|'') lock_pid=0 ;; esac
|
|
428
|
+
case "${lock_at:-}" in (*[!0-9]*|'') lock_pid=0; lock_at=0 ;; esac
|
|
429
|
+
age=$(( $(date +%s) - ${lock_at:-0} ))
|
|
430
|
+
# The staleness window is ASKED FOR, not copied: a second 3600 here would drift the moment
|
|
431
|
+
# LOCK_MAX_SECONDS moves, and doctor would then call a held lock stale (or the reverse).
|
|
432
|
+
# Deliberately NOT guarded by `command -v node`, unlike the perf block: a missing node leaves
|
|
433
|
+
# lock_max empty and the branch below already reports that, where the perf block has no output
|
|
434
|
+
# to fall back to. Do not "fix" this into a guard that silently skips the check.
|
|
435
|
+
# pathToFileURL, not a bare path: import() of an absolute path is read as a package specifier.
|
|
436
|
+
lock_max=$(node -e 'import(require("node:url").pathToFileURL(process.argv[1]).href).then((m) => console.log(m.LOCK_MAX_SECONDS))' \
|
|
437
|
+
"$ROOT/hooks/lib/graph-staleness-check.mjs" 2>/dev/null)
|
|
438
|
+
case "${lock_max:-}" in (*[!0-9]*|'') lock_max='' ;; esac
|
|
439
|
+
# `-gt 0`: `kill -0 0` signals our own process group and succeeds, so pid 0 would read as alive.
|
|
440
|
+
if [ "${lock_pid:-0}" -le 0 ] || ! kill -0 "$lock_pid" 2>/dev/null; then
|
|
441
|
+
warn "stale graphgen lock in run/" "its owner is gone. The next stale session reclaims it; nothing to do."
|
|
442
|
+
elif [ -z "$lock_max" ]; then
|
|
443
|
+
warn "graphgen lock held by live pid $lock_pid (${age}s)" "could not read LOCK_MAX_SECONDS, so whether it is still within its window is unknown. See the runtime section."
|
|
444
|
+
elif [ "$age" -lt "$lock_max" ]; then
|
|
445
|
+
ok "graph re-index running (pid $lock_pid, ${age}s) — other sessions will not start a second one"
|
|
446
|
+
else
|
|
447
|
+
warn "stale graphgen lock in run/" "held for ${age}s, past the ${lock_max}s window. The next stale session reclaims it; nothing to do."
|
|
448
|
+
fi
|
|
449
|
+
fi
|
|
450
|
+
|
|
451
|
+
echo
|
|
452
|
+
echo "eval case sets"
|
|
453
|
+
# Reported because the gap is invisible otherwise: a project with no held-out set has no way to tell
|
|
454
|
+
# a retrieval improvement from a case set fitted to the result, and nothing else in the tool says so.
|
|
455
|
+
# Names counts and kinds only, never a question — these files hold vault content (#87).
|
|
456
|
+
# Globbed, not rebuilt: defaultCasesPath() is the one place a case-set filename is constructed, and
|
|
457
|
+
# a second copy here would also miss every style but `semantic`.
|
|
458
|
+
# Reported inside the loop, never accumulated into a string: `for f in $list` word-splits, and
|
|
459
|
+
# $CLAUDE_MEMORY_HOME may contain a space.
|
|
460
|
+
_held="" _tuning=0
|
|
461
|
+
for f in "$STATE"/eval/eval-cases-"$slug"-*.jsonl; do
|
|
462
|
+
[ -f "$f" ] || continue
|
|
463
|
+
case "$f" in
|
|
464
|
+
*-heldout.jsonl) _held="$f" ;;
|
|
465
|
+
*)
|
|
466
|
+
_tuning=$((_tuning + 1))
|
|
467
|
+
# Style only. The slug is this project's and doctor echoes it already, but the line is long
|
|
468
|
+
# enough without it.
|
|
469
|
+
_style=$(basename "$f" .jsonl); _style=${_style##*-}
|
|
470
|
+
ok "tuning set ($_style): $(grep -c . "$f") cases"
|
|
471
|
+
;;
|
|
472
|
+
esac
|
|
473
|
+
done
|
|
474
|
+
[ "$_tuning" -eq 0 ] && echo " none tuning set: not authored for this project"
|
|
475
|
+
if [ -n "$_held" ]; then
|
|
476
|
+
if [ -f "$_held.sha256" ]; then
|
|
477
|
+
ok "held-out set: $(grep -c . "$_held") cases, frozen"
|
|
478
|
+
else
|
|
479
|
+
warn "held-out set is not frozen" \
|
|
480
|
+
"a set nobody pinned can be edited to fit a result. Run /memory:eval and freeze it."
|
|
481
|
+
fi
|
|
482
|
+
else
|
|
483
|
+
warn "no held-out set for this project" \
|
|
484
|
+
"tuning against a set you also score on overfits to it. Run /memory:eval to mine candidates from your own past prompts and label them — you pick the answers, that is the point."
|
|
485
|
+
fi
|
|
486
|
+
|
|
487
|
+
echo
|
|
488
|
+
echo "recall"
|
|
489
|
+
if [ "$(recall_config)" = "true" ]; then
|
|
490
|
+
ok "per-prompt recall armed (\"recall\": true in $(basename "$(config_file)"))"
|
|
491
|
+
elif [ "${MEMORY_RECALL_ENABLED:-}" = "1" ]; then
|
|
492
|
+
warn "recall armed by env var only" \
|
|
493
|
+
"works where the environment reaches the hook, but a value added mid-session does not. Prefer \"recall\": true in $(config_file)"
|
|
494
|
+
else
|
|
495
|
+
warn "per-prompt recall is OFF" "ships inert by design. Arm it with \"recall\": true in $(config_file)"
|
|
496
|
+
fi
|
|
497
|
+
# Recall logs every decision, including abstentions. No log at all means it never ran.
|
|
498
|
+
if recall_enabled && [ -z "$(ls "$STATE/logs"/recall-*.jsonl 2>/dev/null)" ]; then
|
|
499
|
+
warn "recall is armed but has never logged a decision" \
|
|
500
|
+
"expected until a session runs with it armed; if it persists, the hook is not firing."
|
|
501
|
+
fi
|
|
502
|
+
|
|
503
|
+
if [ "$perf" -eq 1 ]; then
|
|
504
|
+
# Read-only like everything else here: it never starts a server, loads a model or re-indexes, so
|
|
505
|
+
# a missing socket is reported as "not measured" rather than spawned into existence.
|
|
506
|
+
if command -v node >/dev/null 2>&1; then
|
|
507
|
+
echo
|
|
508
|
+
echo "performance"
|
|
509
|
+
# `^.` and not `^`: indenting a blank line would leave trailing whitespace behind.
|
|
510
|
+
# --disable-warning, not `2>/dev/null`: node:sqlite is experimental below 22.22 and its warning
|
|
511
|
+
# lands MID-REPORT (the handle is opened lazily, while the index table is being built), but
|
|
512
|
+
# stderr still has to reach the reader — a crash in doctor-perf.mjs must not vanish.
|
|
513
|
+
node --disable-warning=ExperimentalWarning "$ROOT/scripts/doctor-perf.mjs" "$PWD" 2>&1 |
|
|
514
|
+
sed 's/^./ &/'
|
|
515
|
+
else
|
|
516
|
+
echo
|
|
517
|
+
warn "cannot report performance without node" "see the runtime section above."
|
|
518
|
+
fi
|
|
519
|
+
fi
|
|
520
|
+
|
|
521
|
+
if [ "$stats" -eq 1 ]; then
|
|
522
|
+
# Reads the recall logs and this project's index. Writes nothing, starts nothing: with no logs
|
|
523
|
+
# it reports "not measured" rather than arming recall to produce some.
|
|
524
|
+
if command -v node >/dev/null 2>&1; then
|
|
525
|
+
echo
|
|
526
|
+
node --disable-warning=ExperimentalWarning "$ROOT/scripts/doctor-perf.mjs" "$PWD" "$stats_arg" 2>&1 |
|
|
527
|
+
sed 's/^./ &/'
|
|
528
|
+
else
|
|
529
|
+
echo
|
|
530
|
+
warn "cannot report recall stats without node" "see the runtime section above."
|
|
531
|
+
fi
|
|
532
|
+
fi
|
|
533
|
+
|
|
534
|
+
if [ "$hooks" -eq 1 ]; then
|
|
535
|
+
# Reads the hook logs and hooks.json. Writes nothing and runs no hook: with no logs it reports
|
|
536
|
+
# "not measured" rather than firing one to produce some.
|
|
537
|
+
if command -v node >/dev/null 2>&1; then
|
|
538
|
+
echo
|
|
539
|
+
node --disable-warning=ExperimentalWarning "$ROOT/scripts/doctor-perf.mjs" "$PWD" "$hooks_arg" 2>&1 |
|
|
540
|
+
sed 's/^./ &/'
|
|
541
|
+
else
|
|
542
|
+
echo
|
|
543
|
+
warn "cannot report hook stats without node" "see the runtime section above."
|
|
544
|
+
fi
|
|
545
|
+
fi
|
|
546
|
+
|
|
547
|
+
echo
|
|
548
|
+
if [ "$fails" -gt 0 ]; then
|
|
549
|
+
# Not "semantic recall will not work": every failure here WAS a recall blocker until the auto
|
|
550
|
+
# memory section landed, and an over-cap MEMORY.md breaks nothing about recall — the index is
|
|
551
|
+
# built from the notes. This line is what people paste into issues, so it names no cause.
|
|
552
|
+
echo "$fails failure(s), $warns warning(s) — see each FAIL above for what is broken and how to fix it."
|
|
553
|
+
elif [ "$warns" -gt 0 ]; then
|
|
554
|
+
echo "no failures, $warns warning(s) — core memory works; see the warnings for what is degraded."
|
|
555
|
+
else
|
|
556
|
+
echo "all checks passed."
|
|
557
|
+
fi
|
|
558
|
+
exit 0
|
package/scripts/env.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Prints the resolved memory environment as shell assignments; eval "$(node scripts/env.mjs "$PWD")" from hooks/lib/vault-env.sh.
|
|
3
|
+
// Off-pattern placement (logic lives in hooks/lib/env-shell.mjs, not scripts/lib/) — why: docs/architecture.md, "B1 — hooks/ and scripts/ are not layers".
|
|
4
|
+
import { shellEnv } from '../hooks/lib/env-shell.mjs';
|
|
5
|
+
|
|
6
|
+
process.stdout.write(shellEnv(process.argv[2] || process.cwd()));
|