segmem

Reviewed at commit c80dac9

Segmented, scoped memory in one SQLite file: wakes at session start, recalls on every prompt, nags when stale.

Made by
Mark Huebel
What we checked

Keeps a local SQLite memory of notes Claude writes about you and your projects, and adds relevant notes to the context at session start, on each prompt and before Bash commands, by running its own bundled Python script. It sends nothing over the network. Notes persist in ~/.segmem; it also tells Claude to record notes and to pass a read-only rule to subagents.

Review details

Static review of the source at the pinned commit; not run. The plugin has shell command hooks (SessionStart prompt and wake, UserPromptSubmit hook, PreToolUse Bash hook) that call the bundled Python script ${CLAUDE_PLUGIN_ROOT}/segmem, plus a function-hook module hooks.ts registering prompt.context (adds the wake text as a block), prompt.submit (runs the script with the prompt on stdin and appends the recall as context), agent.spawn (appends a read-only memory rule to each subagent prompt), two tool.call hooks on Bash (check-note runs the script on commands that contain segmem and note and can deny a malformed note; a recall hook adds matching notes as context) and session.start (registers a recall tool, whose calls run the script and return its output). It uses $.process.run, $.session.cwd/id, $.ui.status/toast/log and $.tool.register. The script is readable Python using sqlite3 and stdlib only; it stores notes, summaries and touch counts in ~/.segmem/segmem.db (or SEGMEM_DIR), reads git state for the project key and optionally reads a local knowledge repo from SEGMEM_ORG_DIR. The serve command is on demand, bound to 127.0.0.1 and read-only; html writes a local file; org-init scaffolds files only when the user runs it; no commands pre-approve permissions and no settings are written (init only prints a suggested hooks snippet). Skills (compile, import, org, review) tell Claude to run segmem commands, edit repo config files when compiling a fact, and read ~/.claude/projects memory markdown for import, always asking before deleting. Failures are logged and ignored. The script was truncated in the bundle and the remainder (serve, mcp, audit, hook) was checked in the cloned repo.

What it uses
  • Reads your prompts: yes
  • Sees tool calls: yes
  • Blocks or changes tool calls: yes
  • Reads or writes files: yes
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events

Segmented, scoped memory for agents: one file, SQLite, no daemon. Wake at session start, recall on every prompt, staleness nag at stop.

Made this mod? Add a badge to your README

modsforClaude badge for segmem

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/segmem.svg)](https://modsforclaude.com/mods/segmem/)

← All mods