Skip to content

feat(widgets): add Claude memory widget#513

Open
3351163616 wants to merge 1 commit into
sirmalloc:mainfrom
3351163616:feat/claude-memory-widget
Open

feat(widgets): add Claude memory widget#513
3351163616 wants to merge 1 commit into
sirmalloc:mainfrom
3351163616:feat/claude-memory-widget

Conversation

@3351163616

Copy link
Copy Markdown

What

Adds a new claude-memory widget that surfaces the current project's Claude Code auto-memory state in the status line: how many memory files exist and how recently they were updated.

Renders 🧠 <count> (<age>), e.g. 🧠 5 (2h).

Why

Claude Code maintains per-project persistent memory under ~/.claude/projects/<slug>/memory/ (with a MEMORY.md index). Surfacing the count and last-updated age gives a quick at-a-glance signal of the current project's memory state — e.g. whether memory is fresh or has gone stale — without leaving the prompt.

Behavior

  • Locates the memory directory next to the transcript: dirname(transcript_path)/memory (no project-slug computation needed).
  • Count: .md files in the memory dir excluding the MEMORY.md index.
  • Age: newest mtime across all .md files, formatted <1m / Xm / Xh / Xd.
  • rawValue mode omits the icon prefix.
  • Hidden (returns null) when there is no transcript path, the memory dir is missing, the count is 0, or any filesystem error occurs — the status line never throws.
  • Category Session; default color magenta; supports colors and raw value; getNumericValue() returns the count.

Implementation

  • Reads the filesystem synchronously inside render() (same pattern as FreeMemory); no RenderContext or entry-point changes.
  • Covered by unit tests (ClaudeMemory.test.ts) with the fs module mocked.

Notes

Depends on Claude Code's memory directory convention (memory/ + MEMORY.md). If that convention shifts, the widget degrades gracefully (hides) rather than erroring.

Adds a claude-memory widget that surfaces the project's Claude Code memory state: the number of memory files and how recently they were updated (e.g. "🧠 5 (2h)"). Reads the memory directory next to the transcript path. Hidden when there is no transcript path, no memory directory, or zero memory files; supports rawValue and custom colors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant