/memory-init — Memory Skeleton Initializer
Create the .ai-skills-memory/ directory tree from plugin/memory/templates/. Idempotent. Layer model and write rules: plugin/docs/concepts/memory.md.
When to use
- After cloning a repo that uses ai-skills but has no
.ai-skills-memory/(first run on a fresh checkout) - After upgrading the plugin to a version that adds new memory paths
- When
/plugin-doctorreports "no memory tree present"
Not needed when running /ai-skills-init — that workflow runs memory-init as one of its steps.
Behavior
- Detect current project root (
<repo>= the cwd where the user runs the command). - Check for existing
.ai-skills-memory/:- If missing → create
- If present → no-op for existing files; create only what is missing (idempotent)
- Create directory tree:
<repo>/.ai-skills-memory/ ├── .gitignore (from plugin/memory/templates/ai-skills-memory.gitignore) ├── learnings.md (empty header template) ├── runs.jsonl (touch-create, append-only) ├── errors.log (touch-create, append-only) ├── redactions.log (touch-create, append-only) ├── sessions/ (per-session subdirs created by hooks) ├── ralph/ (per-RALF-run subdirs) ├── pending-flush/ (PreCompact flush markers) ├── designs/ (/feature-design output summaries) ├── env-reports/ (/env-analyze baselines) ├── refactor/ (/refactor logs) ├── migrate/ (/migrate plans) ├── spikes/ (/spike reports) ├── security-audits/ (/security-audit findings) ├── docs/ (/docs-pack generation summaries) ├── knowledge-sync/ (/knowledge-sync per-run logs + run-lock) └── .committed/ ├── README.md (from plugin/memory/templates/committed-readme.md) ├── .allowlist-extensions.txt (project-extension allowlist, empty by default) ├── conventions.md (from plugin/memory/templates/conventions-schema.md, empty body) └── learnings.md (committed-learnings template, empty body) - Append
.ai-skills-memory/rule to<repo>/.gitignoreif not already present. - Print summary: created vs skipped paths.
Hard rules
- Never overwrite existing files. If a file exists, skip it and report "skipped: ".
- Never write to
.committed/paths outside the allowlist —pre-tool-use-committed-write.pyhook enforces this; the skill must not bypass. - PII filter applies to any seeded content per
memory-discipline.mdrule 2.
Failure modes
- No write permission in cwd: report error, suggest
cdto a writable directory or run with elevated permissions. - Existing
.ai-skills-memory/corrupted (bad JSON, bad allowlist): flag corrupted files but do not delete or rewrite them. Suggest user inspect and back up before re-running.
Memory writes
| Layer | When | Shape |
|---|---|---|
| L4 | On first init | .ai-skills-memory/init-summary.md — timestamp + version + paths created |
Integration
- Templates source:
${CLAUDE_PLUGIN_ROOT}/memory/templates/(7 files: ai-skills-memory.gitignore, committed-allowlist.txt, committed-readme.md, conventions-schema.md, eval-baseline.schema.json, learnings-schema.md, untrusted-content-wrapper.md). PII pattern file lives separately at${CLAUDE_PLUGIN_ROOT}/hooks/scripts/pii-patterns.txtbecause the secret-scan + memory-curator hooks load it directly. - Called by:
/ai-skills-init(full bootstrap including memory), used standalone for upgrades - Rules:
memory-discipline(write rules per layer),memory-validation(entry validation) - Hooks:
pre-tool-use-committed-write.pyvalidates.committed/writes against allowlist - Layer model:
plugin/docs/concepts/memory.mddocuments the L0–L5 layers. This skill creates L3 dirs (sessions/,ralph/) and L4 files (learnings.md,runs.jsonl, etc.) inside.ai-skills-memory/.