-
Notifications
You must be signed in to change notification settings - Fork 2
feat: memory staleness caveats #721
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
Claude Code appends a staleness caveat when injecting memories older than 1 day:
"This memory is N days old. Memories are point-in-time observations, not live state — claims about code behavior or file:line citations may be outdated. Verify against current code before asserting as fact."
This prevents agents from acting on stale information — a root cause of duplicate issues and contradicting fixes in our system.
From Claude Code Source
memoryAge.ts:
memoryAgeDays(mtimeMs) = floor((Date.now() - mtimeMs) / 86_400_000)
memoryFreshnessText(mtimeMs) = age > 1 day ? staleness caveat : ''The caveat is injected as a <system-reminder> before the memory content.
Current State
Our state.md files have no age signal. An agent reads state.md written 3 days ago and treats it as current truth. This causes:
- Acting on resolved blockers
- Re-filing closed issues
- Contradicting decisions made in intervening runs
Proposed Changes
In run-context.ts, when loading state.md or topic files:
- Check file mtime
- If > 24 hours old, prepend caveat:
⚠️ This memory is {N} days old. Verify against current state before acting on it. - If > 7 days old, stronger caveat:
⚠️ This memory is {N} days old and likely outdated. Check git log and current issues before relying on it.
Files to change
- src/lib/run-context.ts — add staleness check when reading memory files (~3 lines)
Expected impact
Minimal code change, significant quality improvement. Agents will verify stale state instead of blindly acting on it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request