@rememlyai/hooks
v0.1.1
Published
Capture hooks for Rememly - ingest AI coding sessions into the personal capture layer for Claude Code, Cursor, and Codex.
Readme
@rememlyai/hooks - Rememly capture hooks
Capture AI coding sessions into your personal Rememly memory layer,
so the next session (in any tool) starts already knowing what happened in the
last one. This is the capture layer of Rememly's double-layer memory model
(ADR-018): raw,
verbatim, personal-only, and hash-idempotent. The curated layer (approval-gated
extractions) is built separately by the extract_memories tool.
Two guarantees:
- Personal-only. Captured transcripts are written to your personal scope and never to a team scope — a raw, unreviewed transcript is never pushed at a teammate. The server rejects any non-personal capture.
- Idempotent. Every chunk is content-hashed, so re-uploading an overlapping transcript (the hooks fire repeatedly) saves nothing new.
Configure
Set these in your shell environment (the hooks read them at fire time):
| Variable | Required | Default | Meaning |
| --- | --- | --- | --- |
| REMEMLY_TOKEN | ✅ | - | A cm_* API token with memory:write |
| REMEMLY_API_URL | | https://api.rememly.ai | Backend base URL |
| REMEMLY_CAPTURE_EVERY | | 15 | Human turns between Stop uploads |
| REMEMLY_CAPTURE_OFF | | - | Set to disable capture entirely |
| REMEMLY_CAPTURE_DEBUG | | - | Set to log hook activity to stderr |
Claude Code
Full transcript capture. Install as a plugin (the .claude-plugin/ manifest
wires the Stop, PreCompact, and SessionEnd hooks):
npm i -g @rememlyai/hooks
# then add this repo's plugin dir to Claude Code, or copy .claude-plugin/hooks.json
# into your ~/.claude/settings.json hooks block.- Stop - uploads once every
REMEMLY_CAPTURE_EVERYhuman turns. - PreCompact — always uploads (the transcript is about to be summarised away; this is the one hard-guarantee firing).
- SessionEnd — uploads anything new before the session closes.
The hook never emits blocking output — it always exits 0, so it can never wedge
Claude Code, and it never loops on stop_hook_active.
Cursor
Cursor doesn't expose a parseable transcript, so instead of uploading we nudge
the agent to call the Rememly checkpoint MCP tool itself. Copy
hosts/cursor-hooks.json into your Cursor hooks
config and replace /ABS/PATH/TO with the installed package path.
- sessionStart — injects a context block: recall relevant memory first, and the inferred project container (your workspace folder name).
- stop - every
REMEMLY_CAPTURE_EVERYfirings, returns afollowup_messageasking the agent tocheckpointthe session (decisions, preferences, facts + a one-line diary). De-dup is automatic.
The hook does not provide MCP tools by itself. Connect the host to /mcp or
@rememlyai/mcp first; the local package is preferred when the agent should
resolve project memory and Todo work from the current git repository.
Codex
Codex reuses the Claude Code capture script. Copy
hosts/codex-hooks.json into .codex/hooks.json and
fix the path.
Develop
npm install
npm test # vitest — pure core logic (parsing, cadence, container hints)The pure, testable core lives in lib/capture-core.mjs;
the runners in bin/ are thin I/O shells over it.
