feat(widgets): add Claude memory widget#513
Open
3351163616 wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new
claude-memorywidget 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 aMEMORY.mdindex). 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
dirname(transcript_path)/memory(no project-slug computation needed)..mdfiles in the memory dir excluding theMEMORY.mdindex.mtimeacross all.mdfiles, formatted<1m/Xm/Xh/Xd.rawValuemode omits the icon prefix.null) when there is no transcript path, the memory dir is missing, the count is0, or any filesystem error occurs — the status line never throws.Session; default colormagenta; supports colors and raw value;getNumericValue()returns the count.Implementation
render()(same pattern asFreeMemory); noRenderContextor entry-point changes.ClaudeMemory.test.ts) with thefsmodule 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.