mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
fix(workflow): complete path migration and enhance session:complete
Comprehensive update to eliminate all old path references and implement transactional archival in session:complete.
## Part 1: Complete Path Migration (43 files)
### Files Updated
- action-plan-verify.md
- session/list.md, session/resume.md
- tdd-verify.md, tdd-plan.md, test-*.md
- All brainstorm/*.md files (13 files)
- All tools/*.md files (10 files)
- All ui-design/*.md files (10 files)
- lite-plan.md, lite-execute.md, plan.md
### Path Changes
- `.workflow/.active-*` → `find .workflow/sessions/ -name "WFS-*" -type d`
- `.workflow/WFS-{session}` → `.workflow/sessions/WFS-{session}`
- `.workflow/.archives/` → `.workflow/archives/`
- Removed all marker file operations (touch/rm .active-*)
### Verification
- ✅ 0 references to .active-* markers remain
- ✅ 0 references to direct .workflow/WFS-* paths
- ✅ 0 references to .workflow/.archives/ (dot prefix)
## Part 2: Transactional Archival Enhancement
### session/complete.md - Complete Rewrite
**New Four-Phase Architecture**:
1. **Phase 1: Pre-Archival Preparation**
- Find active session in .workflow/sessions/
- Check for existing .archiving marker (resume detection)
- Create .archiving marker to prevent concurrent operations
2. **Phase 2: Agent Analysis (In-Place)**
- Agent processes session WHILE STILL in sessions/ directory
- Pure analysis - no file moves or manifest updates
- Returns complete metadata package for atomic commit
- Failure here → session remains active, safe to retry
3. **Phase 3: Atomic Commit**
- Only executes if Phase 2 succeeds
- Move session to archives/
- Update manifest.json
- Remove .archiving marker
- All-or-nothing guarantee
4. **Phase 4: Project Registry Update**
- Extract feature metadata and update project.json
**Key Improvements**:
- **Agent-first, move-second**: Prevents inconsistent states
- **Transactional guarantees**: All-or-nothing file operations
- **Resume capability**: .archiving marker enables safe retry
- **Error recovery**: Comprehensive failure handling documented
**Old Design Flaw (Fixed)**:
- Old: Move first → Agent processes → If agent fails, session moved but metadata incomplete
- New: Agent processes → If success, atomic commit → Guaranteed consistency
## Benefits
1. **Consistency**: All commands use identical path patterns
2. **Robustness**: Transactional archival prevents data loss
3. **Maintainability**: Single source of truth for directory structure
4. **Recoverability**: Failed operations can be safely retried
5. **Alignment**: Closer to OpenSpec's clean three-layer model
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,10 +27,10 @@ allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*)
|
||||
### Phase 1: Session & Framework Detection
|
||||
```bash
|
||||
# Check active session and framework
|
||||
CHECK: .workflow/.active-* marker files
|
||||
CHECK: find .workflow/sessions/ -name "WFS-*" -type d
|
||||
IF active_session EXISTS:
|
||||
session_id = get_active_session()
|
||||
brainstorm_dir = .workflow/WFS-{session}/.brainstorming/
|
||||
brainstorm_dir = .workflow/sessions/WFS-{session}/.brainstorming/
|
||||
|
||||
CHECK: brainstorm_dir/guidance-specification.md
|
||||
IF EXISTS:
|
||||
@@ -67,13 +67,13 @@ Execute subject-matter-expert analysis for existing topic framework
|
||||
|
||||
## Context Loading
|
||||
ASSIGNED_ROLE: subject-matter-expert
|
||||
OUTPUT_LOCATION: .workflow/WFS-{session}/.brainstorming/subject-matter-expert/
|
||||
OUTPUT_LOCATION: .workflow/sessions/WFS-{session}/.brainstorming/subject-matter-expert/
|
||||
ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
## Flow Control Steps
|
||||
1. **load_topic_framework**
|
||||
- Action: Load structured topic discussion framework
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/guidance-specification.md)
|
||||
- Command: Read(.workflow/sessions/WFS-{session}/.brainstorming/guidance-specification.md)
|
||||
- Output: topic_framework_content
|
||||
|
||||
2. **load_role_template**
|
||||
@@ -83,7 +83,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Command: Read(.workflow/sessions/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -143,7 +143,7 @@ TodoWrite({
|
||||
|
||||
### Framework-Based Analysis
|
||||
```
|
||||
.workflow/WFS-{session}/.brainstorming/subject-matter-expert/
|
||||
.workflow/sessions/WFS-{session}/.brainstorming/subject-matter-expert/
|
||||
└── analysis.md # Structured analysis addressing guidance-specification.md discussion points
|
||||
```
|
||||
|
||||
@@ -188,7 +188,7 @@ TodoWrite({
|
||||
"subject_matter_expert": {
|
||||
"status": "completed",
|
||||
"framework_addressed": true,
|
||||
"output_location": ".workflow/WFS-{session}/.brainstorming/subject-matter-expert/analysis.md",
|
||||
"output_location": ".workflow/sessions/WFS-{session}/.brainstorming/subject-matter-expert/analysis.md",
|
||||
"framework_reference": "@../guidance-specification.md"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user