diff --git a/lib/memory-feedback/advisor.test.ts b/lib/memory-feedback/advisor.test.ts index 1b70643..9017d39 100644 --- a/lib/memory-feedback/advisor.test.ts +++ b/lib/memory-feedback/advisor.test.ts @@ -190,12 +190,15 @@ test('12: shape drift is counted and replaces the plain zero', () => { expect(s).not.toContain('No advisor call') }) -test('13: the retention note appears past 7 days only', () => { +test('13: the retention note appears past 7 calendar days only', () => { const t: Tally = { uses: [], unparsed: 0, files: 1 } expect(renderAdvisor(t, TO - 10 * DAY, TO)).toContain( 'Transcripts kept 7 d: calls before 2026-01-04 may be missing.') expect(renderAdvisor(t, TO - 3 * DAY, TO)).not.toContain('Transcripts kept') expect(renderAdvisor(t, 0, TO)).not.toContain('Transcripts kept') + const to = TO + 17 * 3600000 // a weekly run lands mid-day, not at 00:00 + expect(renderAdvisor(t, to - 7 * DAY - 5 * 3600000, to)) + .not.toContain('Transcripts kept') }) test('14: an unreadable sub-directory is skipped, the rest counts', () => { diff --git a/lib/memory-feedback/advisor.ts b/lib/memory-feedback/advisor.ts index eb731a4..a0ca77c 100644 --- a/lib/memory-feedback/advisor.ts +++ b/lib/memory-feedback/advisor.ts @@ -188,9 +188,10 @@ function bodyOf(t: Tally, from: number): string { /** The `## Advisor usage` markdown section, ending with a newline. */ export function renderAdvisor(t: Tally, from: number, to: number): string { const blocks = [heading(from, to)] - if (from > 0 && to - from > RETENTION_DAYS * DAY_MS) { + const cut = day(to - RETENTION_DAYS * DAY_MS) + if (from > 0 && cut > day(from)) { blocks.push(`Transcripts kept ${RETENTION_DAYS} d: calls before ` + - `${day(to - RETENTION_DAYS * DAY_MS)} may be missing.`) + `${cut} may be missing.`) } blocks.push(bodyOf(t, from)) return blocks.join('\n\n') + '\n' diff --git a/skills/memory-feedback/SKILL.md b/skills/memory-feedback/SKILL.md index 097e332..fb52729 100644 --- a/skills/memory-feedback/SKILL.md +++ b/skills/memory-feedback/SKILL.md @@ -8,8 +8,8 @@ description: Run only when the user asks for it ("memory feedback", "label recal Phase 4d (BDR-125). The memory mod logs every recall ask; transcripts live 7 days, so this runs weekly. Claude labels, the user spot-checks. Redacted -text stays in the scratchpad; `~/.claude/memory-feedback/` keeps IDs, enums -and repo tags only, never in git. +text stays in the scratchpad; `~/.claude/memory-feedback/` keeps IDs, enums, +repo tags and advisor call counts only, never in git. ## STEP 1 — WORKSHEET