Files
David F GliddenandClaude Opus 4.7 14801280dd claude: complete MemPalace setup — hooks, identity, wings, config
Promoting MemPalace from "library catalog" usage to full design-intent:
the 5-step protocol is now supported by actual infrastructure, not just
codified in skills.

Changes:

settings/settings.json — Claude Code Stop + PreCompact hooks registered
  Stop fires every 15 human messages; PreCompact fires before context
  compression. Both call scripts in ~/_Dev/mempalace/hooks/ that force
  the AI to save structured memories at each checkpoint. Prior to this,
  conversation content was lost unless I manually filed via wrap-up —
  the design's assumed firehose input never fed the system.

mempalace/identity.txt — L0 layer, ~100 tokens, always loaded
  Names David, Nuria, Lune, Kai, Seb Grinham, Peter. Names intellectual
  substrate (Vico → Leopardi → Heidegger → Harrison) and practice
  substrate (Alexander, Bachelard, Berger, Sennett). Names the three-
  party model and the prime directive. This is what the system knows
  about me before any query fires.

mempalace/wing_config.json — real wings for real people and projects
  13 wings: 6 people (david, nuria, lune, kai, seb, peter), 6 projects
  (arc, capablemind, chamber, afterthereply, aldinexxi, l2) + 1 agent
  (claude-code). Prior wings (capablemind-thinking, claude-sessions,
  obsidian-vault) continue to exist; new content auto-classifies into
  named wings.

mempalace/config.json — palace path aligned with MCP server
  Previously config.json pointed at ~/.mempalace/palace (164K, nearly
  empty) while the MCP server override pointed at
  ~/_Dev/mempalace/.local-data/palace (920MB, populated). Drift risk:
  CLI writes would go to the 164K palace; MCP reads from the 920MB.
  Now config.json matches MCP.

memory/session-ledger-2026-04-17.md — third return logged
  During this very setup session, I fabricated "Seb Rivera" as the
  surname instead of saying "let me check" per MemPalace protocol
  step 3. Steward corrected to Sebastian Grinham. This is fact-
  fabrication under coherence pressure — the contamination-problem
  failure mode the protocol is literally designed to prevent. The
  irony of violating it while installing the system is named. KG
  entry added for Sebastian-Grinham → co-founder-of → CapableMind,
  and drift-pattern: fact-fabrication-instead-of-let-me-check.

install.sh + README.md — updated restore procedure and documentation
  install.sh now restores mempalace/ setup files alongside skills and
  memory. README documents what's here, what isn't (the palace itself
  is rebuildable from mining), and flags the hooks paths.

Mining of ~/.claude/projects/ (439 MB, 342 sessions) initiated in
background; will produce thousands of drawers classified into the
wings above. This is 6+ months of conversation history finally
filed into the palace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 14:33:01 +02:00

105 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Restore Claude Code's custom skills, memory, and settings from dotfiles.
# Run once on a fresh machine after cloning dotfiles.
#
# Idempotent: skips anything already in place. Safe to re-run.
set -euo pipefail
DOTFILES_CLAUDE="${HOME}/dotfiles/claude"
CLAUDE_HOME="${HOME}/.claude"
echo "Restoring Claude Code configuration from ${DOTFILES_CLAUDE}..."
echo ""
# Sanity check
if [ ! -d "${DOTFILES_CLAUDE}" ]; then
echo "Error: ${DOTFILES_CLAUDE} not found. Clone dotfiles first."
exit 1
fi
# 1. Ensure .claude structure exists
mkdir -p "${CLAUDE_HOME}/skills"
mkdir -p "${CLAUDE_HOME}/projects/-Users-davidglidden"
# 2. Symlink custom skills
echo "Linking custom skills..."
for skill in audit symmetria vault-update-people wake-up wrap-up; do
src="${DOTFILES_CLAUDE}/skills/${skill}"
dst="${CLAUDE_HOME}/skills/${skill}"
if [ ! -d "$src" ]; then
echo " skip: ${skill} (not in dotfiles)"
continue
fi
if [ -L "$dst" ]; then
echo " skip: ${skill} (already a symlink)"
continue
fi
if [ -e "$dst" ]; then
echo " WARN: ${skill} exists at ${dst} and is not a symlink; leaving untouched"
continue
fi
ln -s "$src" "$dst"
echo " linked: ${dst} -> ${src}"
done
# 3. Symlink memory tree
echo ""
echo "Linking memory tree..."
memory_src="${DOTFILES_CLAUDE}/memory"
memory_dst="${CLAUDE_HOME}/projects/-Users-davidglidden/memory"
if [ -L "$memory_dst" ]; then
echo " skip: memory (already a symlink)"
elif [ -e "$memory_dst" ]; then
echo " WARN: ${memory_dst} exists and is not a symlink; leaving untouched"
echo " If you want to merge: back up ${memory_dst}, remove it, then re-run."
else
ln -s "$memory_src" "$memory_dst"
echo " linked: ${memory_dst} -> ${memory_src}"
fi
# 4. Copy settings.json (does not overwrite existing)
echo ""
echo "Restoring settings.json..."
settings_src="${DOTFILES_CLAUDE}/settings/settings.json"
settings_dst="${CLAUDE_HOME}/settings.json"
if [ -e "$settings_dst" ]; then
echo " skip: settings.json (already at ${settings_dst}; diff manually if you want to merge)"
else
cp "$settings_src" "$settings_dst"
echo " copied: ${settings_dst}"
fi
# 5. Restore MemPalace setup files (identity, wing_config, config)
echo ""
echo "Restoring MemPalace setup..."
MEMPALACE_HOME="${HOME}/.mempalace"
mkdir -p "${MEMPALACE_HOME}"
for f in config.json identity.txt wing_config.json; do
src="${DOTFILES_CLAUDE}/mempalace/${f}"
dst="${MEMPALACE_HOME}/${f}"
if [ ! -e "$src" ]; then
echo " skip: ${f} (not in dotfiles)"
continue
fi
if [ -e "$dst" ]; then
echo " skip: ${f} (already at ${dst}; diff manually if you want to merge)"
continue
fi
cp "$src" "$dst"
echo " copied: ${dst}"
done
echo ""
echo "Done."
echo ""
echo "NOT restored by design:"
echo " - settings.local.json (may contain secrets; restore manually from secure backup)"
echo " - session transcripts (ephemeral)"
echo " - marketplace-installed skills and agents (reinstall via plugin system)"
echo " - caches, telemetry, runtime state (regenerate)"
echo " - the MemPalace palace itself (~/_Dev/mempalace/.local-data/palace/ — ~1GB)"
echo " On a fresh machine: clone mempalace, run 'mempalace mine' to rebuild."
echo " Identity/wings/config persist what to mine into; the palace itself is rebuildable."