mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
feat(ccw): add session manager tool with auto workspace detection
- Add session_manager tool for workflow session lifecycle management - Add ccw session CLI command with subcommands: - list, init, status, task, stats, delete, read, write, update, archive, mkdir - Implement auto workspace detection (traverse up to find .workflow) - Implement auto session location detection (active, archived, lite-plan, lite-fix) - Add dashboard notifications for tool executions via WebSocket - Add granular event types (SESSION_CREATED, TASK_UPDATED, etc.) - Add status_history auto-tracking for task status changes - Update workflow session commands to document ccw session usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -507,3 +507,64 @@ Session state: PARTIALLY COMPLETE (session archived, manifest needs update)
|
||||
- Idempotent operations (safe to retry)
|
||||
|
||||
|
||||
|
||||
## session_manager Tool Alternative
|
||||
|
||||
Use `ccw tool exec session_manager` for session completion operations:
|
||||
|
||||
### List Active Sessions
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"list","location":"active"}'
|
||||
```
|
||||
|
||||
### Update Session Status to Completed
|
||||
```bash
|
||||
ccw tool exec session_manager '{
|
||||
"operation": "update",
|
||||
"session_id": "WFS-xxx",
|
||||
"content_type": "session",
|
||||
"content": {
|
||||
"status": "completed",
|
||||
"archived_at": "2025-12-10T08:00:00Z"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Archive Session
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"archive","session_id":"WFS-xxx"}'
|
||||
|
||||
# This operation:
|
||||
# 1. Updates status to "completed" if update_status=true (default)
|
||||
# 2. Moves session from .workflow/active/ to .workflow/archives/
|
||||
```
|
||||
|
||||
### Read Session Data
|
||||
```bash
|
||||
# Read workflow-session.json
|
||||
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
|
||||
|
||||
# Read IMPL_PLAN.md
|
||||
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"plan"}'
|
||||
```
|
||||
|
||||
### Write Archiving Marker
|
||||
```bash
|
||||
ccw tool exec session_manager '{
|
||||
"operation": "write",
|
||||
"session_id": "WFS-xxx",
|
||||
"content_type": "process",
|
||||
"path_params": {"filename": ".archiving"},
|
||||
"content": ""
|
||||
}'
|
||||
```
|
||||
|
||||
### Operation Reference
|
||||
| Old Pattern | session_manager |
|
||||
|------------|-----------------|
|
||||
| `find .workflow/active/ -name "WFS-*"` | `{"operation":"list","location":"active"}` |
|
||||
| `jq '.status = "completed"' ...` | `{"operation":"update","content":{"status":"completed"}}` |
|
||||
| `mv .workflow/active/WFS-xxx .workflow/archives/` | `{"operation":"archive","session_id":"WFS-xxx"}` |
|
||||
| `touch .archiving` | `{"operation":"write","content_type":"process","path_params":{"filename":".archiving"}}` |
|
||||
| `rm .archiving` | Use bash `rm` directly (no delete operation in tool) |
|
||||
| `cat manifest.json` | Read manifest directly with bash (outside session scope) |
|
||||
|
||||
@@ -93,4 +93,40 @@ ls .workflow/active/WFS-* | wc -l
|
||||
|
||||
# Show recent sessions
|
||||
ls -t .workflow/active/WFS-*/workflow-session.json | head -3
|
||||
```
|
||||
```
|
||||
## session_manager Tool Alternative
|
||||
|
||||
Use `ccw tool exec session_manager` for simplified session listing:
|
||||
|
||||
### List All Sessions (Active + Archived)
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"list","location":"both","include_metadata":true}'
|
||||
|
||||
# Response:
|
||||
# {
|
||||
# "success": true,
|
||||
# "result": {
|
||||
# "active": [{"session_id":"WFS-xxx","metadata":{...}}],
|
||||
# "archived": [{"session_id":"WFS-yyy","metadata":{...}}],
|
||||
# "total": 2
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
### List Active Sessions Only
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'
|
||||
```
|
||||
|
||||
### Read Specific Session
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
|
||||
```
|
||||
|
||||
### Operation Reference
|
||||
| Old Pattern | session_manager |
|
||||
|------------|-----------------|
|
||||
| `ls .workflow/active/WFS-*` | `{"operation":"list","location":"active"}` |
|
||||
| `find ... -type d` | `{"operation":"list"}` returns session_id list |
|
||||
| `jq -r '.status' session.json` | `{"operation":"read","content_type":"session"}` |
|
||||
| `cat workflow-session.json` | `{"operation":"read","content_type":"session"}` |
|
||||
|
||||
@@ -58,4 +58,33 @@ Session WFS-user-auth resumed
|
||||
- Paused at: 2025-09-15T14:30:00Z
|
||||
- Resumed at: 2025-09-15T15:45:00Z
|
||||
- Ready for: /workflow:execute
|
||||
```
|
||||
```
|
||||
## session_manager Tool Alternative
|
||||
|
||||
Use `ccw tool exec session_manager` for session resume:
|
||||
|
||||
### Update Session Status
|
||||
```bash
|
||||
# Update status to active
|
||||
ccw tool exec session_manager '{
|
||||
"operation": "update",
|
||||
"session_id": "WFS-xxx",
|
||||
"content_type": "session",
|
||||
"content": {
|
||||
"status": "active",
|
||||
"resumed_at": "2025-12-10T08:00:00Z"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Read Session Status
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
|
||||
```
|
||||
|
||||
### Operation Reference
|
||||
| Old Pattern | session_manager |
|
||||
|------------|-----------------|
|
||||
| `jq -r '.status' session.json` | `{"operation":"read","content_type":"session"}` |
|
||||
| `jq '.status = "active"' ... > temp.json && mv` | `{"operation":"update","content":{"status":"active"}}` |
|
||||
| `jq '.resumed_at = "..."'` | `{"operation":"update","content":{"resumed_at":"..."}}` |
|
||||
|
||||
@@ -197,4 +197,44 @@ SESSION_ID: WFS-promptmaster-platform
|
||||
- Pattern: `WFS-[lowercase-slug]`
|
||||
- Characters: `a-z`, `0-9`, `-` only
|
||||
- Max length: 50 characters
|
||||
- Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`)
|
||||
- Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`)
|
||||
|
||||
## session_manager Tool Alternative
|
||||
|
||||
The above bash commands can be replaced with `ccw tool exec session_manager`:
|
||||
|
||||
### List Sessions
|
||||
```bash
|
||||
# List active sessions with metadata
|
||||
ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'
|
||||
|
||||
# Response: {"success":true,"result":{"active":[{"session_id":"WFS-xxx","metadata":{...}}],"total":1}}
|
||||
```
|
||||
|
||||
### Create Session (replaces mkdir + echo)
|
||||
```bash
|
||||
# Single command creates directories + metadata
|
||||
ccw tool exec session_manager '{
|
||||
"operation": "init",
|
||||
"session_id": "WFS-my-session",
|
||||
"metadata": {
|
||||
"project": "my project description",
|
||||
"status": "planning",
|
||||
"type": "workflow",
|
||||
"created_at": "2025-12-10T08:00:00Z"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Read Session Metadata
|
||||
```bash
|
||||
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
|
||||
```
|
||||
|
||||
### Operation Reference
|
||||
| Old Pattern | session_manager |
|
||||
|------------|-----------------|
|
||||
| `ls .workflow/active/` | `{"operation":"list","location":"active"}` |
|
||||
| `mkdir -p .../.process .../.task .../.summaries` | `{"operation":"init","session_id":"WFS-xxx"}` |
|
||||
| `echo '{...}' > workflow-session.json` | `{"operation":"write","content_type":"session","content":{...}}` |
|
||||
| `cat workflow-session.json` | `{"operation":"read","content_type":"session"}` |
|
||||
Reference in New Issue
Block a user