refactor(skill): replace compact protection with TodoWrite-driven compact recovery

Redesign Pattern 9 from "forbid compression" to smart dual-layer approach:
- Layer 1: TodoWrite in_progress phase preserved by compact, completed phases compressible
- Layer 2: Compact sentinel in phase files as fallback re-read trigger

Applied to 6 workflow skills: skill-designer, lite-plan, multi-cli-plan, plan, tdd, test-fix
This commit is contained in:
catlog22
2026-02-27 11:13:50 +08:00
parent 3f25dbb11b
commit 07452e57b7
12 changed files with 219 additions and 79 deletions

View File

@@ -114,6 +114,14 @@ if (mode === 'plan') {
}
```
## Compact Recovery (Phase Persistence)
Multi-phase execution (multi-cli-plan → lite-execute) spans long conversations. Uses **双重保险**: TodoWrite 跟踪 active phase 保护其不被压缩sentinel 作为兜底。
> **⚠️ COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status.
> The phase currently marked `in_progress` is the active execution phase — preserve its FULL content.
> Only compress phases marked `completed` or `pending`.
## Execution Flow
### Plan Mode (workflow:multi-cli-plan)
@@ -144,7 +152,12 @@ Plan mode and execute mode are triggered by skill name routing (see Mode Detecti
## Phase Reference Documents
| Phase | Document | Purpose |
|-------|----------|---------|
| 1 | [phases/01-multi-cli-plan.md](phases/01-multi-cli-plan.md) | Complete multi-CLI planning pipeline: ACE context, iterative discussion, options, user decision, plan generation, handoff |
| 2 | [phases/02-lite-execute.md](phases/02-lite-execute.md) | Complete execution engine: input modes, task grouping, batch execution, code review |
| Phase | Document | Purpose | Compact |
|-------|----------|---------|---------|
| 1 | [phases/01-multi-cli-plan.md](phases/01-multi-cli-plan.md) | Complete multi-CLI planning pipeline: ACE context, iterative discussion, options, user decision, plan generation, handoff | TodoWrite 驱动 |
| 2 | [phases/02-lite-execute.md](phases/02-lite-execute.md) | Complete execution engine: input modes, task grouping, batch execution, code review | TodoWrite 驱动 + 🔄 sentinel |
**Compact Rules**:
1. **TodoWrite `in_progress`** → 保留完整内容,禁止压缩
2. **TodoWrite `completed`** → 可压缩为摘要
3. **🔄 sentinel fallback** → Phase 2 包含 compact sentinel若 compact 后仅存 sentinel 而无完整 Step 协议,必须立即 `Read("phases/02-lite-execute.md")` 恢复