claude-mem-lite 6.35.0 → 6.35.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/hook.mjs +65 -87
- package/lib/citation-tracker.mjs +243 -121
- package/lib/cite-back-hint.mjs +56 -35
- package/lib/persist-reminder.mjs +40 -31
- package/lib/summary-extractor.mjs +72 -12
- package/lib/transcript-digest.mjs +305 -0
- package/lib/transcript-scan.mjs +4 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
- package/source-files.mjs +4 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"plugins": [
|
|
10
10
|
{
|
|
11
11
|
"name": "claude-mem-lite",
|
|
12
|
-
"version": "6.35.
|
|
12
|
+
"version": "6.35.1",
|
|
13
13
|
"source": "./",
|
|
14
14
|
"homepage": "https://github.com/sdsrss/claude-mem-lite",
|
|
15
15
|
"description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. FTS5 BM25 keyword search with episode batching. Single SQLite DB, no external services. A lighter, lower-cost alternative to claude-mem (episode batching + a smaller model; cost savings are an internal estimate, not a measured benchmark)."
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-mem-lite",
|
|
3
|
-
"version": "6.35.
|
|
3
|
+
"version": "6.35.1",
|
|
4
4
|
"description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. FTS5 BM25 keyword search with episode batching. Single SQLite DB, no external services. A lighter, lower-cost alternative to claude-mem (episode batching + a smaller model; cost savings are an internal estimate, not a measured benchmark).",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "sdsrss"
|
package/hook.mjs
CHANGED
|
@@ -164,19 +164,17 @@ import {
|
|
|
164
164
|
} from './lib/maintain-core.mjs';
|
|
165
165
|
import { snapshotDb } from './lib/db-backup.mjs';
|
|
166
166
|
import {
|
|
167
|
-
|
|
168
|
-
extractInjectedBySurface,
|
|
169
|
-
buildCitationRelevanceSet,
|
|
167
|
+
citationRelevanceSetFrom,
|
|
170
168
|
unionSurfaces,
|
|
171
169
|
extractInjectedFromKeyContext,
|
|
172
170
|
bumpCitationAccess,
|
|
173
|
-
|
|
171
|
+
citeRecallStats,
|
|
174
172
|
applyCitationDecay,
|
|
175
173
|
recordCitationFunnel,
|
|
176
174
|
recordCitationSurfaces,
|
|
177
|
-
|
|
178
|
-
hasMainThreadAssistantText,
|
|
175
|
+
subagentSurfaceFrom,
|
|
179
176
|
} from './lib/citation-tracker.mjs';
|
|
177
|
+
import { digestTranscript, DIGEST_FILE_PREFIX } from './lib/transcript-digest.mjs';
|
|
180
178
|
import { resolveEdgeAttribution, readPreRecallFileEdges } from './lib/edge-attribution.mjs';
|
|
181
179
|
import { extractTailAssistantText, extractStructuredSummary } from './lib/summary-extractor.mjs';
|
|
182
180
|
import { recordTurnReply, TURN_REPLIES_PREFIX } from './lib/turn-replies.mjs';
|
|
@@ -211,11 +209,10 @@ import {
|
|
|
211
209
|
} from './hook-handoff.mjs';
|
|
212
210
|
import {
|
|
213
211
|
loadCiteBackForEpisode,
|
|
214
|
-
extractCiteBackSignals,
|
|
215
212
|
buildUnsavedBugfixHint,
|
|
216
213
|
claimBugfixNudge,
|
|
217
214
|
BUGFIX_NUDGE_MARKER_PREFIX,
|
|
218
|
-
|
|
215
|
+
bugfixShapeStats,
|
|
219
216
|
buildCiteRecallNudge as libBuildCiteRecallNudge,
|
|
220
217
|
nextCiteStreakState,
|
|
221
218
|
} from './lib/cite-back-hint.mjs';
|
|
@@ -1279,21 +1276,26 @@ async function readStopHookInput() {
|
|
|
1279
1276
|
return { ccSessionId, transcriptPath, lastAssistantMessage };
|
|
1280
1277
|
}
|
|
1281
1278
|
|
|
1279
|
+
/**
|
|
1280
|
+
* This turn's final reply: the host's `last_assistant_message` when it sends one, else the
|
|
1281
|
+
* transcript's last assistant text, read backwards from the end of the file. A forward parse of
|
|
1282
|
+
* the whole file took 1.6 s on a 475 MB transcript, on every turn (issue #53). Claude Code
|
|
1283
|
+
* 2.1.322 omits the field only when its last assistant message carries no text.
|
|
1284
|
+
*/
|
|
1285
|
+
function stopFinalReply({ transcriptPath, lastAssistantMessage }) {
|
|
1286
|
+
if (lastAssistantMessage !== null) return lastAssistantMessage;
|
|
1287
|
+
return transcriptPath ? extractTailAssistantText(transcriptPath) : null;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1282
1290
|
/**
|
|
1283
1291
|
* D#825 — record this turn's final reply under this Stop's memory session and its current prompt
|
|
1284
|
-
* number, for the summary worker (lib/turn-replies.mjs). The
|
|
1285
|
-
* when it sends one; from a host that does not, the transcript's last assistant text, the reply
|
|
1292
|
+
* number, for the summary worker (lib/turn-replies.mjs). The reply is stopFinalReply's, the one
|
|
1286
1293
|
* the Stop baseline reads. A turn answering a task notice stores no prompt, so its reply lands
|
|
1287
1294
|
* on the prompt before it and replaces that reply: a turn's last reply wins. Never throws.
|
|
1288
1295
|
*/
|
|
1289
1296
|
function recordStopTurnReply(db, { sessionId, transcriptPath, lastAssistantMessage }) {
|
|
1290
1297
|
try {
|
|
1291
|
-
const reply =
|
|
1292
|
-
lastAssistantMessage !== null
|
|
1293
|
-
? lastAssistantMessage
|
|
1294
|
-
: transcriptPath
|
|
1295
|
-
? extractTailAssistantText(transcriptPath)
|
|
1296
|
-
: null;
|
|
1298
|
+
const reply = stopFinalReply({ transcriptPath, lastAssistantMessage });
|
|
1297
1299
|
if (!reply || !reply.trim()) return;
|
|
1298
1300
|
const n =
|
|
1299
1301
|
db
|
|
@@ -1423,7 +1425,7 @@ function markSessionCompletedAndSaveHandoff(
|
|
|
1423
1425
|
}
|
|
1424
1426
|
|
|
1425
1427
|
/** Fast summary baseline — ensures a summary exists even if the background LLM fails. */
|
|
1426
|
-
function writeFastSummaryBaseline(db, { sessionId, project, transcriptPath }) {
|
|
1428
|
+
function writeFastSummaryBaseline(db, { sessionId, project, transcriptPath, lastAssistantMessage }) {
|
|
1427
1429
|
// Stop fires once per assistant TURN and the mem session survives it (R10-P1-1), so this
|
|
1428
1430
|
// runs on every turn of a session. The first turn with anything to say INSERTs the row
|
|
1429
1431
|
// (T4-P2-B's guard: never a second row); every later turn REFRESHES that row from its tail's
|
|
@@ -1439,8 +1441,7 @@ function writeFastSummaryBaseline(db, { sessionId, project, transcriptPath }) {
|
|
|
1439
1441
|
// CLAUDE.md §10 mandates Done/Not done/Failed/Uncertain markers, so the
|
|
1440
1442
|
// tail is deterministically parseable without Haiku. Prior baseline left
|
|
1441
1443
|
// remaining_items=='' for every session whose Haiku pass failed (≈66%
|
|
1442
|
-
// in prod data), losing the user-visible "Not done" list.
|
|
1443
|
-
// AFTER trackCitationsAtStop so the parse is the one it left memoized.
|
|
1444
|
+
// in prod data), losing the user-visible "Not done" list.
|
|
1444
1445
|
let structuredCompleted = '';
|
|
1445
1446
|
let structuredNotDone = '';
|
|
1446
1447
|
let structuredNotes = '';
|
|
@@ -1448,7 +1449,7 @@ function writeFastSummaryBaseline(db, { sessionId, project, transcriptPath }) {
|
|
|
1448
1449
|
// (D#121, lib/fast-summary.mjs writeStopSummary).
|
|
1449
1450
|
let tail = null;
|
|
1450
1451
|
try {
|
|
1451
|
-
tail = transcriptPath
|
|
1452
|
+
tail = stopFinalReply({ transcriptPath, lastAssistantMessage });
|
|
1452
1453
|
if (tail) {
|
|
1453
1454
|
const s = extractStructuredSummary(tail);
|
|
1454
1455
|
structuredCompleted = s.done;
|
|
@@ -1488,23 +1489,26 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1488
1489
|
// applyCitationDecay checks separately.
|
|
1489
1490
|
try {
|
|
1490
1491
|
if (transcriptPath && !process.env.CLAUDE_MEM_NO_CITATION_TRACK) {
|
|
1492
|
+
// Issue #53: every question below is answered from the digest, which parses only the
|
|
1493
|
+
// bytes appended since the previous Stop (lib/transcript-digest.mjs). Each of them used
|
|
1494
|
+
// to parse the whole transcript: one shared parse per Stop within lib/transcript-scan.mjs's
|
|
1495
|
+
// heap budget (256 MB at most), one parse per question above it. Each answer is copied
|
|
1496
|
+
// where the code below used to get a fresh Set and may add to it.
|
|
1497
|
+
const digest = digestTranscript(transcriptPath, { runtimeDir: RUNTIME_DIR });
|
|
1498
|
+
if (!digest.complete) {
|
|
1499
|
+
// A transcript first seen larger than one Stop's read budget is caught up over several
|
|
1500
|
+
// Stops. Writing from part of it would bank verdicts the rest contradicts — an id cited
|
|
1501
|
+
// later in the unread part would be decided uncited — so this Stop writes nothing.
|
|
1502
|
+
debugLog('DEBUG', 'handleStop', 'citations: transcript digest still catching up; nothing written');
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
const d = digest.main;
|
|
1491
1506
|
// D#152/D#177: the `subagent` face, collected ONCE, up front, and used twice —
|
|
1492
1507
|
// by the decay block below (only under CLAUDE_MEM_SUBAGENT_DECAY) and by its own
|
|
1493
|
-
// metering call at the tail.
|
|
1494
|
-
|
|
1495
|
-
// memoizes ONE file and reading the sidechains evicts the parent. That constraint
|
|
1496
|
-
// is real but it is not "last" — it is "not BETWEEN two parent scans". Running it
|
|
1497
|
-
// FIRST parses the sidechains before anything has memoized the parent, so the
|
|
1498
|
-
// parent is then parsed once and stays memoized for every scanner after it:
|
|
1499
|
-
// still one parent parse per Stop, the property the tail comment was protecting.
|
|
1500
|
-
let sub = { injected: new Set(), cited: new Set(), files: 0 };
|
|
1501
|
-
try {
|
|
1502
|
-
sub = collectSubagentSurface(transcriptPath);
|
|
1503
|
-
} catch (e) {
|
|
1504
|
-
debugCatch(e, 'handleStop-subagent-collect');
|
|
1505
|
-
}
|
|
1508
|
+
// metering call at the tail.
|
|
1509
|
+
const sub = subagentSurfaceFrom(digest.subagents);
|
|
1506
1510
|
|
|
1507
|
-
const ids =
|
|
1511
|
+
const ids = new Set(d.cited);
|
|
1508
1512
|
if (ids.size > 0) {
|
|
1509
1513
|
// Gate the access-count channel on relevance (audit FLOW-2 / D#179). The cited
|
|
1510
1514
|
// set is every `#NN` in this session's assistant text and cannot tell a
|
|
@@ -1512,8 +1516,9 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1512
1516
|
// session names dozens of ids in prose, and access_count > 3 promotes a row a
|
|
1513
1517
|
// tier via boostAccessed. The population to credit — all seven faces, and why
|
|
1514
1518
|
// extractAllInjected alone is the wrong five — lives in the builder.
|
|
1515
|
-
const relevant =
|
|
1516
|
-
|
|
1519
|
+
const relevant = citationRelevanceSetFrom({
|
|
1520
|
+
attachmentInjected: unionSurfaces(d.injected),
|
|
1521
|
+
userTyped: d.userTyped,
|
|
1517
1522
|
runtimeDir: RUNTIME_DIR,
|
|
1518
1523
|
project,
|
|
1519
1524
|
sessionId: ccSessionId,
|
|
@@ -1531,11 +1536,9 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1531
1536
|
);
|
|
1532
1537
|
}
|
|
1533
1538
|
|
|
1534
|
-
// v32 citation-decay: tighter feedback loop on top of P4.
|
|
1535
|
-
//
|
|
1536
|
-
//
|
|
1537
|
-
// then mutate importance/streak per applyCitationDecay's contract.
|
|
1538
|
-
// Cheap (file still in OS cache).
|
|
1539
|
+
// v32 citation-decay: tighter feedback loop on top of P4. The main-thread
|
|
1540
|
+
// injected ids from every attachment face (PTR + UserPromptSubmit
|
|
1541
|
+
// <memory-context> + …), then mutate the streaks per applyCitationDecay's contract.
|
|
1539
1542
|
//
|
|
1540
1543
|
// v34.x: pre-v34 this only saw pre-tool-recall injections, leaving the
|
|
1541
1544
|
// UPS surface (highest-volume — all decision-type FTS hits) starved.
|
|
@@ -1552,13 +1555,13 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1552
1555
|
// survives to citation_surface_log below so "which face earns its
|
|
1553
1556
|
// budget" becomes answerable. Before this, every face was merged
|
|
1554
1557
|
// before anything was recorded and no lever had a target.
|
|
1555
|
-
const injectedBySurface =
|
|
1558
|
+
const injectedBySurface = d.injectedMain;
|
|
1556
1559
|
const injected = unionSurfaces(injectedBySurface);
|
|
1557
1560
|
// P5 ①: cite-back signals — observations whose warned file the agent
|
|
1558
1561
|
// edited this session. Union into injected so they're resolved (they
|
|
1559
1562
|
// were injected via pre-tool-recall) and, below, into cited so the
|
|
1560
1563
|
// edit promotes them even without a literal #NN in text.
|
|
1561
|
-
const citeBackIds =
|
|
1564
|
+
const citeBackIds = d.citeBack;
|
|
1562
1565
|
for (const id of citeBackIds) injected.add(id);
|
|
1563
1566
|
// D#124, promotion-only (v3.66.1): the SessionStart Key Context block
|
|
1564
1567
|
// leaves no hook attachment, so its ids come from the per-session
|
|
@@ -1595,14 +1598,14 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1595
1598
|
// contract is "NEXT time you produce user-facing text," so a
|
|
1596
1599
|
// session with zero main-thread text gets a free pass — the
|
|
1597
1600
|
// next Stop in the same session will re-evaluate.
|
|
1598
|
-
if (!
|
|
1601
|
+
if (!d.mainText.seen) {
|
|
1599
1602
|
debugLog(
|
|
1600
1603
|
'DEBUG',
|
|
1601
1604
|
'handleStop',
|
|
1602
1605
|
`citation-decay: skipped (no main-thread assistant text yet, injected=${injected.size})`,
|
|
1603
1606
|
);
|
|
1604
1607
|
} else {
|
|
1605
|
-
const citedMain =
|
|
1608
|
+
const citedMain = new Set(d.citedMain);
|
|
1606
1609
|
for (const id of citeBackIds) citedMain.add(id);
|
|
1607
1610
|
// D#177: admit the `subagent` face to the decay loop. It cannot ride the
|
|
1608
1611
|
// normal path because its injection lands in a dispatched agent's PROMPT
|
|
@@ -1731,15 +1734,9 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1731
1734
|
}
|
|
1732
1735
|
|
|
1733
1736
|
// Persist cite-recall ratio for the next SessionStart to surface as
|
|
1734
|
-
// feedback.
|
|
1735
|
-
// count through `extractCitationsFromTranscript`, so the bump path stays
|
|
1736
|
-
// unchanged — and since P2-8 every scanner in it shares ONE parse via
|
|
1737
|
-
// lib/transcript-scan.mjs, so "scan again" costs an array iteration, not a
|
|
1738
|
-
// re-read. (The old wording, "cheap; the file is already in OS cache", was
|
|
1739
|
-
// arguing the pre-memo case: the OS cache saved the read, never the parse,
|
|
1740
|
-
// which was ~all of the cost.)
|
|
1737
|
+
// feedback.
|
|
1741
1738
|
try {
|
|
1742
|
-
const stats =
|
|
1739
|
+
const stats = citeRecallStats(d.citeRecall);
|
|
1743
1740
|
// D#19: the RATIO GATE's own denominator, alongside the wide one. `stats` counts
|
|
1744
1741
|
// every `#NN`-shaped token in non-assistant text — tool_result bodies, file
|
|
1745
1742
|
// contents, CLI output, pasted reports — which is the right caliber for "what has
|
|
@@ -1747,24 +1744,19 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1747
1744
|
// (measured 11.2x inflation, R11-B-P2-2). Both are persisted; buildCiteRecallNudge
|
|
1748
1745
|
// gates on this pair and falls back to the wide one for older payloads.
|
|
1749
1746
|
//
|
|
1750
|
-
//
|
|
1751
|
-
// own extractInjectedBySurface on the same path, and lib/transcript-scan.mjs memoizes
|
|
1752
|
-
// the parse. mainOnly mirrors the decay loop — an id injected only inside a subagent
|
|
1747
|
+
// mainOnly mirrors the decay loop — an id injected only inside a subagent
|
|
1753
1748
|
// would otherwise enter the denominator while its citation lands in another
|
|
1754
1749
|
// transcript, scoring a miss the main thread never had a chance to avoid.
|
|
1755
1750
|
let gate = { gateInjected: null, gateRecalled: null, gateRatio: null };
|
|
1756
1751
|
try {
|
|
1757
|
-
const gateInjectedIds = unionSurfaces(
|
|
1752
|
+
const gateInjectedIds = unionSurfaces(d.injectedMain);
|
|
1758
1753
|
// The nudge asks whether the agent ANSWERED what the hooks showed it, so a
|
|
1759
1754
|
// `#NN n/a — <reason>` still counts. Since D#98 the default directive asks for no
|
|
1760
1755
|
// reply on a lesson that did not apply, so that silence now reads as a miss here and
|
|
1761
1756
|
// the gate fires more (projected 78/95 → up to 87/95 qualifying sessions,
|
|
1762
1757
|
// docs/audits/20260927-d98-dismissal-baseline.md). Left as is: the gate already fired
|
|
1763
1758
|
// on most sessions and self-silences after 3; D#111's readout re-measures it.
|
|
1764
|
-
const gateCited =
|
|
1765
|
-
mainOnly: true,
|
|
1766
|
-
includeDismissed: true,
|
|
1767
|
-
});
|
|
1759
|
+
const gateCited = d.citedMainAnswered;
|
|
1768
1760
|
let hit = 0;
|
|
1769
1761
|
for (const id of gateInjectedIds) if (gateCited.has(id)) hit++;
|
|
1770
1762
|
gate = {
|
|
@@ -1779,9 +1771,8 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1779
1771
|
}
|
|
1780
1772
|
// B2 (v2.83.1): also persist the bugfix-shape nudge/save delta so
|
|
1781
1773
|
// the next SessionStart can surface "N unsaved bugfix-shape edits"
|
|
1782
|
-
// alongside cite-recall. Same
|
|
1783
|
-
|
|
1784
|
-
const bugfixStats = countUnsavedBugfixShape(transcriptPath);
|
|
1774
|
+
// alongside cite-recall. Same persistence file; one extra line in buildCiteRecallNudge.
|
|
1775
|
+
const bugfixStats = bugfixShapeStats(d.bugfixShape);
|
|
1785
1776
|
const dest = citeRecallPathFor(RUNTIME_DIR, project);
|
|
1786
1777
|
// Carry the consecutive-low-cite streak forward so the SessionStart
|
|
1787
1778
|
// nag can self-silence after the project has ignored it N times.
|
|
@@ -1812,11 +1803,11 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1812
1803
|
`,
|
|
1813
1804
|
)
|
|
1814
1805
|
.all(sessionId);
|
|
1815
|
-
const
|
|
1806
|
+
const u = detectUnpersistedDecision({
|
|
1816
1807
|
prompts: promptRows.map((r) => r.prompt_text),
|
|
1817
|
-
|
|
1808
|
+
persistenceCount: d.persistence.count,
|
|
1818
1809
|
});
|
|
1819
|
-
if (
|
|
1810
|
+
if (u.fire) decisionSignal = u.signal;
|
|
1820
1811
|
} catch (e) {
|
|
1821
1812
|
debugCatch(e, 'handleStop-persist-reminder');
|
|
1822
1813
|
}
|
|
@@ -1853,25 +1844,14 @@ function trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptP
|
|
|
1853
1844
|
// promotion all keep the un-widened set. `CLAUDE_MEM_SUBAGENT_DECAY=0` returns
|
|
1854
1845
|
// the face to metering-only.
|
|
1855
1846
|
//
|
|
1856
|
-
//
|
|
1857
|
-
// at the HEAD of this block (the decay loop needs its result), and `sub` here is
|
|
1858
|
-
// that same object rather than a second call. The parse-count property the note
|
|
1859
|
-
// defends is unchanged — see the comment at the collection site.
|
|
1860
|
-
// earlier, this block costs ONE extra parse of the parent — the memo
|
|
1861
|
-
// re-caches on the first re-read, so it is one, not one per later
|
|
1862
|
-
// scanner — and breaks the "one parse per Stop" property the block
|
|
1863
|
-
// above documents. Measured by instrumenting the parse: 1 parent parse
|
|
1864
|
-
// at this position, 2 when relocated earlier. ~25ms on the largest
|
|
1865
|
-
// real transcript here (5.4MB), matching lib/transcript-scan.mjs's
|
|
1866
|
-
// own header figure.
|
|
1847
|
+
// `sub` is the one collected at the head of this block (the decay loop needs it too).
|
|
1867
1848
|
// The text floor is re-checked rather than inherited — same reason as
|
|
1868
1849
|
// every other face: a tool-only Stop must not bank a verdict, and it
|
|
1869
1850
|
// must not enter the funnel's session denominator either.
|
|
1870
1851
|
try {
|
|
1871
|
-
if (
|
|
1872
|
-
// `sub` is the one collected at the top of this block
|
|
1873
|
-
//
|
|
1874
|
-
// worse, could disagree with the set the decay loop above just scored.
|
|
1852
|
+
if (d.mainText.seen) {
|
|
1853
|
+
// `sub` is the one collected at the top of this block, so this records the set
|
|
1854
|
+
// the decay loop above just scored.
|
|
1875
1855
|
if (sub.injected.size > 0) {
|
|
1876
1856
|
recordCitationSurfaces(
|
|
1877
1857
|
db,
|
|
@@ -1920,11 +1900,8 @@ async function handleStop() {
|
|
|
1920
1900
|
if (db) {
|
|
1921
1901
|
try {
|
|
1922
1902
|
markSessionCompletedAndSaveHandoff(db, { sessionId, project, ccSessionId, episodeSnapshot, stopEpoch });
|
|
1923
|
-
// Citations first: they read the subagent transcripts before the parent, so the parent is
|
|
1924
|
-
// parsed once and stays memoized (D#152). The summary reads the parent's tail on every
|
|
1925
|
-
// turn; run before them, it parsed the parent a second time in any session with subagents.
|
|
1926
1903
|
trackCitationsAtStop(db, { sessionId, project, ccSessionId, transcriptPath });
|
|
1927
|
-
writeFastSummaryBaseline(db, { sessionId, project, transcriptPath });
|
|
1904
|
+
writeFastSummaryBaseline(db, { sessionId, project, transcriptPath, lastAssistantMessage });
|
|
1928
1905
|
} catch (e) {
|
|
1929
1906
|
// Another process held the write lock past HOOK_DB_DEADLINE_MS: this turn's handoff,
|
|
1930
1907
|
// citations and baseline are lost either way. The summary worker below does not run under
|
|
@@ -2017,7 +1994,8 @@ function gcStalePreRecallCooldowns() {
|
|
|
2017
1994
|
name.startsWith('.claude-mem-keyctx-') || // D#123 Key Context marker — same per-session growth, same 24h GC
|
|
2018
1995
|
name.startsWith(BUGFIX_NUDGE_MARKER_PREFIX) || // §9-B once-per-session nudge claim — same shape
|
|
2019
1996
|
name.startsWith(RECALL_SHOWN_PREFIX) || // injection budget C1/C3 per-thread marker — same shape
|
|
2020
|
-
name.startsWith(TURN_REPLIES_PREFIX)
|
|
1997
|
+
name.startsWith(TURN_REPLIES_PREFIX) || // D#825 per-session turn replies; its workers read it within minutes
|
|
1998
|
+
name.startsWith(DIGEST_FILE_PREFIX); // issue #53 per-transcript Stop digest; a later Stop re-reads from byte 0
|
|
2021
1999
|
if (!isCooldown && !isInjectedMarker) continue;
|
|
2022
2000
|
try {
|
|
2023
2001
|
const p = join(RUNTIME_DIR, name);
|