fix(memory-feedback): retention note only when its cut day passes the start day

A weekly run's window is just over 7 days, so the note fired every week with a cut day equal to the heading's start. SKILL.md names advisor counts in the local data line.
This commit is contained in:
bchanot committed 2026-11-19 18:10:38 +01:00
1 parent c6f2dad39a
commit 63f5fa4a9c
3 files changed
+9 -5

No files matched your search

+4 -1
View File
@@ -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', () => {
+3 -2
View File
@@ -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'
+2 -2
View File
@@ -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