mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
Refactor workflow file paths from .workflow/sessions/ to .workflow/active/ for improved session management and consistency across commands. Updated documentation and command references to reflect the new directory structure, ensuring all relevant commands and outputs are correctly aligned with the active session model.
This commit is contained in:
@@ -26,17 +26,17 @@ Mark the currently active workflow session as complete, analyze it for lessons l
|
||||
#### Step 1.1: Find Active Session and Get Name
|
||||
```bash
|
||||
# Find active session directory
|
||||
bash(find .workflow/sessions/ -name "WFS-*" -type d | head -1)
|
||||
bash(find .workflow/active/ -name "WFS-*" -type d | head -1)
|
||||
|
||||
# Extract session name from directory path
|
||||
bash(basename .workflow/sessions/WFS-session-name)
|
||||
bash(basename .workflow/active/WFS-session-name)
|
||||
```
|
||||
**Output**: Session name `WFS-session-name`
|
||||
|
||||
#### Step 1.2: Check for Existing Archiving Marker (Resume Detection)
|
||||
```bash
|
||||
# Check if session is already being archived
|
||||
bash(test -f .workflow/sessions/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW")
|
||||
bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW")
|
||||
```
|
||||
|
||||
**If RESUMING**:
|
||||
@@ -49,14 +49,14 @@ bash(test -f .workflow/sessions/WFS-session-name/.archiving && echo "RESUMING" |
|
||||
#### Step 1.3: Create Archiving Marker
|
||||
```bash
|
||||
# Mark session as "archiving in progress"
|
||||
bash(touch .workflow/sessions/WFS-session-name/.archiving)
|
||||
bash(touch .workflow/active/WFS-session-name/.archiving)
|
||||
```
|
||||
**Purpose**:
|
||||
- Prevents concurrent operations on this session
|
||||
- Enables recovery if archival fails
|
||||
- Session remains in `.workflow/sessions/` for agent analysis
|
||||
- Session remains in `.workflow/active/` for agent analysis
|
||||
|
||||
**Result**: Session still at `.workflow/sessions/WFS-session-name/` with `.archiving` marker
|
||||
**Result**: Session still at `.workflow/active/WFS-session-name/` with `.archiving` marker
|
||||
|
||||
### Phase 2: Agent Analysis (In-Place Processing)
|
||||
|
||||
@@ -75,7 +75,7 @@ Task(
|
||||
Analyze workflow session for archival preparation. Session is STILL in active location.
|
||||
|
||||
## Context
|
||||
- Session: .workflow/sessions/WFS-session-name/
|
||||
- Session: .workflow/active/WFS-session-name/
|
||||
- Status: Marked as archiving (.archiving marker present)
|
||||
- Location: Active sessions directory (NOT archived yet)
|
||||
|
||||
@@ -123,7 +123,7 @@ Analyze workflow session for archival preparation. Session is STILL in active lo
|
||||
## Important Constraints
|
||||
- DO NOT move or delete any files
|
||||
- DO NOT update manifest.json yet
|
||||
- Session remains in .workflow/sessions/ during analysis
|
||||
- Session remains in .workflow/active/ during analysis
|
||||
- Return complete metadata package for orchestrator to commit atomically
|
||||
|
||||
## Error Handling
|
||||
@@ -135,7 +135,7 @@ Analyze workflow session for archival preparation. Session is STILL in active lo
|
||||
|
||||
**Expected Output**:
|
||||
- Agent returns complete metadata package
|
||||
- Session remains in `.workflow/sessions/` with `.archiving` marker
|
||||
- Session remains in `.workflow/active/` with `.archiving` marker
|
||||
- No files moved or manifests updated yet
|
||||
|
||||
### Phase 3: Atomic Commit (Transactional File Operations)
|
||||
@@ -149,7 +149,7 @@ bash(mkdir -p .workflow/archives/)
|
||||
|
||||
#### Step 3.2: Move Session to Archive
|
||||
```bash
|
||||
bash(mv .workflow/sessions/WFS-session-name .workflow/archives/WFS-session-name)
|
||||
bash(mv .workflow/active/WFS-session-name .workflow/archives/WFS-session-name)
|
||||
```
|
||||
**Result**: Session now at `.workflow/archives/WFS-session-name/`
|
||||
|
||||
@@ -345,16 +345,16 @@ function getLatestCommitHash() {
|
||||
|
||||
**Recovery Steps**:
|
||||
```bash
|
||||
# Session still in .workflow/sessions/WFS-session-name
|
||||
# Session still in .workflow/active/WFS-session-name
|
||||
# Remove archiving marker
|
||||
bash(rm .workflow/sessions/WFS-session-name/.archiving)
|
||||
bash(rm .workflow/active/WFS-session-name/.archiving)
|
||||
```
|
||||
|
||||
**User Notification**:
|
||||
```
|
||||
ERROR: Session archival failed during analysis phase
|
||||
Reason: [error message from agent]
|
||||
Session remains active in: .workflow/sessions/WFS-session-name
|
||||
Session remains active in: .workflow/active/WFS-session-name
|
||||
|
||||
Recovery:
|
||||
1. Fix any issues identified in error message
|
||||
@@ -373,7 +373,7 @@ Session state: SAFE (no changes committed)
|
||||
**Recovery Steps**:
|
||||
```bash
|
||||
# Archiving marker still present
|
||||
# Session still in .workflow/sessions/ (move failed)
|
||||
# Session still in .workflow/active/ (move failed)
|
||||
# No manifest updated yet
|
||||
```
|
||||
|
||||
@@ -381,7 +381,7 @@ Session state: SAFE (no changes committed)
|
||||
```
|
||||
ERROR: Session archival failed during move operation
|
||||
Reason: [mv error message]
|
||||
Session remains in: .workflow/sessions/WFS-session-name
|
||||
Session remains in: .workflow/active/WFS-session-name
|
||||
|
||||
Recovery:
|
||||
1. Fix filesystem issues (permissions, disk space)
|
||||
|
||||
@@ -19,35 +19,35 @@ Display all workflow sessions with their current status, progress, and metadata.
|
||||
|
||||
### Step 1: Find All Sessions
|
||||
```bash
|
||||
ls .workflow/sessions/WFS-* 2>/dev/null
|
||||
ls .workflow/active/WFS-* 2>/dev/null
|
||||
```
|
||||
|
||||
### Step 2: Check Active Session
|
||||
```bash
|
||||
find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | head -1
|
||||
find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1
|
||||
```
|
||||
|
||||
### Step 3: Read Session Metadata
|
||||
```bash
|
||||
jq -r '.session_id, .status, .project' .workflow/sessions/WFS-session/workflow-session.json
|
||||
jq -r '.session_id, .status, .project' .workflow/active/WFS-session/workflow-session.json
|
||||
```
|
||||
|
||||
### Step 4: Count Task Progress
|
||||
```bash
|
||||
find .workflow/sessions/WFS-session/.task/ -name "*.json" -type f 2>/dev/null | wc -l
|
||||
find .workflow/sessions/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l
|
||||
find .workflow/active/WFS-session/.task/ -name "*.json" -type f 2>/dev/null | wc -l
|
||||
find .workflow/active/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l
|
||||
```
|
||||
|
||||
### Step 5: Get Creation Time
|
||||
```bash
|
||||
jq -r '.created_at // "unknown"' .workflow/sessions/WFS-session/workflow-session.json
|
||||
jq -r '.created_at // "unknown"' .workflow/active/WFS-session/workflow-session.json
|
||||
```
|
||||
|
||||
## Simple Bash Commands
|
||||
|
||||
### Basic Operations
|
||||
- **List sessions**: `find .workflow/sessions/ -name "WFS-*" -type d`
|
||||
- **Find active**: `find .workflow/sessions/ -name "WFS-*" -type d`
|
||||
- **List sessions**: `find .workflow/active/ -name "WFS-*" -type d`
|
||||
- **Find active**: `find .workflow/active/ -name "WFS-*" -type d`
|
||||
- **Read session data**: `jq -r '.session_id, .status' session.json`
|
||||
- **Count tasks**: `find .task/ -name "*.json" -type f | wc -l`
|
||||
- **Count completed**: `find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l`
|
||||
@@ -89,8 +89,8 @@ Total: 3 sessions (1 active, 1 paused, 1 completed)
|
||||
### Quick Commands
|
||||
```bash
|
||||
# Count all sessions
|
||||
ls .workflow/sessions/WFS-* | wc -l
|
||||
ls .workflow/active/WFS-* | wc -l
|
||||
|
||||
# Show recent sessions
|
||||
ls -t .workflow/sessions/WFS-*/workflow-session.json | head -3
|
||||
ls -t .workflow/active/WFS-*/workflow-session.json | head -3
|
||||
```
|
||||
@@ -17,37 +17,37 @@ Resume the most recently paused workflow session, restoring all context and stat
|
||||
|
||||
### Step 1: Find Paused Sessions
|
||||
```bash
|
||||
ls .workflow/sessions/WFS-* 2>/dev/null
|
||||
ls .workflow/active/WFS-* 2>/dev/null
|
||||
```
|
||||
|
||||
### Step 2: Check Session Status
|
||||
```bash
|
||||
jq -r '.status' .workflow/sessions/WFS-session/workflow-session.json
|
||||
jq -r '.status' .workflow/active/WFS-session/workflow-session.json
|
||||
```
|
||||
|
||||
### Step 3: Find Most Recent Paused
|
||||
```bash
|
||||
ls -t .workflow/sessions/WFS-*/workflow-session.json | head -1
|
||||
ls -t .workflow/active/WFS-*/workflow-session.json | head -1
|
||||
```
|
||||
|
||||
### Step 4: Update Session Status
|
||||
```bash
|
||||
jq '.status = "active"' .workflow/sessions/WFS-session/workflow-session.json > temp.json
|
||||
mv temp.json .workflow/sessions/WFS-session/workflow-session.json
|
||||
jq '.status = "active"' .workflow/active/WFS-session/workflow-session.json > temp.json
|
||||
mv temp.json .workflow/active/WFS-session/workflow-session.json
|
||||
```
|
||||
|
||||
### Step 5: Add Resume Timestamp
|
||||
```bash
|
||||
jq '.resumed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"' .workflow/sessions/WFS-session/workflow-session.json > temp.json
|
||||
mv temp.json .workflow/sessions/WFS-session/workflow-session.json
|
||||
jq '.resumed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"' .workflow/active/WFS-session/workflow-session.json > temp.json
|
||||
mv temp.json .workflow/active/WFS-session/workflow-session.json
|
||||
```
|
||||
|
||||
## Simple Bash Commands
|
||||
|
||||
### Basic Operations
|
||||
- **List sessions**: `ls .workflow/sessions/WFS-*`
|
||||
- **List sessions**: `ls .workflow/active/WFS-*`
|
||||
- **Check status**: `jq -r '.status' session.json`
|
||||
- **Find recent**: `ls -t .workflow/sessions/*/workflow-session.json | head -1`
|
||||
- **Find recent**: `ls -t .workflow/active/*/workflow-session.json | head -1`
|
||||
- **Update status**: `jq '.status = "active"' session.json > temp.json`
|
||||
- **Add timestamp**: `jq '.resumed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"'`
|
||||
|
||||
|
||||
@@ -51,12 +51,12 @@ SlashCommand({command: "/workflow:init"});
|
||||
|
||||
### Step 1: List Active Sessions
|
||||
```bash
|
||||
bash(ls -1 .workflow/sessions/ 2>/dev/null | head -5)
|
||||
bash(ls -1 .workflow/active/ 2>/dev/null | head -5)
|
||||
```
|
||||
|
||||
### Step 2: Display Session Metadata
|
||||
```bash
|
||||
bash(cat .workflow/sessions/WFS-promptmaster-platform/workflow-session.json)
|
||||
bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json)
|
||||
```
|
||||
|
||||
### Step 4: User Decision
|
||||
@@ -73,7 +73,7 @@ Present session information and wait for user to select or create session.
|
||||
|
||||
### Step 1: Check Active Sessions Count
|
||||
```bash
|
||||
bash(find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | wc -l)
|
||||
bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l)
|
||||
```
|
||||
|
||||
### Step 2a: No Active Sessions → Create New
|
||||
@@ -82,12 +82,12 @@ bash(find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | wc -l)
|
||||
bash(echo "implement OAuth2 auth" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
|
||||
|
||||
# Create directory structure
|
||||
bash(mkdir -p .workflow/sessions/WFS-implement-oauth2-auth/.process)
|
||||
bash(mkdir -p .workflow/sessions/WFS-implement-oauth2-auth/.task)
|
||||
bash(mkdir -p .workflow/sessions/WFS-implement-oauth2-auth/.summaries)
|
||||
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.process)
|
||||
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.task)
|
||||
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.summaries)
|
||||
|
||||
# Create metadata
|
||||
bash(echo '{"session_id":"WFS-implement-oauth2-auth","project":"implement OAuth2 auth","status":"planning"}' > .workflow/sessions/WFS-implement-oauth2-auth/workflow-session.json)
|
||||
bash(echo '{"session_id":"WFS-implement-oauth2-auth","project":"implement OAuth2 auth","status":"planning"}' > .workflow/active/WFS-implement-oauth2-auth/workflow-session.json)
|
||||
```
|
||||
|
||||
**Output**: `SESSION_ID: WFS-implement-oauth2-auth`
|
||||
@@ -95,10 +95,10 @@ bash(echo '{"session_id":"WFS-implement-oauth2-auth","project":"implement OAuth2
|
||||
### Step 2b: Single Active Session → Check Relevance
|
||||
```bash
|
||||
# Extract session ID
|
||||
bash(find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
|
||||
bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
|
||||
|
||||
# Read project name from metadata
|
||||
bash(cat .workflow/sessions/WFS-promptmaster-platform/workflow-session.json | grep -o '"project":"[^"]*"' | cut -d'"' -f4)
|
||||
bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json | grep -o '"project":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
# Check keyword match (manual comparison)
|
||||
# If task contains project keywords → Reuse session
|
||||
@@ -111,7 +111,7 @@ bash(cat .workflow/sessions/WFS-promptmaster-platform/workflow-session.json | gr
|
||||
### Step 2c: Multiple Active Sessions → Use First
|
||||
```bash
|
||||
# Get first active session
|
||||
bash(find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
|
||||
bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
|
||||
|
||||
# Output warning and session ID
|
||||
# WARNING: Multiple active sessions detected
|
||||
@@ -131,19 +131,19 @@ bash(find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | head -1 | xarg
|
||||
bash(echo "fix login bug" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
|
||||
|
||||
# Check if exists, add counter if needed
|
||||
bash(ls .workflow/sessions/WFS-fix-login-bug 2>/dev/null && echo "WFS-fix-login-bug-2" || echo "WFS-fix-login-bug")
|
||||
bash(ls .workflow/active/WFS-fix-login-bug 2>/dev/null && echo "WFS-fix-login-bug-2" || echo "WFS-fix-login-bug")
|
||||
```
|
||||
|
||||
### Step 2: Create Session Structure
|
||||
```bash
|
||||
bash(mkdir -p .workflow/sessions/WFS-fix-login-bug/.process)
|
||||
bash(mkdir -p .workflow/sessions/WFS-fix-login-bug/.task)
|
||||
bash(mkdir -p .workflow/sessions/WFS-fix-login-bug/.summaries)
|
||||
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.process)
|
||||
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.task)
|
||||
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.summaries)
|
||||
```
|
||||
|
||||
### Step 3: Create Metadata
|
||||
```bash
|
||||
bash(echo '{"session_id":"WFS-fix-login-bug","project":"fix login bug","status":"planning"}' > .workflow/sessions/WFS-fix-login-bug/workflow-session.json)
|
||||
bash(echo '{"session_id":"WFS-fix-login-bug","project":"fix login bug","status":"planning"}' > .workflow/active/WFS-fix-login-bug/workflow-session.json)
|
||||
```
|
||||
|
||||
**Output**: `SESSION_ID: WFS-fix-login-bug`
|
||||
|
||||
Reference in New Issue
Block a user