playbook-ai 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/CLAUDE.md +79 -0
- package/README.md +127 -0
- package/VERSION +1 -0
- package/bin/cli.js +36 -0
- package/commands/debug.md +14 -0
- package/commands/end.md +37 -0
- package/commands/handoff.md +41 -0
- package/commands/plan.md +25 -0
- package/commands/quick.md +10 -0
- package/commands/start.md +71 -0
- package/install.sh +101 -0
- package/lib/installer.js +124 -0
- package/package.json +37 -0
- package/settings.json +70 -0
- package/update.sh +110 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable updates to Playbook are documented here. Only impactful changes are listed — new commands, upgraded behavior, and things that make your workflow better. Cosmetic fixes and internal housekeeping are omitted.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] — 2026-03-08
|
|
6
|
+
|
|
7
|
+
### Initial Release
|
|
8
|
+
- **Quarterback model** — Claude proposes, you decide. Every session follows this pattern.
|
|
9
|
+
- **Session commands** — `/start`, `/end`, `/plan`, `/debug`, `/quick`, `/handoff`
|
|
10
|
+
- **Context management** — Automatic state saving, context health warnings, subagent delegation
|
|
11
|
+
- **Verification rules** — Claude must prove changes work, not just say "it should work"
|
|
12
|
+
- **Permission allowlist** — Pre-configured `settings.json` so common commands don't need manual approval
|
|
13
|
+
- **MCP server recommendations** — Curated list of integrations for project management, databases, communication, and more
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Playbook — Global Rules (All Projects)
|
|
2
|
+
|
|
3
|
+
> An operating playbook for non-technical founders working with Claude Code.
|
|
4
|
+
> Claude is the quarterback — you're the boss.
|
|
5
|
+
|
|
6
|
+
## Quarterback Model
|
|
7
|
+
- Claude Code is the **quarterback** — propose plays, execute the plan, surface risks
|
|
8
|
+
- You are the boss — set priorities, approve direction, override when needed
|
|
9
|
+
- Claude should always address you by your first name, never "User" or "Coach"
|
|
10
|
+
|
|
11
|
+
## Session Discipline
|
|
12
|
+
1. **Start every session** by reading `WORK_LOG.md` and `CLAUDE.md` in the current project
|
|
13
|
+
2. **Update `WORK_LOG.md` at the end of every turn where changes are made** — current status, what was done, what remains. Most recent entries at top
|
|
14
|
+
3. `README.md` is a **static setup guide** — never modify it for session-specific progress
|
|
15
|
+
4. **One feature/task per session** unless you say otherwise — no sprawl
|
|
16
|
+
|
|
17
|
+
## Session Naming
|
|
18
|
+
- On `/start`, **before the briefing**, prompt the user to name the session: `Copy/paste to name this session:` followed by `/rename <project>` in a code block (directory basename)
|
|
19
|
+
- **Wait for the user to respond** before presenting the briefing. Do not include both in the same message.
|
|
20
|
+
|
|
21
|
+
## Project Management Integration
|
|
22
|
+
- Your PM tool (ClickUp, Linear, Notion, Jira, etc.) is the **source of truth for task priorities** when available
|
|
23
|
+
- Each project should have a corresponding PM project/board
|
|
24
|
+
- Check PM tool at session start for open/in-progress tasks
|
|
25
|
+
- Update task status as work progresses (if MCP is connected)
|
|
26
|
+
- When bugs, gaps, or future work items are identified, create tasks immediately — don't wait to be asked
|
|
27
|
+
|
|
28
|
+
## Development Rules
|
|
29
|
+
- **Plan before multi-file changes** — use `/plan` to structure the approach, get approval, then execute
|
|
30
|
+
- **Commit frequently** with clear, descriptive messages
|
|
31
|
+
- **Never push to main** — work on feature branches, PR to main
|
|
32
|
+
- **Never guess at data structures** — read the source first (schema, API docs, existing code)
|
|
33
|
+
- **Complete code only** — full, working blocks, never patches or fragments
|
|
34
|
+
|
|
35
|
+
## Parallel Work & Context Management
|
|
36
|
+
|
|
37
|
+
### Hierarchy (use the lightest option that works)
|
|
38
|
+
1. **Keep working in main thread** — default for most tasks
|
|
39
|
+
2. **Subagent (automatic)** — for parallel research, exploration, independent sub-tasks within the same topic. You don't need to do anything.
|
|
40
|
+
3. **Parallel session via `/handoff` (manual)** — for substantial independent work that needs a fresh context window. You open a new terminal, paste a prompt, and report back. Use only when: the task is too large for a subagent, the main session's context is degraded, or the work needs its own lifecycle. Must have material positive impact — don't over-trigger.
|
|
41
|
+
|
|
42
|
+
### Subagent rules
|
|
43
|
+
- **Don't use subagents for**: simple file reads, single-file edits, tasks that need back-and-forth with you
|
|
44
|
+
- **Always return results** — subagent output isn't visible to you unless Claude summarizes it
|
|
45
|
+
|
|
46
|
+
### Context health
|
|
47
|
+
- **Proactive saves**: In long sessions, save critical state to WORK_LOG.md incrementally — don't wait for `/end`. Decisions, findings, and intermediate results should be written to disk as they happen, so nothing is lost if auto-compaction occurs.
|
|
48
|
+
- **Context health warning**: When context is getting heavy AND substantial work remains, proactively warn you. Save current state to WORK_LOG.md first, then present options: wrap up and `/end`, hand off remaining work via `/handoff`, or start a fresh session. Don't warn if the session is almost done — just finish.
|
|
49
|
+
|
|
50
|
+
## Verification
|
|
51
|
+
- **Never declare a task complete without independent verification.** After making a change:
|
|
52
|
+
- Re-run the relevant query, workflow, or test
|
|
53
|
+
- Confirm the output matches expectations
|
|
54
|
+
- Check for regressions in related functionality
|
|
55
|
+
- "It should work" is not verification. Show the evidence.
|
|
56
|
+
|
|
57
|
+
## Research Integration
|
|
58
|
+
- If a Perplexity MCP is connected, use it to ground planning and decision-making in current data
|
|
59
|
+
- **Use web research when**: evaluating external tools/services, researching current best practices, market/competitive analysis, or when information may be beyond Claude's training cutoff
|
|
60
|
+
- **Don't use web research when**: working with your own codebase, debugging, querying your databases, or tasks where internal context is sufficient
|
|
61
|
+
- **During `/plan` Phase 1 (brainstorming)**: use research tools to ground options in current data when evaluating external tools or approaches
|
|
62
|
+
- **Transparency**: Always tell the user when using web research — say so before the call, and clearly distinguish what came from live web data vs. existing knowledge in the response
|
|
63
|
+
- **Recency discipline**: Perplexity's base LLM may have stale training data, but its value is **live web search**. If a research response includes caveats about training data cutoff or says "verify current status," that means the search didn't return current results. **Immediately follow up** with targeted searches using recency filters to get actual current data. Never present stale results without first attempting to get fresher data.
|
|
64
|
+
|
|
65
|
+
## Tool Integration
|
|
66
|
+
- When a manual task is performed repeatedly (copy-pasting between apps, checking status in external tools, triggering actions manually), proactively suggest connecting the tool as an MCP server to eliminate the manual step
|
|
67
|
+
- Frame the suggestion with the time/effort saved vs. setup cost
|
|
68
|
+
|
|
69
|
+
## Code Quality
|
|
70
|
+
- No fabricated data in production — 100% accuracy
|
|
71
|
+
- Propose parallel work when independent tasks can run simultaneously
|
|
72
|
+
- Never overlap files/tables/workflows between parallel sessions
|
|
73
|
+
|
|
74
|
+
## Decision Tracking
|
|
75
|
+
- When making non-trivial architectural or design decisions, save them to `docs/decisions/` in the relevant project repo
|
|
76
|
+
- Format: `YYYY-MM-DD-<topic>.md` (e.g., `2026-03-01-auth-approach.md`)
|
|
77
|
+
- Include: context, options considered, decision made, and reasoning
|
|
78
|
+
- Reference from WORK_LOG.md but don't bury decisions in session logs
|
|
79
|
+
- Only for decisions that future sessions need to understand — don't over-document
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Playbook
|
|
2
|
+
|
|
3
|
+
An operating playbook for non-technical founders working with Claude Code.
|
|
4
|
+
|
|
5
|
+
Most Claude Code configs are built for developers. This one is built for operators — people who use Claude as their technical co-founder to build and run products without writing code themselves.
|
|
6
|
+
|
|
7
|
+
## What's included
|
|
8
|
+
|
|
9
|
+
| File | What it does |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `CLAUDE.md` | Core rules: quarterback model, session discipline, verification, context management |
|
|
12
|
+
| `commands/start.md` | `/start` — session kickoff with project briefing |
|
|
13
|
+
| `commands/end.md` | `/end` — session closeout with handoff documentation |
|
|
14
|
+
| `commands/plan.md` | `/plan` — brainstorm + plan in one command (auto-detects complexity) |
|
|
15
|
+
| `commands/debug.md` | `/debug` — 4-step systematic debugging |
|
|
16
|
+
| `commands/quick.md` | `/quick` — lightweight mode for small fixes |
|
|
17
|
+
| `commands/handoff.md` | `/handoff` — generates parallel session prompts (Claude invokes this, not you) |
|
|
18
|
+
| `settings.json` | Permission allowlist for common tools |
|
|
19
|
+
| `update.sh` | Handles updates when a new Playbook version is available |
|
|
20
|
+
| `VERSION` | Current Playbook version number |
|
|
21
|
+
| `CHANGELOG.md` | What changed in each version (only impactful updates) |
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
### Option 1: npm (recommended)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx playbook-ai install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That's it. Works without installing anything globally.
|
|
32
|
+
|
|
33
|
+
### Option 2: Plugin
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
/plugin install playbook
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Run this inside Claude Code. The plugin gives you the same commands as skills (`/playbook:start`, `/playbook:end`, etc.) and includes a SessionStart hook that kicks off your session automatically.
|
|
40
|
+
|
|
41
|
+
### Option 3: Manual (git clone)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git clone https://github.com/bluemax713/playbook.git
|
|
45
|
+
cd playbook
|
|
46
|
+
chmod +x install.sh
|
|
47
|
+
./install.sh
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> **Don't have git?** Download the [latest release](https://github.com/bluemax713/playbook/archive/refs/heads/main.zip), unzip it, and run `./install.sh` from the folder. Updates will still work — they'll use direct downloads instead of git.
|
|
51
|
+
|
|
52
|
+
## After installing
|
|
53
|
+
|
|
54
|
+
1. **Edit `~/.claude/CLAUDE.md`** — Replace generic references with your name and preferences
|
|
55
|
+
2. **Set up MCP servers** — Connect your project management tool (ClickUp, Linear, etc.), database, and any other services in `~/.claude.json`
|
|
56
|
+
3. **Create `WORK_LOG.md`** in your project root — this is the cross-session handoff document
|
|
57
|
+
4. **Run `/start`** in Claude Code to verify everything works
|
|
58
|
+
|
|
59
|
+
## Updates
|
|
60
|
+
|
|
61
|
+
Playbook checks for updates automatically every time you run `/start`. If a new version is available, you'll see a summary of what's new and can choose to update or skip. No surprises — you're always in control.
|
|
62
|
+
|
|
63
|
+
**Your customizations are always safe.** Updates will never delete or overwrite anything you've personalized:
|
|
64
|
+
|
|
65
|
+
- **Commands** update automatically (they're standard across all users)
|
|
66
|
+
- **`CLAUDE.md`** is never touched without your explicit permission — if the new version has changes, you choose: keep yours, use the new Playbook version, or let Claude merge both together while preserving your customizations
|
|
67
|
+
- **`settings.json`** keeps your existing permissions intact — new ones are suggested for your approval, never forced
|
|
68
|
+
|
|
69
|
+
Everything is transparent. Check `settings.json` to see exactly what's auto-approved. The Playbook source is [open on GitHub](https://github.com/bluemax713/playbook) — every command, every permission, and every update mechanism is visible.
|
|
70
|
+
|
|
71
|
+
## How it works
|
|
72
|
+
|
|
73
|
+
### The quarterback model
|
|
74
|
+
Claude proposes plays, you call the shots. Claude will always present options and wait for your approval before making changes. You set priorities, Claude executes.
|
|
75
|
+
|
|
76
|
+
### Session lifecycle
|
|
77
|
+
Every session follows a consistent pattern:
|
|
78
|
+
- `/start` — Claude reads context, checks your PM tool, presents a briefing
|
|
79
|
+
- Work happens — one feature/task per session to prevent sprawl
|
|
80
|
+
- `/end` — Claude updates documentation, cleans up, commits, and presents a summary
|
|
81
|
+
|
|
82
|
+
### Commands
|
|
83
|
+
- **`/plan`** — Before complex work. Claude assesses whether brainstorming is needed (multiple approaches? tradeoffs?) and either explores options first or jumps straight to an implementation plan. Always waits for your approval.
|
|
84
|
+
- **`/debug`** — When something is broken. Follows: reproduce, isolate root cause, fix, verify. No guessing.
|
|
85
|
+
- **`/quick`** — For small fixes that don't need the full session ceremony.
|
|
86
|
+
- **`/handoff`** — Claude uses this (not you) when a task should run in a separate terminal with fresh context.
|
|
87
|
+
|
|
88
|
+
### Context management
|
|
89
|
+
Claude proactively manages session quality:
|
|
90
|
+
- Saves state incrementally during long sessions (not just at the end)
|
|
91
|
+
- Warns you when context is getting heavy and suggests strategies
|
|
92
|
+
- Uses subagents for parallel work automatically
|
|
93
|
+
- Generates parallel session prompts when a fresh context would produce better results
|
|
94
|
+
|
|
95
|
+
## Recommended MCP Servers
|
|
96
|
+
|
|
97
|
+
MCP (Model Context Protocol) servers give Claude direct access to your tools — no copy-pasting between apps. Install the ones that match your stack:
|
|
98
|
+
|
|
99
|
+
| Category | MCP Server | What it does |
|
|
100
|
+
|----------|-----------|-------------|
|
|
101
|
+
| **Google Workspace** | [Google Workspace CLI](https://github.com/googleworkspace/cli) | Gmail, Drive, Calendar, Docs, Sheets, Chat, Admin — one MCP for all Google services |
|
|
102
|
+
| **Project Management** | [ClickUp](https://mcp.clickup.com), [Linear](https://github.com/linear/linear-mcp), Notion | Read/update tasks, check priorities, create issues |
|
|
103
|
+
| **Database** | [Supabase](https://mcp.supabase.com), Neon, PlanetScale | Run queries, apply migrations, inspect schema |
|
|
104
|
+
| **Analytics** | [Metabase](https://github.com/easecloudio/mcp-metabase-server), Posthog | Query dashboards, pull metrics |
|
|
105
|
+
| **Automation** | [n8n](https://github.com/leonardsellem/n8n-mcp-server), Make, Zapier | Read/update workflows, check execution logs |
|
|
106
|
+
| **Code Hosting** | [GitHub](https://github.com/github/github-mcp-server) | PRs, issues, code review |
|
|
107
|
+
| **Communication** | [Slack](https://github.com/modelcontextprotocol/servers/tree/main/src/slack), Discord | Read/send messages, monitor channels |
|
|
108
|
+
| **Research** | [Perplexity](https://github.com/ppl-ai/modelcontextprotocol) | Real-time web search, deep research, current best practices |
|
|
109
|
+
|
|
110
|
+
**Authorize broadly, expose everything.** When setting up an MCP server that uses OAuth (like Google Workspace), grant all the scopes/permissions upfront — even for services you don't plan to use immediately. Re-authorizing mid-session requires a browser flow and breaks your workflow. For the Google Workspace CLI specifically, use `-s all --tool-mode compact` to expose every service while keeping the tool list manageable. You can always ask Claude which services are available if you're not sure what's possible.
|
|
111
|
+
|
|
112
|
+
**The rule of thumb:** If you find yourself repeatedly switching to another app to copy data, check status, or trigger an action — that's a sign you should connect it as an MCP server. Tell Claude "I keep having to manually check X in Y tool" and it will help you evaluate whether an MCP connection would save time.
|
|
113
|
+
|
|
114
|
+
MCP servers are configured in `~/.claude.json` (global) or in project-level settings. See [Anthropic's MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp) for setup instructions.
|
|
115
|
+
|
|
116
|
+
## Customizing
|
|
117
|
+
|
|
118
|
+
This playbook is a starting point. Customize `CLAUDE.md` to fit your workflow:
|
|
119
|
+
- Add tool-specific sections (database, CI/CD, deployment platforms)
|
|
120
|
+
- Add project-specific rules in project-level `CLAUDE.md` files
|
|
121
|
+
- Add new commands in `~/.claude/commands/` for your recurring workflows
|
|
122
|
+
|
|
123
|
+
**Tip:** You don't need to do any of this manually. Just tell Claude what you want — "set up the Slack MCP server," "add a rule about always running tests," "create a new command for deployments" — and Claude will handle the file edits and configuration for you. Or even just ask Claude, after installing this Playbook, to "/plan review README.md and walk me through everything."
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
package/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { install } from '../lib/installer.js';
|
|
5
|
+
|
|
6
|
+
const USAGE = `
|
|
7
|
+
playbook-ai — Operating playbook for non-technical founders working with Claude Code
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
npx playbook-ai install Install the playbook to ~/.claude/
|
|
11
|
+
npx playbook-ai --help Show this help message
|
|
12
|
+
|
|
13
|
+
Learn more: https://github.com/bluemax713/playbook
|
|
14
|
+
`.trim();
|
|
15
|
+
|
|
16
|
+
const { values, positionals } = parseArgs({
|
|
17
|
+
allowPositionals: true,
|
|
18
|
+
options: {
|
|
19
|
+
help: { type: 'boolean', short: 'h' },
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const command = positionals[0];
|
|
24
|
+
|
|
25
|
+
if (values.help || !command) {
|
|
26
|
+
console.log(USAGE);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (command === 'install') {
|
|
31
|
+
await install();
|
|
32
|
+
} else {
|
|
33
|
+
console.error(`Unknown command: ${command}\n`);
|
|
34
|
+
console.log(USAGE);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Follow this systematic debugging process:
|
|
2
|
+
|
|
3
|
+
1. **Reproduce** — Confirm the bug exists. Get the exact error, query, or behavior. Don't guess.
|
|
4
|
+
2. **Isolate** — Narrow down the root cause:
|
|
5
|
+
- What changed recently? (Check WORK_LOG.md, recent commits, recent deployments)
|
|
6
|
+
- Where in the pipeline does it fail?
|
|
7
|
+
- What does the data actually look like? (Query the source directly)
|
|
8
|
+
3. **Fix** — Apply the minimal fix. Don't refactor surrounding code.
|
|
9
|
+
4. **Verify** — Independently confirm the fix works:
|
|
10
|
+
- Re-run the failing query/workflow
|
|
11
|
+
- Check the output matches expectations
|
|
12
|
+
- Confirm no regressions in related functionality
|
|
13
|
+
|
|
14
|
+
Report findings at each step. Don't skip to step 3.
|
package/commands/end.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Session closeout. Do everything needed so the user can walk away without taking notes or remembering anything. The next `/start` must pick up seamlessly.
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. **Review what was done this session.** Look at all changes made, files edited, commits created, and conversations had. Don't miss anything.
|
|
6
|
+
|
|
7
|
+
2. **Update WORK_LOG.md.** This is the critical handoff document.
|
|
8
|
+
- Update "Last updated" date
|
|
9
|
+
- Update "Overall State" headline if it changed
|
|
10
|
+
- Add numbered entries under "Recent Changes (this session)" for everything done — be specific (file names, node counts, what changed and why)
|
|
11
|
+
- Update "Workflow Status" or equivalent current-state section to reflect reality
|
|
12
|
+
- Update "Known Issues / Next Steps" — remove anything completed, add anything new discovered, reprioritize if needed. Be explicit about what's next and what's blocked
|
|
13
|
+
- If any task is partially done, document exactly where it was left off and what remains
|
|
14
|
+
|
|
15
|
+
3. **Update PM tool** (if MCP is connected). Mark completed tasks as done. Update in-progress tasks with status notes. Create new tasks for anything discovered during the session that needs tracking.
|
|
16
|
+
|
|
17
|
+
4. **Cleanup** — remove temporary artifacts:
|
|
18
|
+
- Delete `HANDOFF_RESULT.md` if it exists in the project root
|
|
19
|
+
- Remove any other temp files created during the session (scratch scripts, debug output, etc.)
|
|
20
|
+
- Do NOT delete docs/decisions/ files — those are permanent
|
|
21
|
+
|
|
22
|
+
5. **Pre-commit checklist** — before committing, verify:
|
|
23
|
+
- All changes tested/verified (not just "should work" — show evidence)
|
|
24
|
+
- No hardcoded secrets, tokens, or credentials in code
|
|
25
|
+
- No uncommitted changes left behind accidentally
|
|
26
|
+
- No temp files being committed
|
|
27
|
+
- Branch pushed to origin
|
|
28
|
+
|
|
29
|
+
6. **Commit and push.** Stage all changed files, commit with a clear message summarizing the session's work, and push to remote. Do NOT commit .env or credentials.
|
|
30
|
+
|
|
31
|
+
7. **Present the closeout summary:**
|
|
32
|
+
- **Done this session** — bullet list of completed work
|
|
33
|
+
- **Left in progress** — anything partially done and where it stands
|
|
34
|
+
- **Next session priorities** — what `/start` will surface as the top items
|
|
35
|
+
- **Action items** — anything that requires action outside of Claude Code
|
|
36
|
+
|
|
37
|
+
Keep it concise. The goal is zero information loss between sessions.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
This command is for CLAUDE to invoke, never the user. Generate a parallel session prompt when a task should run in a separate Claude Code terminal with fresh context.
|
|
2
|
+
|
|
3
|
+
## When to use this
|
|
4
|
+
|
|
5
|
+
Only when ALL of these are true:
|
|
6
|
+
- The task is substantial enough to benefit from a fresh context window
|
|
7
|
+
- The task is independent from the main session's current work
|
|
8
|
+
- Continuing in the main session would materially degrade output quality
|
|
9
|
+
- A subagent within this session can't handle it (too large, needs its own lifecycle)
|
|
10
|
+
|
|
11
|
+
Do NOT use when:
|
|
12
|
+
- The session is almost done anyway
|
|
13
|
+
- A subagent would suffice
|
|
14
|
+
- The overhead of context-switching outweighs the benefit
|
|
15
|
+
|
|
16
|
+
## What to generate
|
|
17
|
+
|
|
18
|
+
Create a complete, self-contained prompt block to paste into a new Claude Code terminal. The block must include:
|
|
19
|
+
|
|
20
|
+
1. **Context** — Everything the new session needs to know. No assumptions about shared state. Include specific file paths, IDs, table names, and any decisions already made.
|
|
21
|
+
2. **Task** — Clear, specific instructions for what to do.
|
|
22
|
+
3. **Embedded commands** — If the new session should /plan first, say so explicitly in the prompt.
|
|
23
|
+
4. **Output instructions** — Tell the new session to:
|
|
24
|
+
- Save all artifacts to files (not just terminal output)
|
|
25
|
+
- Write a brief summary to `HANDOFF_RESULT.md` in the project root: what was done, what files changed, any decisions made
|
|
26
|
+
- Do NOT run /end — no WORK_LOG update, no PM tool update, no commit. Just do the work and stop.
|
|
27
|
+
- The user will close the terminal when done.
|
|
28
|
+
|
|
29
|
+
## Format for the user
|
|
30
|
+
|
|
31
|
+
Present the prompt in a single code block that can be copy-pasted. Preface it with:
|
|
32
|
+
- One sentence explaining what the parallel session will do
|
|
33
|
+
- "Open a new Claude Code terminal and paste the block below. When it's done, come back here and tell me 'parallel done.'"
|
|
34
|
+
|
|
35
|
+
## After return
|
|
36
|
+
|
|
37
|
+
When the user says the parallel session is done:
|
|
38
|
+
1. Read `HANDOFF_RESULT.md` from the project root
|
|
39
|
+
2. Integrate the results into the main session's work
|
|
40
|
+
3. Delete `HANDOFF_RESULT.md` (cleanup)
|
|
41
|
+
4. Continue with the main session's work
|
package/commands/plan.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Before making any changes, assess the task and create a structured plan.
|
|
2
|
+
|
|
3
|
+
## Phase 1: Assess Complexity
|
|
4
|
+
|
|
5
|
+
Read all relevant files first. Then determine:
|
|
6
|
+
- **Is this straightforward?** (One obvious approach, clear requirements) → Skip to Phase 2.
|
|
7
|
+
- **Are there meaningful tradeoffs?** (Multiple approaches, architectural choices, unclear requirements) → Brainstorm first:
|
|
8
|
+
- Present 2-3 approaches with pros/cons in short, scannable sections
|
|
9
|
+
- Flag which approach you'd recommend and why
|
|
10
|
+
- Wait for approval of a direction before proceeding to Phase 2
|
|
11
|
+
- Save the decision to `docs/decisions/YYYY-MM-DD-<topic>.md` if it's non-trivial
|
|
12
|
+
|
|
13
|
+
## Phase 2: Implementation Plan
|
|
14
|
+
|
|
15
|
+
1. **Scope** — What's in scope, what's NOT. State assumptions.
|
|
16
|
+
2. **Steps** — Ordered steps. For each:
|
|
17
|
+
- What file(s) to change
|
|
18
|
+
- What the change does
|
|
19
|
+
- What could go wrong
|
|
20
|
+
- How to verify it worked
|
|
21
|
+
3. **Dependencies** — What must happen in order vs. can be parallelized.
|
|
22
|
+
4. **Risks** — Highest-risk changes and rollback plan.
|
|
23
|
+
|
|
24
|
+
Present the plan and WAIT for approval before making any changes.
|
|
25
|
+
Keep it concise — bullet points, not essays.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Quick mode — for bug fixes, small changes, and one-off tasks that don't need full session ceremony.
|
|
2
|
+
|
|
3
|
+
Skip the full /start briefing. Instead:
|
|
4
|
+
1. Read CLAUDE.md (for rules) and the last WORK_LOG.md entry (for context) — don't present a briefing.
|
|
5
|
+
2. Do the task.
|
|
6
|
+
3. Update WORK_LOG.md with a brief entry (2-3 lines under a "Quick fix" sub-header of today's date).
|
|
7
|
+
4. Commit with a clear message.
|
|
8
|
+
5. If the fix reveals a bigger issue, flag it and suggest creating a task — don't scope-creep.
|
|
9
|
+
|
|
10
|
+
Do NOT skip: task creation if a bug/gap is discovered. Do NOT skip: committing changes.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Read CLAUDE.md and WORK_LOG.md to understand the project and where we left off.
|
|
2
|
+
|
|
3
|
+
Check your project management tool via MCP (if available) for current task priorities. If not connected, skip this step and rely on WORK_LOG.md.
|
|
4
|
+
|
|
5
|
+
Check your auto-memory files for any relevant context from prior sessions.
|
|
6
|
+
|
|
7
|
+
## Step 0: Check for Playbook Updates
|
|
8
|
+
|
|
9
|
+
Before anything else, silently check if a newer version of Playbook is available. This must not slow down the session or require user interaction unless there's actually an update.
|
|
10
|
+
|
|
11
|
+
### Pre-flight (silent — no output to user)
|
|
12
|
+
|
|
13
|
+
1. Check if `~/.claude/.playbook-version` exists. If not, skip the update check entirely.
|
|
14
|
+
2. Read the installed version from `~/.claude/.playbook-version`.
|
|
15
|
+
3. Try to fetch the latest version:
|
|
16
|
+
- **If git is available and `~/.claude/.playbook/` is a git repo:** Run `git -C ~/.claude/.playbook fetch origin main --quiet` then read `VERSION` from the fetched main branch using `git -C ~/.claude/.playbook show origin/main:VERSION`.
|
|
17
|
+
- **If git is not available or fails:** Use `curl -sf https://raw.githubusercontent.com/bluemax713/playbook/main/VERSION` to get the latest version.
|
|
18
|
+
- **If both fail:** Skip the update check entirely. Do not mention it to the user. Continue with the normal briefing.
|
|
19
|
+
4. Compare the installed version with the latest version. If they match, skip to the normal briefing.
|
|
20
|
+
|
|
21
|
+
### If an update is available
|
|
22
|
+
|
|
23
|
+
1. Fetch the CHANGELOG.md content between the installed version and the latest:
|
|
24
|
+
- Via git: `git -C ~/.claude/.playbook show origin/main:CHANGELOG.md`
|
|
25
|
+
- Via curl: `curl -sf https://raw.githubusercontent.com/bluemax713/playbook/main/CHANGELOG.md`
|
|
26
|
+
2. Extract only the entries NEWER than the user's installed version. Do not show the entry for their current version.
|
|
27
|
+
3. Present to the user:
|
|
28
|
+
|
|
29
|
+
> **Playbook vX.Y.Z is available** (you have vA.B.C). Here's what's new:
|
|
30
|
+
>
|
|
31
|
+
> [Relevant changelog entries]
|
|
32
|
+
>
|
|
33
|
+
> Would you like to update?
|
|
34
|
+
|
|
35
|
+
4. **If the user says yes:**
|
|
36
|
+
- Run `bash ~/.claude/.playbook/update.sh` (if git is available in the playbook dir) or fetch updated files via curl and run the update.
|
|
37
|
+
- After update.sh completes, check if CLAUDE.md has changed between versions:
|
|
38
|
+
- Via git: `git -C ~/.claude/.playbook diff vA.B.C..origin/main -- CLAUDE.md` (or compare the files directly)
|
|
39
|
+
- Or: compare `~/.claude/CLAUDE.md` with `~/.claude/.playbook/CLAUDE.md`
|
|
40
|
+
- If CLAUDE.md has NOT changed upstream: done, continue to briefing.
|
|
41
|
+
- If CLAUDE.md HAS changed upstream, tell the user what changed (summarize the differences in plain language), then offer three choices:
|
|
42
|
+
1. **Keep mine** — no changes to your CLAUDE.md
|
|
43
|
+
2. **Use Playbook** — replace your CLAUDE.md with the new Playbook version
|
|
44
|
+
3. **Merge** — I'll combine your customizations with the new Playbook changes into one file. I'll show you the result before saving.
|
|
45
|
+
- If the user picks **Merge**: read both files, produce a merged version that preserves user customizations while incorporating new upstream content, show it to the user for approval, and only write it after they confirm.
|
|
46
|
+
|
|
47
|
+
After any new settings.json permissions are available in the updated Playbook, check if the user's `~/.claude/settings.json` is missing any permissions from the Playbook version. If so, mention: "The new version includes some additional pre-approved permissions: [list them briefly]. Want me to add these to your settings?" Only add with user approval.
|
|
48
|
+
|
|
49
|
+
5. **If the user says no (skip the update):** Continue with the normal briefing. Do not mention the update again during this session.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Normal Briefing
|
|
54
|
+
|
|
55
|
+
Present a concise briefing:
|
|
56
|
+
- **Where we left off** — last session's work (from WORK_LOG.md)
|
|
57
|
+
- **Current status** — what's working, what's not
|
|
58
|
+
- **Known issues** — bugs, blockers, pending items
|
|
59
|
+
- **PM tasks** — open/in-progress tasks if PM tool is available
|
|
60
|
+
- **Suggested next steps** — prioritized list of what to tackle, flagging anything that needs a decision
|
|
61
|
+
|
|
62
|
+
Keep it short and scannable. Bullet points. No fluff. Wait for direction before making changes.
|
|
63
|
+
|
|
64
|
+
## Session Naming
|
|
65
|
+
|
|
66
|
+
**Before the briefing**, prompt the user to name the session. Output only this — nothing else:
|
|
67
|
+
|
|
68
|
+
> Copy/paste to name this session:
|
|
69
|
+
> `/rename <project>`
|
|
70
|
+
|
|
71
|
+
Where `<project>` is the current directory's basename (e.g., `playbook`). Then **wait for the user to respond** before presenting the briefing. Do not include the briefing in the same message.
|
package/install.sh
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Playbook Installer — Claude Code Operating Playbook
|
|
3
|
+
# Copies config files into ~/.claude/ for Claude Code to use.
|
|
4
|
+
# Also sets up the local Playbook source for automatic updates.
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
9
|
+
CLAUDE_DIR="$HOME/.claude"
|
|
10
|
+
COMMANDS_DIR="$CLAUDE_DIR/commands"
|
|
11
|
+
PLAYBOOK_DIR="$CLAUDE_DIR/.playbook"
|
|
12
|
+
REPO_URL="https://github.com/bluemax713/playbook.git"
|
|
13
|
+
|
|
14
|
+
echo "Installing Playbook into $CLAUDE_DIR..."
|
|
15
|
+
|
|
16
|
+
# Create directories if they don't exist
|
|
17
|
+
mkdir -p "$COMMANDS_DIR"
|
|
18
|
+
|
|
19
|
+
# --- Set up Playbook source for updates ---
|
|
20
|
+
|
|
21
|
+
# Determine if we're running from a git repo
|
|
22
|
+
IS_GIT_REPO=false
|
|
23
|
+
if [ -d "$SCRIPT_DIR/.git" ] || git -C "$SCRIPT_DIR" rev-parse --git-dir > /dev/null 2>&1; then
|
|
24
|
+
IS_GIT_REPO=true
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if [ "$IS_GIT_REPO" = true ]; then
|
|
28
|
+
# Running from a git clone — copy the repo to the standard location
|
|
29
|
+
if [ "$SCRIPT_DIR" != "$PLAYBOOK_DIR" ]; then
|
|
30
|
+
if [ -d "$PLAYBOOK_DIR" ]; then
|
|
31
|
+
echo " Updating Playbook source at $PLAYBOOK_DIR..."
|
|
32
|
+
rm -rf "$PLAYBOOK_DIR"
|
|
33
|
+
fi
|
|
34
|
+
cp -R "$SCRIPT_DIR" "$PLAYBOOK_DIR"
|
|
35
|
+
echo " Playbook source saved to $PLAYBOOK_DIR"
|
|
36
|
+
else
|
|
37
|
+
echo " Already running from $PLAYBOOK_DIR"
|
|
38
|
+
fi
|
|
39
|
+
else
|
|
40
|
+
# Not a git repo (downloaded zip, curl, etc.) — try to clone fresh
|
|
41
|
+
if command -v git &> /dev/null; then
|
|
42
|
+
echo " Cloning Playbook repo for update support..."
|
|
43
|
+
if [ -d "$PLAYBOOK_DIR" ]; then
|
|
44
|
+
rm -rf "$PLAYBOOK_DIR"
|
|
45
|
+
fi
|
|
46
|
+
git clone --quiet "$REPO_URL" "$PLAYBOOK_DIR"
|
|
47
|
+
echo " Playbook source cloned to $PLAYBOOK_DIR"
|
|
48
|
+
else
|
|
49
|
+
# No git available — copy what we have, updates will use curl
|
|
50
|
+
if [ -d "$PLAYBOOK_DIR" ]; then
|
|
51
|
+
rm -rf "$PLAYBOOK_DIR"
|
|
52
|
+
fi
|
|
53
|
+
cp -R "$SCRIPT_DIR" "$PLAYBOOK_DIR"
|
|
54
|
+
echo " Playbook source saved to $PLAYBOOK_DIR (install git for easier updates)"
|
|
55
|
+
fi
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# --- Install files ---
|
|
59
|
+
|
|
60
|
+
# Copy CLAUDE.md (won't overwrite if exists — user might have customized it)
|
|
61
|
+
if [ -f "$CLAUDE_DIR/CLAUDE.md" ]; then
|
|
62
|
+
echo " CLAUDE.md already exists — skipping (back up yours first if you want to replace it)"
|
|
63
|
+
else
|
|
64
|
+
cp "$PLAYBOOK_DIR/CLAUDE.md" "$CLAUDE_DIR/CLAUDE.md"
|
|
65
|
+
echo " Installed CLAUDE.md"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Copy commands (will overwrite — commands are meant to be standard)
|
|
69
|
+
for cmd in "$PLAYBOOK_DIR/commands/"*.md; do
|
|
70
|
+
filename=$(basename "$cmd")
|
|
71
|
+
cp "$cmd" "$COMMANDS_DIR/$filename"
|
|
72
|
+
echo " Installed command: /${filename%.md}"
|
|
73
|
+
done
|
|
74
|
+
|
|
75
|
+
# Copy settings.json (won't overwrite if exists — user might have custom permissions)
|
|
76
|
+
if [ -f "$CLAUDE_DIR/settings.json" ]; then
|
|
77
|
+
echo " settings.json already exists — skipping (review playbook/settings.json to merge permissions)"
|
|
78
|
+
else
|
|
79
|
+
cp "$PLAYBOOK_DIR/settings.json" "$CLAUDE_DIR/settings.json"
|
|
80
|
+
echo " Installed settings.json"
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# --- Record installed version ---
|
|
84
|
+
if [ -f "$PLAYBOOK_DIR/VERSION" ]; then
|
|
85
|
+
cp "$PLAYBOOK_DIR/VERSION" "$CLAUDE_DIR/.playbook-version"
|
|
86
|
+
echo " Version $(cat "$CLAUDE_DIR/.playbook-version" | tr -d '\n') installed"
|
|
87
|
+
else
|
|
88
|
+
echo "1.0.0" > "$CLAUDE_DIR/.playbook-version"
|
|
89
|
+
echo " Version 1.0.0 installed"
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
echo ""
|
|
93
|
+
echo "Done! Restart Claude Code to pick up the new config."
|
|
94
|
+
echo ""
|
|
95
|
+
echo "Next steps:"
|
|
96
|
+
echo " 1. Edit ~/.claude/CLAUDE.md to add your name (replace 'you/your' with your preferences)"
|
|
97
|
+
echo " 2. Set up your MCP servers in ~/.claude.json (project management, database, etc.)"
|
|
98
|
+
echo " 3. Create a WORK_LOG.md in your project root"
|
|
99
|
+
echo " 4. Run /start in Claude Code to verify everything works"
|
|
100
|
+
echo ""
|
|
101
|
+
echo "Playbook will automatically check for updates when you run /start."
|
package/lib/installer.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
9
|
+
|
|
10
|
+
const CLAUDE_DIR = path.join(os.homedir(), '.claude');
|
|
11
|
+
const COMMANDS_DIR = path.join(CLAUDE_DIR, 'commands');
|
|
12
|
+
const PLAYBOOK_DIR = path.join(CLAUDE_DIR, '.playbook');
|
|
13
|
+
|
|
14
|
+
// Files to copy into .playbook/ for the update mechanism
|
|
15
|
+
const PLAYBOOK_SOURCE_FILES = [
|
|
16
|
+
'CLAUDE.md',
|
|
17
|
+
'settings.json',
|
|
18
|
+
'install.sh',
|
|
19
|
+
'update.sh',
|
|
20
|
+
'VERSION',
|
|
21
|
+
'CHANGELOG.md',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export async function install() {
|
|
25
|
+
console.log(`Installing Playbook into ${CLAUDE_DIR}...`);
|
|
26
|
+
|
|
27
|
+
// Create directories
|
|
28
|
+
await fs.mkdir(COMMANDS_DIR, { recursive: true });
|
|
29
|
+
await fs.mkdir(PLAYBOOK_DIR, { recursive: true });
|
|
30
|
+
|
|
31
|
+
const summary = { installed: [], skipped: [] };
|
|
32
|
+
|
|
33
|
+
// --- Install CLAUDE.md ---
|
|
34
|
+
const claudeMdDest = path.join(CLAUDE_DIR, 'CLAUDE.md');
|
|
35
|
+
if (await fileExists(claudeMdDest)) {
|
|
36
|
+
summary.skipped.push('CLAUDE.md (already exists)');
|
|
37
|
+
} else {
|
|
38
|
+
await fs.copyFile(path.join(PACKAGE_ROOT, 'CLAUDE.md'), claudeMdDest);
|
|
39
|
+
summary.installed.push('CLAUDE.md');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// --- Install commands (always overwrite) ---
|
|
43
|
+
const commandsSource = path.join(PACKAGE_ROOT, 'commands');
|
|
44
|
+
const commandFiles = await fs.readdir(commandsSource);
|
|
45
|
+
for (const file of commandFiles) {
|
|
46
|
+
if (!file.endsWith('.md')) continue;
|
|
47
|
+
await fs.copyFile(
|
|
48
|
+
path.join(commandsSource, file),
|
|
49
|
+
path.join(COMMANDS_DIR, file)
|
|
50
|
+
);
|
|
51
|
+
const commandName = file.replace(/\.md$/, '');
|
|
52
|
+
summary.installed.push(`command: /${commandName}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// --- Install settings.json ---
|
|
56
|
+
const settingsDest = path.join(CLAUDE_DIR, 'settings.json');
|
|
57
|
+
if (await fileExists(settingsDest)) {
|
|
58
|
+
summary.skipped.push('settings.json (already exists)');
|
|
59
|
+
} else {
|
|
60
|
+
await fs.copyFile(path.join(PACKAGE_ROOT, 'settings.json'), settingsDest);
|
|
61
|
+
summary.installed.push('settings.json');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// --- Set up .playbook/ source for auto-updates ---
|
|
65
|
+
// Copy individual files
|
|
66
|
+
for (const file of PLAYBOOK_SOURCE_FILES) {
|
|
67
|
+
const src = path.join(PACKAGE_ROOT, file);
|
|
68
|
+
if (await fileExists(src)) {
|
|
69
|
+
await fs.copyFile(src, path.join(PLAYBOOK_DIR, file));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Copy commands/ directory into .playbook/commands/
|
|
74
|
+
const playbookCommandsDir = path.join(PLAYBOOK_DIR, 'commands');
|
|
75
|
+
await fs.mkdir(playbookCommandsDir, { recursive: true });
|
|
76
|
+
for (const file of commandFiles) {
|
|
77
|
+
if (!file.endsWith('.md')) continue;
|
|
78
|
+
await fs.copyFile(
|
|
79
|
+
path.join(commandsSource, file),
|
|
80
|
+
path.join(playbookCommandsDir, file)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// --- Write version ---
|
|
85
|
+
const versionFile = path.join(PACKAGE_ROOT, 'VERSION');
|
|
86
|
+
let version = '1.0.0';
|
|
87
|
+
if (await fileExists(versionFile)) {
|
|
88
|
+
version = (await fs.readFile(versionFile, 'utf-8')).trim();
|
|
89
|
+
}
|
|
90
|
+
await fs.writeFile(path.join(CLAUDE_DIR, '.playbook-version'), version + '\n');
|
|
91
|
+
|
|
92
|
+
// --- Print summary ---
|
|
93
|
+
console.log('');
|
|
94
|
+
if (summary.installed.length > 0) {
|
|
95
|
+
console.log('Installed:');
|
|
96
|
+
for (const item of summary.installed) {
|
|
97
|
+
console.log(` + ${item}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (summary.skipped.length > 0) {
|
|
101
|
+
console.log('Skipped:');
|
|
102
|
+
for (const item of summary.skipped) {
|
|
103
|
+
console.log(` - ${item}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log(`\nVersion ${version} installed.`);
|
|
108
|
+
console.log('');
|
|
109
|
+
console.log('Next steps:');
|
|
110
|
+
console.log(' 1. Open ~/.claude/CLAUDE.md and replace "you" with your name');
|
|
111
|
+
console.log(' 2. Create a WORK_LOG.md in your project root');
|
|
112
|
+
console.log(' 3. Run /start in Claude Code');
|
|
113
|
+
console.log('');
|
|
114
|
+
console.log('Playbook will automatically check for updates when you run /start.');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function fileExists(filePath) {
|
|
118
|
+
try {
|
|
119
|
+
await fs.access(filePath);
|
|
120
|
+
return true;
|
|
121
|
+
} catch {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "playbook-ai",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Operating playbook for non-technical founders working with Claude Code",
|
|
5
|
+
"bin": {
|
|
6
|
+
"playbook-ai": "bin/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"lib/",
|
|
12
|
+
"commands/",
|
|
13
|
+
"CLAUDE.md",
|
|
14
|
+
"settings.json",
|
|
15
|
+
"install.sh",
|
|
16
|
+
"update.sh",
|
|
17
|
+
"VERSION",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"claude",
|
|
22
|
+
"claude-code",
|
|
23
|
+
"playbook",
|
|
24
|
+
"ai",
|
|
25
|
+
"operations"
|
|
26
|
+
],
|
|
27
|
+
"author": "Max Assoulin",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/bluemax713/playbook.git"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/bluemax713/playbook",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/settings.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(python3:*)",
|
|
5
|
+
"Bash(python:*)",
|
|
6
|
+
"Bash(node:*)",
|
|
7
|
+
"Bash(npm install*)",
|
|
8
|
+
"Bash(npm run*)",
|
|
9
|
+
"Bash(npm test*)",
|
|
10
|
+
"Bash(npm list*)",
|
|
11
|
+
"Bash(npm info*)",
|
|
12
|
+
"Bash(pip install*)",
|
|
13
|
+
"Bash(pip list*)",
|
|
14
|
+
"Bash(pip show*)",
|
|
15
|
+
"Bash(pip freeze*)",
|
|
16
|
+
"Bash(pytest:*)",
|
|
17
|
+
"Bash(uv:*)",
|
|
18
|
+
"Bash(cat:*)",
|
|
19
|
+
"Bash(ls:*)",
|
|
20
|
+
"Bash(pwd)",
|
|
21
|
+
"Bash(which:*)",
|
|
22
|
+
"Bash(echo:*)",
|
|
23
|
+
"Bash(head:*)",
|
|
24
|
+
"Bash(tail:*)",
|
|
25
|
+
"Bash(wc:*)",
|
|
26
|
+
"Bash(grep:*)",
|
|
27
|
+
"Bash(rg:*)",
|
|
28
|
+
"Bash(find:*)",
|
|
29
|
+
"Bash(tree:*)",
|
|
30
|
+
"Bash(diff:*)",
|
|
31
|
+
"Bash(jq:*)",
|
|
32
|
+
"Bash(mkdir:*)",
|
|
33
|
+
"Bash(touch:*)",
|
|
34
|
+
"Bash(cp:*)",
|
|
35
|
+
"Bash(mv:*)",
|
|
36
|
+
"Bash(curl:*)",
|
|
37
|
+
"Bash(date*)",
|
|
38
|
+
"Bash(whoami*)",
|
|
39
|
+
"Bash(hostname*)",
|
|
40
|
+
"Bash(env*)",
|
|
41
|
+
"Bash(npx:*)",
|
|
42
|
+
"Bash(bun:*)",
|
|
43
|
+
"Bash(bunx:*)",
|
|
44
|
+
"Bash(git status*)",
|
|
45
|
+
"Bash(git log*)",
|
|
46
|
+
"Bash(git diff*)",
|
|
47
|
+
"Bash(git show*)",
|
|
48
|
+
"Bash(git branch*)",
|
|
49
|
+
"Bash(git rev-parse*)",
|
|
50
|
+
"Bash(git fetch*)",
|
|
51
|
+
"Bash(git stash*)",
|
|
52
|
+
"Bash(git add*)",
|
|
53
|
+
"Bash(git commit*)",
|
|
54
|
+
"Bash(git checkout*)",
|
|
55
|
+
"Bash(git switch*)",
|
|
56
|
+
"Bash(git pull*)",
|
|
57
|
+
"Bash(git push*)",
|
|
58
|
+
"Bash(git remote*)",
|
|
59
|
+
"Bash(git merge*)",
|
|
60
|
+
"Bash(git rebase*)",
|
|
61
|
+
"Bash(git clone*)",
|
|
62
|
+
"Bash(git tag*)",
|
|
63
|
+
"Bash(git cherry-pick*)",
|
|
64
|
+
"Bash(git -C ~/.claude/.playbook*)",
|
|
65
|
+
"Bash(bash ~/.claude/.playbook/update.sh*)",
|
|
66
|
+
"Bash(chmod +x ~/.claude/.playbook/*)",
|
|
67
|
+
"Bash(gh:*)"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
package/update.sh
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Playbook Updater — Fetches latest version and updates commands + settings.
|
|
3
|
+
# Called by /start when an update is available and the user approves.
|
|
4
|
+
# CLAUDE.md is NOT touched by this script — Claude handles that interactively.
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
CLAUDE_DIR="$HOME/.claude"
|
|
9
|
+
COMMANDS_DIR="$CLAUDE_DIR/commands"
|
|
10
|
+
PLAYBOOK_DIR="$CLAUDE_DIR/.playbook"
|
|
11
|
+
REPO_URL="https://github.com/bluemax713/playbook.git"
|
|
12
|
+
RAW_BASE="https://raw.githubusercontent.com/bluemax713/playbook/main"
|
|
13
|
+
TEMP_DIR="$CLAUDE_DIR/.playbook-update-tmp"
|
|
14
|
+
|
|
15
|
+
# --- Fetch latest source ---
|
|
16
|
+
|
|
17
|
+
fetch_via_git() {
|
|
18
|
+
if [ -d "$PLAYBOOK_DIR/.git" ]; then
|
|
19
|
+
git -C "$PLAYBOOK_DIR" pull --quiet origin main 2>/dev/null
|
|
20
|
+
return $?
|
|
21
|
+
elif command -v git &> /dev/null; then
|
|
22
|
+
rm -rf "$PLAYBOOK_DIR"
|
|
23
|
+
git clone --quiet "$REPO_URL" "$PLAYBOOK_DIR" 2>/dev/null
|
|
24
|
+
return $?
|
|
25
|
+
fi
|
|
26
|
+
return 1
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fetch_via_curl() {
|
|
30
|
+
# Download key files individually via GitHub raw content
|
|
31
|
+
local files=("VERSION" "CHANGELOG.md" "CLAUDE.md" "settings.json" "install.sh" "update.sh")
|
|
32
|
+
local cmd_files=("start.md" "end.md" "plan.md" "debug.md" "quick.md" "handoff.md")
|
|
33
|
+
|
|
34
|
+
mkdir -p "$PLAYBOOK_DIR/commands"
|
|
35
|
+
|
|
36
|
+
for f in "${files[@]}"; do
|
|
37
|
+
curl -sf "$RAW_BASE/$f" -o "$PLAYBOOK_DIR/$f" || return 1
|
|
38
|
+
done
|
|
39
|
+
|
|
40
|
+
for f in "${cmd_files[@]}"; do
|
|
41
|
+
curl -sf "$RAW_BASE/commands/$f" -o "$PLAYBOOK_DIR/commands/$f" || return 1
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
return 0
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
echo "Updating Playbook..."
|
|
48
|
+
|
|
49
|
+
# Try git first, fall back to curl
|
|
50
|
+
if ! fetch_via_git; then
|
|
51
|
+
if ! fetch_via_curl; then
|
|
52
|
+
echo "ERROR: Could not fetch updates. Check your internet connection."
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# --- Stage updates in temp directory (atomic) ---
|
|
58
|
+
|
|
59
|
+
rm -rf "$TEMP_DIR"
|
|
60
|
+
mkdir -p "$TEMP_DIR/commands"
|
|
61
|
+
|
|
62
|
+
# Copy commands to temp
|
|
63
|
+
for cmd in "$PLAYBOOK_DIR/commands/"*.md; do
|
|
64
|
+
[ -f "$cmd" ] && cp "$cmd" "$TEMP_DIR/commands/"
|
|
65
|
+
done
|
|
66
|
+
|
|
67
|
+
# Copy settings.json to temp (will be merged, not overwritten)
|
|
68
|
+
if [ -f "$PLAYBOOK_DIR/settings.json" ]; then
|
|
69
|
+
cp "$PLAYBOOK_DIR/settings.json" "$TEMP_DIR/settings.json"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# --- Validate staged files ---
|
|
73
|
+
|
|
74
|
+
# Check that key files exist in temp
|
|
75
|
+
if [ ! -f "$TEMP_DIR/commands/start.md" ]; then
|
|
76
|
+
echo "ERROR: Update validation failed — missing start.md. Update aborted."
|
|
77
|
+
rm -rf "$TEMP_DIR"
|
|
78
|
+
exit 1
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# --- Apply updates ---
|
|
82
|
+
|
|
83
|
+
# Commands: overwrite (they're standard)
|
|
84
|
+
for cmd in "$TEMP_DIR/commands/"*.md; do
|
|
85
|
+
filename=$(basename "$cmd")
|
|
86
|
+
cp "$cmd" "$COMMANDS_DIR/$filename"
|
|
87
|
+
echo " Updated command: /${filename%.md}"
|
|
88
|
+
done
|
|
89
|
+
|
|
90
|
+
# Settings.json: additive merge
|
|
91
|
+
if [ -f "$TEMP_DIR/settings.json" ] && [ -f "$CLAUDE_DIR/settings.json" ]; then
|
|
92
|
+
# Use a simple merge strategy: if the user has settings.json, we don't overwrite.
|
|
93
|
+
# Claude will handle intelligent merging of new permissions in /start if needed.
|
|
94
|
+
echo " settings.json: existing file preserved (new permissions will be suggested in /start)"
|
|
95
|
+
elif [ -f "$TEMP_DIR/settings.json" ]; then
|
|
96
|
+
cp "$TEMP_DIR/settings.json" "$CLAUDE_DIR/settings.json"
|
|
97
|
+
echo " Installed settings.json"
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# --- Update version (LAST — only on success) ---
|
|
101
|
+
|
|
102
|
+
if [ -f "$PLAYBOOK_DIR/VERSION" ]; then
|
|
103
|
+
cp "$PLAYBOOK_DIR/VERSION" "$CLAUDE_DIR/.playbook-version"
|
|
104
|
+
echo " Updated to version $(cat "$CLAUDE_DIR/.playbook-version" | tr -d '\n')"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# --- Cleanup ---
|
|
108
|
+
|
|
109
|
+
rm -rf "$TEMP_DIR"
|
|
110
|
+
echo "Update complete."
|