From 8625fe791b8c1932232169c5563a6f8eecfb07fe Mon Sep 17 00:00:00 2001 From: Parfii-bot Date: Tue, 21 Apr 2026 03:07:15 +0800 Subject: [PATCH] fix(install): scaffold ~/.claude/memory dir + placeholder MEMORY.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _blocks/memory-protocol.md references ~/.claude/memory/MEMORY.md, but the installer previously only scaffolded agents/ hooks/ skills/ — so the first agent that followed the block would fail reading a non-existent index. Now mkdir -p ~/.claude/memory and, only when MEMORY.md is absent, write a minimal placeholder (frontmatter + pointer to the block). User-edited MEMORY.md is never overwritten. --- install.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index cdbdfc0..9f6bf04 100755 --- a/install.sh +++ b/install.sh @@ -60,7 +60,22 @@ mkdir -p \ "$AGENTS_DIR/_assembler/src" \ "$AGENTS_DIR/_generated" \ "$HOOKS_DIR" \ - "$SKILLS_DIR/new-agent" + "$SKILLS_DIR/new-agent" \ + "$HOME_DIR/.claude/memory" + +# --- scaffold MEMORY.md placeholder (user-respecting) ---------------------- +# _blocks/memory-protocol.md references ~/.claude/memory/MEMORY.md; without +# this file the first agent following the protocol fails on read. +MEMORY_INDEX="$HOME_DIR/.claude/memory/MEMORY.md" +if [[ ! -f "$MEMORY_INDEX" ]]; then + cat > "$MEMORY_INDEX" <<'EOF' +# Auto Memory — Index + +> File-based memory index. Add entries as you save memory files under this directory. +> See `_blocks/memory-protocol.md` for format. +EOF + say "scaffolded $MEMORY_INDEX" +fi # --- copy blocks (overwrite ours; blocks are SSoT from kit) ---------------- say "copying shared blocks -> $AGENTS_DIR/_blocks/"