Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@

Battle-tested Claude Code workflows from power users. Self-correcting memory, parallel worktrees, wrap-up rituals, and the 80/20 AI coding ratio.

**v1.0.0: Now with persistent SQLite storage and searchable learnings!**
**v1.1.0: Agent teams, custom subagents, adaptive thinking, smart commit, and session insights!**

**If this helps your workflow, please give it a star!**

## What's New in v1.0.0
## What's New in v1.1.0

- **`/commit`**: Smart commit with quality gates, code review, and learning capture
- **`/insights`**: Session analytics, learning patterns, correction trends, and productivity metrics
- **Agent Teams**: Coordinate multiple Claude Code sessions with shared task lists and inter-agent messaging
- **Custom Subagents**: Create project or user-level subagents with custom tools, memory, and hooks
- **Adaptive Thinking**: Opus 4.6 calibrates reasoning depth per task automatically
- **Context Compaction**: Keep long-running agents alive with auto-compaction and PreCompact hooks
- **Updated Model Selection**: Haiku 4.5, Sonnet 4.5, Opus 4.6 model recommendations
- **Persistent Storage**: Learnings survive reboots in `~/.pro-workflow/data.db`
- **Full-Text Search**: Find past learnings instantly with BM25-powered FTS5
- **Session Analytics**: Track edits, corrections, and prompts per session
- **New Commands**: `/learn`, `/search`, `/list` for database operations

## The Core Idea

Expand Down Expand Up @@ -109,6 +114,8 @@ After plugin install, commands are namespaced:
| `/pro-workflow:learn` | **NEW** Claude Code best practices & save learnings |
| `/pro-workflow:search` | **NEW** Search learnings by keyword |
| `/pro-workflow:list` | **NEW** List all stored learnings |
| `/pro-workflow:commit` | **NEW** Smart commit with quality gates and code review |
| `/pro-workflow:insights` | **NEW** Session analytics and learning patterns |

## Database Features

