- name
- memory-manage
- description
- Unified memory management - CLAUDE.md updates and documentation generation with interactive routing. Triggers on "memory manage", "update claude", "update memory", "generate docs", "ๆดๆฐ่ฎฐๅฟ", "็ๆๆๆกฃ".
- allowed-tools
- Agent(*), Bash(*), AskUserQuestion(*), Read(*)
# Memory Management Skill
Unified entry point for project memory (CLAUDE.md) updates and documentation (API.md/README.md) generation. Routes to specialized sub-commands via arguments or interactive needs assessment.
## Architecture Overview
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Memory Manage (Router) โ
โ โ Parse input โ Detect mode โ Route to phase โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโดโโโโโโโโ
โ โ
โโโโโโโโโโโโโ โโโโโโโโโโโโโ
โ CLAUDE.md โ โ Docs โ
โ ็ฎก็ โ โ ็ๆ โ
โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ
โ โ
โโโโโโผโโโโโ โโโโโโดโโโโโ
โ โ โ โ โ
Full Related Single Full Related
ๅ
จ้ ๅข้ ๅๆจกๅ ๅ
จ้ ๅข้
```
## Execution Flow
### Step 1: Parse Input & Route
Detect execution mode from user input:
**Auto-Route Rules** (priority order):
| Signal | Route | Examples |
|--------|-------|---------|
| Explicit sub-command token | โ Direct dispatch | `update-full --tool qwen` |
| Keyword: full, ๅ
จ้, all, entire + update/claude | โ update-full | "ๅ
จ้ๆดๆฐclaude" |
| Keyword: related, changed, ๅข้, diff + update/claude | โ update-related | "ๆดๆฐๅๆดๆจกๅ" |
| Keyword: single, module, ๅๆจกๅ + path-like token | โ update-single | "ๆดๆฐ src/auth ๆจกๅ" |
| Keyword: docs, documentation, ๆๆกฃ + full/all/ๅ
จ้ | โ docs-full | "ๅ
จ้็ๆๆๆกฃ" |
| Keyword: docs, documentation, ๆๆกฃ + related/changed/ๅข้ | โ docs-related | "ๅข้็ๆๆๆกฃ" |
| Ambiguous or no arguments | โ **AskUserQuestion** | `/memory-manage` |
Valid sub-command tokens: `update-full`, `update-related`, `update-single`, `docs-full`, `docs-related`
**Direct dispatch examples**:
```
input = "update-full --tool qwen"
โ subcommand = "update-full", remainingArgs = "--tool qwen"
โ Read phases/01-update-full.md, execute
input = "update-single src/auth --tool gemini"
โ subcommand = "update-single", remainingArgs = "src/auth --tool gemini"
โ Read phases/03-update-single.md, execute
```
**When ambiguous or no arguments**, proceed to Step 2.
### Step 2: Interactive Needs Assessment
**Q1 โ ็กฎๅฎๅ
ๅฎน็ฑปๅซ**:
```
AskUserQuestion({
questions: [{
question: "ไฝ ่ฆ็ฎก็ๅช็ฑปๅ
ๅฎน๏ผ",
header: "็ฑปๅซ",
multiSelect: false,
options: [
{
label: "CLAUDE.md (้กน็ฎ่ฎฐๅฟ)",
description: "ๆดๆฐๆจกๅๆไปคๆไปถ๏ผๅธฎๅฉClaude็่งฃไปฃ็ ๅบ็ปๆๅ็บฆๅฎ"
},
{
label: "้กน็ฎๆๆกฃ (API+README)",
description: "็ๆAPI.mdๅREADME.mdๅฐ.workflow/docs/็ฎๅฝ"
}
]
}]
})
```
**Q2a โ CLAUDE.md ็ฎก็่ๅด** (็จๆท้ไบ CLAUDE.md):
```
AskUserQuestion({
questions: [{
question: "CLAUDE.md ๆดๆฐ่ๅด๏ผ",
header: "่ๅด",
multiSelect: false,
options: [
{
label: "ๅข้ๆดๆฐ (Recommended)",
description: "ไป
ๆดๆฐgitๅๆดๆจกๅๅๅ
ถ็ถ็บง๏ผๆฅๅธธๅผๅ้ฆ้"
},
{
label: "ๅ
จ้ๆดๆฐ",
description: "ๆดๆฐๆๆๆจกๅ๏ผ3ๅฑๆถๆbottom-up๏ผ้ๅ้ๅคง้ๆๅ"
},
{
label: "ๅๆจกๅๆดๆฐ",
description: "ๆๅฎไธไธชๆจกๅ๏ผExploreๆทฑๅบฆๅๆๅ็ๆ่ฏดๆไนฆๅผๆๆกฃ"
}
]
}]
})
```
Route mapping:
- "ๅข้ๆดๆฐ" โ `update-related` โ Ref: phases/02-update-related.md
- "ๅ
จ้ๆดๆฐ" โ `update-full` โ Ref: phases/01-update-full.md
- "ๅๆจกๅๆดๆฐ" โ `update-single` โ continue to Q3
**Q2b โ ๆๆกฃ็ๆ่ๅด** (็จๆท้ไบ้กน็ฎๆๆกฃ):
```
AskUserQuestion({
questions: [{
question: "ๆๆกฃ็ๆ่ๅด๏ผ",
header: "่ๅด",
multiSelect: false,
options: [
{
label: "ๅข้็ๆ (Recommended)",
description: "ไป
ไธบgitๅๆดๆจกๅ็ๆ/ๆดๆฐๆๆกฃ๏ผๆฅๅธธๅผๅ้ฆ้"
},
{
label: "ๅ
จ้็ๆ",
description: "ๆๆๆจกๅ+้กน็ฎ็บงๆๆกฃ(ARCHITECTURE.md็ญ)๏ผ้ๅๅๅงๅ"
}
]
}]
})
```
Route mapping:
- "ๅข้็ๆ" โ `docs-related` โ Ref: phases/05-docs-related.md
- "ๅ
จ้็ๆ" โ `docs-full` โ Ref: phases/04-docs-full.md
**Q3 โ ่กฅๅ
่ทฏๅพ** (ไป
update-single ้่ฆ๏ผไธๆ ่ทฏๅพๅๆฐๆถ):
```
AskUserQuestion({
questions: [{
question: "่ฏทๆๅฎ่ฆๆดๆฐ็ๆจกๅ่ทฏๅพ๏ผ",
header: "่ทฏๅพ",
multiSelect: false,
options: [
{
label: "src",
description: "src ็ฎๅฝ"
},
{
label: ".",
description: "้กน็ฎๆ น็ฎๅฝ"
}
]
}]
})
```
็จๆทๅฏ้ "Other" ่พๅ
ฅ่ชๅฎไน่ทฏๅพใ
### Step 3: Execute Selected Phase
Based on routing result, read and execute the corresponding phase:
**Phase Reference Documents** (read on-demand when phase executes):
| Mode | Document | Purpose |
|------|----------|---------|
| update-full | [phases/01-update-full.md](phases/01-update-full.md) | Full CLAUDE.md update, 3-layer architecture, batched agents |
| update-related | [phases/02-update-related.md](phases/02-update-related.md) | Git-changed CLAUDE.md update, depth-first |
| update-single | [phases/03-update-single.md](phases/03-update-single.md) | Single module CLAUDE.md, Explore + handbook style |
| docs-full | [phases/04-docs-full.md](phases/04-docs-full.md) | Full API.md + README.md generation |
| docs-related | [phases/05-docs-related.md](phases/05-docs-related.md) | Git-changed docs generation, incremental |
## Shared Configuration
### Tool Fallback Hierarchy
All sub-commands share the same fallback:
```
--tool gemini โ [gemini, qwen, codex] // default
--tool qwen โ [qwen, gemini, codex]
--tool codex โ [codex, gemini, qwen]
```
### Common Parameters
| Parameter | Description | Default | Used By |
|-----------|-------------|---------|---------|
| `--tool <gemini\|qwen\|codex>` | Primary CLI tool | gemini | All |
| `--path <dir>` | Target directory | . | update-full, docs-full |
| `<path>` (positional) | Module path | _(required)_ | update-single |
### Batching Thresholds
| Sub-Command | Direct Execution | Agent Batch | Batch Size |
|-------------|-----------------|-------------|------------|
| update-full | <20 modules | โฅ20 modules | 4/agent |
| update-related | <15 modules | โฅ15 modules | 4/agent |
| update-single | always single | N/A | 1 |
| docs-full | <20 modules | โฅ20 modules | 4/agent |
| docs-related | <15 modules | โฅ15 modules | 4/agent |
## Core Rules
1. **Route before execute**: Determine sub-command before any execution
2. **Phase doc is truth**: All execution logic lives in phase docs, router only dispatches
3. **Read on-demand**: Only read the selected phase doc, never load all
4. **Pass arguments through**: Forward remaining args unchanged to sub-command
5. **User confirmation**: Each sub-command handles its own plan presentation and y/n confirmation
## Error Handling
| Error | Resolution |
|-------|------------|
| Unknown sub-command | Fall through to interactive flow |
| Phase doc not found | Abort with file path error |
| Missing path for update-single | Prompt via Q3 |
| Sub-command execution fails | Follow phase doc's own error handling |
View on GitHub