mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
Add session status file creation rule across workflow commands
Updates all workflow commands to create .workflow/session_status.jsonl if it doesn't exist when checking for active sessions. This ensures consistent behavior across: - gemini-chat.md: Added creation rule and updated workflow pseudocode - gemini-execute.md: Added session file creation requirement - gemini-mode.md: Updated session check process - workflow/action-plan.md: Updated both session check locations - task/replan.md: Added creation rule to session validation - task/breakdown.md: Updated session check process - workflow/brainstorm.md: Added creation rule to session registry query Also includes cleanup of deprecated command files (context.md, sync.md) and documentation updates for task creation complexity escalation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,7 @@ Creates actionable implementation plans based on brainstorming insights or direc
|
||||
⚠️ **CRITICAL**: Before planning, MUST check for existing active session to avoid creating duplicate sessions.
|
||||
|
||||
**Session Check Process:**
|
||||
1. **Query Session Registry**: Check `.workflow/session_status.jsonl` for active sessions
|
||||
1. **Query Session Registry**: Check `.workflow/session_status.jsonl` for active sessions. If the file doesn't exist, create it.
|
||||
2. **Session Selection**: Use existing active session or create new one only if none exists
|
||||
3. **Context Integration**: Load existing session state and brainstorming outputs
|
||||
|
||||
@@ -67,7 +67,7 @@ Creates actionable implementation plans based on brainstorming insights or direc
|
||||
|
||||
### Phase 1: Context Understanding & Structure Establishment
|
||||
1. **Session Detection & Selection**:
|
||||
- **Check Active Sessions**: Query `.workflow/session_status.jsonl` for existing active sessions
|
||||
- **Check Active Sessions**: Query `.workflow/session_status.jsonl` for existing active sessions. If the file doesn't exist, create it.
|
||||
- **Session Priority**: Use existing active session if available, otherwise create new session
|
||||
- **Session Analysis**: Read and understand workflow-session.json from selected session
|
||||
- Detect existing brainstorming outputs
|
||||
@@ -104,9 +104,70 @@ Creates actionable implementation plans based on brainstorming insights or direc
|
||||
- **Medium**: Generate IMPL_PLAN.md with task breakdown
|
||||
- **Complex**: Generate comprehensive IMPL_PLAN.md with staged approach and risk assessment
|
||||
|
||||
8. **Update Session**: Mark PLAN phase complete with document references
|
||||
8. **Auto-Generate Tasks (NEW)**: Parse IMPL_PLAN.md and automatically create corresponding task JSON files
|
||||
- **Extract Tasks**: Parse task identifiers (IMPL-001, IMPL-002, etc.) from plan
|
||||
- **Create Task Files**: Generate `.task/impl-*.json` files with plan context
|
||||
- **Link to Plan**: Include `source_plan_ref` field linking tasks back to plan sections
|
||||
- **Set Dependencies**: Establish task dependencies based on plan structure
|
||||
|
||||
9. **Link Documents**: Update JSON state with generated document paths
|
||||
9. **Update Session**: Mark PLAN phase complete with document references and generated task list
|
||||
|
||||
10. **Link Documents**: Update JSON state with generated document paths and task file references
|
||||
|
||||
## Automated Task Generation (Single Source of Truth Integration)
|
||||
|
||||
### Planning-to-Execution Automation
|
||||
**NEW FEATURE**: Eliminates the gap between planning and execution by automatically creating executable task files from planning documents.
|
||||
|
||||
### Task Extraction Process
|
||||
1. **Parse IMPL_PLAN.md**: Scan for task identifiers in standardized format:
|
||||
- `IMPL-001`, `IMPL-002`, etc. (main tasks)
|
||||
- `IMPL-1.1`, `IMPL-1.2`, etc. (subtasks)
|
||||
- Task titles and descriptions from plan sections
|
||||
|
||||
2. **Generate Task JSON Files**: For each identified task, create structured JSON:
|
||||
```json
|
||||
{
|
||||
"id": "IMPL-001",
|
||||
"title": "Foundation/Infrastructure setup",
|
||||
"status": "pending",
|
||||
"type": "infrastructure",
|
||||
"agent": "code-developer",
|
||||
"effort": "2h",
|
||||
|
||||
"context": {
|
||||
"inherited_from": "WFS-[topic-slug]",
|
||||
"source_plan_ref": "IMPL_PLAN.md#phase-1-foundation",
|
||||
"requirements": ["Extracted from plan description"],
|
||||
"scope": ["Derived from plan context"],
|
||||
"acceptance": ["Extracted from success criteria"]
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"upstream": [],
|
||||
"downstream": ["IMPL-002"],
|
||||
"phase_group": "Phase 1: Foundation"
|
||||
},
|
||||
|
||||
"metadata": {
|
||||
"created_at": "2025-09-07T15:00:00Z",
|
||||
"created_by": "workflow:action-plan",
|
||||
"auto_generated": true,
|
||||
"plan_version": "1.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Link Bidirectionally**:
|
||||
- Task files reference plan sections
|
||||
- Session state includes all generated task IDs
|
||||
- Ready for immediate execution via `/task:execute`
|
||||
|
||||
### Benefits of Automation
|
||||
- **Zero Manual Task Creation**: Plans immediately become executable
|
||||
- **Consistency**: All tasks derive from same authoritative plan
|
||||
- **Traceability**: Clear linkage from requirements through plan to tasks
|
||||
- **Immediate Execution**: Can run `/task:execute IMPL-001` immediately after planning
|
||||
|
||||
## Session State Analysis & Document Understanding
|
||||
|
||||
@@ -269,27 +330,42 @@ Generated documents are stored in session directory:
|
||||
└── workflow-session.json # Updated with document references
|
||||
```
|
||||
|
||||
## Session Updates
|
||||
## Session Updates (Enhanced with Task Generation)
|
||||
```json
|
||||
{
|
||||
"phases": {
|
||||
"PLAN": {
|
||||
"status": "completed",
|
||||
"output": {
|
||||
"primary": "IMPL_PLAN.md"
|
||||
"primary": "IMPL_PLAN.md",
|
||||
"tasks_generated": [".task/impl-001.json", ".task/impl-002.json", ".task/impl-003.json"]
|
||||
},
|
||||
"documents_generated": ["IMPL_PLAN.md"],
|
||||
"tasks_auto_created": 3,
|
||||
"completed_at": "2025-09-05T11:00:00Z",
|
||||
"tasks_identified": ["IMPL-001", "IMPL-002", "IMPL-003"]
|
||||
"tasks_identified": ["IMPL-001", "IMPL-002", "IMPL-003"],
|
||||
"ready_for_implementation": true
|
||||
}
|
||||
},
|
||||
"documents": {
|
||||
"planning": {
|
||||
"IMPL_PLAN.md": {
|
||||
"status": "generated",
|
||||
"path": ".workflow/WFS-[topic-slug]/IMPL_PLAN.md"
|
||||
"path": ".workflow/WFS-[topic-slug]/IMPL_PLAN.md",
|
||||
"tasks_extracted": 3,
|
||||
"auto_generation": "completed"
|
||||
}
|
||||
}
|
||||
},
|
||||
"task_system": {
|
||||
"enabled": true,
|
||||
"auto_generated": true,
|
||||
"directory": ".workflow/WFS-[topic-slug]/.task/",
|
||||
"task_count": {
|
||||
"total": 3,
|
||||
"pending": 3,
|
||||
"from_planning": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -109,7 +109,7 @@ END FUNCTION
|
||||
⚠️ **CRITICAL**: Before brainstorming, MUST check for existing active session to avoid creating duplicate sessions.
|
||||
|
||||
**Session Check Process:**
|
||||
1. **Query Session Registry**: Check `.workflow/session_status.jsonl` for active sessions
|
||||
1. **Query Session Registry**: Check `.workflow/session_status.jsonl` for active sessions. If the file doesn't exist, create it.
|
||||
2. **Session Selection**: Use existing active session or create new one only if none exists
|
||||
3. **Context Integration**: Load existing session state and continue brainstorming phase
|
||||
|
||||
|
||||
@@ -1,398 +0,0 @@
|
||||
---
|
||||
name: workflow-context
|
||||
description: Unified workflow context analysis and status overview with file export capabilities
|
||||
usage: /workflow:context [--detailed] [--health-check] [--format=<tree|json|summary>] [--export]
|
||||
argument-hint: Optional flags for analysis depth, output format, and file export
|
||||
examples:
|
||||
- /workflow:context
|
||||
- /workflow:context --detailed
|
||||
- /workflow:context --health-check
|
||||
- /workflow:context --format=tree
|
||||
- /workflow:context --detailed --export
|
||||
- /workflow:context --health-check --export
|
||||
---
|
||||
|
||||
# Workflow Context Command (/workflow:context)
|
||||
|
||||
## Overview
|
||||
Unified workflow context analysis command providing comprehensive state analysis and quick overview of current work status.
|
||||
|
||||
## Core Principles
|
||||
**System:** @~/.claude/workflows/unified-workflow-system-principles.md
|
||||
|
||||
## Features
|
||||
|
||||
### Core Functionality
|
||||
- **Real-time Status Snapshot** → Complete workflow state display
|
||||
- **Task Progress Overview** → Completed, active, pending task statistics
|
||||
- **Document Health Check** → Document consistency and completeness analysis
|
||||
- **Dependency Analysis** → Task dependency and conflict identification
|
||||
- **Time Estimation** → Completion time prediction based on current progress
|
||||
|
||||
### Advanced Analysis
|
||||
- **Blocker Identification** → Automatic detection of progress obstacles
|
||||
- **Priority Recommendations** → Next action suggestions based on dependencies
|
||||
- **Risk Assessment** → Execution risk evaluation for current plan
|
||||
|
||||
## Core Principles
|
||||
**System:** @~/.claude/workflows/unified-workflow-system-principles.md
|
||||
|
||||
## Display Modes
|
||||
|
||||
### Summary View (/workflow:context)
|
||||
```
|
||||
🔍 Workflow Status Overview
|
||||
========================
|
||||
|
||||
📋 Session Information:
|
||||
- Session ID: WFS-2025-001
|
||||
- Current Phase: Implementation
|
||||
- Start Time: 2025-01-15 09:30:00
|
||||
- Duration: 2h 45m
|
||||
|
||||
📊 Task Progress:
|
||||
✅ Completed: 9/15 (60%)
|
||||
🔄 In Progress: 2 tasks
|
||||
⏳ Pending: 4 tasks
|
||||
🚫 Blocked: 0 tasks
|
||||
|
||||
📁 Document Status:
|
||||
✅ IMPL_PLAN.md - Healthy
|
||||
✅ TODO_LIST.md - Healthy
|
||||
⚠️ TODO_CHECKLIST.md - Needs sync
|
||||
❌ WORKFLOW_ISSUES.md - Missing
|
||||
|
||||
⏱️ Estimated Completion: 2025-01-15 16:45 (4h 15m remaining)
|
||||
|
||||
🎯 Next Steps:
|
||||
1. Complete current API endpoint implementation
|
||||
2. Update TODO_CHECKLIST.md status
|
||||
3. Start frontend user interface development
|
||||
```
|
||||
|
||||
### Detailed View (/workflow:context --detailed)
|
||||
```
|
||||
🔍 Detailed Workflow Analysis
|
||||
========================
|
||||
|
||||
📋 Session Details:
|
||||
Session ID: WFS-2025-001
|
||||
Workflow Type: Complex
|
||||
Main Task: "Implement OAuth2 User Authentication System"
|
||||
|
||||
📊 Detailed Progress Analysis:
|
||||
|
||||
✅ Completed Tasks (9):
|
||||
- [PLAN-001] Requirements analysis and architecture design
|
||||
- [PLAN-002] Database model design
|
||||
- [IMPL-001] User model implementation
|
||||
- [IMPL-002] JWT token service
|
||||
- [IMPL-003] Password encryption service
|
||||
- [TEST-001] Unit tests - User model
|
||||
- [TEST-002] Unit tests - JWT service
|
||||
- [DOC-001] API documentation - Auth endpoints
|
||||
- [DOC-002] Database migration documentation
|
||||
|
||||
🔄 In Progress Tasks (2):
|
||||
- [IMPL-004] OAuth2 provider integration (70% complete)
|
||||
↳ Dependencies: [PLAN-002], [IMPL-001]
|
||||
↳ Estimated remaining: 1.5h
|
||||
- [TEST-003] Integration tests - OAuth flow (30% complete)
|
||||
↳ Dependencies: [IMPL-004]
|
||||
↳ Estimated remaining: 2h
|
||||
|
||||
⏳ Pending Tasks (4):
|
||||
- [IMPL-005] Frontend login interface
|
||||
- [IMPL-006] Session management middleware
|
||||
- [TEST-004] End-to-end testing
|
||||
- [DOC-003] User documentation
|
||||
|
||||
📁 Document Health Analysis:
|
||||
|
||||
✅ IMPL_PLAN.md:
|
||||
- Status: Healthy
|
||||
- Last updated: 2025-01-15 10:15
|
||||
- Coverage: 100% (all tasks defined)
|
||||
|
||||
✅ TODO_LIST.md:
|
||||
- Status: Healthy
|
||||
- Progress tracking: 15 tasks, 4 levels
|
||||
- Dependencies: Verified
|
||||
|
||||
⚠️ TODO_CHECKLIST.md:
|
||||
- Status: Needs sync
|
||||
- Issue: 3 completed tasks not marked
|
||||
- Recommendation: Run /workflow:sync
|
||||
|
||||
🔗 Dependency Analysis:
|
||||
|
||||
Critical Path:
|
||||
[IMPL-004] → [TEST-003] → [IMPL-005] → [TEST-004]
|
||||
|
||||
Potential Blockers:
|
||||
❌ No blockers detected
|
||||
|
||||
Parallel Execution Suggestions:
|
||||
- [IMPL-005] can start immediately after [TEST-003] completes
|
||||
- [DOC-003] can run in parallel with [IMPL-006]
|
||||
|
||||
⚠️ Risk Assessment:
|
||||
|
||||
🟢 Low Risk (Current Status)
|
||||
- OAuth2 integration progressing as expected
|
||||
- All tests passing
|
||||
- No technical debt accumulation
|
||||
|
||||
Potential Risks:
|
||||
- Frontend interface design not finalized (Impact: Medium)
|
||||
- Third-party OAuth service dependency (Impact: Low)
|
||||
```
|
||||
|
||||
### Tree Format (/workflow:context --format=tree)
|
||||
```
|
||||
📁 WFS-2025-001: User Authentication
|
||||
├── 📋 PLAN [Completed]
|
||||
│ └── Output: IMPL_PLAN.md
|
||||
├── 🔨 IMPLEMENT [Active - 45%]
|
||||
│ ├── ✅ IMPL-001: Authentication
|
||||
│ ├── ✅ IMPL-002: Database
|
||||
│ ├── ✅ IMPL-003: JWT
|
||||
│ ├── 🔄 IMPL-004: OAuth2 (70%)
|
||||
│ ├── ⏳ IMPL-005: Testing
|
||||
│ ├── 🚫 IMPL-006: Integration
|
||||
│ └── ⏳ IMPL-007: Documentation
|
||||
└── 📝 REVIEW [Pending]
|
||||
```
|
||||
|
||||
### JSON Format (/workflow:context --format=json)
|
||||
Returns merged workflow-session.json + task data for programmatic access.
|
||||
|
||||
## File Export Feature
|
||||
|
||||
### Export Mode (/workflow:context --export)
|
||||
When `--export` flag is used, generates persistent status report files in addition to console output.
|
||||
|
||||
#### Generated Files
|
||||
|
||||
**Status Report Generation:**
|
||||
- **Standard Mode**: Creates `reports/STATUS_REPORT.md`
|
||||
- **Detailed Mode**: Creates `reports/DETAILED_STATUS_REPORT.md`
|
||||
- **Health Check Mode**: Creates `reports/HEALTH_CHECK.md`
|
||||
|
||||
#### File Storage Location
|
||||
```
|
||||
.workflow/WFS-[topic-slug]/reports/
|
||||
├── STATUS_REPORT.md # Standard context export
|
||||
├── DETAILED_STATUS_REPORT.md # Detailed context export
|
||||
├── HEALTH_CHECK.md # Health check export
|
||||
└── context-exports/ # Historical exports
|
||||
├── status-2025-09-07-14-30.md
|
||||
├── detailed-2025-09-07-15-45.md
|
||||
└── health-2025-09-07-16-15.md
|
||||
```
|
||||
|
||||
#### Export File Structure
|
||||
|
||||
**STATUS_REPORT.md Format:**
|
||||
```markdown
|
||||
# Workflow Status Report
|
||||
*Generated: 2025-09-07 14:30:00*
|
||||
|
||||
## Session Information
|
||||
- **Session ID**: WFS-2025-001
|
||||
- **Current Phase**: Implementation
|
||||
- **Start Time**: 2025-01-15 09:30:00
|
||||
- **Duration**: 2h 45m
|
||||
|
||||
## Task Progress Summary
|
||||
- **Completed**: 9/15 (60%)
|
||||
- **In Progress**: 2 tasks
|
||||
- **Pending**: 4 tasks
|
||||
- **Blocked**: 0 tasks
|
||||
|
||||
## Document Status
|
||||
- ✅ IMPL_PLAN.md - Healthy
|
||||
- ✅ TODO_LIST.md - Healthy
|
||||
- ⚠️ TODO_CHECKLIST.md - Needs sync
|
||||
- ❌ WORKFLOW_ISSUES.md - Missing
|
||||
|
||||
## Time Estimation
|
||||
- **Estimated Completion**: 2025-01-15 16:45
|
||||
- **Remaining Time**: 4h 15m
|
||||
|
||||
## Next Steps
|
||||
1. Complete current API endpoint implementation
|
||||
2. Update TODO_CHECKLIST.md status
|
||||
3. Start frontend user interface development
|
||||
|
||||
---
|
||||
*Report generated by /workflow:context --export*
|
||||
```
|
||||
|
||||
**HEALTH_CHECK.md Format:**
|
||||
```markdown
|
||||
# Workflow Health Check Report
|
||||
*Generated: 2025-09-07 16:15:00*
|
||||
|
||||
## Overall Health Score: 85/100 (Good)
|
||||
|
||||
## System Health Analysis
|
||||
|
||||
### ✅ Session State Check
|
||||
- **workflow-session.json**: Exists and valid
|
||||
- **Backup files**: 3 backups available
|
||||
- **Data integrity**: Verified
|
||||
|
||||
### 📋 Document Consistency Check
|
||||
- **IMPL_PLAN.md ↔ TODO_LIST.md**: ✅ 100% consistency
|
||||
- **TODO_CHECKLIST.md ↔ TodoWrite status**: ⚠️ 80% (3 items out of sync)
|
||||
- **WORKFLOW_ISSUES.md**: ❌ Missing file
|
||||
|
||||
### 🔄 Progress Tracking Health
|
||||
- **TodoWrite integration**: ✅ Running normally
|
||||
- **Timestamp recording**: ✅ Complete
|
||||
- **Progress estimation**: ⚠️ 85% accuracy
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Immediate Actions
|
||||
1. Run /workflow:sync to sync document status
|
||||
2. Execute /workflow:issue create to establish issue tracking
|
||||
|
||||
### Planned Actions
|
||||
3. Consider creating more checkpoints to improve recovery capability
|
||||
4. Optimize dependencies to reduce critical path length
|
||||
|
||||
## Detailed Analysis
|
||||
[Detailed health metrics and analysis...]
|
||||
|
||||
---
|
||||
*Health check generated by /workflow:context --health-check --export*
|
||||
```
|
||||
|
||||
#### Session Updates
|
||||
When files are exported, the workflow-session.json is updated:
|
||||
```json
|
||||
{
|
||||
"documents": {
|
||||
"reports": {
|
||||
"STATUS_REPORT.md": {
|
||||
"status": "generated",
|
||||
"path": ".workflow/WFS-[topic-slug]/reports/STATUS_REPORT.md",
|
||||
"generated_at": "2025-09-07T14:30:00Z",
|
||||
"type": "status_report"
|
||||
},
|
||||
"HEALTH_CHECK.md": {
|
||||
"status": "generated",
|
||||
"path": ".workflow/WFS-[topic-slug]/reports/HEALTH_CHECK.md",
|
||||
"generated_at": "2025-09-07T16:15:00Z",
|
||||
"type": "health_check"
|
||||
}
|
||||
}
|
||||
},
|
||||
"export_history": [
|
||||
{
|
||||
"type": "status_report",
|
||||
"timestamp": "2025-09-07T14:30:00Z",
|
||||
"file": "reports/STATUS_REPORT.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Historical Exports
|
||||
- **Automatic archiving**: Previous exports moved to `context-exports/` with timestamps
|
||||
- **Retention policy**: Keep last 10 exports of each type
|
||||
- **Cross-referencing**: Links to historical data in current reports
|
||||
|
||||
### Health Check Mode (/workflow:context --health-check)
|
||||
```
|
||||
🏥 Workflow Health Diagnosis
|
||||
========================
|
||||
|
||||
✅ Session State Check:
|
||||
- workflow-session.json: Exists and valid
|
||||
- Backup files: 3 backups available
|
||||
- Data integrity: Verified
|
||||
|
||||
📋 Document Consistency Check:
|
||||
|
||||
✅ IMPL_PLAN.md ↔ TODO_LIST.md
|
||||
- Task definition consistency: ✅ 100%
|
||||
- Progress synchronization: ✅ 100%
|
||||
|
||||
⚠️ TODO_CHECKLIST.md ↔ TodoWrite status
|
||||
- Sync status: ❌ 80% (3 items out of sync)
|
||||
- Recommended action: Run /workflow:sync
|
||||
|
||||
❌ WORKFLOW_ISSUES.md
|
||||
- Status: File does not exist
|
||||
- Recommendation: Create issue tracking document
|
||||
|
||||
🔄 Progress Tracking Health:
|
||||
|
||||
✅ TodoWrite integration: Running normally
|
||||
✅ Timestamp recording: Complete
|
||||
⚠️ Progress estimation: Based on historical data, 85% accuracy
|
||||
|
||||
🔧 System Recommendations:
|
||||
|
||||
Immediate Actions:
|
||||
1. Run /workflow:sync to sync document status
|
||||
2. Execute /workflow:issue create to establish issue tracking
|
||||
|
||||
Planned Actions:
|
||||
3. Consider creating more checkpoints to improve recovery capability
|
||||
4. Optimize dependencies to reduce critical path length
|
||||
|
||||
🎯 Overall Health Score: 85/100 (Good)
|
||||
```
|
||||
|
||||
## Use Cases
|
||||
|
||||
### Case 1: Work Recovery
|
||||
User returns after interrupting work and needs quick status understanding:
|
||||
```bash
|
||||
/workflow:context
|
||||
# Get quick overview, understand progress and next actions
|
||||
```
|
||||
|
||||
### Case 2: Status Reporting
|
||||
Need to report project progress to team or management:
|
||||
```bash
|
||||
/workflow:context --detailed
|
||||
# Get detailed progress analysis and estimates
|
||||
```
|
||||
|
||||
### Case 3: Problem Diagnosis
|
||||
Workflow shows anomalies and needs problem diagnosis:
|
||||
```bash
|
||||
/workflow:context --health-check
|
||||
# Comprehensive health check and repair recommendations
|
||||
```
|
||||
|
||||
### Case 4: Pre-change Assessment
|
||||
Before adding new requirements or modifying plans, assess current state:
|
||||
```bash
|
||||
/workflow:context --detailed --health-check
|
||||
# Complete status analysis to inform change decisions
|
||||
```
|
||||
|
||||
## Technical Implementation
|
||||
|
||||
### Data Source Integration
|
||||
- **workflow-session.json** - Session state and history
|
||||
- **TodoWrite status** - Real-time task progress
|
||||
- **Document analysis** - Workflow-related document parsing
|
||||
- **Git status** - Code repository change tracking
|
||||
|
||||
### Intelligent Analysis Algorithms
|
||||
- **Dependency graph construction** - Auto-build dependency graphs from task definitions
|
||||
- **Critical path algorithm** - Identify key task sequences affecting overall progress
|
||||
- **Health scoring** - Multi-dimensional workflow state health assessment
|
||||
- **Time estimation model** - Intelligent estimation based on historical data and current progress
|
||||
|
||||
### Caching and Performance Optimization
|
||||
- **Status caching** - Cache computationally intensive analysis results
|
||||
- **Incremental updates** - Only recalculate changed portions
|
||||
- **Asynchronous analysis** - Background execution of complex analysis tasks
|
||||
@@ -179,24 +179,6 @@ When starting a new session, the following files are automatically generated:
|
||||
*Use /workflow:plan to populate this document*
|
||||
```
|
||||
|
||||
### Backup and Recovery System
|
||||
|
||||
#### Automatic Backup Creation
|
||||
- **Trigger Events**: Session pause, critical state changes, error recovery
|
||||
- **Backup Location**: `.workflow/WFS-[topic-slug]/.backups/`
|
||||
- **Retention**: Last 5 backups per session
|
||||
- **Format**: Timestamped JSON and markdown backups
|
||||
|
||||
#### Backup Structure
|
||||
```
|
||||
.workflow/WFS-[topic-slug]/.backups/
|
||||
├── session-2025-09-07-14-00.json # Session state backup
|
||||
├── session-2025-09-07-15-30.json
|
||||
├── session-2025-09-07-16-45.json
|
||||
├── IMPL_PLAN-2025-09-07-14-00.md # Document backups
|
||||
└── TODO_LIST-2025-09-07-15-30.md
|
||||
```
|
||||
|
||||
#### Recovery Operations
|
||||
- **Auto-recovery**: On session corruption or inconsistency
|
||||
- **Manual recovery**: Via `/workflow:session recover --from-backup`
|
||||
|
||||
@@ -1,311 +0,0 @@
|
||||
---
|
||||
name: workflow-sync
|
||||
description: Synchronize workflow documents and validate data integrity with comprehensive reporting
|
||||
usage: /workflow:sync [--check] [--fix] [--force] [--export-report]
|
||||
argument-hint: [optional: check-only, auto-fix, force, or export report]
|
||||
examples:
|
||||
- /workflow:sync
|
||||
- /workflow:sync --check
|
||||
- /workflow:sync --fix
|
||||
- /workflow:sync --force
|
||||
- /workflow:sync --export-report
|
||||
---
|
||||
|
||||
# Workflow Sync Command (/workflow:sync)
|
||||
|
||||
## Overview
|
||||
Ensures consistency between workflow-session.json, tasks.json, and related documents.
|
||||
|
||||
## Core Principles
|
||||
**Dynamic Change Management:** @~/.claude/workflows/dynamic-change-management.md
|
||||
|
||||
## Sync Targets
|
||||
|
||||
### Primary Files
|
||||
- `workflow-session.json` - Workflow state
|
||||
- `tasks.json` - Task data
|
||||
- `IMPL_PLAN.md` - Planning document
|
||||
- `REVIEW.md` - Review results
|
||||
|
||||
### Validation Checks
|
||||
- Session ID consistency
|
||||
- Task ID references
|
||||
- Progress calculations
|
||||
- Status transitions
|
||||
- Timestamp logic
|
||||
|
||||
## Usage Modes
|
||||
|
||||
### Default Mode
|
||||
```bash
|
||||
/workflow:sync
|
||||
|
||||
🔄 Workflow Synchronization
|
||||
━━━━━━━━━━━━━━━━━━━━━
|
||||
Checking consistency...
|
||||
|
||||
Issues found:
|
||||
- Progress mismatch: 45% vs 60%
|
||||
- Task IMPL-003 status differs
|
||||
- 2 tasks missing from workflow
|
||||
|
||||
Fixing...
|
||||
✅ Updated progress to 60%
|
||||
✅ Synced IMPL-003 status
|
||||
✅ Added missing tasks
|
||||
|
||||
Sync complete: 3 fixes applied
|
||||
```
|
||||
|
||||
### Check Mode (--check)
|
||||
```bash
|
||||
/workflow:sync --check
|
||||
```
|
||||
- Read-only validation
|
||||
- Reports issues without fixing
|
||||
- Safe for production
|
||||
|
||||
### Fix Mode (--fix)
|
||||
```bash
|
||||
/workflow:sync --fix
|
||||
```
|
||||
- Auto-fixes safe issues
|
||||
- Prompts for conflicts
|
||||
- Creates backup first
|
||||
|
||||
### Force Mode (--force)
|
||||
```bash
|
||||
/workflow:sync --force
|
||||
```
|
||||
- Overwrites all conflicts
|
||||
- No confirmation prompts
|
||||
- Use with caution
|
||||
|
||||
## Sync Rules
|
||||
|
||||
### Data Authority
|
||||
1. **workflow-session.json** - Highest (main state)
|
||||
2. **tasks.json** - High (task details)
|
||||
3. **Markdown files** - Medium (documentation)
|
||||
4. **TodoWrite** - Low (temporary state)
|
||||
|
||||
### Conflict Resolution
|
||||
- Recent changes win (timestamp)
|
||||
- More complete data preferred
|
||||
- User confirmation for ambiguous
|
||||
|
||||
### Auto-fix Scenarios
|
||||
- Progress calculation errors
|
||||
- Missing task references
|
||||
- Invalid status transitions
|
||||
|
||||
## Report Generation
|
||||
|
||||
### Sync Report Export (--export-report)
|
||||
When `--export-report` flag is used, generates comprehensive sync reports:
|
||||
|
||||
#### Generated Files
|
||||
- **reports/SYNC_REPORT.md** - Detailed synchronization analysis
|
||||
- **reports/sync-backups/** - Backup files created during sync
|
||||
- **reports/sync-history/** - Historical sync reports
|
||||
|
||||
#### File Storage Structure
|
||||
```
|
||||
.workflow/WFS-[topic-slug]/reports/
|
||||
├── SYNC_REPORT.md # Latest sync report
|
||||
├── sync-backups/ # Pre-sync backups
|
||||
│ ├── workflow-session-backup.json
|
||||
│ ├── TODO_LIST-backup.md
|
||||
│ └── IMPL_PLAN-backup.md
|
||||
├── sync-history/ # Historical reports
|
||||
│ ├── sync-2025-09-07-14-30.md
|
||||
│ ├── sync-2025-09-07-15-45.md
|
||||
│ └── sync-2025-09-07-16-15.md
|
||||
└── sync-logs/ # Detailed sync logs
|
||||
└── sync-operations.jsonl
|
||||
```
|
||||
|
||||
### SYNC_REPORT.md Structure
|
||||
```markdown
|
||||
# Workflow Synchronization Report
|
||||
*Generated: 2025-09-07 14:30:00*
|
||||
|
||||
## Sync Operation Summary
|
||||
- **Operation Type**: Full Sync with Auto-fix
|
||||
- **Duration**: 2.3 seconds
|
||||
- **Files Processed**: 5
|
||||
- **Issues Found**: 3
|
||||
- **Issues Fixed**: 3
|
||||
- **Backup Created**: Yes
|
||||
|
||||
## Pre-Sync State Analysis
|
||||
### Document Integrity Check
|
||||
- ✅ **workflow-session.json**: Valid JSON structure
|
||||
- ⚠️ **TODO_LIST.md**: 3 completed tasks not marked
|
||||
- ❌ **IMPL_PLAN.md**: Missing 2 task references
|
||||
- ✅ **WORKFLOW_ISSUES.md**: Healthy
|
||||
- ⚠️ **IMPLEMENTATION_LOG.md**: Timestamp inconsistency
|
||||
|
||||
### Data Consistency Analysis
|
||||
- **Task References**: 85% consistent (missing 2 references)
|
||||
- **Progress Tracking**: 78% accurate (3 items out of sync)
|
||||
- **Cross-Document Links**: 92% valid (1 broken link)
|
||||
|
||||
## Synchronization Operations
|
||||
|
||||
### 1. Progress Calculation Fix
|
||||
- **Issue**: Progress mismatch between JSON and markdown
|
||||
- **Before**: workflow-session.json: 45%, TODO_LIST.md: 60%
|
||||
- **Action**: Updated workflow-session.json progress to 60%
|
||||
- **Result**: ✅ Progress synchronized
|
||||
|
||||
### 2. Task Reference Update
|
||||
- **Issue**: Missing task references in IMPL_PLAN.md
|
||||
- **Before**: 8 tasks in JSON, 6 tasks in IMPL_PLAN.md
|
||||
- **Action**: Added IMPL-007 and IMPL-008 references
|
||||
- **Result**: ✅ All tasks referenced
|
||||
|
||||
### 3. TodoWrite Status Sync
|
||||
- **Issue**: 3 completed tasks not marked in checklist
|
||||
- **Before**: TodoWrite showed completed, TODO_LIST.md showed pending
|
||||
- **Action**: Updated TODO_LIST.md completion status
|
||||
- **Result**: ✅ TodoWrite and documents synchronized
|
||||
|
||||
## Post-Sync State
|
||||
### Document Health Status
|
||||
- ✅ **workflow-session.json**: Healthy (100% consistent)
|
||||
- ✅ **TODO_LIST.md**: Healthy (100% accurate)
|
||||
- ✅ **IMPL_PLAN.md**: Healthy (all references valid)
|
||||
- ✅ **WORKFLOW_ISSUES.md**: Healthy (no issues)
|
||||
- ✅ **IMPLEMENTATION_LOG.md**: Healthy (timestamps corrected)
|
||||
|
||||
### Data Integrity Metrics
|
||||
- **Task References**: 100% consistent
|
||||
- **Progress Tracking**: 100% accurate
|
||||
- **Cross-Document Links**: 100% valid
|
||||
- **Timestamp Consistency**: 100% aligned
|
||||
|
||||
## Backup Information
|
||||
### Created Backups
|
||||
- **workflow-session-backup.json**: Original session state
|
||||
- **TODO_LIST-backup.md**: Original task list
|
||||
- **IMPL_PLAN-backup.md**: Original implementation plan
|
||||
|
||||
### Backup Location
|
||||
```
|
||||
.workflow/WFS-[topic-slug]/reports/sync-backups/2025-09-07-14-30/
|
||||
```
|
||||
|
||||
## Recommendations
|
||||
### Immediate Actions
|
||||
- No immediate actions required
|
||||
- All issues successfully resolved
|
||||
|
||||
### Preventive Measures
|
||||
1. Consider running sync more frequently during active development
|
||||
2. Enable auto-sync triggers for task completion events
|
||||
3. Review document update procedures to maintain consistency
|
||||
|
||||
## Next Sync Recommendation
|
||||
- **Frequency**: Every 2 hours during active development
|
||||
- **Trigger Events**: After task completion, before major operations
|
||||
- **Auto-fix**: Enabled for minor consistency issues
|
||||
|
||||
---
|
||||
*Report generated by /workflow:sync --export-report*
|
||||
```
|
||||
|
||||
### Session Updates
|
||||
After sync operations, workflow-session.json is updated with sync metadata:
|
||||
```json
|
||||
{
|
||||
"sync_history": [
|
||||
{
|
||||
"timestamp": "2025-09-07T14:30:00Z",
|
||||
"type": "full_sync_with_autofix",
|
||||
"duration_seconds": 2.3,
|
||||
"issues_found": 3,
|
||||
"issues_fixed": 3,
|
||||
"backup_created": true,
|
||||
"report_path": "reports/SYNC_REPORT.md"
|
||||
}
|
||||
],
|
||||
"last_sync": {
|
||||
"timestamp": "2025-09-07T14:30:00Z",
|
||||
"status": "successful",
|
||||
"integrity_score": 100
|
||||
},
|
||||
"documents": {
|
||||
"reports": {
|
||||
"SYNC_REPORT.md": {
|
||||
"status": "generated",
|
||||
"path": ".workflow/WFS-[topic-slug]/reports/SYNC_REPORT.md",
|
||||
"generated_at": "2025-09-07T14:30:00Z",
|
||||
"type": "sync_report"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Sync Operation Logging
|
||||
All sync operations are logged in `sync-logs/sync-operations.jsonl`:
|
||||
```jsonl
|
||||
{"timestamp":"2025-09-07T14:30:00Z","operation":"progress_fix","before":{"session":45,"checklist":60},"after":{"session":60,"checklist":60},"status":"success"}
|
||||
{"timestamp":"2025-09-07T14:30:01Z","operation":"task_reference_update","tasks_added":["IMPL-007","IMPL-008"],"status":"success"}
|
||||
{"timestamp":"2025-09-07T14:30:02Z","operation":"todowrite_sync","tasks_updated":3,"status":"success"}
|
||||
```
|
||||
- Timestamp inconsistencies
|
||||
|
||||
## Example Outputs
|
||||
|
||||
### Success
|
||||
```
|
||||
✅ All documents in sync
|
||||
- Files checked: 4
|
||||
- Issues found: 0
|
||||
- Last sync: 2 minutes ago
|
||||
```
|
||||
|
||||
### With Issues
|
||||
```
|
||||
⚠️ Sync issues detected:
|
||||
1. Progress: 45% (should be 60%)
|
||||
2. Task IMPL-003: 'completed' vs 'active'
|
||||
3. Missing: IMPL-005 not in workflow
|
||||
|
||||
Run with --fix to resolve
|
||||
```
|
||||
|
||||
### After Fix
|
||||
```
|
||||
✅ Sync completed:
|
||||
- Fixed: 3 issues
|
||||
- Backup: .backup/sync-20250116
|
||||
- Verified: All consistent
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Common Errors
|
||||
```bash
|
||||
❌ workflow-session.json not found
|
||||
→ Run: /workflow:init first
|
||||
|
||||
❌ tasks.json corrupted
|
||||
→ Restoring from backup...
|
||||
✅ Restored successfully
|
||||
|
||||
❌ Permission denied
|
||||
→ Check file permissions
|
||||
```
|
||||
|
||||
## Performance
|
||||
- Incremental checks (fast)
|
||||
- Cached validations
|
||||
- Typical time: < 200ms
|
||||
|
||||
## Related Commands
|
||||
- `/task:sync` - Task-specific sync
|
||||
- `/workflow:status` - View current state
|
||||
- `/task:status` - Task details
|
||||
Reference in New Issue
Block a user