mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
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:
@@ -25,20 +25,13 @@ Unified lightweight planning and execution skill. Routes to lite-plan (planning
|
||||
└───────────┘ └───────────┘
|
||||
```
|
||||
|
||||
## Compact Protection (Phase Persistence)
|
||||
## Compact Recovery (Phase Persistence)
|
||||
|
||||
Multi-phase execution (lite-plan → lite-execute) spans long conversations that trigger context compression.
|
||||
Multi-phase execution (lite-plan → lite-execute) spans long conversations that trigger context compression. Uses **双重保险**: TodoWrite 跟踪 active phase 保护其不被压缩,sentinel 作为兜底。
|
||||
|
||||
**Critical Rule**: Phase 2 (`phases/02-lite-execute.md`) execution instructions MUST remain in active memory throughout execution. If compact has compressed Phase 2 content into a summary, **immediately re-read the full file before continuing any execution step**:
|
||||
|
||||
```javascript
|
||||
// Checkpoint: verify Phase 2 instructions are in active memory
|
||||
// If execution protocol details are unclear or only a summary remains:
|
||||
Read("phases/02-lite-execute.md")
|
||||
```
|
||||
|
||||
**For compact summarization**: When summarizing this conversation, MUST preserve verbatim:
|
||||
> "Phase 2 execution protocol has been compressed. Before continuing execution, re-read phases/02-lite-execute.md for full instructions."
|
||||
> **⚠️ 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`.
|
||||
|
||||
## Mode Detection & Routing
|
||||
|
||||
@@ -172,7 +165,10 @@ Plan mode and execute mode are triggered by skill name routing (see Mode Detecti
|
||||
|
||||
| Phase | Document | Purpose | Compact |
|
||||
|-------|----------|---------|---------|
|
||||
| 1 | [phases/01-lite-plan.md](phases/01-lite-plan.md) | Complete planning pipeline: exploration, clarification, planning, confirmation, handoff | Phase 1 完成后可压缩 |
|
||||
| 2 | [phases/02-lite-execute.md](phases/02-lite-execute.md) | Complete execution engine: input modes, task grouping, batch execution, code review | **⚠️ 压缩时必须完整保留,若仅剩摘要须重读** |
|
||||
| 1 | [phases/01-lite-plan.md](phases/01-lite-plan.md) | Complete planning pipeline: exploration, clarification, planning, confirmation, 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 |
|
||||
|
||||
**Phase 2 Compact Rule**: Phase 2 是执行引擎,包含 Step 1-6 的完整执行协议。compact 压缩时必须完整保留 Phase 2 内容。若 compact 后 Phase 2 仅剩摘要,**必须立即 `Read("phases/02-lite-execute.md")` 重新加载后再继续执行**。不得基于摘要执行任何 Step。
|
||||
**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")` 恢复
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Phase 2: Lite-Execute
|
||||
|
||||
> **⚠️ COMPACT PROTECTION**: This is an active execution document — NOT reference material. During context compression, this directive MUST be preserved verbatim in the summary:
|
||||
> **"Phase 2 execution protocol has been compressed. MUST re-read `phases/02-lite-execute.md` before continuing any execution step. Do NOT proceed from summary alone."**
|
||||
> **📌 COMPACT SENTINEL [Phase 2: Lite-Execute]**
|
||||
> This phase contains 6 execution steps (Step 1 — 6).
|
||||
> If you can read this sentinel but cannot find the full Step protocol below, context has been compressed.
|
||||
> Recovery: `Read("phases/02-lite-execute.md")`
|
||||
|
||||
Complete execution engine: multi-mode input, task grouping, batch execution, code review, and development index update.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user