|
@@ -1,350 +1,670 @@
|
|
|
---
|
|
---
|
|
|
-description: "Create, review, and persist project plans. Captures Claude Code Plan Mode state and writes to git-trackable docs/PLAN.md."
|
|
|
|
|
|
|
+description: "Unified project planning and session continuity. Create plans, save/load state, track progress. Smart defaults with context detection."
|
|
|
---
|
|
---
|
|
|
|
|
|
|
|
-# Plan - Persistent Project Planning
|
|
|
|
|
|
|
+# Plan - Project Planning & Session Continuity
|
|
|
|
|
|
|
|
-Create, review, and update project plans. Automatically captures Claude Code's internal Plan Mode state and persists to `docs/PLAN.md`.
|
|
|
|
|
-
|
|
|
|
|
-## Why This Exists
|
|
|
|
|
-
|
|
|
|
|
-Claude Code's native Plan Mode (Shift+Tab) is powerful for exploration, but **the plan state doesn't persist**. When your session ends, the strategic thinking is lost.
|
|
|
|
|
-
|
|
|
|
|
-This command bridges that gap:
|
|
|
|
|
-- **Captures** any active Plan Mode context
|
|
|
|
|
-- **Persists** to `docs/PLAN.md` (git-trackable)
|
|
|
|
|
-- **Survives** across sessions and machines
|
|
|
|
|
-- **Pairs** with `/save` + `/load` for complete session continuity
|
|
|
|
|
|
|
+Unified command for strategic planning and session state management. Creates persistent plans, saves/loads session state, and provides intelligent context-aware defaults.
|
|
|
|
|
|
|
|
## Arguments
|
|
## Arguments
|
|
|
|
|
|
|
|
$ARGUMENTS
|
|
$ARGUMENTS
|
|
|
|
|
|
|
|
-- `<goal>` - Create/update plan for a goal
|
|
|
|
|
-- `--review` - Display current plan
|
|
|
|
|
-- `--status` - Update progress on steps
|
|
|
|
|
-- `--capture` - Capture conversation context only (no new planning)
|
|
|
|
|
-- `--sync` - Auto-update status from recent git commits
|
|
|
|
|
-- `--diff` - Show what changed since last plan update
|
|
|
|
|
-- `--clear` - Archive current plan and start fresh
|
|
|
|
|
|
|
+- No args: **Interactive mode** - detects context, suggests action
|
|
|
|
|
+- `<goal>`: Create or update plan for goal
|
|
|
|
|
+- `save "notes"` or `--save`: Save session state (TodoWrite, plan context, git)
|
|
|
|
|
+- `load` or `--load`: Restore session state from previous save
|
|
|
|
|
+- `status` or `--status`: Quick read-only status view
|
|
|
|
|
+- `sync` or `--sync`: Auto-update plan progress from git commits
|
|
|
|
|
+- `diff` or `--diff`: Show what changed since last update
|
|
|
|
|
+- `clear` or `--clear`: Archive current plan and start fresh
|
|
|
|
|
|
|
|
-## Default Behavior: Capture First
|
|
|
|
|
|
|
+**Note:** Subcommands work with or without the `--` prefix.
|
|
|
|
|
|
|
|
-**Every invocation of `/plan` attempts to capture internal state first.**
|
|
|
|
|
|
|
+## Architecture
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-/plan <anything>
|
|
|
|
|
- │
|
|
|
|
|
- ├─→ Step 0: Capture internal state (ALWAYS RUNS)
|
|
|
|
|
- │ ├─ Detect if Plan Mode was recently active
|
|
|
|
|
- │ ├─ Extract plan-related context from conversation
|
|
|
|
|
- │ ├─ Check for temp files (.claude/plan*, docs/PLAN.md)
|
|
|
|
|
- │ ├─ Gather git context (uncommitted changes, recent commits)
|
|
|
|
|
- │ └─ Merge into working state
|
|
|
|
|
- │
|
|
|
|
|
- ├─→ Step 1: Check existing docs/PLAN.md
|
|
|
|
|
- │ └─ Load and parse if exists
|
|
|
|
|
- │
|
|
|
|
|
- └─→ Step 2: Execute requested action
|
|
|
|
|
- ├─ Create new plan
|
|
|
|
|
- ├─ Update existing plan
|
|
|
|
|
- └─ Review/display plan
|
|
|
|
|
|
|
+/plan [goal] [--save|--load|--status|--sync|--clear]
|
|
|
|
|
+ │
|
|
|
|
|
+ ├─→ No args: INTERACTIVE MODE
|
|
|
|
|
+ │ │
|
|
|
|
|
+ │ ├─ No plan exists?
|
|
|
|
|
+ │ │ └─ "No plan found. Create one: /plan 'your goal'"
|
|
|
|
|
+ │ │
|
|
|
|
|
+ │ ├─ Plan exists + saved state exists?
|
|
|
|
|
+ │ │ ├─ State is stale (>2 hours)?
|
|
|
|
|
+ │ │ │ └─ "Welcome back! Load previous session? (Y/n)"
|
|
|
|
|
+ │ │ └─ State is fresh?
|
|
|
|
|
+ │ │ └─ Show status + "Continue: <in_progress_task>"
|
|
|
|
|
+ │ │
|
|
|
|
|
+ │ └─ Plan exists + no saved state?
|
|
|
|
|
+ │ └─ Show status + "Save before leaving: /plan --save"
|
|
|
|
|
+ │
|
|
|
|
|
+ ├─→ /plan "goal"
|
|
|
|
|
+ │ ├─ Capture conversation context (goals, decisions, approaches)
|
|
|
|
|
+ │ ├─ Capture git context (branch, uncommitted, recent commits)
|
|
|
|
|
+ │ ├─ Merge with existing docs/PLAN.md if present
|
|
|
|
|
+ │ └─ Write updated plan
|
|
|
|
|
+ │
|
|
|
|
|
+ ├─→ /plan --save "notes"
|
|
|
|
|
+ │ ├─ Capture TodoWrite state
|
|
|
|
|
+ │ ├─ Capture current plan step
|
|
|
|
|
+ │ ├─ Capture git context
|
|
|
|
|
+ │ ├─ Write .claude/session-cache.json
|
|
|
|
|
+ │ └─ Write .claude/claude-progress.md (human-readable)
|
|
|
|
|
+ │
|
|
|
|
|
+ ├─→ /plan --load
|
|
|
|
|
+ │ ├─ Read .claude/session-cache.json
|
|
|
|
|
+ │ ├─ Restore TodoWrite tasks
|
|
|
|
|
+ │ ├─ Show what changed since save
|
|
|
|
|
+ │ └─ Suggest next action
|
|
|
|
|
+ │
|
|
|
|
|
+ ├─→ /plan --status
|
|
|
|
|
+ │ ├─ Read docs/PLAN.md
|
|
|
|
|
+ │ ├─ Read TodoWrite state
|
|
|
|
|
+ │ ├─ Read git state
|
|
|
|
|
+ │ └─ Display unified view
|
|
|
|
|
+ │
|
|
|
|
|
+ ├─→ /plan --sync
|
|
|
|
|
+ │ ├─ Parse recent git commits
|
|
|
|
|
+ │ ├─ Match to plan steps
|
|
|
|
|
+ │ └─ Auto-update step status
|
|
|
|
|
+ │
|
|
|
|
|
+ └─→ /plan --clear
|
|
|
|
|
+ ├─ Archive to docs/PLAN-<date>.md
|
|
|
|
|
+ └─ Start fresh
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-This ensures you never lose Plan Mode thinking, even if you forget to explicitly save.
|
|
|
|
|
|
|
+---
|
|
|
|
|
|
|
|
-## Execution Steps
|
|
|
|
|
|
|
+## Interactive Mode (No Args)
|
|
|
|
|
|
|
|
-### Step 0: Capture Internal State (Always)
|
|
|
|
|
|
|
+When you run `/plan` with no arguments, it detects your context and suggests the right action:
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-# Check for Plan Mode artifacts
|
|
|
|
|
-ls -la .claude/plan* docs/PLAN.md 2>/dev/null
|
|
|
|
|
|
|
+### Scenario 1: No Plan Exists
|
|
|
|
|
|
|
|
-# Gather git context
|
|
|
|
|
-git status --short
|
|
|
|
|
-git diff --stat
|
|
|
|
|
-git log --oneline -5
|
|
|
|
|
|
|
+```
|
|
|
|
|
+📋 Plan Status
|
|
|
|
|
|
|
|
-# Check conversation for plan-related discussion
|
|
|
|
|
-# (Analyze recent messages for: goals, approaches, decisions, steps)
|
|
|
|
|
|
|
+No plan found at docs/PLAN.md
|
|
|
|
|
+
|
|
|
|
|
+Get started:
|
|
|
|
|
+ /plan "your project goal" Create a new plan
|
|
|
|
|
+ /plan --status View current tasks and git state
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-**Extract from conversation:**
|
|
|
|
|
-- Goal statements ("I want to...", "We need to...")
|
|
|
|
|
-- Approach discussions ("Option A vs B", "We could...")
|
|
|
|
|
-- Decisions made ("Let's go with...", "The best approach is...")
|
|
|
|
|
-- Steps identified ("First... then... finally...")
|
|
|
|
|
-- Open questions ("Should we...", "What about...")
|
|
|
|
|
|
|
+### Scenario 2: Plan Exists, Saved State Available
|
|
|
|
|
|
|
|
-**Git context to capture:**
|
|
|
|
|
-- Uncommitted changes (files, insertions, deletions)
|
|
|
|
|
-- Recent commits that may relate to plan steps
|
|
|
|
|
-- Current branch and status
|
|
|
|
|
|
|
+```
|
|
|
|
|
+📋 Plan Status
|
|
|
|
|
+
|
|
|
|
|
+┌─ Welcome Back ─────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Last saved: 3 hours ago │
|
|
|
|
|
+│ Branch: feature/auth │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ You were working on: │
|
|
|
|
|
+│ ◐ Step 3: Implement OAuth flow │
|
|
|
|
|
+│ Task: Fix callback URL handling │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ Notes: "Stopped at redirect issue" │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+Load previous session? [Y/n]
|
|
|
|
|
+```
|
|
|
|
|
|
|
|
-### Step 1: Check Existing docs/PLAN.md
|
|
|
|
|
|
|
+### Scenario 3: Plan Exists, No Saved State
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-# Read existing plan if present
|
|
|
|
|
-cat docs/PLAN.md 2>/dev/null
|
|
|
|
|
|
|
+```
|
|
|
|
|
+📋 Plan Status
|
|
|
|
|
+
|
|
|
|
|
+┌─ Plan ─────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Goal: Add user authentication with OAuth2 │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ ✓ Step 1: Research OAuth providers │
|
|
|
|
|
+│ ✓ Step 2: Set up Google OAuth app │
|
|
|
|
|
+│ ◐ Step 3: Implement OAuth flow ← CURRENT │
|
|
|
|
|
+│ ○ Step 4: Add token refresh │
|
|
|
|
|
+│ ○ Step 5: Write integration tests │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ Progress: ██████░░░░ 40% (2/5) │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Tasks ────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ ◐ Fix callback URL handling │
|
|
|
|
|
+│ ○ Add token refresh logic │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Git ──────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Branch: feature/auth │
|
|
|
|
|
+│ Uncommitted: 3 files (+45/-12) │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+Suggestions:
|
|
|
|
|
+ → Continue: Fix callback URL handling
|
|
|
|
|
+ → Save before leaving: /plan --save
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Parse structure:
|
|
|
|
|
-- Current goal
|
|
|
|
|
-- Completed steps
|
|
|
|
|
-- In-progress steps
|
|
|
|
|
-- Pending steps
|
|
|
|
|
-- Blockers
|
|
|
|
|
-- Open questions
|
|
|
|
|
-- Decision log
|
|
|
|
|
|
|
+---
|
|
|
|
|
|
|
|
-### Step 2: Merge and Execute
|
|
|
|
|
|
|
+## Create/Update Plan: `/plan "goal"`
|
|
|
|
|
|
|
|
-Combine:
|
|
|
|
|
-1. Captured conversation context
|
|
|
|
|
-2. Existing docs/PLAN.md content
|
|
|
|
|
-3. Git context (uncommitted changes, recent commits)
|
|
|
|
|
-4. New goal/instructions from command
|
|
|
|
|
|
|
+Creates or updates `docs/PLAN.md` with strategic planning.
|
|
|
|
|
|
|
|
-### Step 3: Write docs/PLAN.md
|
|
|
|
|
|
|
+### What It Captures
|
|
|
|
|
+
|
|
|
|
|
+**From conversation:**
|
|
|
|
|
+- Goal statements ("I want to...", "We need to...")
|
|
|
|
|
+- Approach discussions ("Option A vs B")
|
|
|
|
|
+- Decisions made ("Let's go with...")
|
|
|
|
|
+- Steps identified ("First... then...")
|
|
|
|
|
+- Open questions
|
|
|
|
|
+
|
|
|
|
|
+**From git:**
|
|
|
|
|
+- Current branch
|
|
|
|
|
+- Uncommitted changes
|
|
|
|
|
+- Recent commits
|
|
|
|
|
+
|
|
|
|
|
+### Plan Format: `docs/PLAN.md`
|
|
|
|
|
|
|
|
```markdown
|
|
```markdown
|
|
|
# Project Plan
|
|
# Project Plan
|
|
|
|
|
|
|
|
-**Goal**: <primary objective>
|
|
|
|
|
-**Created**: <timestamp>
|
|
|
|
|
-**Last Updated**: <timestamp>
|
|
|
|
|
-**Status**: In Progress | Complete | Blocked
|
|
|
|
|
|
|
+**Goal**: Add user authentication with OAuth2
|
|
|
|
|
+**Created**: 2025-12-13
|
|
|
|
|
+**Last Updated**: 2025-12-13
|
|
|
|
|
+**Status**: In Progress
|
|
|
|
|
|
|
|
## Context
|
|
## Context
|
|
|
|
|
|
|
|
-<Brief description of current state and constraints>
|
|
|
|
|
|
|
+Building OAuth2 authentication for the web app. Need to support Google
|
|
|
|
|
+and GitHub providers initially, with ability to add more later.
|
|
|
|
|
|
|
|
## Approach
|
|
## Approach
|
|
|
|
|
|
|
|
-<High-level strategy chosen and why>
|
|
|
|
|
|
|
+Using JWT tokens with refresh rotation. Chose this over session-based
|
|
|
|
|
+auth for better scalability and API compatibility.
|
|
|
|
|
|
|
|
### Alternatives Considered
|
|
### Alternatives Considered
|
|
|
-- **Option A**: <description> - <why not chosen>
|
|
|
|
|
-- **Option B**: <description> - <why not chosen>
|
|
|
|
|
|
|
+- **Session-based auth**: Simpler but doesn't scale well
|
|
|
|
|
+- **Auth0/Clerk**: Good but adds external dependency
|
|
|
|
|
|
|
|
## Implementation Steps
|
|
## Implementation Steps
|
|
|
|
|
|
|
|
### Completed
|
|
### Completed
|
|
|
-- ✓ Step 1: <description> [S]
|
|
|
|
|
- - Completed: <date>
|
|
|
|
|
- - Commit: `abc123` <commit message>
|
|
|
|
|
- - Notes: <any relevant context>
|
|
|
|
|
|
|
+- ✓ Step 1: Research OAuth providers [S]
|
|
|
|
|
+ - Completed: 2025-12-12
|
|
|
|
|
+ - Commit: `abc123` research: Compare OAuth providers
|
|
|
|
|
+
|
|
|
|
|
+- ✓ Step 2: Set up Google OAuth app [S]
|
|
|
|
|
+ - Completed: 2025-12-12
|
|
|
|
|
+ - Commit: `def456` feat: Add Google OAuth credentials
|
|
|
|
|
|
|
|
### In Progress
|
|
### In Progress
|
|
|
-- ◐ Step 2: <description> [M]
|
|
|
|
|
- - Started: <date>
|
|
|
|
|
- - Depends on: Step 1
|
|
|
|
|
- - Notes: <current status>
|
|
|
|
|
|
|
+- ◐ Step 3: Implement OAuth flow [M]
|
|
|
|
|
+ - Started: 2025-12-13
|
|
|
|
|
+ - Notes: Working on callback URL handling
|
|
|
|
|
|
|
|
### Pending
|
|
### Pending
|
|
|
-- ○ Step 3: <description> [L]
|
|
|
|
|
- - Depends on: Step 2
|
|
|
|
|
-- ○ Step 4: <description> [S]
|
|
|
|
|
-
|
|
|
|
|
-### Blocked
|
|
|
|
|
-- ⚠ Step 5: <description> [M]
|
|
|
|
|
- - Blocker: <what's blocking this>
|
|
|
|
|
- - Waiting on: <person/decision/external>
|
|
|
|
|
|
|
+- ○ Step 4: Add token refresh [S]
|
|
|
|
|
+- ○ Step 5: Write integration tests [M]
|
|
|
|
|
|
|
|
## Uncommitted Changes
|
|
## Uncommitted Changes
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
📊 Working Tree Status:
|
|
📊 Working Tree Status:
|
|
|
- Modified: X files (+Y/-Z lines)
|
|
|
|
|
- Staged: X files
|
|
|
|
|
- Unstaged: X files
|
|
|
|
|
- Untracked: X files
|
|
|
|
|
|
|
+ Modified: 3 files (+127/-45)
|
|
|
|
|
|
|
|
Files:
|
|
Files:
|
|
|
- • path/to/file.ts +89/-12 (staged)
|
|
|
|
|
- • path/to/other.ts +38/-33 (unstaged)
|
|
|
|
|
|
|
+ • src/auth/oauth.ts +89/-12
|
|
|
|
|
+ • src/auth/callback.ts +25/-20
|
|
|
|
|
+ • tests/auth.test.ts +13/-13
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Decision Log
|
|
## Decision Log
|
|
|
|
|
|
|
|
| Date | Decision | Rationale |
|
|
| Date | Decision | Rationale |
|
|
|
|------|----------|-----------|
|
|
|------|----------|-----------|
|
|
|
-| <date> | <what was decided> | <why this choice> |
|
|
|
|
|
|
|
+| 12-12 | Use JWT over sessions | Better API compatibility |
|
|
|
|
|
+| 12-12 | Start with Google only | Largest user base |
|
|
|
|
|
|
|
|
## Blockers
|
|
## Blockers
|
|
|
|
|
|
|
|
-- ⚠ <blocker 1>: <description and what's needed to unblock>
|
|
|
|
|
-- ⚠ <blocker 2>: <description>
|
|
|
|
|
|
|
+None currently.
|
|
|
|
|
|
|
|
## Open Questions
|
|
## Open Questions
|
|
|
|
|
|
|
|
-- ○ <question 1>
|
|
|
|
|
-- ○ <question 2>
|
|
|
|
|
|
|
+- Should we support "Remember me" functionality?
|
|
|
|
|
+- How long should refresh tokens last?
|
|
|
|
|
|
|
|
## Success Criteria
|
|
## Success Criteria
|
|
|
|
|
|
|
|
-- ○ <criterion 1>
|
|
|
|
|
-- ○ <criterion 2>
|
|
|
|
|
|
|
+- [ ] Users can sign in with Google
|
|
|
|
|
+- [ ] Tokens refresh automatically
|
|
|
|
|
+- [ ] 90% test coverage on auth module
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+*Plan managed by `/plan` command. Last captured: 2025-12-13 10:30*
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### Execution Steps
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+# Step 1: Capture git context
|
|
|
|
|
+git branch --show-current
|
|
|
|
|
+git status --short
|
|
|
|
|
+git diff --stat
|
|
|
|
|
+git log --oneline -5
|
|
|
|
|
+
|
|
|
|
|
+# Step 2: Check existing plan
|
|
|
|
|
+cat docs/PLAN.md 2>/dev/null
|
|
|
|
|
|
|
|
-## Directory Structure
|
|
|
|
|
|
|
+# Step 3: Analyze conversation for plan-related content
|
|
|
|
|
+# (Extract goals, decisions, approaches, steps)
|
|
|
|
|
|
|
|
|
|
+# Step 4: Merge and write
|
|
|
|
|
+mkdir -p docs
|
|
|
|
|
+# Write updated docs/PLAN.md
|
|
|
```
|
|
```
|
|
|
-project/
|
|
|
|
|
-├── src/
|
|
|
|
|
-│ ├── core/ # Core functionality
|
|
|
|
|
-│ └── features/ # Feature modules
|
|
|
|
|
-├── tests/
|
|
|
|
|
-├── docs/
|
|
|
|
|
-│ └── PLAN.md # This file
|
|
|
|
|
-└── config/
|
|
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
|
|
+## Save State: `/plan --save "notes"`
|
|
|
|
|
+
|
|
|
|
|
+Persists session state for later restoration.
|
|
|
|
|
+
|
|
|
|
|
+### What It Saves
|
|
|
|
|
+
|
|
|
|
|
+| Data | Source | Destination |
|
|
|
|
|
+|------|--------|-------------|
|
|
|
|
|
+| TodoWrite tasks | Current session | `.claude/session-cache.json` |
|
|
|
|
|
+| Current plan step | `docs/PLAN.md` | `.claude/session-cache.json` |
|
|
|
|
|
+| Git context | `git status/log` | `.claude/session-cache.json` |
|
|
|
|
|
+| User notes | Command argument | `.claude/session-cache.json` |
|
|
|
|
|
+
|
|
|
|
|
+### Output Files
|
|
|
|
|
+
|
|
|
|
|
+**`.claude/session-cache.json`** (machine-readable):
|
|
|
|
|
+```json
|
|
|
|
|
+{
|
|
|
|
|
+ "version": "2.0",
|
|
|
|
|
+ "timestamp": "2025-12-13T10:30:00Z",
|
|
|
|
|
+ "todos": {
|
|
|
|
|
+ "completed": ["Set up OAuth credentials"],
|
|
|
|
|
+ "in_progress": ["Fix callback URL handling"],
|
|
|
|
|
+ "pending": ["Add token refresh"]
|
|
|
|
|
+ },
|
|
|
|
|
+ "plan": {
|
|
|
|
|
+ "file": "docs/PLAN.md",
|
|
|
|
|
+ "goal": "Add user authentication with OAuth2",
|
|
|
|
|
+ "current_step": "Step 3: Implement OAuth flow",
|
|
|
|
|
+ "current_step_index": 3,
|
|
|
|
|
+ "total_steps": 5,
|
|
|
|
|
+ "progress_percent": 40
|
|
|
|
|
+ },
|
|
|
|
|
+ "git": {
|
|
|
|
|
+ "branch": "feature/auth",
|
|
|
|
|
+ "last_commit": "abc123f",
|
|
|
|
|
+ "last_commit_message": "feat: Add OAuth config",
|
|
|
|
|
+ "uncommitted_count": 3
|
|
|
|
|
+ },
|
|
|
|
|
+ "notes": "Stopped at callback URL issue - need to fix redirect"
|
|
|
|
|
+}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Sources & References
|
|
|
|
|
|
|
+**`.claude/claude-progress.md`** (human-readable):
|
|
|
|
|
+```markdown
|
|
|
|
|
+# Session Progress
|
|
|
|
|
+
|
|
|
|
|
+**Saved**: 2025-12-13 10:30 AM
|
|
|
|
|
+**Branch**: feature/auth
|
|
|
|
|
+
|
|
|
|
|
+## Plan Context
|
|
|
|
|
+
|
|
|
|
|
+**Goal**: Add user authentication with OAuth2
|
|
|
|
|
+**Current Step**: ◐ Step 3 - Implement OAuth flow
|
|
|
|
|
+**Progress**: ██████░░░░ 40% (2/5 steps)
|
|
|
|
|
+
|
|
|
|
|
+## Tasks
|
|
|
|
|
|
|
|
-- [Official Documentation](https://example.com/docs)
|
|
|
|
|
-- [API Reference](https://example.com/api)
|
|
|
|
|
-- [Related RFC/Spec](https://example.com/spec)
|
|
|
|
|
|
|
+- ✓ Set up OAuth credentials
|
|
|
|
|
+- ◐ Fix callback URL handling
|
|
|
|
|
+- ○ Add token refresh logic
|
|
|
|
|
|
|
|
## Notes
|
|
## Notes
|
|
|
|
|
|
|
|
-<Additional context, decisions, or observations>
|
|
|
|
|
|
|
+> Stopped at callback URL issue - need to fix redirect
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
-*Plan managed by `/plan` command. Last captured: <timestamp>*
|
|
|
|
|
|
|
+*Restore with: /plan --load*
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+### Output
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+✓ Session saved
|
|
|
|
|
+
|
|
|
|
|
+┌─ Saved State ──────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Plan: Step 3/5 (40%) - Implement OAuth flow │
|
|
|
|
|
+│ Tasks: 1 completed, 1 in progress, 1 pending │
|
|
|
|
|
+│ Git: 3 uncommitted files on feature/auth │
|
|
|
|
|
+│ Notes: "Stopped at callback URL issue..." │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+Files written:
|
|
|
|
|
+ • .claude/session-cache.json
|
|
|
|
|
+ • .claude/claude-progress.md
|
|
|
|
|
+
|
|
|
|
|
+Restore with: /plan --load
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
|
|
+## Load State: `/plan --load`
|
|
|
|
|
+
|
|
|
|
|
+Restores session from previous save.
|
|
|
|
|
+
|
|
|
|
|
+### What It Does
|
|
|
|
|
+
|
|
|
|
|
+1. Reads `.claude/session-cache.json`
|
|
|
|
|
+2. Restores TodoWrite tasks
|
|
|
|
|
+3. Shows what changed since save
|
|
|
|
|
+4. Suggests next action
|
|
|
|
|
+
|
|
|
|
|
+### Output
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+📂 Session Loaded
|
|
|
|
|
+
|
|
|
|
|
+┌─ Time ─────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Saved: 2 hours ago (2025-12-13 10:30 AM) │
|
|
|
|
|
+│ Branch: feature/auth │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Plan Context ─────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Goal: Add user authentication with OAuth2 │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ ✓ Step 1: Research OAuth providers │
|
|
|
|
|
+│ ✓ Step 2: Set up Google OAuth app │
|
|
|
|
|
+│ ◐ Step 3: Implement OAuth flow ← YOU WERE HERE │
|
|
|
|
|
+│ ○ Step 4: Add token refresh │
|
|
|
|
|
+│ ○ Step 5: Write integration tests │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ Progress: ██████░░░░ 40% (2/5) │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Restored Tasks ───────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ ◐ Fix callback URL handling │
|
|
|
|
|
+│ ○ Add token refresh logic │
|
|
|
|
|
+│ ✓ Set up OAuth credentials │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Since Last Save ──────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Commits: 0 new │
|
|
|
|
|
+│ Files: 3 still uncommitted │
|
|
|
|
|
+│ Plan: unchanged │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Notes ────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ "Stopped at callback URL issue - need to fix redirect" │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+→ Continue with: Fix callback URL handling
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### Edge Cases
|
|
|
|
|
+
|
|
|
|
|
+**Stale state (>7 days):**
|
|
|
|
|
+```
|
|
|
|
|
+⚠ Saved state is 12 days old
|
|
|
|
|
+
|
|
|
|
|
+Options:
|
|
|
|
|
+ 1. Load anyway (tasks may still be relevant)
|
|
|
|
|
+ 2. Start fresh: /plan --clear
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+**Branch changed:**
|
|
|
|
|
+```
|
|
|
|
|
+⚠ Branch changed since save
|
|
|
|
|
+
|
|
|
|
|
+Saved on: feature/old-branch
|
|
|
|
|
+Current: feature/new-branch
|
|
|
|
|
+
|
|
|
|
|
+Options:
|
|
|
|
|
+ 1. Load anyway
|
|
|
|
|
+ 2. Switch back: git checkout feature/old-branch
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
|
|
+## Status View: `/plan --status`
|
|
|
|
|
+
|
|
|
|
|
+Quick read-only view of current state.
|
|
|
|
|
+
|
|
|
|
|
+### Output
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+📊 Plan Status
|
|
|
|
|
+
|
|
|
|
|
+┌─ Plan ─────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Goal: Add user authentication with OAuth2 │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ ✓ Step 1: Research OAuth providers [S] │
|
|
|
|
|
+│ ✓ Step 2: Set up Google OAuth app [S] │
|
|
|
|
|
+│ ◐ Step 3: Implement OAuth flow [M] ← CURRENT │
|
|
|
|
|
+│ ○ Step 4: Add token refresh [S] │
|
|
|
|
|
+│ ○ Step 5: Write integration tests [M] │
|
|
|
|
|
+│ │
|
|
|
|
|
+│ Progress: ██████░░░░ 40% (2/5) │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Active Tasks ─────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ ◐ Fix callback URL handling │
|
|
|
|
|
+│ ○ Add token refresh logic │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+
|
|
|
|
|
+┌─ Git ──────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
+│ Branch: feature/auth │
|
|
|
|
|
+│ Uncommitted: 3 files (+45/-12) │
|
|
|
|
|
+│ Recent: abc123f feat: Add OAuth config │
|
|
|
|
|
+└────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
|
|
+## Sync from Git: `/plan --sync`
|
|
|
|
|
+
|
|
|
|
|
+Auto-updates plan step status from recent commits.
|
|
|
|
|
+
|
|
|
|
|
+### How It Works
|
|
|
|
|
+
|
|
|
|
|
+1. Parse recent git commits
|
|
|
|
|
+2. Match commit messages to plan steps
|
|
|
|
|
+3. Update step status in `docs/PLAN.md`
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+# Get recent commits
|
|
|
|
|
+git log --oneline -20
|
|
|
|
|
+
|
|
|
|
|
+# Match patterns like:
|
|
|
|
|
+# "feat: Add OAuth config" → matches Step 2
|
|
|
|
|
+# "fix: Token refresh" → matches Step 4
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### Output
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+🔄 Syncing plan from git...
|
|
|
|
|
+
|
|
|
|
|
+Found matches:
|
|
|
|
|
+ • abc123f "feat: Add OAuth config" → Step 2 (marked complete)
|
|
|
|
|
+ • def456a "fix: Callback handling" → Step 3 (in progress)
|
|
|
|
|
+
|
|
|
|
|
+Updated docs/PLAN.md:
|
|
|
|
|
+ ✓ Step 2: now marked complete
|
|
|
|
|
+ ◐ Step 3: now marked in progress
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
|
|
+## Clear and Archive: `/plan --clear`
|
|
|
|
|
+
|
|
|
|
|
+Archives current plan and starts fresh.
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+/plan --clear "New feature: payment processing"
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### What It Does
|
|
|
|
|
+
|
|
|
|
|
+1. Moves `docs/PLAN.md` → `docs/PLAN-2025-12-13.md`
|
|
|
|
|
+2. Clears `.claude/session-cache.json`
|
|
|
|
|
+3. Creates new plan with provided goal
|
|
|
|
|
+
|
|
|
|
|
+### Output
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+📦 Archived: docs/PLAN.md → docs/PLAN-2025-12-13.md
|
|
|
|
|
+
|
|
|
|
|
+Starting fresh plan...
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
## Status Markers
|
|
## Status Markers
|
|
|
|
|
|
|
|
-| Marker | Meaning | Usage |
|
|
|
|
|
-|--------|---------|-------|
|
|
|
|
|
-| ✓ | Completed | Task finished successfully |
|
|
|
|
|
-| ◐ | In Progress | Currently being worked on |
|
|
|
|
|
-| ○ | Pending | Not yet started |
|
|
|
|
|
-| ⚠ | Blocked | Cannot proceed, needs resolution |
|
|
|
|
|
|
|
+| Marker | Meaning |
|
|
|
|
|
+|--------|---------|
|
|
|
|
|
+| ✓ | Completed |
|
|
|
|
|
+| ◐ | In Progress |
|
|
|
|
|
+| ○ | Pending |
|
|
|
|
|
+| ⚠ | Blocked |
|
|
|
|
|
|
|
|
## Effort Indicators
|
|
## Effort Indicators
|
|
|
|
|
|
|
|
-| Tag | Meaning | Guidance |
|
|
|
|
|
-|-----|---------|----------|
|
|
|
|
|
-| `[S]` | Small | Quick task, minimal complexity |
|
|
|
|
|
-| `[M]` | Medium | Moderate effort, some complexity |
|
|
|
|
|
-| `[L]` | Large | Significant effort, high complexity |
|
|
|
|
|
|
|
+| Tag | Meaning |
|
|
|
|
|
+|-----|---------|
|
|
|
|
|
+| `[S]` | Small - Quick task |
|
|
|
|
|
+| `[M]` | Medium - Moderate effort |
|
|
|
|
|
+| `[L]` | Large - Significant effort |
|
|
|
|
|
|
|
|
-Effort is relative to the project, not absolute time. Avoid time estimates.
|
|
|
|
|
|
|
+Effort is relative to project, not time-based. Avoid time estimates.
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
|
|
|
## Usage Examples
|
|
## Usage Examples
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
-# Create new plan (captures any Plan Mode context first)
|
|
|
|
|
|
|
+# Interactive mode - context-aware suggestions
|
|
|
|
|
+/plan
|
|
|
|
|
+
|
|
|
|
|
+# Create new plan
|
|
|
/plan "Add user authentication with OAuth2"
|
|
/plan "Add user authentication with OAuth2"
|
|
|
|
|
|
|
|
-# Just capture current conversation to plan (no new analysis)
|
|
|
|
|
-/plan --capture
|
|
|
|
|
|
|
+# Save session before leaving
|
|
|
|
|
+/plan --save "Stopped at redirect issue"
|
|
|
|
|
|
|
|
-# Review current plan
|
|
|
|
|
-/plan --review
|
|
|
|
|
|
|
+# Load previous session
|
|
|
|
|
+/plan --load
|
|
|
|
|
|
|
|
-# Update progress on steps
|
|
|
|
|
|
|
+# Quick status check
|
|
|
/plan --status
|
|
/plan --status
|
|
|
|
|
|
|
|
-# Sync status from recent git commits
|
|
|
|
|
|
|
+# Sync progress from git commits
|
|
|
/plan --sync
|
|
/plan --sync
|
|
|
|
|
|
|
|
-# Show what changed since last update
|
|
|
|
|
|
|
+# See what changed
|
|
|
/plan --diff
|
|
/plan --diff
|
|
|
|
|
|
|
|
-# Start fresh (archives old plan)
|
|
|
|
|
-/plan --clear "New feature: payment processing"
|
|
|
|
|
|
|
+# Archive and start fresh
|
|
|
|
|
+/plan --clear "New feature: payments"
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Workflow Integration
|
|
|
|
|
|
|
+---
|
|
|
|
|
|
|
|
-### With Native Plan Mode
|
|
|
|
|
|
|
+## Flags Reference
|
|
|
|
|
|
|
|
-```
|
|
|
|
|
-1. [Shift+Tab] Enter Plan Mode
|
|
|
|
|
-2. [Explore codebase, discuss approaches]
|
|
|
|
|
-3. /plan --capture # Persist the thinking
|
|
|
|
|
-4. [Shift+Tab] Exit Plan Mode
|
|
|
|
|
-5. [Implement]
|
|
|
|
|
-6. /plan --status # Update progress
|
|
|
|
|
-```
|
|
|
|
|
|
|
+| Flag | Effect |
|
|
|
|
|
+|------|--------|
|
|
|
|
|
+| `save "notes"` or `--save` | Save session state with optional notes |
|
|
|
|
|
+| `load` or `--load` | Restore session from saved state |
|
|
|
|
|
+| `status` or `--status` | Quick read-only status view |
|
|
|
|
|
+| `sync` or `--sync` | Auto-update from git commits |
|
|
|
|
|
+| `diff` or `--diff` | Show changes since last update |
|
|
|
|
|
+| `clear` or `--clear` | Archive current plan, start fresh |
|
|
|
|
|
+| `--capture` | Only capture context, no new planning |
|
|
|
|
|
+| `--verbose` | Show detailed operation output |
|
|
|
|
|
|
|
|
-### With /save + /load
|
|
|
|
|
|
|
+---
|
|
|
|
|
|
|
|
-```
|
|
|
|
|
-Session 1:
|
|
|
|
|
- /plan "Feature X" # Strategic planning → docs/PLAN.md
|
|
|
|
|
- [work on implementation]
|
|
|
|
|
- /save "Completed step 2" # Tactical state → session-cache.json
|
|
|
|
|
|
|
+## File Locations
|
|
|
|
|
|
|
|
-Session 2:
|
|
|
|
|
- /load # Restore TodoWrite tasks
|
|
|
|
|
- /plan --review # See the strategy
|
|
|
|
|
- [continue work]
|
|
|
|
|
- /plan --status # Update plan progress
|
|
|
|
|
- /save "Completed step 3"
|
|
|
|
|
-```
|
|
|
|
|
|
|
+| File | Purpose | Git-tracked? |
|
|
|
|
|
+|------|---------|--------------|
|
|
|
|
|
+| `docs/PLAN.md` | Strategic plan | Yes |
|
|
|
|
|
+| `.claude/session-cache.json` | Session state | No (gitignored) |
|
|
|
|
|
+| `.claude/claude-progress.md` | Human-readable progress | No (gitignored) |
|
|
|
|
|
+| `docs/PLAN-<date>.md` | Archived plans | Yes |
|
|
|
|
|
|
|
|
-### Complete Session Continuity
|
|
|
|
|
|
|
+---
|
|
|
|
|
|
|
|
-| Command | Captures | Persists To |
|
|
|
|
|
-|---------|----------|-------------|
|
|
|
|
|
-| `/plan` | Strategic thinking, decisions | `docs/PLAN.md` |
|
|
|
|
|
-| `/save` | TodoWrite tasks, git context | `.claude/session-cache.json` |
|
|
|
|
|
-| `/load` | - | Restores from `.claude/` |
|
|
|
|
|
|
|
+## Workflow Examples
|
|
|
|
|
|
|
|
-## Flags
|
|
|
|
|
|
|
+### Daily Session
|
|
|
|
|
|
|
|
-| Flag | Effect |
|
|
|
|
|
-|------|--------|
|
|
|
|
|
-| `--review` | Display current plan without modifications |
|
|
|
|
|
-| `--status` | Interactive update of step progress |
|
|
|
|
|
-| `--capture` | Only capture conversation context, no new planning |
|
|
|
|
|
-| `--sync` | Auto-update step status from recent git commits |
|
|
|
|
|
-| `--diff` | Show what changed since last plan update |
|
|
|
|
|
-| `--clear` | Archive current plan to `docs/PLAN-<date>.md` and start fresh |
|
|
|
|
|
-| `--verbose` | Show detailed capture/merge process |
|
|
|
|
|
|
|
+```bash
|
|
|
|
|
+# Start of day
|
|
|
|
|
+/plan # Interactive: loads previous state if exists
|
|
|
|
|
|
|
|
-## Output
|
|
|
|
|
|
|
+# During work
|
|
|
|
|
+[implement features]
|
|
|
|
|
+/plan --status # Quick check on progress
|
|
|
|
|
|
|
|
|
|
+# End of day
|
|
|
|
|
+/plan --save "Completed auth, starting tests tomorrow"
|
|
|
```
|
|
```
|
|
|
-🔍 Capturing internal state...
|
|
|
|
|
- ✓ Plan Mode context detected (8 relevant messages)
|
|
|
|
|
- ✓ Existing docs/PLAN.md found (3 steps complete)
|
|
|
|
|
- ✓ Git context captured
|
|
|
|
|
- ✗ No temp plan files
|
|
|
|
|
|
|
|
|
|
-📊 Uncommitted Changes:
|
|
|
|
|
- Modified: 2 files (+127/-45)
|
|
|
|
|
- • src/auth.ts +89/-12
|
|
|
|
|
- • tests/auth.test.ts +38/-33
|
|
|
|
|
|
|
+### With Native Plan Mode
|
|
|
|
|
|
|
|
-📋 Merging sources...
|
|
|
|
|
- → Goal: "Add user authentication with OAuth2"
|
|
|
|
|
- → Approach: JWT tokens with refresh rotation
|
|
|
|
|
- → Progress: 3 complete, 1 in progress, 2 pending
|
|
|
|
|
|
|
+```bash
|
|
|
|
|
+# Enter Plan Mode for exploration
|
|
|
|
|
+[Shift+Tab]
|
|
|
|
|
+
|
|
|
|
|
+# Discuss approaches, make decisions
|
|
|
|
|
+[Explore codebase, discuss options]
|
|
|
|
|
+
|
|
|
|
|
+# Capture the thinking
|
|
|
|
|
+/plan --capture
|
|
|
|
|
|
|
|
-📝 Updated docs/PLAN.md
|
|
|
|
|
|
|
+# Exit and implement
|
|
|
|
|
+[Shift+Tab]
|
|
|
|
|
+```
|
|
|
|
|
|
|
|
-Summary:
|
|
|
|
|
- ✓ Completed: 3 steps
|
|
|
|
|
- ◐ In Progress: 1 step
|
|
|
|
|
- ○ Pending: 2 steps
|
|
|
|
|
- ⚠ Blocked: 0 steps
|
|
|
|
|
- ? Open questions: 2
|
|
|
|
|
- 📋 Decisions: 4 logged
|
|
|
|
|
|
|
+### Multi-Session Feature
|
|
|
|
|
|
|
|
-Review with: /plan --review
|
|
|
|
|
|
|
+```bash
|
|
|
|
|
+# Session 1
|
|
|
|
|
+/plan "Implement payment processing"
|
|
|
|
|
+[work on steps 1-2]
|
|
|
|
|
+/plan --save "Done with Stripe setup"
|
|
|
|
|
+
|
|
|
|
|
+# Session 2
|
|
|
|
|
+/plan --load # Restore context
|
|
|
|
|
+[work on steps 3-4]
|
|
|
|
|
+/plan --sync # Update from commits
|
|
|
|
|
+/plan --save "Payment flow working"
|
|
|
|
|
+
|
|
|
|
|
+# Session 3
|
|
|
|
|
+/plan --load
|
|
|
|
|
+[complete remaining work]
|
|
|
|
|
+/plan --clear "Next: Add subscriptions"
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
## Notes
|
|
## Notes
|
|
|
|
|
|
|
|
-- Always captures internal state first—you can't lose Plan Mode thinking
|
|
|
|
|
-- Archives old plans when using `--clear` (never destructive)
|
|
|
|
|
-- Works across machines if docs/PLAN.md is committed
|
|
|
|
|
-- Pairs with `/save` + `/load` for complete session continuity
|
|
|
|
|
-- Human-readable format works without Claude Code
|
|
|
|
|
-- Git context helps track what's changed since last session
|
|
|
|
|
-- Effort indicators are relative, not time-based
|
|
|
|
|
|
|
+- **Never destructive** - Always archives before clearing
|
|
|
|
|
+- **Git-aware** - Tracks uncommitted changes and recent commits
|
|
|
|
|
+- **Session-aware** - Knows when state is stale
|
|
|
|
|
+- **Human-readable** - Progress files work without Claude Code
|
|
|
|
|
+- **Smart defaults** - No args = intelligent context detection
|