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
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pro-workflow",
"version": "1.2.0",
"version": "1.3.0",
"description": "Battle-tested Claude Code workflows with persistent storage and searchable learnings. Self-correcting memory, parallel worktrees, wrap-up rituals, and the 80/20 AI coding ratio.",
"author": {
"name": "Rohit Ghumare",
Expand Down
27 changes: 27 additions & 0 deletions .claude-plugin/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(npm run lint)",
"Bash(npm run typecheck)",
"Bash(npm test)",
"Bash(npm test -- *)",
"Bash(pnpm run lint)",
"Bash(pnpm run typecheck)",
"Bash(pnpm test)",
"Bash(pnpm test -- *)",
"Bash(yarn lint)",
"Bash(yarn typecheck)",
"Bash(yarn test)",
"Bash(yarn test -- *)",
"Bash(pytest)",
"Bash(pytest *)",
"Bash(go test ./...)",
"Bash(go test *)",
"Bash(git worktree *)",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

"Bash(git worktree *)" pre-approves all worktree subcommands, including destructive ones.

The wildcard permits git worktree add <arbitrary-path>, git worktree remove, and git worktree prune --expire now without user confirmation. This is intentional for the parallel-worktrees workflow, but consumers of this template who don't use native worktrees may want to scope it to just git worktree list and git worktree add. Worth documenting the intentional breadth in a comment or the README so adopters can make an informed choice.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude-plugin/settings.json at line 21, The current pre-approval entry
"Bash(git worktree *)" grants all worktree subcommands (including destructive
ones); replace it with more specific entries (e.g., "Bash(git worktree list)",
"Bash(git worktree add *") and optionally "Bash(git worktree remove)" only if
intended, or keep the wildcard but add an inline comment explaining the
intentional breadth for parallel-worktrees; update the settings.json entry (the
exact string "Bash(git worktree *)") and add a short note in the README
clarifying the security tradeoff so adopters can opt to restrict or accept the
broader pattern.

"Bash(git status)",
"Bash(git diff *)",
"Bash(git log *)"
]
}
}
2 changes: 1 addition & 1 deletion .cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pro-workflow",
"displayName": "Pro Workflow",
"version": "1.2.0",
"version": "1.3.0",
"description": "Battle-tested AI coding workflows from power users. Self-correcting memory, parallel worktrees, wrap-up rituals, quality gates, and the 80/20 AI coding ratio. Distilled from real production use.",
"author": {
"name": "Rohit Ghumare",
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ This skill optimizes for that ratio. Every pattern reduces correction cycles.
| Pattern | What It Does |
|---------|--------------|
| **Self-Correction Loop** | Claude learns from your corrections automatically |
| **Parallel Worktrees** | Zero dead time - work while Claude thinks |
| **Parallel Worktrees** | Zero dead time - native `claude -w` worktrees |
| **Wrap-Up Ritual** | End sessions with intention, capture learnings |
| **Split Memory** | Modular CLAUDE.md for complex projects |
| **80/20 Review** | Batch reviews at checkpoints |
| **Model Selection** | Opus+Thinking for one-shot accuracy |
| **Model Selection** | Opus 4.6 adaptive thinking, Sonnet 4.6 (1M context) |
| **Context Discipline** | Manage your 200k token budget |
| **Learning Log** | Auto-document insights |

Expand Down Expand Up @@ -178,10 +178,11 @@ Automated enforcement of workflow patterns.
| PreToolUse | Before git commit/push | Remind about quality gates, wrap-up |
| PostToolUse | After code edits | Check for console.log, TODOs, secrets |
| PostToolUse | After tests | Suggest [LEARN] from failures |
| UserPromptSubmit | Each prompt |Drift detection — warns when straying from original intent |
| UserPromptSubmit | Each prompt | Drift detection — warns when straying from original intent |
| SessionStart | New session | Load learnings from database |
| Stop | Each response | Periodic wrap-up reminders |
| Stop | Each response | Context-aware reminders using `last_assistant_message` |
| SessionEnd | Session close | Save session stats to database |
| ConfigChange | Settings modified | Detect when quality gates or hooks are changed mid-session |

### Install Hooks

Expand All @@ -205,7 +206,7 @@ cp -r /tmp/pw/commands/* ~/.claude/commands/
|-------|---------|
| planner | Break down complex tasks |
| reviewer | Code review, security audit |
| scout |Confidence-gated exploration before implementation |
| scout | Background confidence-gated exploration with worktree isolation |

### Agent Teams (Experimental)

Expand All @@ -219,7 +220,7 @@ Coordinate multiple Claude Code sessions working together:
- 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)
- Display modes: in-process (`Shift+Down` to navigate, wraps around) or split panes (tmux/iTerm2)
- Delegate mode (`Shift+Tab`): lead orchestrates only
- Docs: https://code.claude.com/docs/agent-teams

Expand All @@ -230,6 +231,7 @@ pro-workflow/
├── .claude-plugin/ # Claude Code plugin
│ ├── plugin.json
│ ├── marketplace.json
│ ├── settings.json # Default permissions for quality gates
│ └── README.md
├── .cursor-plugin/ # Cursor plugin
│ └── plugin.json
Expand Down Expand Up @@ -265,7 +267,7 @@ pro-workflow/
│ └── ...
├── hooks/ # Claude Code hooks
│ └── hooks.json
├── scripts/ # Hook scripts
├── scripts/ # Hook scripts (includes config-watcher.js)
├── contexts/ # Context modes
│ ├── dev.md
│ ├── review.md
Expand Down
5 changes: 5 additions & 0 deletions agents/scout.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
name: scout
description: Confidence-gated exploration that assesses readiness before implementation. Scores 0-100 across five dimensions and gives GO/HOLD verdict.
tools: ["Read", "Glob", "Grep", "Bash"]
background: true
isolation: worktree
---

# Scout - Confidence-Gated Exploration

Assess whether there's enough context to implement a task confidently.

Runs in the background so you can continue working while it explores.

## Trigger

Use before starting implementation of unfamiliar or complex tasks.
Expand Down Expand Up @@ -52,3 +56,4 @@ VERDICT: GO / HOLD
- Never edit files. Read-only exploration.
- Be honest about gaps. A false GO wastes more time than a HOLD.
- Re-score after gathering context. If still < 70 after 2 rounds, escalate to user.
- Runs in isolated worktree to avoid interfering with main session.
43 changes: 36 additions & 7 deletions commands/learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Learn Claude Code best practices and capture lessons into persistent memory.
- Context window is finite (200k tokens). Use `/context` to check usage.
- Use `/compact` at task boundaries — after planning, after a feature, when >70%.
- Don't compact mid-task. You lose working context.
- Plan mode now survives compaction (fixed in 2.1.49).
- **Docs:** https://code.claude.com/docs/common-workflows
- **Pattern:** Context Discipline (Pattern 7)

Expand All @@ -30,6 +31,7 @@ Learn Claude Code best practices and capture lessons into persistent memory.
- **Normal** — Claude asks before edits (default)
- **Auto-Accept** — Claude edits without asking (trusted iteration)
- **Plan** — Research first, then propose plan (complex tasks)
- **Simple** — Bash + Edit tools only (lightweight, no extra overhead)
- Use Plan mode when: >3 files, architecture decisions, multiple approaches, unclear requirements.
- Toggle with `Shift+Tab`.
- **Docs:** https://code.claude.com/docs/common-workflows
Expand All @@ -38,21 +40,30 @@ Learn Claude Code best practices and capture lessons into persistent memory.
### CLI Shortcuts
| Shortcut | Action |
|----------|--------|
| `Shift+Tab` | Cycle modes (Normal/Auto-Accept/Plan/Delegate) |
| `Shift+Tab` | Cycle modes (Normal/Auto-Accept/Plan) |
| `Ctrl+L` | Clear screen |
| `Ctrl+C` | Cancel generation |
| `Ctrl+B` | Run task in background |
| `Ctrl+F` | Kill all background agents (two-press confirmation) |
| `Ctrl+T` | Toggle task list (agent teams) |
| `Shift+Up/Down` | Navigate teammates (agent teams) |
| `Shift+Down` | Navigate teammates (wraps around) |
| `Up/Down` | Prompt history |
| `/compact` | Compact context |
| `/context` | Check context usage |
| `/clear` | Clear conversation |
| `/agents` | Manage subagents |
| `/model` | Switch models |
| `/commit` | Smart commit with quality gates |
| `/insights` | Session analytics and patterns |
- **Docs:** https://code.claude.com/docs/cli-reference
Comment on lines 57 to 58
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix markdownlint MD058: add a blank line after the CLI shortcuts table.

The static analysis tool reports that the table ending at line 57 is not followed by a blank line before the - **Docs:** bullet at line 58.

🔧 Proposed fix
 | `/insights` | Session analytics and patterns |
+
 - **Docs:** https://code.claude.com/docs/cli-reference
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `/insights` | Session analytics and patterns |
- **Docs:** https://code.claude.com/docs/cli-reference
| `/insights` | Session analytics and patterns |
- **Docs:** https://code.claude.com/docs/cli-reference
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 57-57: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commands/learn.md` around lines 57 - 58, The Markdown table ending with the
CLI shortcuts row is not followed by a blank line, triggering markdownlint
MD058; fix by inserting a single blank line between the table (the row
containing `/insights | Session analytics and patterns`) and the following
bullet line (`- **Docs:** https://code.claude.com/docs/cli-reference`) so the
table is separated from the list.


### Worktrees
Native worktree support (2.1.49+):
```bash
claude --worktree # or claude -w
```
Creates an isolated git worktree automatically. Subagents support `isolation: worktree` in frontmatter.

### Prompting
Good prompts have four parts:
1. **Scope** — What files/area to work in
Expand Down Expand Up @@ -81,8 +92,11 @@ 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.
- Press `Ctrl+F` to kill all background agents (two-press confirmation).
- ESC cancels the main thread only; background agents keep running.
- Create custom subagents in `.claude/agents/` (project) or `~/.claude/agents/` (user).
- Subagents support: custom tools, permission modes, persistent memory, hooks, and skill preloading.
- Subagents support: custom tools, permission modes, persistent memory, hooks, skill preloading, and **worktree isolation**.
- Agent definitions support `background: true` to always run as background tasks.
- 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
Expand All @@ -94,8 +108,8 @@ Coordinate multiple Claude Code instances working together as a team.
- 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.
- Display modes: in-process (`Shift+Down` to navigate, wraps around) 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
Expand All @@ -104,21 +118,35 @@ Coordinate multiple Claude Code instances working together as a team.
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.
- Extended thinking is built-in — no need to toggle a separate mode.

### Model Selection
- **Sonnet 4.5 with 1M context has been retired** — switch to Sonnet 4.6 (now has 1M context) via `/model`.
- Opus 4.6 has adaptive thinking built-in.
- Use Haiku 4.5 for quick, read-only exploration subagents.

### 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.
- Plan mode now survives compaction (2.1.49 fix).

### Hooks
Hooks run scripts on events to automate quality enforcement.
- Types: PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, UserPromptSubmit, PreCompact, SubagentStart, SubagentStop
- Pro-Workflow ships hooks for edit tracking, quality gates, and learning capture.
- Types: PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, UserPromptSubmit, PreCompact, SubagentStart, SubagentStop, **ConfigChange**, Notification
- **ConfigChange** (2.1.49+): fires when settings files change mid-session — useful for security auditing.
- **Stop hook** now receives `last_assistant_message` for context-aware reminders.
- Pro-Workflow ships hooks for edit tracking, quality gates, config monitoring, and learning capture.
- Subagent hooks: define in frontmatter or settings.json for lifecycle events.
- **Docs:** https://code.claude.com/docs/hooks

### Plugins
- Plugins can ship `settings.json` for default permission configuration (2.1.49+).
- Pro-Workflow ships default permissions for quality gate commands (lint, test, typecheck).
- **Docs:** https://code.claude.com/docs/plugins

### Security
- Review permission requests carefully.
- Don't auto-approve shell commands you don't understand.
Expand All @@ -130,6 +158,7 @@ Hooks run scripts on events to automate quality enforcement.
- Keep <10 MCPs enabled, <80 tools total.
- Disable MCPs you're not actively using.
- Each MCP adds context overhead.
- MCP auth failures are now cached to avoid repeated connection attempts.
- **Docs:** https://code.claude.com/docs/mcp

### Integration
Expand Down
54 changes: 39 additions & 15 deletions commands/parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,78 @@

Set up parallel Claude Code sessions using git worktrees.

## Native Worktree Mode (Claude Code 2.1.49+)

Claude Code now has built-in worktree support:

```bash
claude --worktree
claude -w
```

This creates an isolated git worktree automatically and runs Claude inside it. No manual setup needed.

### Subagent Worktree Isolation

Subagents can also run in isolated worktrees:

```yaml
# In .claude/agents/my-agent.md frontmatter
isolation: worktree
```

This gives each subagent its own working copy, preventing file conflicts.

## Current State

```bash
git worktree list
```

## Create Worktree
## Manual Worktree Setup

For cases where you want more control:

```bash
# For a new feature
git worktree add ../[project]-feat [branch-name]

# For a bugfix
git worktree add ../[project]-fix [branch-name]

# For exploration
git worktree add ../[project]-exp -b experiment
```

## Usage Pattern

```
Terminal 1: ~/project → Main work
Terminal 2: ~/project-feat → Feature development
Terminal 3: ~/project-fix → Bug fixes
Terminal 1: ~/project → Main work (or `claude`)
Terminal 2: ~/project-feat → claude --worktree (auto-isolated)
Terminal 3: ~/project-fix → claude -w (shorthand)
```

Each worktree runs its own Claude session independently.

## When to Use

| Scenario | Action |
|----------|--------|
| Scenario | Recommended Approach |
|----------|---------------------|
| Quick parallel task | `claude -w` (auto worktree) |
| Tests running | Start feature in worktree |
| Long build | Debug in parallel |
| Exploring approaches | Compare 2-3 simultaneously |
| Review + new work | Reviewer in one, dev in other |
| Background exploration | Subagent with `isolation: worktree` |

## Managing Background Agents

- `Ctrl+F` — Kill all background agents (two-press confirmation)
- `Ctrl+B` — Send current task to background
- Background agents continue running when you press ESC

## Cleanup

```bash
# Remove worktree when done
git worktree remove ../[project]-feat

# Clean stale references
git worktree prune
```

---

**Tip:** "Like having a dev team you can clone" - zero dead time.
**Tip:** `claude -w` is the fastest way to parallelize. Like having a dev team you can clone.
10 changes: 6 additions & 4 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
},
"parallel_sessions": {
"suggest_worktrees": true,
"worktree_prefix": "../"
"worktree_prefix": "../",
"native_worktree": true
},
"model_preferences": {
"quick_fixes": "sonnet",
"quick_fixes": "haiku",
"features": "sonnet",
"refactors": "opus",
"architecture": "opus-thinking",
"debugging": "opus-thinking"
"architecture": "opus",
"debugging": "opus"
}
}
14 changes: 13 additions & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/session-check.js\""
}
],
"description": "Periodic wrap-up reminder and learning prompt"
"description": "Context-aware wrap-up reminders using last_assistant_message"
},
{
"matcher": "*",
Expand Down Expand Up @@ -135,6 +135,18 @@
"description": "Save context state before compaction"
}
],
"ConfigChange": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/config-watcher.js\""
}
],
"description": "Detect when quality gates or hooks are modified mid-session"
}
],
"Notification": [
{
"matcher": "*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pro-workflow",
"version": "1.2.0",
"version": "1.3.0",
"description": "Battle-tested Claude Code workflows with agent teams, smart commit, insights, and searchable learnings",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Loading