/memory-loop:setupfrom memory-loop
First-time memory-loop setup — offer identity names, create HABITS.md and OUTPUT.md from the templates, wire their imports into ~/.claude/CLAUDE.md, write an initial config, and verify the hooks respond.
Ships in memory-loop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Walk the user through first-time setup, in this order. Every step is optional — respect a "skip".
Run the identity skill flow: offer the one-time name setup (set or decline).
See that skill for the schema and the confirmation rule.
The habit-distillation frame is two files — rules that load every session, and the case records they point to, which do not:
~/.claude/groundwork/HABITS.md (imported into every session — budgeted)
~/.claude/groundwork/HABITS-CASES.md (on demand, via [Cnn] pointers)
~/.claude/groundwork/HABITS-ARCHIVE.md (retired rules; created when first needed)
The habit file carries a budget — 8000 bytes / 24 rules by default — that
habits-budget-guard.sh enforces at the write. Mention it when you show the
file: the cap is what keeps an always-loaded file affordable, and the habit
skill explains how to make room.
mkdir -p ~/.claude/groundwork
cp "${CLAUDE_PLUGIN_ROOT}/templates/HABITS.md" ~/.claude/groundwork/HABITS.md
cp "${CLAUDE_PLUGIN_ROOT}/templates/HABITS-CASES.md" ~/.claude/groundwork/HABITS-CASES.md
habit
skill describes how to move the prose across.)A short output-style rule file — ELI5 plainness, next action first, core only, easy to scan, and a list of what must never be trimmed (evidence, repro commands, error text). Its goal is less reading time, less generation time, fewer tokens.
Unlike the habit files, this one has two parts: the user's own rules at the top, and one managed block that mirrors the plugin template. The sync script creates the file if it is missing, and otherwise replaces only the managed block (a file from before 2.3.0 has no block: the user's text is kept and the block is appended). It writes a backup next to the file before any change and prints one line saying what it did:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/sync-output-template.sh"
From now on the output-template-sync.sh SessionStart hook runs the same
script every session, so a template change lands automatically; the user's
rules above the block are never touched. Tell the user: edit above the block,
not inside it, and set "syncOutputTemplate": false in memory-loop.json to
opt out.
Neither file does anything until the user's own ~/.claude/CLAUDE.md imports
it — an unimported habit file is the quiet failure mode of this whole loop: it
still collects rules, and none of them ever reach a session. Say what the
script is about to do (one managed block, two @ lines, a backup next to the
file), then run it:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/install-claude-imports.sh"
It is idempotent: a line already present anywhere in the file (for instance
one the user added by hand earlier) is not duplicated, and a second run prints
ok: and writes nothing. Presence is a whole-line match, so an import quoted
inside a code fence or comment also counts — if it prints ok: but the user
says the file is not loading, look for that. Show the user its output,
including the backup path. It follows a symlinked CLAUDE.md to the real file
and keeps the file's mode and line endings.
Import only HABITS.md and OUTPUT.md — HABITS-CASES.md and HABITS-ARCHIVE.md
are deliberately left out so their prose is not re-read on every request; do
not add them by hand.
If the user declines the edit, say plainly that habit capture will keep
running with no effect, and offer to skip habit capture entirely instead. To
undo later, delete the managed block (the two <!-- groundwork:memory-loop … --> markers and the lines between them).
Offer to copy the example config to the global location:
cp "${CLAUDE_PLUGIN_ROOT}/examples/memory-loop.example.json" ~/.claude/groundwork/memory-loop.json
Explain the four keys before copying:
correctionInjectionCap — max correction-signal context injections per
session (default 3; 0 disables injection, but every match is still
recorded to signals.jsonl).habitsBudgetBytes — size budget for the always-loaded habit file (default
8000). A write past it is denied; 0 disables the check.habitsMaxRules — rule-count cap for that file, 🟢 and 🛑 together (default
24). This is the one that usually binds; 0 disables it.extraMemoryDirs — additional memory directories the expiry sweep should
cover, beyond the current project's own memory directory.The example's budget values match the hooks' built-in defaults, so copying it changes nothing until the user edits them — say so, rather than letting the copy look like it pinned something.
A repo can override the global config with <repo>/.groundwork/memory-loop.json.
Run each hook once with stub input and show the user what got injected:
printf '{}' | bash "${CLAUDE_PLUGIN_ROOT}/hooks/identity-context.sh"
printf '{}' | bash "${CLAUDE_PLUGIN_ROOT}/hooks/memory-expiry-sweep.sh"
printf '{"session_id":"setup-smoke","prompt":"that is wrong"}' | bash "${CLAUDE_PLUGIN_ROOT}/hooks/correction-signal.sh"
Expected: identity prints either the configured names or the setup offer; the
sweep prints nothing (or a report if something already lapsed); the
correction-signal smoke test prints one line of JSON —
{"hookSpecificOutput":{"hookEventName":"UserPromptSubmit","additionalContext":"Correction signal: ..."}}
— because "that is wrong" matches the wrong keyword.
Finish by pointing at the two everyday skills: remember (the save gate for
memories) and habit (distilling lessons into HABITS.md).
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
6 skills in this plugin
/consolidatePeriodically merge the memory index, long-tier memory files, and the habit file — deduplicate, resolve contradictions to the current truth, absolutize dates, bring HABITS.md back under budget — and propose the result for your confirmation before any write. Use when MEMORY.md grows large (~120+ lines), when the habit file is over budget, or when memories accumulate duplicates, contradictions, or stale facts./habitDistill a lesson — a mistake, a user correction, or a praised behavior — into HABITS.md as a positive practice or a hard line, after it clears the damage/recurrence/generality gate. Use after the user corrects you, after an incident, or when a correction signal fires./identitySet, change, or decline the user/assistant names that memory-loop injects at session start. Use when the user wants to set up names, rename either party, ask the assistant to pick its own name, or stop the name-setup offer from appearing./rememberSave gate for persistent memories — confirm tier (long/short) and expiry with the user before writing, so hallucinated or transient facts never enter long-term memory. Use whenever saving a memory file, and when the expiry sweep reports archived memories./tutorRun a spaced-repetition self-quiz over lessons already distilled into HABITS.md — one novel-scenario transfer question per due item, anti-sycophancy grading, and a 1-4 recall rating logged through the tutor scheduler. Use when the user asks to be quizzed or reviewed (English or Korean), or replies to a memory-loop tutor due-reminder line ("N개 복습 항목이 대기 중").memory-loop@buildwithclaude is listed by davepoon/buildwithclaude — review the source before installing
npx claudepluginhub davepoon/buildwithclaude --plugin memory-loop