Install
openclaw skills install slim-project-memoryUse when a project's project memory file is over ~300 lines, when starting a new project from scratch, or when the user mentions context bloat, lost env URLs, sessions pointing at the wrong environment, the memory file becoming a journal, or wanting to organize project context. Restructures or initializes a slim router-style memory file, a gitignored local env reference file, a topical docs/ tree, and a housekeeping protocol that keeps the structure from rebloating.
openclaw skills install slim-project-memoryRestructure or initialize a project's CLAUDE.md so it stays small, sustainable, and credential-safe.
After running, the target project will have:
CLAUDE.md (≤ ~300 lines) — acts as a router/index, not an encyclopedia. Contains hard rules, branch/environment topology (no secrets), pointers to topical docs, common commands, today's state, a housekeeping protocol, and a session protocol.CLAUDE.local.md — holds environment URLs, hosting service names, and env var name references (not inline secrets). The agent reads it before any DB or hosting operation to know which env vars to use.docs/ tree (architecture/, features/, pipeline/, scripts/, recaps/) containing reference material previously stuffed into CLAUDE.md. Each file loaded on-demand..gitignore updated to exclude CLAUDE.local.md.Run this first to decide which path to take:
[ -f CLAUDE.md ] && wc -l CLAUDE.md || echo "no CLAUDE.md yet"
CLAUDE.md or fewer than ~50 lines → NEW mode (Section A below).CLAUDE.md exists with substantial content (≥ 100 lines) → EXISTING mode (Section B below).Also check:
.gitignore present?CLAUDE.local.md already present or already in .gitignore?docs/ directory?Ask the user (one batched question) for:
main only) — solo project, simple deploydevelop → main) — small team, manual proddevelop → staging → main) — most commondevelop → staging → canary → main) — production-grade with canary gateIf the user wants defaults: develop → staging → main, Railway hosting, DB + API key sections in CLAUDE.local.md.
mkdir -p docs/architecture docs/features docs/pipeline docs/scripts docs/recaps docs/plans
Don't create pipeline/ or scripts/ if the project has no data pipeline or doesn't use scripts heavily.
Read references/CLAUDE-template.md, substitute placeholders with values from A1. Inline the housekeeping protocol from references/housekeeping-protocol.md verbatim. Write to project root.
Read references/CLAUDE-local-template.md, substitute placeholders for branch/env structure. The template uses env var name references instead of inline credential slots. Write to project root.
Add (only if not already present):
# Claude local env reference — env var names and URLs only, not credential values
CLAUDE.local.md
If .gitignore doesn't exist yet, also add standard ignores for the project's stack (node_modules/, .next/, __pycache__/, target/, etc.) — but be conservative and tell the user what was added.
wc -l CLAUDE.md
git check-ignore -v CLAUDE.local.md # should match
git status --short # CLAUDE.local.md should NOT appear
ls docs/
Tell the user:
docs/ file, not directly to CLAUDE.md."Do not commit anything. The user owns the first commit.
Read references/cruise-intelligence-case-study.md to refresh on how a real 2,275-line CLAUDE.md got mapped to docs/. You don't need to copy the exact mapping — every project is different — but seeing the patterns helps you propose sensible homes.
wc -l CLAUDE.md # current size
ls .gitignore && grep -c CLAUDE.local.md .gitignore # is it ignored?
ls -d .claude 2>/dev/null # existing .claude/ dir?
ls docs/ 2>/dev/null # existing docs?
[ -f CLAUDE.local.md ] && wc -l CLAUDE.local.md || echo "no CLAUDE.local.md yet"
Read CLAUDE.md in chunks if it's >2000 lines so the full content is in context for extraction.
For each top-level ## Section in the current CLAUDE.md, decide:
CLAUDE.local.md: any block containing connection strings, passwords, API keys, or internal proxy URLs — convert to env var name references, not inline valuesdocs/architecture/<name>.md: schema, auth, caching, project structure, rating systems, patternsdocs/features/<name>.md: per-feature deep dives (one file per major feature)docs/pipeline/<name>.md: data pipelines, scrapers, sync scriptsdocs/scripts/README.md: script catalogsdocs/STATE-SNAPSHOT.md: dated entity counts, "current state" tablesdocs/recaps/: existing dated session recap files (use git mv to preserve history)prisma/schema.prismaPresent the map to the user as a table. Confirm before executing.
Pull these into the slim version's "Hard rules" section:
These are the load-bearing parts that genuinely need to be in every session's context.
CLAUDE.local.md to .gitignore.CLAUDE.local.md with secrets extracted from existing CLAUDE.md. Verify git check-ignore.docs/architecture/, docs/features/, docs/pipeline/, docs/scripts/, docs/recaps/ directories.git mv existing SESSION-RECAP-*.md files into docs/recaps/.docs/STATE-SNAPSHOT.md with dated entity counts pulled from CLAUDE.md.CLAUDE.md from references/CLAUDE-template.md, substituting hard rules, branch table, and pointer index. Inline housekeeping protocol.wc -l CLAUDE.md # should be ≤ ~300
git check-ignore -v CLAUDE.local.md # should match
git status --short # CLAUDE.local.md must NOT appear
# Walk every docs/ pointer in the new CLAUDE.md and confirm:
for f in $(grep -oE 'docs/[a-zA-Z0-9_/.-]+\.md' CLAUDE.md); do
[ -e "$f" ] && echo "OK $f" || echo "MISS $f"
done
Also grep new CLAUDE.md and all new docs files for accidentally-leaked secrets.
Leave a clean working tree of changes for the user to review. Tell them:
CLAUDE.local.md is on disk but invisible to gitThe user owns the commit.
$STAGING_DATABASE_URL) instead of inline values. Secrets go in environment variables (Railway dashboard, .env files, etc.) — not in project files. CLAUDE.local.md and .env must be gitignored before writing.docs/STATE-SNAPSHOT.md.develop → staging → canary → main. Detect actual branches with git branch -a.docs/pipeline/.git statusdocs/ pointer paths from CLAUDE.md resolve to existing filesdocs/ tree created with correct subdirectories