agent-recall-core 3.4.39 → 3.4.41
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/dist/helpers/auto-name.d.ts +2 -1
- package/dist/helpers/auto-name.d.ts.map +1 -1
- package/dist/helpers/auto-name.js +45 -6
- package/dist/helpers/auto-name.js.map +1 -1
- package/dist/helpers/journal-files.d.ts +29 -1
- package/dist/helpers/journal-files.d.ts.map +1 -1
- package/dist/helpers/journal-files.js +124 -33
- package/dist/helpers/journal-files.js.map +1 -1
- package/dist/helpers/journal-sig-theme.d.ts +18 -0
- package/dist/helpers/journal-sig-theme.d.ts.map +1 -1
- package/dist/helpers/journal-sig-theme.js +45 -4
- package/dist/helpers/journal-sig-theme.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/archive-write.d.ts.map +1 -1
- package/dist/storage/archive-write.js +7 -1
- package/dist/storage/archive-write.js.map +1 -1
- package/dist/storage/blind-spots-store.d.ts +9 -1
- package/dist/storage/blind-spots-store.d.ts.map +1 -1
- package/dist/storage/blind-spots-store.js +9 -2
- package/dist/storage/blind-spots-store.js.map +1 -1
- package/dist/storage/corrections.d.ts +47 -3
- package/dist/storage/corrections.d.ts.map +1 -1
- package/dist/storage/corrections.js +53 -6
- package/dist/storage/corrections.js.map +1 -1
- package/dist/storage/extraction.d.ts +136 -0
- package/dist/storage/extraction.d.ts.map +1 -0
- package/dist/storage/extraction.js +368 -0
- package/dist/storage/extraction.js.map +1 -0
- package/dist/storage/fs-utils.d.ts +21 -0
- package/dist/storage/fs-utils.d.ts.map +1 -1
- package/dist/storage/fs-utils.js +86 -0
- package/dist/storage/fs-utils.js.map +1 -1
- package/dist/storage/hook-health.d.ts +50 -0
- package/dist/storage/hook-health.d.ts.map +1 -0
- package/dist/storage/hook-health.js +183 -0
- package/dist/storage/hook-health.js.map +1 -0
- package/dist/storage/hygiene.d.ts +111 -0
- package/dist/storage/hygiene.d.ts.map +1 -0
- package/dist/storage/hygiene.js +422 -0
- package/dist/storage/hygiene.js.map +1 -0
- package/dist/storage/memory-protocol.d.ts.map +1 -1
- package/dist/storage/memory-protocol.js +4 -1
- package/dist/storage/memory-protocol.js.map +1 -1
- package/dist/storage/paths.d.ts +23 -4
- package/dist/storage/paths.d.ts.map +1 -1
- package/dist/storage/paths.js +26 -9
- package/dist/storage/paths.js.map +1 -1
- package/dist/storage/recency-index.d.ts +79 -0
- package/dist/storage/recency-index.d.ts.map +1 -0
- package/dist/storage/recency-index.js +204 -0
- package/dist/storage/recency-index.js.map +1 -0
- package/dist/storage/session-card.d.ts +74 -0
- package/dist/storage/session-card.d.ts.map +1 -0
- package/dist/storage/session-card.js +219 -0
- package/dist/storage/session-card.js.map +1 -0
- package/dist/storage/store-manifest.d.ts +31 -0
- package/dist/storage/store-manifest.d.ts.map +1 -0
- package/dist/storage/store-manifest.js +108 -0
- package/dist/storage/store-manifest.js.map +1 -0
- package/dist/supabase/recall-backend.d.ts +1 -1
- package/dist/supabase/recall-backend.d.ts.map +1 -1
- package/dist/supabase/recall-backend.js.map +1 -1
- package/dist/supabase/sync.d.ts.map +1 -1
- package/dist/supabase/sync.js +13 -2
- package/dist/supabase/sync.js.map +1 -1
- package/dist/tools-logic/drill-down.d.ts +9 -2
- package/dist/tools-logic/drill-down.d.ts.map +1 -1
- package/dist/tools-logic/drill-down.js +32 -1
- package/dist/tools-logic/drill-down.js.map +1 -1
- package/dist/tools-logic/journal-search.d.ts.map +1 -1
- package/dist/tools-logic/journal-search.js +7 -1
- package/dist/tools-logic/journal-search.js.map +1 -1
- package/dist/tools-logic/predict-correction.d.ts +10 -0
- package/dist/tools-logic/predict-correction.d.ts.map +1 -1
- package/dist/tools-logic/predict-correction.js +6 -2
- package/dist/tools-logic/predict-correction.js.map +1 -1
- package/dist/tools-logic/recognition-builder.d.ts +9 -0
- package/dist/tools-logic/recognition-builder.d.ts.map +1 -1
- package/dist/tools-logic/recognition-builder.js +5 -3
- package/dist/tools-logic/recognition-builder.js.map +1 -1
- package/dist/tools-logic/resurrect.d.ts +106 -0
- package/dist/tools-logic/resurrect.d.ts.map +1 -0
- package/dist/tools-logic/resurrect.js +561 -0
- package/dist/tools-logic/resurrect.js.map +1 -0
- package/dist/tools-logic/session-start-lite.d.ts +6 -0
- package/dist/tools-logic/session-start-lite.d.ts.map +1 -1
- package/dist/tools-logic/session-start-lite.js +15 -0
- package/dist/tools-logic/session-start-lite.js.map +1 -1
- package/dist/tools-logic/session-start.d.ts +17 -0
- package/dist/tools-logic/session-start.d.ts.map +1 -1
- package/dist/tools-logic/session-start.js +87 -5
- package/dist/tools-logic/session-start.js.map +1 -1
- package/dist/tools-logic/smart-recall.d.ts +9 -4
- package/dist/tools-logic/smart-recall.d.ts.map +1 -1
- package/dist/tools-logic/smart-recall.js +170 -4
- package/dist/tools-logic/smart-recall.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hygiene.ts — DETECTION-ONLY store trash audit ("ar hygiene").
|
|
3
|
+
*
|
|
4
|
+
* Sibling to store-doctor.ts, but a different axis:
|
|
5
|
+
* - store-doctor = STRUCTURAL integrity (index drift, stale locks, stalled
|
|
6
|
+
* consolidation seam, orphaned markers, ledger divergence).
|
|
7
|
+
* - hygiene = STORE TRASH (junk project dirs, unbounded counter files,
|
|
8
|
+
* recurring-theme epidemics, case-fold forks, stale derived caches,
|
|
9
|
+
* leaked-secret-shaped strings, missing materialized indexes, reserved-
|
|
10
|
+
* word slug collisions).
|
|
11
|
+
*
|
|
12
|
+
* HARD INVARIANTS (owner-approved 2026-07-27):
|
|
13
|
+
* 1. Scan != clean. `runHygieneScan` NEVER deletes, renames, or quarantines
|
|
14
|
+
* anything — findings only. No mkdir, no unlink, no rename, no write of
|
|
15
|
+
* any kind. Only fs reads (existsSync/readdirSync/readFileSync/statSync).
|
|
16
|
+
* 2. The ONLY write this module ever performs is its own baseline file
|
|
17
|
+
* (`hygiene-baseline.json`), and ONLY via the explicit `updateBaseline`
|
|
18
|
+
* call — never as a side effect of scanning or of `applyBaseline`.
|
|
19
|
+
* 3. Each check runs independently try/caught inside `runHygieneScan` — one
|
|
20
|
+
* failing check (unreadable dir, permissions, malformed file) degrades
|
|
21
|
+
* that check to zero findings; it never kills the whole scan.
|
|
22
|
+
* 4. `runHygieneScan(root)` is PURE with respect to global state: unlike
|
|
23
|
+
* store-doctor.ts (which reads the process-global root via getRoot()),
|
|
24
|
+
* every path here is built from the explicit `root` parameter. This is
|
|
25
|
+
* deliberate — it lets tests exercise the scanner against a temp
|
|
26
|
+
* directory without mutating (or restoring) any global root state.
|
|
27
|
+
*
|
|
28
|
+
* Baseline: without one, every pre-existing finding (e.g. ~985 stray counter
|
|
29
|
+
* files) would resurface on every run and drown out anything NEW. The first
|
|
30
|
+
* invocation of `ar hygiene --baseline-update` snapshots every current
|
|
31
|
+
* finding's `stable_id`; subsequent bare `ar hygiene` runs report only
|
|
32
|
+
* findings whose `stable_id` is NOT in that snapshot ("fresh"), plus a
|
|
33
|
+
* one-line count of how many are already known.
|
|
34
|
+
*/
|
|
35
|
+
import * as fs from "node:fs";
|
|
36
|
+
import * as path from "node:path";
|
|
37
|
+
import { createHash } from "node:crypto";
|
|
38
|
+
import { ensureDir } from "./fs-utils.js";
|
|
39
|
+
import { listCaseVariantForks, PROJECTS_DIRNAME } from "./paths.js";
|
|
40
|
+
import { parseJournalFileName } from "../helpers/journal-name-parser.js";
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// Constants
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
/** The baseline file lives at the store root, alongside `projects/`. */
|
|
45
|
+
export const HYGIENE_BASELINE_FILENAME = "hygiene-baseline.json";
|
|
46
|
+
export function hygieneBaselinePath(root) {
|
|
47
|
+
return path.join(root, HYGIENE_BASELINE_FILENAME);
|
|
48
|
+
}
|
|
49
|
+
const CHECK_NAMES = [
|
|
50
|
+
"junk-project-dirs",
|
|
51
|
+
"counter-accumulation",
|
|
52
|
+
"theme-epidemic",
|
|
53
|
+
"case-fold-forks",
|
|
54
|
+
"stale-derived-caches",
|
|
55
|
+
"root-secret-patterns",
|
|
56
|
+
"missing-corrections-index",
|
|
57
|
+
"reserved-word-slugs",
|
|
58
|
+
];
|
|
59
|
+
// (a) junk-project-dirs
|
|
60
|
+
const UUID_PREFIX_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-/i;
|
|
61
|
+
const DOT_DOT_RE = /\.\./;
|
|
62
|
+
const JUNK_LITERAL_RE = /^(test-|this-project-does-not-exist|not-a-real-project)/i;
|
|
63
|
+
const EPOCH_SUFFIX_RE = /-\d{13}$/;
|
|
64
|
+
// (b) counter-accumulation
|
|
65
|
+
const COUNTER_PREFIX = ".ambient-counter-";
|
|
66
|
+
const COUNTER_YELLOW_THRESHOLD = 100;
|
|
67
|
+
const COUNTER_RED_THRESHOLD = 500;
|
|
68
|
+
// (c) theme-epidemic
|
|
69
|
+
const THEME_EPIDEMIC_MIN_FILES = 10;
|
|
70
|
+
const THEME_EPIDEMIC_SHARE = 0.5;
|
|
71
|
+
// (e) stale-derived-caches
|
|
72
|
+
const STALE_CACHE_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
|
73
|
+
const SECRET_PATTERNS = [
|
|
74
|
+
{ name: "openai-sk-proj", regex: /sk-proj-/ },
|
|
75
|
+
{ name: "openai-or-anthropic-sk", regex: /sk-[A-Za-z0-9_-]{20,}/ },
|
|
76
|
+
{ name: "supabase-secret-key", regex: /sb_secret_/ },
|
|
77
|
+
{ name: "supabase-service-role-key", regex: /sbp_[a-f0-9]{40}/ },
|
|
78
|
+
{ name: "aws-access-key-id", regex: /AKIA[A-Z0-9]{16}/ },
|
|
79
|
+
{ name: "github-pat", regex: /ghp_[A-Za-z0-9]{36}/ },
|
|
80
|
+
{ name: "slack-token", regex: /xox[bap]-/ },
|
|
81
|
+
];
|
|
82
|
+
// (h) reserved-word-slugs
|
|
83
|
+
const RESERVED_SLUGS = new Set([
|
|
84
|
+
"palace", "journal", "corrections", "tmp", "insights", "rooms", "skills",
|
|
85
|
+
]);
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Internal helpers
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
function stableId(check, findingPath) {
|
|
90
|
+
return createHash("sha256").update(`${check}:${findingPath}`).digest("hex").slice(0, 16);
|
|
91
|
+
}
|
|
92
|
+
function mkFinding(check, severity, findingPath, evidence, agentInstruction) {
|
|
93
|
+
return {
|
|
94
|
+
check,
|
|
95
|
+
severity,
|
|
96
|
+
path: findingPath,
|
|
97
|
+
evidence,
|
|
98
|
+
stable_id: stableId(check, findingPath),
|
|
99
|
+
agent_instruction: agentInstruction,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function safeReaddirNames(dir) {
|
|
103
|
+
try {
|
|
104
|
+
return fs.readdirSync(dir);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function safeReaddirEntries(dir) {
|
|
111
|
+
try {
|
|
112
|
+
return fs.readdirSync(dir, { withFileTypes: true });
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** Every directory entry directly under `<root>/projects` (junk dirs included). */
|
|
119
|
+
function listProjectDirNames(root) {
|
|
120
|
+
return safeReaddirEntries(path.join(root, PROJECTS_DIRNAME))
|
|
121
|
+
.filter((e) => e.isDirectory())
|
|
122
|
+
.map((e) => e.name);
|
|
123
|
+
}
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// Check (a) — junk-project-dirs
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
function checkJunkProjectDirs(projectNames) {
|
|
128
|
+
const out = [];
|
|
129
|
+
for (const name of projectNames) {
|
|
130
|
+
const isUuid = UUID_PREFIX_RE.test(name);
|
|
131
|
+
const isDotDot = DOT_DOT_RE.test(name);
|
|
132
|
+
const isLiteralJunk = JUNK_LITERAL_RE.test(name);
|
|
133
|
+
const isEpoch = EPOCH_SUFFIX_RE.test(name);
|
|
134
|
+
if (!isUuid && !isDotDot && !isLiteralJunk && !isEpoch)
|
|
135
|
+
continue;
|
|
136
|
+
const severity = isUuid || isDotDot ? "red" : "yellow";
|
|
137
|
+
const reasons = [
|
|
138
|
+
isUuid && "uuid-shaped name",
|
|
139
|
+
isDotDot && "path-traversal-shaped (contains '..')",
|
|
140
|
+
isLiteralJunk && "literal test/placeholder slug",
|
|
141
|
+
isEpoch && "epoch-timestamp-suffixed name",
|
|
142
|
+
]
|
|
143
|
+
.filter((r) => Boolean(r))
|
|
144
|
+
.join(", ");
|
|
145
|
+
out.push(mkFinding("junk-project-dirs", severity, `${PROJECTS_DIRNAME}/${name}`, `${PROJECTS_DIRNAME}/${name}: ${reasons}`, "Likely a stray/test project directory, not real project data. Confirm with the owner before removing it — this scan never mutates the store and an agent must never auto-delete a project directory."));
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
// Check (b) — counter-accumulation (ONE aggregate finding, never per-file)
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
function checkCounterAccumulation(root) {
|
|
153
|
+
const n = safeReaddirNames(root).filter((f) => f.startsWith(COUNTER_PREFIX)).length;
|
|
154
|
+
if (n <= COUNTER_YELLOW_THRESHOLD)
|
|
155
|
+
return [];
|
|
156
|
+
const severity = n > COUNTER_RED_THRESHOLD ? "red" : "yellow";
|
|
157
|
+
return [
|
|
158
|
+
mkFinding("counter-accumulation", severity, `${COUNTER_PREFIX}*`, `${n} ${COUNTER_PREFIX}* file(s) at store root (thresholds: yellow>${COUNTER_YELLOW_THRESHOLD}, red>${COUNTER_RED_THRESHOLD})`, "These are per-session ambient-injection counters that accumulate forever with no automatic cleanup. Confirm with the owner before bulk-deleting files matching this exact prefix — never auto-delete from an agent."),
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// Check (c) — theme-epidemic
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
function checkThemeEpidemic(root, projectNames) {
|
|
165
|
+
const out = [];
|
|
166
|
+
for (const name of projectNames) {
|
|
167
|
+
const journalDirPath = path.join(root, PROJECTS_DIRNAME, name, "journal");
|
|
168
|
+
const files = safeReaddirNames(journalDirPath).filter((f) => f.endsWith(".md") && f !== "index.md");
|
|
169
|
+
if (files.length === 0)
|
|
170
|
+
continue;
|
|
171
|
+
const themeCounts = new Map();
|
|
172
|
+
let parseableCount = 0;
|
|
173
|
+
for (const f of files) {
|
|
174
|
+
let parsed;
|
|
175
|
+
try {
|
|
176
|
+
parsed = parseJournalFileName(f);
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (parsed.isLegacy)
|
|
182
|
+
continue; // only v2/current parseable names count
|
|
183
|
+
parseableCount++;
|
|
184
|
+
if (parsed.theme && parsed.theme !== "none") {
|
|
185
|
+
themeCounts.set(parsed.theme, (themeCounts.get(parsed.theme) ?? 0) + 1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (parseableCount < THEME_EPIDEMIC_MIN_FILES)
|
|
189
|
+
continue;
|
|
190
|
+
let topTheme = null;
|
|
191
|
+
let topCount = 0;
|
|
192
|
+
for (const [theme, count] of themeCounts) {
|
|
193
|
+
if (count > topCount) {
|
|
194
|
+
topTheme = theme;
|
|
195
|
+
topCount = count;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!topTheme)
|
|
199
|
+
continue;
|
|
200
|
+
const share = topCount / parseableCount;
|
|
201
|
+
if (share <= THEME_EPIDEMIC_SHARE)
|
|
202
|
+
continue;
|
|
203
|
+
out.push(mkFinding("theme-epidemic", "yellow", `${PROJECTS_DIRNAME}/${name}`, `theme="${topTheme}" in ${topCount}/${parseableCount} (${Math.round(share * 100)}%) of parseable journal filenames`, "One recurring theme dominates this project's journal — likely the same unresolved issue recurring across sessions. Surface it to the owner as a candidate for a durable correction/fix rather than more journal notes; never delete or merge journal files."));
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
// Check (d) — case-fold-forks (reuses paths.ts's listCaseVariantForks)
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
/**
|
|
211
|
+
* Pure mapping from case-variant fork groups (as returned by
|
|
212
|
+
* `listCaseVariantForks`) to HygieneFinding objects. Extracted for fs-free
|
|
213
|
+
* testability — real case-variant sibling directories cannot be fabricated on
|
|
214
|
+
* a case-insensitive-but-case-preserving filesystem (macOS APFS default: a
|
|
215
|
+
* second `mkdirSync("agentrecall")` silently collides with an existing
|
|
216
|
+
* "AgentRecall"). Same constraint documented on `pickProjectDirEntry` in
|
|
217
|
+
* paths.ts; same fix (test the pure mapping directly). Not part of the
|
|
218
|
+
* public core barrel — internal/test-only export.
|
|
219
|
+
*/
|
|
220
|
+
export function caseFoldForksToFindings(forks) {
|
|
221
|
+
return forks.map((fork) => mkFinding("case-fold-forks", "red", `${PROJECTS_DIRNAME}/${fork.project}`, `${fork.variants.length} case-variant directories for one project: ${fork.variants.join(", ")} (diverges on case-sensitive filesystems)`, "These directories are the SAME project split by a case-fold mismatch. Merging requires combining journal/palace/corrections content by hand — confirm with the owner first; never auto-delete or auto-merge either directory."));
|
|
222
|
+
}
|
|
223
|
+
function checkCaseFoldForks(root) {
|
|
224
|
+
try {
|
|
225
|
+
return caseFoldForksToFindings(listCaseVariantForks(root));
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return [];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
// Check (e) — stale-derived-caches
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
function checkStaleDerivedCaches(root) {
|
|
235
|
+
const out = [];
|
|
236
|
+
const now = Date.now();
|
|
237
|
+
for (const entry of safeReaddirEntries(root)) {
|
|
238
|
+
if (!entry.isFile())
|
|
239
|
+
continue;
|
|
240
|
+
const name = entry.name;
|
|
241
|
+
if (name === HYGIENE_BASELINE_FILENAME)
|
|
242
|
+
continue;
|
|
243
|
+
const isCacheJson = /-cache\.json$/.test(name);
|
|
244
|
+
const isKnownDerived = name === "dashboard.json" || name === "scoreboard.json";
|
|
245
|
+
if (!isCacheJson && !isKnownDerived)
|
|
246
|
+
continue;
|
|
247
|
+
let mtimeMs;
|
|
248
|
+
try {
|
|
249
|
+
mtimeMs = fs.statSync(path.join(root, name)).mtimeMs;
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
const ageMs = now - mtimeMs;
|
|
255
|
+
if (ageMs <= STALE_CACHE_AGE_MS)
|
|
256
|
+
continue;
|
|
257
|
+
out.push(mkFinding("stale-derived-caches", "yellow", name, `${name} is ${Math.round(ageMs / (24 * 60 * 60 * 1000))}d old (derived cache — regeneratable from the store)`, "This is a DERIVED cache file, not source data — it is safe to delete or let its producer overwrite it. Confirm with the owner before deleting; never auto-delete from an agent without confirmation."));
|
|
258
|
+
}
|
|
259
|
+
return out;
|
|
260
|
+
}
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
// Check (f) — root-secret-patterns
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
function checkRootSecretPatterns(root) {
|
|
265
|
+
const out = [];
|
|
266
|
+
for (const entry of safeReaddirEntries(root)) {
|
|
267
|
+
if (!entry.isFile())
|
|
268
|
+
continue;
|
|
269
|
+
if (!entry.name.endsWith(".json"))
|
|
270
|
+
continue;
|
|
271
|
+
if (entry.name === HYGIENE_BASELINE_FILENAME)
|
|
272
|
+
continue;
|
|
273
|
+
let content;
|
|
274
|
+
try {
|
|
275
|
+
content = fs.readFileSync(path.join(root, entry.name), "utf-8");
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
const lines = content.split(/\r?\n/);
|
|
281
|
+
for (let i = 0; i < lines.length; i++) {
|
|
282
|
+
const line = lines[i];
|
|
283
|
+
for (const pattern of SECRET_PATTERNS) {
|
|
284
|
+
if (!pattern.regex.test(line))
|
|
285
|
+
continue;
|
|
286
|
+
const lineNo = i + 1;
|
|
287
|
+
out.push(mkFinding("root-secret-patterns", "red", `${entry.name}#L${lineNo}`,
|
|
288
|
+
// Evidence is file + pattern NAME + line number ONLY — NEVER the
|
|
289
|
+
// matched secret text itself.
|
|
290
|
+
`${entry.name}: pattern=${pattern.name}, line=${lineNo}`, "A credential-shaped string was found in a root-level store file. NEVER echo, log, or paste the matched value anywhere. Confirm with the owner and rotate the credential immediately, then move it out of this file (env var / secret manager)."));
|
|
291
|
+
break; // one finding per matching line — avoid double-reporting the
|
|
292
|
+
// same secret under two overlapping pattern names (e.g. sk-proj- is
|
|
293
|
+
// also a valid match of the generic openai-or-anthropic-sk pattern).
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return out;
|
|
298
|
+
}
|
|
299
|
+
// ---------------------------------------------------------------------------
|
|
300
|
+
// Check (g) — missing-corrections-index
|
|
301
|
+
// ---------------------------------------------------------------------------
|
|
302
|
+
function checkMissingCorrectionsIndex(root, projectNames) {
|
|
303
|
+
const out = [];
|
|
304
|
+
for (const name of projectNames) {
|
|
305
|
+
const correctionsDirPath = path.join(root, PROJECTS_DIRNAME, name, "corrections");
|
|
306
|
+
const jsonCount = safeReaddirNames(correctionsDirPath).filter((f) => f.endsWith(".json") && !f.startsWith("_")).length;
|
|
307
|
+
if (jsonCount < 1)
|
|
308
|
+
continue;
|
|
309
|
+
if (fs.existsSync(path.join(correctionsDirPath, "_index.md")))
|
|
310
|
+
continue;
|
|
311
|
+
out.push(mkFinding("missing-corrections-index", "yellow", `${PROJECTS_DIRNAME}/${name}/corrections`, `${jsonCount} correction record(s) but no _index.md`, "Regenerate the materialized index by writing (or retracting) any correction for this project — regenerateCorrectionsIndex() runs automatically on every corrections mutation. No manual file edit is needed or advised."));
|
|
312
|
+
}
|
|
313
|
+
return out;
|
|
314
|
+
}
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
// Check (h) — reserved-word-slugs
|
|
317
|
+
// ---------------------------------------------------------------------------
|
|
318
|
+
function checkReservedWordSlugs(projectNames) {
|
|
319
|
+
const out = [];
|
|
320
|
+
for (const name of projectNames) {
|
|
321
|
+
if (!RESERVED_SLUGS.has(name.toLowerCase()))
|
|
322
|
+
continue;
|
|
323
|
+
out.push(mkFinding("reserved-word-slugs", "red", `${PROJECTS_DIRNAME}/${name}`, `${PROJECTS_DIRNAME}/${name} collides with a reserved internal directory name (${[...RESERVED_SLUGS].join("/")})`, "A project slug that shadows a reserved internal name can corrupt path resolution for every project. Confirm with the owner and migrate this project to a different slug — never auto-rename or auto-delete."));
|
|
324
|
+
}
|
|
325
|
+
return out;
|
|
326
|
+
}
|
|
327
|
+
// ---------------------------------------------------------------------------
|
|
328
|
+
// Rollup + public entry point
|
|
329
|
+
// ---------------------------------------------------------------------------
|
|
330
|
+
function rollupGrade(findings) {
|
|
331
|
+
let grade = "clean";
|
|
332
|
+
for (const f of findings) {
|
|
333
|
+
if (f.severity === "red")
|
|
334
|
+
return "red";
|
|
335
|
+
if (f.severity === "yellow")
|
|
336
|
+
grade = "yellow";
|
|
337
|
+
}
|
|
338
|
+
return grade;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Run every hygiene check against `root`. READ-ONLY: never writes, never
|
|
342
|
+
* mkdirs, never renames, never acquires a lock. Each check is independently
|
|
343
|
+
* try/caught — one failing check degrades to zero findings for that check,
|
|
344
|
+
* never throws out of the scan as a whole.
|
|
345
|
+
*/
|
|
346
|
+
export function runHygieneScan(root) {
|
|
347
|
+
const counts = {};
|
|
348
|
+
for (const name of CHECK_NAMES)
|
|
349
|
+
counts[name] = 0;
|
|
350
|
+
const findings = [];
|
|
351
|
+
const projectNames = listProjectDirNames(root);
|
|
352
|
+
const runners = [
|
|
353
|
+
["junk-project-dirs", () => checkJunkProjectDirs(projectNames)],
|
|
354
|
+
["counter-accumulation", () => checkCounterAccumulation(root)],
|
|
355
|
+
["theme-epidemic", () => checkThemeEpidemic(root, projectNames)],
|
|
356
|
+
["case-fold-forks", () => checkCaseFoldForks(root)],
|
|
357
|
+
["stale-derived-caches", () => checkStaleDerivedCaches(root)],
|
|
358
|
+
["root-secret-patterns", () => checkRootSecretPatterns(root)],
|
|
359
|
+
["missing-corrections-index", () => checkMissingCorrectionsIndex(root, projectNames)],
|
|
360
|
+
["reserved-word-slugs", () => checkReservedWordSlugs(projectNames)],
|
|
361
|
+
];
|
|
362
|
+
for (const [name, run] of runners) {
|
|
363
|
+
try {
|
|
364
|
+
const results = run();
|
|
365
|
+
counts[name] = results.length;
|
|
366
|
+
findings.push(...results);
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
// One failing check must never kill the whole scan.
|
|
370
|
+
counts[name] = 0;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return { findings, grade: rollupGrade(findings), counts };
|
|
374
|
+
}
|
|
375
|
+
// ---------------------------------------------------------------------------
|
|
376
|
+
// Baseline (separate from the pure scan — the ONLY write path in this file)
|
|
377
|
+
// ---------------------------------------------------------------------------
|
|
378
|
+
function readBaselineSafe(baselinePath) {
|
|
379
|
+
try {
|
|
380
|
+
if (!fs.existsSync(baselinePath))
|
|
381
|
+
return null;
|
|
382
|
+
const parsed = JSON.parse(fs.readFileSync(baselinePath, "utf-8"));
|
|
383
|
+
if (!parsed || !Array.isArray(parsed.stable_ids))
|
|
384
|
+
return null;
|
|
385
|
+
return parsed;
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Partition `findings` into `fresh` (stable_id NOT in the baseline) and
|
|
393
|
+
* `known` (stable_id IS in the baseline). READ-ONLY — only reads the
|
|
394
|
+
* baseline file; never writes it. Missing/malformed baseline degrades to
|
|
395
|
+
* "everything is fresh" (the honest first-run state).
|
|
396
|
+
*/
|
|
397
|
+
export function applyBaseline(findings, baselinePath) {
|
|
398
|
+
const baseline = readBaselineSafe(baselinePath);
|
|
399
|
+
const knownIds = new Set(baseline?.stable_ids ?? []);
|
|
400
|
+
const fresh = [];
|
|
401
|
+
const known = [];
|
|
402
|
+
for (const f of findings) {
|
|
403
|
+
(knownIds.has(f.stable_id) ? known : fresh).push(f);
|
|
404
|
+
}
|
|
405
|
+
return { fresh, known };
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Snapshot every current finding's stable_id into the baseline file. This is
|
|
409
|
+
* the ONLY write this module ever performs, and it only happens when a
|
|
410
|
+
* caller explicitly invokes this function (CLI: `ar hygiene --baseline-update`).
|
|
411
|
+
* Atomic (tmp + rename), mode 0600.
|
|
412
|
+
*/
|
|
413
|
+
export function updateBaseline(findings, baselinePath) {
|
|
414
|
+
const stable_ids = Array.from(new Set(findings.map((f) => f.stable_id))).sort();
|
|
415
|
+
const baseline = { created_at: new Date().toISOString(), stable_ids };
|
|
416
|
+
ensureDir(path.dirname(baselinePath));
|
|
417
|
+
const tmp = `${baselinePath}.tmp.${process.pid}.${Date.now()}`;
|
|
418
|
+
fs.writeFileSync(tmp, JSON.stringify(baseline, null, 2), { encoding: "utf-8", mode: 0o600 });
|
|
419
|
+
fs.renameSync(tmp, baselinePath);
|
|
420
|
+
return baseline;
|
|
421
|
+
}
|
|
422
|
+
//# sourceMappingURL=hygiene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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G,EAAE,YAAY,CAAC,CAAC;IACjC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-protocol.d.ts","sourceRoot":"","sources":["../../src/storage/memory-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"memory-protocol.d.ts","sourceRoot":"","sources":["../../src/storage/memory-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0EH;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAW3D"}
|
|
@@ -59,7 +59,10 @@ lossless archive instead of answering thinly (the bridge).
|
|
|
59
59
|
Raw dumps are queued for compression, never compressed inside the Stop turn:
|
|
60
60
|
|
|
61
61
|
\`\`\`
|
|
62
|
-
|
|
62
|
+
../../.consolidation-queue/<date>.jsonl ← one JSON job per line, relative
|
|
63
|
+
to this file (../.. = the store
|
|
64
|
+
root, two levels up from
|
|
65
|
+
projects/<slug>/)
|
|
63
66
|
\`\`\`
|
|
64
67
|
|
|
65
68
|
A job looks like \`{ "project", "sessionId", "reason", "at", "done"? }\`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-protocol.js","sourceRoot":"","sources":["../../src/storage/memory-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C,4EAA4E;AAC5E,oEAAoE;AACpE,2EAA2E;AAC3E,8DAA8D;AAC9D,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"memory-protocol.js","sourceRoot":"","sources":["../../src/storage/memory-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C,4EAA4E;AAC5E,oEAAoE;AACpE,2EAA2E;AAC3E,8DAA8D;AAC9D,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;QAC/C,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC,CAAC,aAAa;QACnD,SAAS,CAAC,GAAG,CAAC,CAAC;QACf,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/storage/paths.d.ts
CHANGED
|
@@ -145,10 +145,29 @@ export declare function journalDir(project: string): string;
|
|
|
145
145
|
* Defaults to false so counting paths (session_start, dashboard_export)
|
|
146
146
|
* don't inflate session counts with archived entries (v3.4.26 fix).
|
|
147
147
|
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
148
|
+
* F4 (continuity wave, 2026-07-31): journal/archive/raw/ (the lossless
|
|
149
|
+
* hook-archive verbatim tier written by archiveSession()) is DELIBERATELY
|
|
150
|
+
* NEVER included here, even when includeArchive=true — this used to be
|
|
151
|
+
* pushed unconditionally (Wave 2), which made it an ACCIDENTAL, unlabeled
|
|
152
|
+
* 4th journal source for every includeArchive=true caller (journalSearch,
|
|
153
|
+
* readJournalFile's backlink resolution). Two concrete problems that caused:
|
|
154
|
+
* 1. Filename collision: raw dumps are named `${date}--${sessionId}.md`
|
|
155
|
+
* (archive-write.ts), the SAME `${date}--` prefix convention
|
|
156
|
+
* smart-named journal files use (`YYYY-MM-DD--{saveType}--{lines}L--
|
|
157
|
+
* {slug}.md`). readJournalFile's date-prefix matcher can't tell them
|
|
158
|
+
* apart, so a raw dump for a date could be silently concatenated into
|
|
159
|
+
* (or returned AS) that date's "journal" content.
|
|
160
|
+
* 2. Noise: raw dumps are unstructured transcript slices (hook stdin
|
|
161
|
+
* records, tool_use/tool_result blocks, hook-boilerplate) — treating
|
|
162
|
+
* them as curated journal prose by default surfaced low-value noise
|
|
163
|
+
* on every recall (empirically confirmed: `ar search --include-palace`
|
|
164
|
+
* hit raw text this way; see reports/2026-07-31-continuity-fixture.md
|
|
165
|
+
* §4 Test 1).
|
|
166
|
+
* The gated, labeled replacement is smartRecall's explicit low-confidence
|
|
167
|
+
* "archive" source (tools-logic/smart-recall.ts) plus drill-down.ts's
|
|
168
|
+
* `VerbatimKey kind:"archive"` branch. Any caller that intentionally wants
|
|
169
|
+
* raw/ content should use `archiveRawDir(project)` directly instead of
|
|
170
|
+
* `journalDirs(project, true)`.
|
|
152
171
|
*/
|
|
153
172
|
export declare function journalDirs(project: string, includeArchive?: boolean): string[];
|
|
154
173
|
/**
|
|
@@ -1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QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAM7E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,UAAQ,GAAG,MAAM,EAAE,CAuC7E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|
package/dist/storage/paths.js
CHANGED
|
@@ -183,27 +183,44 @@ export function journalDir(project) {
|
|
|
183
183
|
* Defaults to false so counting paths (session_start, dashboard_export)
|
|
184
184
|
* don't inflate session counts with archived entries (v3.4.26 fix).
|
|
185
185
|
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
186
|
+
* F4 (continuity wave, 2026-07-31): journal/archive/raw/ (the lossless
|
|
187
|
+
* hook-archive verbatim tier written by archiveSession()) is DELIBERATELY
|
|
188
|
+
* NEVER included here, even when includeArchive=true — this used to be
|
|
189
|
+
* pushed unconditionally (Wave 2), which made it an ACCIDENTAL, unlabeled
|
|
190
|
+
* 4th journal source for every includeArchive=true caller (journalSearch,
|
|
191
|
+
* readJournalFile's backlink resolution). Two concrete problems that caused:
|
|
192
|
+
* 1. Filename collision: raw dumps are named `${date}--${sessionId}.md`
|
|
193
|
+
* (archive-write.ts), the SAME `${date}--` prefix convention
|
|
194
|
+
* smart-named journal files use (`YYYY-MM-DD--{saveType}--{lines}L--
|
|
195
|
+
* {slug}.md`). readJournalFile's date-prefix matcher can't tell them
|
|
196
|
+
* apart, so a raw dump for a date could be silently concatenated into
|
|
197
|
+
* (or returned AS) that date's "journal" content.
|
|
198
|
+
* 2. Noise: raw dumps are unstructured transcript slices (hook stdin
|
|
199
|
+
* records, tool_use/tool_result blocks, hook-boilerplate) — treating
|
|
200
|
+
* them as curated journal prose by default surfaced low-value noise
|
|
201
|
+
* on every recall (empirically confirmed: `ar search --include-palace`
|
|
202
|
+
* hit raw text this way; see reports/2026-07-31-continuity-fixture.md
|
|
203
|
+
* §4 Test 1).
|
|
204
|
+
* The gated, labeled replacement is smartRecall's explicit low-confidence
|
|
205
|
+
* "archive" source (tools-logic/smart-recall.ts) plus drill-down.ts's
|
|
206
|
+
* `VerbatimKey kind:"archive"` branch. Any caller that intentionally wants
|
|
207
|
+
* raw/ content should use `archiveRawDir(project)` directly instead of
|
|
208
|
+
* `journalDirs(project, true)`.
|
|
190
209
|
*/
|
|
191
210
|
export function journalDirs(project, includeArchive = false) {
|
|
192
211
|
const dirs = [];
|
|
193
212
|
const primary = journalDir(project);
|
|
194
213
|
if (fs.existsSync(primary))
|
|
195
214
|
dirs.push(primary);
|
|
196
|
-
// Archive: journal/archive/ holds entries moved by journalRollup
|
|
215
|
+
// Archive: journal/archive/ holds ROLLUP entries moved by journalRollup
|
|
216
|
+
// (weekly summaries + individual entries that aged out) — unchanged.
|
|
197
217
|
// Only included when caller explicitly requests it (recall, readJournalFile,
|
|
198
218
|
// journalSearch). Excluded by default so session counting doesn't inflate.
|
|
219
|
+
// journal/archive/raw/ is intentionally NOT pushed here — see doc comment above.
|
|
199
220
|
if (includeArchive) {
|
|
200
221
|
const archiveDir = path.join(primary, "archive");
|
|
201
222
|
if (fs.existsSync(archiveDir))
|
|
202
223
|
dirs.push(archiveDir);
|
|
203
|
-
// Wave 2: lossless verbatim tier (journal/archive/raw).
|
|
204
|
-
const rawDir = path.join(primary, "archive", "raw");
|
|
205
|
-
if (fs.existsSync(rawDir))
|
|
206
|
-
dirs.push(rawDir);
|
|
207
224
|
}
|
|
208
225
|
// Legacy: ~/.claude/projects/*/memory/journal/
|
|
209
226
|
const legacyRoot = getLegacyRoot();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/storage/paths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAgDD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,OAAiB;IACtE,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IACnF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC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