Skip to content

Commit ef4c240

Browse files
authored
Merge pull request #8 from rohitg00/feat/commit-insights-agent-teams
feat: add /commit, /insights and agent teams support
2 parents 7091136 + 31281b4 commit ef4c240

6 files changed

Lines changed: 360 additions & 24 deletions

File tree

README.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55

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

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

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

12-
## What's New in v1.0.0
12+
## What's New in v1.1.0
1313

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

1924
## The Core Idea
2025

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

113120
## Database Features
114121

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

189+
### Agent Teams (Experimental)
190+
191+
Coordinate multiple Claude Code sessions working together:
192+
193+
```bash
194+
# Enable in settings.json
195+
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }
196+
```
197+
198+
- Lead session coordinates, teammates work independently
199+
- Teammates message each other directly
200+
- Shared task list with dependency management
201+
- Display modes: in-process (`Shift+Up/Down`) or split panes (tmux/iTerm2)
202+
- Delegate mode (`Shift+Tab`): lead orchestrates only
203+
- Docs: https://code.claude.com/docs/agent-teams
204+
182205
## Structure
183206
184207
```
@@ -203,12 +226,14 @@ pro-workflow/
203226
│ ├── planner.md # Planner agent
204227
│ └── reviewer.md # Reviewer agent
205228
├── commands/
206-
│ ├── wrap-up.md # Wrap-up command
207-
│ ├── learn-rule.md # Learn rule command
208-
│ ├── parallel.md # Parallel command
229+
│ ├── wrap-up.md
230+
│ ├── learn-rule.md
231+
│ ├── parallel.md
209232
│ ├── learn.md
210-
│ ├── search.md # Search command
211-
│ └── list.md # List command
233+
│ ├── search.md
234+
│ ├── list.md
235+
│ ├── commit.md
236+
│ └── insights.md
212237
├── hooks/
213238
│ └── hooks.json # Hooks file
214239
├── scripts/ # Hook scripts

commands/commit.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# /commit - Smart Commit with Quality Gates
2+
3+
Create a well-crafted commit after running pro-workflow quality checks.
4+
5+
## Process
6+
7+
### 1. Pre-Commit Checks
8+
9+
```bash
10+
git status
11+
git diff --stat
12+
```
13+
14+
- Any unstaged changes to include?
15+
- Any files that shouldn't be committed (.env, credentials, large binaries)?
16+
17+
### 2. Quality Gates
18+
19+
```bash
20+
npm run lint 2>&1 | tail -5
21+
npm run typecheck 2>&1 | tail -5
22+
npm test -- --changed --passWithNoTests 2>&1 | tail -10
23+
```
24+
25+
- All checks passing? If not, fix before committing.
26+
- Skip only if user explicitly says to.
27+
28+
### 3. Code Review
29+
30+
Scan staged changes for:
31+
- `console.log` / `debugger` statements
32+
- TODO/FIXME/HACK comments without tickets
33+
- Hardcoded secrets or API keys
34+
- Leftover test-only code
35+
36+
Flag any issues before proceeding.
37+
38+
### 4. Commit Message
39+
40+
Draft a commit message based on the staged diff:
41+
42+
```
43+
<type>(<scope>): <short summary>
44+
45+
<body - what changed and why>
46+
```
47+
48+
**Types:** feat, fix, refactor, test, docs, chore, perf, ci, style
49+
50+
**Rules:**
51+
- Summary under 72 characters
52+
- Body explains *why*, not *what*
53+
- Reference issue numbers when applicable
54+
- No generic messages ("fix bug", "update code")
55+
56+
### 5. Stage and Commit
57+
58+
```bash
59+
git add <specific files>
60+
git commit -m "<message>"
61+
```
62+
63+
- Stage specific files, not `git add -A`
64+
- Show the commit hash and summary after
65+
66+
### 6. Learning Check
67+
68+
After committing, ask:
69+
- Any learnings from this change to capture?
70+
- Any patterns worth adding to LEARNED?
71+
72+
## Usage
73+
74+
```
75+
/commit
76+
/commit --no-verify
77+
/commit --amend
78+
```
79+
80+
## Options
81+
82+
- **--no-verify**: Skip quality gates (use sparingly)
83+
- **--amend**: Amend the previous commit instead of creating new
84+
- **--push**: Push to remote after commit
85+
86+
## Example Flow
87+
88+
```
89+
> /commit
90+
91+
Pre-commit checks:
92+
Lint: PASS
93+
Types: PASS
94+
Tests: 12/12 PASS
95+
96+
Staged changes:
97+
src/auth/login.ts (+45 -12)
98+
src/auth/session.ts (+8 -3)
99+
100+
Suggested commit:
101+
feat(auth): add rate limiting to login endpoint
102+
103+
Limit login attempts to 5 per IP per 15 minutes using
104+
Redis-backed sliding window. Returns 429 with Retry-After
105+
header when exceeded.
106+
107+
Closes #142
108+
109+
Commit? (y/n)
110+
```
111+
112+
## Related Commands
113+
114+
- `/wrap-up` - Full end-of-session checklist
115+
- `/learn-rule` - Capture a learning after committing
116+
117+
---
118+
119+
**Trigger:** Use when user says "commit", "save changes", "commit this", or is ready to commit after making changes.

commands/insights.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# /insights - Session & Learning Analytics
2+
3+
Surface patterns from your pro-workflow learnings and session history.
4+
5+
## Usage
6+
7+
```
8+
/insights
9+
/insights session
10+
/insights learnings
11+
/insights corrections
12+
```
13+
14+
## What It Shows
15+
16+
### Session Summary
17+
18+
Current session stats:
19+
```
20+
Session Insights
21+
Duration: 47 min
22+
Edits: 23 files modified
23+
Corrections: 2 self-corrections applied
24+
Learnings: 3 new patterns captured
25+
Context: 62% used (safe)
26+
```
27+
28+
### Learning Analytics
29+
30+
Query the learnings database for patterns:
31+
```
32+
Learning Insights (42 total)
33+
34+
Top categories:
35+
Testing 12 learnings (29%)
36+
Navigation 8 learnings (19%)
37+
Git 7 learnings (17%)
38+
Quality 6 learnings (14%)
39+
Editing 5 learnings (12%)
40+
Other 4 learnings (10%)
41+
42+
Most applied:
43+
#12 [Testing] Run tests before commit — 15 times
44+
#8 [Navigation] Confirm path for common names — 11 times
45+
#23 [Git] Use feature branches always — 9 times
46+
47+
Recent learnings (last 7 days):
48+
#42 [Claude-Code] Compact at task boundaries
49+
#41 [Prompting] Include acceptance criteria
50+
#40 [Architecture] Plan before multi-file edits
51+
52+
Stale learnings (never applied):
53+
#15 [Editing] Prefer named exports — 0 times (45 days old)
54+
#19 [Context] Ask before large refactors — 0 times (30 days old)
55+
```
56+
57+
### Correction Patterns
58+
59+
Show what types of mistakes are recurring:
60+
```
61+
Correction Patterns
62+
63+
Most corrected areas:
64+
File navigation 5 corrections
65+
Test coverage 3 corrections
66+
Commit messages 2 corrections
67+
68+
Trend: Navigation errors decreasing (5 → 2 per week)
69+
Trend: Testing corrections stable (1 per week)
70+
71+
Suggestions:
72+
- Add path confirmation rule to CLAUDE.md (3+ corrections)
73+
- Consider /learn-rule for test patterns
74+
```
75+
76+
### Productivity Metrics
77+
78+
```
79+
Productivity (last 10 sessions)
80+
81+
Avg session: 35 min
82+
Avg edits/session: 18
83+
Correction rate: 12% (improving)
84+
Learning capture: 2.1 per session
85+
86+
Best session: 2026-02-01 (28 edits, 0 corrections)
87+
Most productive hour: 10-11am
88+
```
89+
90+
## Options
91+
92+
- **session**: Current session stats only
93+
- **learnings**: Learning database analytics
94+
- **corrections**: Correction pattern analysis
95+
- **all**: Full report (default)
96+
- **--export**: Output as markdown file
97+
98+
## How It Works
99+
100+
1. Reads learnings from `~/.pro-workflow/data.db`
101+
2. Reads session history from the sessions table
102+
3. Aggregates categories, application counts, and trends
103+
4. Identifies stale learnings that may need cleanup
104+
5. Surfaces correction patterns to suggest new rules
105+
106+
## Related Commands
107+
108+
- `/list` - Browse all learnings
109+
- `/search <query>` - Find specific learnings
110+
- `/learn-rule` - Capture a new learning
111+
- `/wrap-up` - End-of-session with learning capture
112+
113+
---
114+
115+
**Trigger:** Use when user asks "show stats", "how am I doing", "what patterns", "analytics", "insights", or wants to understand their learning trajectory.

commands/learn.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,19 @@ Learn Claude Code best practices and capture lessons into persistent memory.
3838
### CLI Shortcuts
3939
| Shortcut | Action |
4040
|----------|--------|
41-
| `Shift+Tab` | Cycle modes |
41+
| `Shift+Tab` | Cycle modes (Normal/Auto-Accept/Plan/Delegate) |
4242
| `Ctrl+L` | Clear screen |
4343
| `Ctrl+C` | Cancel generation |
4444
| `Ctrl+B` | Run task in background |
45+
| `Ctrl+T` | Toggle task list (agent teams) |
46+
| `Shift+Up/Down` | Navigate teammates (agent teams) |
4547
| `Up/Down` | Prompt history |
4648
| `/compact` | Compact context |
4749
| `/context` | Check context usage |
4850
| `/clear` | Clear conversation |
51+
| `/agents` | Manage subagents |
52+
| `/commit` | Smart commit with quality gates |
53+
| `/insights` | Session analytics and patterns |
4954
- **Docs:** https://code.claude.com/docs/cli-reference
5055

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

91+
### Agent Teams (Experimental)
92+
Coordinate multiple Claude Code instances working together as a team.
93+
- Enable: set `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in settings.json or environment.
94+
- One lead session coordinates, teammates work independently with their own context windows.
95+
- Teammates can message each other directly (unlike subagents which only report back).
96+
- Shared task list with self-coordination and dependency management.
97+
- Display modes: in-process (Shift+Up/Down to navigate) or split panes (tmux/iTerm2).
98+
- Delegate mode (Shift+Tab): restricts lead to coordination only.
99+
- Best for: parallel code review, competing hypotheses debugging, cross-layer changes, research.
100+
- Avoid for: sequential tasks, same-file edits, simple operations.
101+
- **Docs:** https://code.claude.com/docs/agent-teams
102+
103+
### Adaptive Thinking
104+
Claude calibrates reasoning depth to each task automatically.
105+
- Lightweight tasks get quick responses, complex tasks get deep analysis.
106+
- No configuration needed - works out of the box with Opus 4.6.
107+
108+
### Context Compaction
109+
Keeps long-running agents from hitting context limits.
110+
- Auto-compacts at ~95% capacity (configurable via `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`).
111+
- Compact manually at task boundaries with `/compact`.
112+
- Custom subagents support auto-compaction independently.
113+
- Use PreCompact hooks to save state before compaction.
114+
82115
### Hooks
83116
Hooks run scripts on events to automate quality enforcement.
84-
- Types: PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, UserPromptSubmit
117+
- Types: PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, UserPromptSubmit, PreCompact, SubagentStart, SubagentStop
85118
- Pro-Workflow ships hooks for edit tracking, quality gates, and learning capture.
119+
- Subagent hooks: define in frontmatter or settings.json for lifecycle events.
86120
- **Docs:** https://code.claude.com/docs/hooks
87121

88122
### Security

0 commit comments

Comments
 (0)