Expand Down Expand Up @@ -179,6 +186,22 @@ cp -r /tmp/pw/commands/* ~/.claude/commands/
| planner | Break down complex tasks |
| reviewer | Code review, security audit |

### Agent Teams (Experimental)

Coordinate multiple Claude Code sessions working together:

```bash
# Enable in settings.json
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }
```

- Lead session coordinates, teammates work independently
- Teammates message each other directly
- Shared task list with dependency management
- Display modes: in-process (`Shift+Up/Down`) or split panes (tmux/iTerm2)
- Delegate mode (`Shift+Tab`): lead orchestrates only
- Docs: https://code.claude.com/docs/agent-teams

## Structure

```
Expand All @@ -203,12 +226,14 @@ pro-workflow/
│ ├── planner.md # Planner agent
│ └── reviewer.md # Reviewer agent
├── commands/
│ ├── wrap-up.md # Wrap-up command
│ ├── learn-rule.md # Learn rule command
│ ├── parallel.md # Parallel command
│ ├── wrap-up.md
│ ├── learn-rule.md
│ ├── parallel.md
│ ├── learn.md
│ ├── search.md # Search command
│ └── list.md # List command
│ ├── search.md
│ ├── list.md
│ ├── commit.md
│ └── insights.md
├── hooks/
│ └── hooks.json # Hooks file
├── scripts/ # Hook scripts
Expand Down
119 changes: 119 additions & 0 deletions commands/commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# /commit - Smart Commit with Quality Gates

Create a well-crafted commit after running pro-workflow quality checks.

## Process

### 1. Pre-Commit Checks

```bash
git status
git diff --stat
```

- Any unstaged changes to include?
- Any files that shouldn't be committed (.env, credentials, large binaries)?

### 2. Quality Gates

```bash
npm run lint 2>&1 | tail -5
npm run typecheck 2>&1 | tail -5
npm test -- --changed --passWithNoTests 2>&1 | tail -10
```

- All checks passing? If not, fix before committing.
- Skip only if user explicitly says to.

### 3. Code Review

Scan staged changes for:
- `console.log` / `debugger` statements
- TODO/FIXME/HACK comments without tickets
- Hardcoded secrets or API keys
- Leftover test-only code

Flag any issues before proceeding.

### 4. Commit Message

Draft a commit message based on the staged diff:

```
<type>(<scope>): <short summary>

<body - what changed and why>
```

**Types:** feat, fix, refactor, test, docs, chore, perf, ci, style

**Rules:**
- Summary under 72 characters
- Body explains *why*, not *what*
- Reference issue numbers when applicable
- No generic messages ("fix bug", "update code")

### 5. Stage and Commit

```bash
git add <specific files>
git commit -m "<message>"
```

- Stage specific files, not `git add -A`
- Show the commit hash and summary after

### 6. Learning Check

After committing, ask:
- Any learnings from this change to capture?
- Any patterns worth adding to LEARNED?

## Usage

```
/commit
/commit --no-verify
/commit --amend
```

## Options

- **--no-verify**: Skip quality gates (use sparingly)
- **--amend**: Amend the previous commit instead of creating new
- **--push**: Push to remote after commit

## Example Flow

```
> /commit

Pre-commit checks:
Lint: PASS
Types: PASS
Tests: 12/12 PASS

Staged changes:
src/auth/login.ts (+45 -12)
src/auth/session.ts (+8 -3)

Suggested commit:
feat(auth): add rate limiting to login endpoint

Limit login attempts to 5 per IP per 15 minutes using
Redis-backed sliding window. Returns 429 with Retry-After
header when exceeded.

Closes #142

Commit? (y/n)
```

## Related Commands

- `/wrap-up` - Full end-of-session checklist
- `/learn-rule` - Capture a learning after committing

---

**Trigger:** Use when user says "commit", "save changes", "commit this", or is ready to commit after making changes.
115 changes: 115 additions & 0 deletions commands/insights.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# /insights - Session & Learning Analytics

Surface patterns from your pro-workflow learnings and session history.

## Usage

```
/insights
/insights session
/insights learnings
/insights corrections
```

## What It Shows

### Session Summary

Current session stats:
```
Session Insights
Duration: 47 min
Edits: 23 files modified
Corrections: 2 self-corrections applied
Learnings: 3 new patterns captured
Context: 62% used (safe)
```

### Learning Analytics

Query the learnings database for patterns:
```
Learning Insights (42 total)

Top categories:
Testing 12 learnings (29%)
Navigation 8 learnings (19%)
Git 7 learnings (17%)
Quality 6 learnings (14%)
Editing 5 learnings (12%)
Other 4 learnings (10%)

Most applied:
#12 [Testing] Run tests before commit — 15 times
#8 [Navigation] Confirm path for common names — 11 times
#23 [Git] Use feature branches always — 9 times

Recent learnings (last 7 days):
#42 [Claude-Code] Compact at task boundaries
#41 [Prompting] Include acceptance criteria
#40 [Architecture] Plan before multi-file edits

Stale learnings (never applied):
#15 [Editing] Prefer named exports — 0 times (45 days old)
#19 [Context] Ask before large refactors — 0 times (30 days old)
```

### Correction Patterns

Show what types of mistakes are recurring:
```
Correction Patterns

Most corrected areas:
File navigation 5 corrections
Test coverage 3 corrections
Commit messages 2 corrections

Trend: Navigation errors decreasing (5 → 2 per week)
Trend: Testing corrections stable (1 per week)

Suggestions:
- Add path confirmation rule to CLAUDE.md (3+ corrections)
- Consider /learn-rule for test patterns
```

### Productivity Metrics

```
Productivity (last 10 sessions)

Avg session: 35 min
Avg edits/session: 18
Correction rate: 12% (improving)
Learning capture: 2.1 per session

Best session: 2026-02-01 (28 edits, 0 corrections)
Most productive hour: 10-11am
```

## Options

- **session**: Current session stats only
- **learnings**: Learning database analytics
- **corrections**: Correction pattern analysis
- **all**: Full report (default)
- **--export**: Output as markdown file

## How It Works

1. Reads learnings from `~/.pro-workflow/data.db`
2. Reads session history from the sessions table
3. Aggregates categories, application counts, and trends
4. Identifies stale learnings that may need cleanup
5. Surfaces correction patterns to suggest new rules

## Related Commands

- `/list` - Browse all learnings
- `/search <query>` - Find specific learnings
- `/learn-rule` - Capture a new learning
- `/wrap-up` - End-of-session with learning capture

---

**Trigger:** Use when user asks "show stats", "how am I doing", "what patterns", "analytics", "insights", or wants to understand their learning trajectory.
38 changes: 36 additions & 2 deletions commands/learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,19 @@ Learn Claude Code best practices and capture lessons into persistent memory.
### CLI Shortcuts
| Shortcut | Action |
|----------|--------|
| `Shift+Tab` | Cycle modes |
| `Shift+Tab` | Cycle modes (Normal/Auto-Accept/Plan/Delegate) |
| `Ctrl+L` | Clear screen |
| `Ctrl+C` | Cancel generation |
| `Ctrl+B` | Run task in background |
| `Ctrl+T` | Toggle task list (agent teams) |
| `Shift+Up/Down` | Navigate teammates (agent teams) |
| `Up/Down` | Prompt history |
| `/compact` | Compact context |
| `/context` | Check context usage |
| `/clear` | Clear conversation |
| `/agents` | Manage subagents |
| `/commit` | Smart commit with quality gates |
| `/insights` | Session analytics and patterns |
- **Docs:** https://code.claude.com/docs/cli-reference

### Prompting
Expand Down Expand Up @@ -76,13 +81,42 @@ Subagents run in separate context windows for parallel work.
- Use for: parallel exploration, background tasks, independent research.
- Avoid for: single-file reads, tasks needing conversation context.
- Press `Ctrl+B` to send tasks to background.
- Create custom subagents in `.claude/agents/` (project) or `~/.claude/agents/` (user).
- Subagents support: custom tools, permission modes, persistent memory, hooks, and skill preloading.
- Built-in subagents: Explore (fast read-only), Plan (research), general-purpose (multi-step).
- Use `/agents` to manage subagents interactively.
- **Docs:** https://code.claude.com/docs/sub-agents
- **Pattern:** Parallel Worktrees (Pattern 2)

### Agent Teams (Experimental)
Coordinate multiple Claude Code instances working together as a team.
- Enable: set `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in settings.json or environment.
- One lead session coordinates, teammates work independently with their own context windows.
- Teammates can message each other directly (unlike subagents which only report back).
- Shared task list with self-coordination and dependency management.
- Display modes: in-process (Shift+Up/Down to navigate) or split panes (tmux/iTerm2).
- Delegate mode (Shift+Tab): restricts lead to coordination only.
- Best for: parallel code review, competing hypotheses debugging, cross-layer changes, research.
- Avoid for: sequential tasks, same-file edits, simple operations.
- **Docs:** https://code.claude.com/docs/agent-teams

### Adaptive Thinking
Claude calibrates reasoning depth to each task automatically.
- Lightweight tasks get quick responses, complex tasks get deep analysis.
- No configuration needed - works out of the box with Opus 4.6.

### Context Compaction
Keeps long-running agents from hitting context limits.
- Auto-compacts at ~95% capacity (configurable via `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`).
- Compact manually at task boundaries with `/compact`.
- Custom subagents support auto-compaction independently.
- Use PreCompact hooks to save state before compaction.

### Hooks
Hooks run scripts on events to automate quality enforcement.
- Types: PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, UserPromptSubmit
- Types: PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, UserPromptSubmit, PreCompact, SubagentStart, SubagentStop
- Pro-Workflow ships hooks for edit tracking, quality gates, and learning capture.
- Subagent hooks: define in frontmatter or settings.json for lifecycle events.
- **Docs:** https://code.claude.com/docs/hooks

### Security
Expand Down
Loading