memory-manage
Unified management of the ai-context/ memory layer. Three modes: init, update, maintain.
Triggers: /memory-init, /memory-update, /memory-maintain, initialize memory, update memory, maintain memory, memory housekeeping, clean ai-context
Mode Detection
Determine the mode from the invocation:
/memory-initor "initialize memory" or "generate ai-context" → init mode/memory-updateor "update memory" or "sync memory" or "record session" → update mode/memory-maintainor "maintain memory" or "memory housekeeping" or "clean ai-context" → maintain mode
Mode: init
Creates the 5 core ai-context/ files from scratch by reading the project.
Use when: Project has no ai-context/ yet, or you want to regenerate from scratch.
Process
- Project inventory: Read configuration files, folder structure, README, representative source files, tests, CI/CD configs.
- Generate files:
- ai-context/stack.md — tech stack, versions, key tools - ai-context/architecture.md — architectural decisions and rationale - ai-context/conventions.md — naming patterns, code conventions - ai-context/known-issues.md — known bugs, tech debt, gotchas - ai-context/changelog-ai.md — empty, ready for session entries
- Feature stubs: Scan for bounded contexts (directories with domain logic). Create
ai-context/features/_template.mdand stub files for discovered domains. - Report: List files created and coverage summary.
Mode: update
Incrementally updates ai-context/ with work done in the current session.
Use when: After completing significant work (SDD cycles, architecture changes, bug fixes).
Process
- Analyze session: Review what changed — files created/modified, decisions made, bugs fixed, conventions established.
- Update relevant files:
- ai-context/stack.md — new dependencies, version changes - ai-context/architecture.md — new decisions, pattern changes - ai-context/conventions.md — new naming patterns, style changes - ai-context/known-issues.md — new issues found, resolved issues marked - ai-context/changelog-ai.md — append entry with date, summary, files affected - ai-context/features/<domain>.md — update if relevant domain was touched
- Preserve: Never overwrite
[manual]sections. Only update[auto-updated]markers.
Mode: maintain
Periodic housekeeping: archive old entries, separate resolved issues, detect gaps.
Use when: changelog-ai.md is long (30+ entries), known-issues has resolved items, or at the start of a new project phase.
Process
- Changelog archival: If
changelog-ai.mdhas more than 30 entries, move older entries tochangelog-ai-archive.md. - Known-issues cleanup: Move resolved items from
known-issues.mdtoknown-issues-archive.md. - Index generation: Create/update
ai-context/index.mdlisting all ai-context/ files with one-line descriptions. - Gap detection: Check if CLAUDE.md references ai-context/ files that don't exist. Report gaps.
- Dry-run first: Present all proposed changes, require user confirmation before applying.
Rules
- Init mode MUST NOT run if ai-context/ already exists — warn and suggest update mode instead
- Update mode MUST NOT create new core files — only modify existing ones
- Maintain mode MUST present dry-run before any destructive action (archival, moves)
- All modes are read-heavy, write-light — the goal is accurate, concise documentation
- Never overwrite
[manual]sections in any file - Feature file updates follow the format defined in
skills/feature-domain-expert/SKILL.md