/work-next - Comprehensive Work Discovery
Analyzes multiple data sources to help you understand current project state and interactively decide what work to begin next.
System Prompt
EXECUTION DIRECTIVE: When the user invokes this command, you MUST execute all 8 discovery steps in sequence, then present an interactive summary with recommendations.
Step 1: Recent Context Activity
Query the context database for recent work:
/cxq --recent 200
Extract:
- Last 10-20 unique activities/topics
- Most recent decisions made
- Open questions or blockers mentioned
Step 2: Active Project Plan
Find and analyze the active project plan:
Glob("**/PILOT*.md")
Glob("**/PROJECT-PLAN*.md")
Read the most recent plan file
Extract:
- Current phase/sprint
- Active tracks and their status
- Blocking items
- Next milestones
Step 3: Tasklist Status
Check the tasklist for pending items:
Glob("**/TASKLIST*.md")
Read and parse task status
Extract:
- In-progress tasks
- Blocked tasks
- Next pending tasks by priority
- Recently completed (for context)
Step 4: Recent Git History
Analyze recent commits:
git log --oneline -20
git log --since="24 hours ago" --oneline
Extract:
- What was worked on recently
- Which areas have momentum
- Any revert or fix commits (indicating issues)
Step 5: Uncommitted Changes
Check working tree status:
git status --short
git diff --stat
Extract:
- Staged changes (ready to commit)
- Unstaged modifications (work in progress)
- Untracked files (new work)
Step 6: Directory Change Analysis
Identify which areas have changes:
git status --short | cut -c4- | xargs -I {} dirname {} | sort -u
Extract:
- Which submodules have changes
- Which directories are active
- Spread of changes (focused vs scattered)
Step 7: Recent Session Analysis
Check Claude Code session files:
ls -lt ~/.claude/projects/-Users-halcasteel-PROJECTS-coditect-rollout-master/*.jsonl | head -5
For the most recent session:
- Extract last 50-100 messages
- Identify topics discussed
- Find any TODO items or follow-ups mentioned
Step 8: Checkpoint Review
Check for recent checkpoints:
Glob("**/CHECKPOINT*.md")
ls -lt context-storage/checkpoints/ | head -5
Extract:
- Last checkpoint date and summary
- Time since last checkpoint
- Whether checkpoint is needed
Interactive Output Format
After gathering all data, present:
╔══════════════════════════════════════════════════════════════════╗
║ WORK DISCOVERY SUMMARY ║
╠══════════════════════════════════════════════════════════════════╣
📊 PROJECT STATUS
├─ Phase: [Current phase from PILOT plan]
├─ Sprint: [Current sprint if applicable]
└─ Overall: [X]% complete
📋 ACTIVE WORK
├─ In Progress: [N tasks]
│ • [Task 1 - brief description]
│ • [Task 2 - brief description]
├─ Blocked: [N tasks]
│ • [Blocker 1]
└─ Uncommitted: [N files in M directories]
• [dir1/] - N files modified
• [dir2/] - N files added
🕐 RECENT ACTIVITY (Last 24h)
├─ Commits: [N commits]
├─ Topics: [topic1, topic2, topic3]
└─ Last session: [time ago] - [brief topic]
🎯 RECOMMENDED NEXT ACTIONS
[1] [HIGH] Continue: [in-progress task with momentum]
└─ Context: [why this is recommended]
[2] [HIGH] Commit: [uncommitted work description]
└─ Files: [N files ready to commit]
[3] [MEDIUM] Unblock: [blocked task]
└─ Blocker: [what's blocking]
[4] [MEDIUM] Start: [next pending task]
└─ From: [PILOT plan track]
[5] [LOW] Checkpoint: Create progress checkpoint
└─ Last: [time since last checkpoint]
╚══════════════════════════════════════════════════════════════════╝
Then ask:
Which would you like to work on? [1-5, or describe different task]
Usage
/work-next # Full discovery with recommendations
/work-next --quick # Abbreviated version (steps 4-6 only)
/work-next --git # Git status focus only
/work-next --context # Context/session focus only
Examples
# Start of session - full discovery
/work-next
# Quick check during work
/work-next --quick
# After a break - what was I doing?
/work-next --context
Options
| Option | Description |
|---|---|
--quick | Abbreviated discovery (git + uncommitted only) |
--git | Focus on git status and history |
--context | Focus on context DB and sessions |
--verbose | Show raw data from each step |
--no-recommend | Show status without recommendations |
Data Sources
| Source | Location | Purpose |
|---|---|---|
| Context DB | context-storage/sessions.db + org.db (ADR-118) | Recent activities, decisions |
| Project Plan | **/PILOT*.md, **/PROJECT-PLAN*.md | Current phase, tracks |
| Tasklist | **/TASKLIST*.md | Task status |
| Git Log | .git/ | Recent commits |
| Git Status | Working tree | Uncommitted changes |
| Sessions | ~/.claude/projects/*.jsonl | Session history |
| Checkpoints | context-storage/checkpoints/ | Progress snapshots |
Integration with Other Commands
| After /work-next | Use |
|---|---|
| Selected task | /agent <name> "task" to execute |
| Need to commit | git add . && git commit |
| Need checkpoint | /cx to capture context |
| Need more context | /cxq "specific query" |
| Start fresh session | /orient |
Recommended Workflow
# 1. Start of day/session
/work-next
# 2. Select recommended action or specify your own
> 1 # Continue in-progress work
# 3. Work on the task...
# 4. Before break/end
/work-next --quick # Check if anything to commit
# 5. End of session
/cx # Capture context
Success Output
When discovery completes successfully:
✅ COMMAND COMPLETE: /work-next
Data sources: 8/8 analyzed
Recommendations: N prioritized actions
Interactive: Ready for selection
Completion Checklist
Before marking complete:
- All 8 discovery steps executed
- Summary displayed with status
- Recommendations prioritized
- Interactive prompt shown
Failure Indicators
This command has FAILED if:
- ❌ Context database unavailable
- ❌ No project plan found
- ❌ Git repository not accessible
- ❌ Session files not readable
When NOT to Use
Do NOT use when:
- Already know what to work on
- Quick single task (overhead not worth it)
- Not in a CODITECT project
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Skip recommendations | Miss priorities | Review all options |
| Ignore blockers | Stuck later | Address blockers first |
| Run repeatedly | Wasted time | Run once at session start |
Principles
This command embodies:
- #9 Based on Facts - Uses multiple data sources
- #10 Research When in Doubt - Comprehensive discovery
- #3 Complete Execution - All 8 steps executed
Full Standard: CODITECT-STANDARD-AUTOMATION.md
Version: 1.0.0 Created: 2026-01-03 Author: CODITECT Team