claude-pro-minmax 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.
Files changed (90) hide show
  1. package/.claude/CLAUDE.md +60 -0
  2. package/.claude/agents/README.ko.md +210 -0
  3. package/.claude/agents/README.md +210 -0
  4. package/.claude/agents/builder.md +96 -0
  5. package/.claude/agents/dplanner.md +58 -0
  6. package/.claude/agents/planner.md +52 -0
  7. package/.claude/agents/reviewer.md +69 -0
  8. package/.claude/commands/README.ko.md +381 -0
  9. package/.claude/commands/README.md +381 -0
  10. package/.claude/commands/analyze-failures.md +49 -0
  11. package/.claude/commands/compact-phase.md +75 -0
  12. package/.claude/commands/do-opus.md +43 -0
  13. package/.claude/commands/do-sonnet.md +43 -0
  14. package/.claude/commands/do.md +56 -0
  15. package/.claude/commands/dplan.md +36 -0
  16. package/.claude/commands/learn.md +64 -0
  17. package/.claude/commands/llms-txt.md +50 -0
  18. package/.claude/commands/load-context.md +46 -0
  19. package/.claude/commands/plan.md +62 -0
  20. package/.claude/commands/review.md +55 -0
  21. package/.claude/commands/session-load.md +61 -0
  22. package/.claude/commands/session-save.md +79 -0
  23. package/.claude/commands/watch.md +58 -0
  24. package/.claude/contexts/README.ko.md +94 -0
  25. package/.claude/contexts/README.md +94 -0
  26. package/.claude/contexts/backend-context.md +23 -0
  27. package/.claude/contexts/frontend-context.md +24 -0
  28. package/.claude/rules/README.ko.md +98 -0
  29. package/.claude/rules/README.md +98 -0
  30. package/.claude/rules/code-style.md +21 -0
  31. package/.claude/rules/critical-actions.md +34 -0
  32. package/.claude/rules/security.md +13 -0
  33. package/.claude/sessions/2025-01-27-auth-jwt-refresh.md +32 -0
  34. package/.claude/sessions/README.ko.md +195 -0
  35. package/.claude/sessions/README.md +195 -0
  36. package/.claude/settings.json +167 -0
  37. package/.claude/settings.local.example.json +3 -0
  38. package/.claude/skills/README.ko.md +60 -0
  39. package/.claude/skills/README.md +60 -0
  40. package/.claude/skills/cli-wrappers/SKILL.md +38 -0
  41. package/.claude/skills/cli-wrappers/references/github-cli.md +18 -0
  42. package/.claude/skills/cli-wrappers/references/mgrep.md +18 -0
  43. package/.claude/skills/learned/README.ko.md +64 -0
  44. package/.claude/skills/learned/README.md +64 -0
  45. package/.claude.json +28 -0
  46. package/.claudeignore +17 -0
  47. package/LICENSE +21 -0
  48. package/README.ko.md +441 -0
  49. package/README.md +441 -0
  50. package/bin/cpmm.js +171 -0
  51. package/install.sh +154 -0
  52. package/package.json +59 -0
  53. package/scripts/README.ko.md +150 -0
  54. package/scripts/README.md +150 -0
  55. package/scripts/analyze-failures.sh +145 -0
  56. package/scripts/build.sh +34 -0
  57. package/scripts/claude_command_smoke.sh +116 -0
  58. package/scripts/commit.sh +7 -0
  59. package/scripts/create-branch.sh +14 -0
  60. package/scripts/hooks/README.ko.md +117 -0
  61. package/scripts/hooks/README.md +118 -0
  62. package/scripts/hooks/compact-suggest.sh +52 -0
  63. package/scripts/hooks/critical-action-check.sh +68 -0
  64. package/scripts/hooks/notification.sh +47 -0
  65. package/scripts/hooks/post-edit-format.sh +39 -0
  66. package/scripts/hooks/pre-compact.sh +55 -0
  67. package/scripts/hooks/readonly-check.sh +19 -0
  68. package/scripts/hooks/retry-check.sh +32 -0
  69. package/scripts/hooks/session-cleanup.sh +83 -0
  70. package/scripts/hooks/session-start.sh +70 -0
  71. package/scripts/hooks/stop-collect-context.sh +39 -0
  72. package/scripts/hooks/tool-failure-log.sh +46 -0
  73. package/scripts/lint.sh +34 -0
  74. package/scripts/runtime/README.ko.md +60 -0
  75. package/scripts/runtime/README.md +60 -0
  76. package/scripts/runtime/adapters/README.ko.md +68 -0
  77. package/scripts/runtime/adapters/README.md +68 -0
  78. package/scripts/runtime/adapters/_interface.sh +53 -0
  79. package/scripts/runtime/adapters/_template.sh +67 -0
  80. package/scripts/runtime/adapters/generic.sh +78 -0
  81. package/scripts/runtime/adapters/go.sh +51 -0
  82. package/scripts/runtime/adapters/jvm.sh +97 -0
  83. package/scripts/runtime/adapters/node.sh +104 -0
  84. package/scripts/runtime/adapters/python.sh +116 -0
  85. package/scripts/runtime/adapters/rust.sh +49 -0
  86. package/scripts/runtime/detect.sh +52 -0
  87. package/scripts/scrub-secrets.js +48 -0
  88. package/scripts/snapshot.sh +45 -0
  89. package/scripts/test.sh +34 -0
  90. package/scripts/verify.sh +35 -0
package/README.md ADDED
@@ -0,0 +1,441 @@
1
+ > **[한국어 버전](README.ko.md)**
2
+
3
+ <!-- Badges -->
4
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
5
+ ![Claude Code](https://img.shields.io/badge/Claude_Code-Compatible-purple.svg)
6
+ ![Pro Plan](https://img.shields.io/badge/Pro_Plan-Optimized-green.svg)
7
+
8
+ # Claude Pro MinMax (CPMM)
9
+
10
+ > **Minimize waste. Maximize validated work.**
11
+
12
+ CPMM helps Pro users complete more verified tasks before reset through model routing, output control, and local safety rails.
13
+
14
+ > **Already installed? Start here: [User Guide](docs/USER-MANUAL.md)**
15
+
16
+ ---
17
+
18
+ > [!TIP]
19
+ > **🚀 3-Second Summary: Why use this?**
20
+ > 1. **Batch Execution:** Use `/do` to keep implementation and verification in one flow, and escalate to `/do-sonnet`/`/do-opus` only when needed.
21
+ > 2. **Output Cost Control:** Use response budgets and CLI filtering to reduce unnecessary output tokens.
22
+ > 3. **Local Safety Rails:** Local hooks and atomic rollback help you recover quickly on failure.
23
+
24
+ ---
25
+
26
+ ## 🛠 Installation
27
+
28
+ ### 1. Prerequisites
29
+ ```bash
30
+ npm install -g @anthropic-ai/claude-code
31
+ npm install -g @mixedbread/mgrep # optional, recommended: ~50% output reduction
32
+ mgrep install-claude-code
33
+ brew install jq # macOS (Linux: sudo apt-get install jq)
34
+ brew install tmux # optional: required for /watch (Linux: sudo apt-get install tmux)
35
+ ```
36
+
37
+ ### 2. npm / npx Install (Recommended)
38
+ ```bash
39
+ npx claude-pro-minmax@latest install
40
+ ```
41
+
42
+ Or install globally:
43
+ ```bash
44
+ npm install -g claude-pro-minmax
45
+ cpmm install
46
+ ```
47
+
48
+ ### 3. One-Line Install (curl)
49
+ ```bash
50
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/move-hoon/claude-pro-minmax/main/install.sh)"
51
+ ```
52
+
53
+ ### 4. Manual Install
54
+ ```bash
55
+ git clone https://github.com/move-hoon/claude-pro-minmax.git
56
+ cd claude-pro-minmax
57
+ less install.sh
58
+ bash install.sh
59
+ ```
60
+
61
+ ### 5. Post-Install Configuration (Optional)
62
+ **The installation script will ask for your Perplexity API Key and output language.**
63
+ If you skipped language selection, you can configure it manually:
64
+ - **Non-English:** Create `~/.claude/rules/language.md` with your preferred language
65
+ - **English (default):** No file needed. Remove `~/.claude/rules/language.md` if it exists
66
+
67
+ If you skipped Perplexity setup during installation, you can set it up manually:
68
+ 1. Open `~/.claude.json`.
69
+ 2. Add the following to the `mcpServers` object:
70
+ ```json
71
+ "perplexity": {
72
+ "command": "npx",
73
+ "args": ["-y", "@perplexity-ai/mcp-server"],
74
+ "env": {
75
+ "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
76
+ }
77
+ }
78
+ ```
79
+
80
+ > **Other included MCP servers (Enabled by default):**
81
+ > - **Sequential Thinking**: Powerful reasoning tool for complex logic.
82
+ > - **Context7**: Advanced documentation fetching and context management.
83
+
84
+ > **Note:** The installation script automatically backs up your existing `~/.claude` settings (`~/.claude-backup-{timestamp}`).
85
+
86
+ ### 6. Project Initialization
87
+ > **Tip:** Before running `claude`, initialize your project by referencing templates in this repository's `project-templates/` directory. (`install.sh` does not copy `project-templates` into `~/.claude`.)
88
+
89
+ ### 7. Verify Installation
90
+ ```bash
91
+ npx claude-pro-minmax@latest doctor
92
+ # or (if installed globally)
93
+ cpmm doctor
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 🚀 Quick Start
99
+
100
+ ### 🤖 Agent Workflow
101
+
102
+ CPMM provides layered model routing: `/plan` chains @planner (Sonnet 4.6) → @builder (Haiku 4.5) for complex tasks, while `/do` executes directly in the current session model for speed.
103
+
104
+ ```mermaid
105
+ flowchart LR
106
+ Start([User Request]) --> Cmd{Command?}
107
+
108
+ Cmd -->|/plan| Plan[/"@planner (Sonnet 4.6)"/]
109
+ Cmd -->|/do| Snap["📸 git stash push"]
110
+
111
+ Snap --> Exec["Session Model (Direct)"]
112
+ Plan -->|"--no-build"| Done([Done])
113
+ Plan -->|Blueprint| Build[/"@builder (Haiku 4.5)"/]
114
+ Exec -- "Success" --> DropDo["🗑️ git stash drop"]
115
+ Build -- "Success" --> DropPlan["🗑️ git stash drop"]
116
+ DropDo --> Verify["✅ verify.sh"]
117
+ DropPlan --> Review[/"@reviewer (Haiku 4.5)"/]
118
+ Exec -- "Failure (2x)" --> Pop["⏪ git stash pop"]
119
+ Build -- "Failure (2x)" --> Pop
120
+ Pop --> Escalate("🚨 Escalate to Sonnet 4.6")
121
+
122
+ Verify --> Done
123
+ Review --> Done
124
+ Escalate -.-> Review
125
+
126
+ classDef planner fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
127
+ classDef builder fill:#bbdefb,stroke:#1565c0,stroke-width:2px;
128
+ classDef reviewer fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
129
+ classDef escalate fill:#ffcdd2,stroke:#b71c1c,stroke-width:2px;
130
+ classDef done fill:#e0e0e0,stroke:#9e9e9e,stroke-width:2px,font-weight:bold;
131
+ classDef snapshot fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px;
132
+ classDef direct fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
133
+ classDef verify fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px;
134
+
135
+ class Plan planner;
136
+ class Build builder;
137
+ class Review reviewer;
138
+ class Escalate escalate;
139
+ class Done done;
140
+ class Snap,DropDo,DropPlan,Pop snapshot;
141
+ class Exec direct;
142
+ class Verify verify;
143
+ ```
144
+
145
+ ### ⌨️ Command Guide
146
+
147
+ **1. Core Commands**
148
+
149
+ Essential commands used most frequently.
150
+
151
+ | Command | Description | Recommended Situation |
152
+ | --- | --- | --- |
153
+ | `/do [task]` | Rapid implementation (session model) | Simple bug fixes, script writing |
154
+ | `/plan [task]` | **Sonnet 4.6** Design → **Haiku 4.5** Implementation | Feature additions, refactoring, complex logic |
155
+ | `/review [target]` | **Haiku 4.5** (Read-only) | Code review (Specify file or directory) |
156
+
157
+ > **Cost Optimization Tip:** Set your session model to Haiku (`/model haiku`) before using `/do` for simple tasks — same **1/5 API input-token price** as @builder. Use `/do-sonnet` or `/plan` for complex tasks.
158
+
159
+ <details>
160
+ <summary><strong>🚀 Advanced Commands - Click to Expand</strong></summary>
161
+
162
+ Full command list for more sophisticated tasks or session management.
163
+
164
+ | Command | Description | Recommended Situation |
165
+ | :--- | :--- | :--- |
166
+ | **🧠 Deep Execution** | | |
167
+ | `/dplan [task]` | **Sonnet 4.6** + Perplexity, Sequential Thinking, Context7 | Library comparison, latest tech research (Deep Research) |
168
+ | `/do-sonnet` | Execute directly with **Sonnet 4.6** | Manual escalation when Haiku 4.5 keeps failing |
169
+ | `/do-opus` | Execute directly with **Opus 4.6** | Resolving extremely complex problems (Cost caution) |
170
+ | **💾 Session/Context** | | |
171
+ | `/session-save` | Summarize and save session | When pausing work (Auto-removal of secrets) |
172
+ | `/session-load` | Load session | Resuming previous work |
173
+ | `/compact-phase` | Step-by-step context compaction | When context cleanup is needed mid-session |
174
+ | `/load-context` | Load context templates | Initial setup for frontend/backend |
175
+ | **🛠️ Utility** | | |
176
+ | `/learn` | Learn and save patterns | Registering frequently recurring errors or preferred styles |
177
+ | `/analyze-failures` | Analyze error logs | Identifying causes of recurring errors |
178
+ | `/watch` | Process monitoring (tmux) | Observing long-running builds/tests |
179
+ | `/llms-txt` | Fetch documentation | Loading official library docs in LLM format |
180
+
181
+ </details>
182
+
183
+ ---
184
+
185
+ ## Core Strategy
186
+
187
+ > [!NOTE]
188
+ > Anthropic does not publish the exact Pro quota formula. This README focuses on practical operating rules you can use immediately. For archived experiment evidence backing this strategy, see the [Core Strategy Experiment Archive](docs/CORE_STRATEGY_EXPERIMENT_ARCHIVE.md).
189
+
190
+ ### Goal
191
+
192
+ **Maximize validated throughput per quota window** by reducing quota spend per validated task.
193
+
194
+ ### Operating Principles
195
+
196
+ 1. Start with `Haiku + /do`. (Set `/model haiku` first if needed.)
197
+ 2. Use `/do` for straightforward tasks (usually 1-3 files).
198
+ 3. Use `/plan` when architecture judgment or multi-file checkpoints are needed.
199
+ 4. If Haiku keeps failing, escalate to `Sonnet + /do-sonnet`.
200
+ 5. Use `Opus + /do-opus` only when truly necessary.
201
+ 6. Keep context lean with timely compaction.
202
+ 7. For measured values and experiment context, see the [experiment archive](docs/CORE_STRATEGY_EXPERIMENT_ARCHIVE.md).
203
+
204
+ ---
205
+
206
+ ## 📚 Documentation Hub
207
+
208
+ This project provides detailed documentation for each component. Refer to the links below for specific operating principles and customization methods.
209
+
210
+ | Category | Description | Detailed Docs (Click) |
211
+ | :--- | :--- | :--- |
212
+ | **📊 Strategy Evidence** | Archived experiment results backing core strategy | [📂 **Experiment Archive**](docs/CORE_STRATEGY_EXPERIMENT_ARCHIVE.md) |
213
+ | **🧭 User Guide** | Practical operating scenarios right after installation | [📂 **User Guide**](docs/USER-MANUAL.md) |
214
+ | **🤖 Agents** | Definitions of roles and prompts for Planner, Builder, Reviewer, etc. | [📂 **Agents Guide**](.claude/agents/README.md) |
215
+ | **🕹️ Commands** | Usage of 14 commands including /plan, /do, /review | [📂 **Commands Guide**](.claude/commands/README.md) |
216
+ | **🪝 Hooks** | Logic of 11 automation scripts including Pre-check, Auto-format | [📂 **Hooks Guide**](scripts/hooks/README.md) |
217
+ | **📏 Rules** | Policies for Security, Code Style, Critical Actions | [📂 **Rules Guide**](.claude/rules/README.md) |
218
+ | **🧠 Skills** | Technical specifications for tools like CLI Wrappers | [📂 **Skills Guide**](.claude/skills/README.md) |
219
+ | **🔧 Contexts** | Context templates for Backend/Frontend projects | [📂 **Contexts Guide**](.claude/contexts/README.md) |
220
+ | **💾 Sessions** | Structure for session summary storage and management | [📂 **Sessions Guide**](.claude/sessions/README.md) |
221
+ | **🛠️ Scripts** | Collection of general-purpose scripts for Verify, Build, Test | [📂 **Scripts Guide**](scripts/README.md) |
222
+ | **⚙️ Runtime** | Automatic project language/framework detection system | [📂 **Runtime Guide**](scripts/runtime/README.md) |
223
+ | **🔌 Adapters** | Details on build adapters by language (Java, Node, Go, etc.) | [📂 **Adapters Guide**](scripts/runtime/adapters/README.md) |
224
+ | **🎓 Learned** | Pattern data accumulated through the /learn command | [📂 **Learned Skills**](.claude/skills/learned/README.md) |
225
+
226
+ ---
227
+
228
+ ## 📂 Project Structure
229
+
230
+ <details>
231
+ <summary><strong>📁 View File Tree (Click to Expand)</strong></summary>
232
+
233
+ ```text
234
+ claude-pro-minmax
235
+ ├── .claude.json # Global MCP Settings (User Scope)
236
+ ├── .claudeignore # Files excluded from Claude's context
237
+ ├── .gitignore # Git ignore rules
238
+ ├── install.sh # One-click installation script
239
+ ├── LICENSE # MIT License
240
+ ├── README.md # English Documentation
241
+ ├── README.ko.md # Korean Documentation
242
+ ├── .claude/
243
+ │ ├── CLAUDE.md # Core Instructions (Loaded in all sessions)
244
+ │ ├── settings.json # Project Settings (Permissions, hooks, env vars)
245
+ │ ├── settings.local.example.json # Template for ~/.claude/settings.local.json
246
+ │ ├── agents/ # Agent Definitions
247
+ │ │ ├── planner.md # Sonnet 4.6: Architecture and design decisions
248
+ │ │ ├── dplanner.md # Sonnet 4.6+MCP: Deep planning utilizing external tools
249
+ │ │ ├── builder.md # Haiku 4.5: Code implementation and refactoring
250
+ │ │ └── reviewer.md # Haiku 4.5: Read-only code review
251
+ │ ├── commands/ # Slash Commands
252
+ │ │ ├── plan.md # Architecture planning (Sonnet -> Haiku)
253
+ │ │ ├── dplan.md # Deep research planning (Sequential Thinking)
254
+ │ │ ├── do.md # Direct execution (Default: Haiku)
255
+ │ │ ├── do-sonnet.md # Execute with Sonnet model
256
+ │ │ ├── do-opus.md # Execute with Opus model
257
+ │ │ ├── review.md # Code review command (Read-only)
258
+ │ │ ├── watch.md # File/process monitoring via tmux
259
+ │ │ ├── session-save.md # Save current session state
260
+ │ │ ├── session-load.md # Restore previous session state
261
+ │ │ ├── compact-phase.md # Guide for step-by-step context compaction
262
+ │ │ ├── load-context.md # Load pre-defined context templates
263
+ │ │ ├── learn.md # Save new patterns to memory
264
+ │ │ ├── analyze-failures.md # Analyze tool failure logs
265
+ │ │ └── llms-txt.md # View LLM-optimized documentation
266
+ │ ├── rules/ # Behavioral Rules
267
+ │ │ ├── critical-actions.md # Block dangerous commands (rm -rf, git push -f, etc.)
268
+ │ │ ├── code-style.md # Coding conventions and standards
269
+ │ │ └── security.md # Security best practices
270
+ │ ├── skills/ # Tool Capabilities
271
+ │ │ ├── cli-wrappers/ # Lightweight CLI wrappers (Replaces MCP overhead)
272
+ │ │ │ ├── SKILL.md # Skill definition and usage
273
+ │ │ │ └── references/ # CLI reference documentation
274
+ │ │ │ ├── github-cli.md
275
+ │ │ │ └── mgrep.md
276
+ │ │ └── learned/ # Patterns accumulated through /learn command
277
+ │ ├── contexts/ # Context Templates
278
+ │ │ ├── backend-context.md # Backend-specific instructions
279
+ │ │ └── frontend-context.md # Frontend-specific instructions
280
+ │ └── sessions/ # Saved session summaries (Markdown)
281
+ ├── .github/
282
+ │ └── ISSUE_TEMPLATE/
283
+ │ └── feedback.md # Issue template for feedback
284
+ ├── docs/ # Project Documentation
285
+ │ ├── CORE_STRATEGY_EXPERIMENT_ARCHIVE.md # Experiment evidence (EN)
286
+ │ ├── CORE_STRATEGY_EXPERIMENT_ARCHIVE.ko.md # Experiment evidence (KO)
287
+ │ ├── USER-MANUAL.md # User manual (EN)
288
+ │ └── USER-MANUAL.ko.md # User manual (KO)
289
+ ├── scripts/ # Utilities and Automation
290
+ │ ├── verify.sh # General-purpose verification script
291
+ │ ├── build.sh # General-purpose build script
292
+ │ ├── test.sh # General-purpose test script
293
+ │ ├── lint.sh # General-purpose lint script
294
+ │ ├── commit.sh # Standardized git commit helper
295
+ │ ├── create-branch.sh # Branch creation helper
296
+ │ ├── snapshot.sh # Atomic rollback for /do commands (git stash)
297
+ │ ├── analyze-failures.sh # Log analysis tool for /analyze-failures
298
+ │ ├── scrub-secrets.js # Logic to remove secrets when saving sessions
299
+ │ ├── hooks/ # Zero-Cost Hooks (Automated checks)
300
+ │ │ ├── critical-action-check.sh # Pre-block dangerous commands
301
+ │ │ ├── tool-failure-log.sh # Record failure log files
302
+ │ │ ├── pre-compact.sh # Compaction pre-processor
303
+ │ │ ├── compact-suggest.sh # 3-tier compact warnings (25/50/75)
304
+ │ │ ├── post-edit-format.sh # Automatic formatting after editing
305
+ │ │ ├── readonly-check.sh # Enforce read-only for reviewer
306
+ │ │ ├── retry-check.sh # Enforce 2-retry limit for builder
307
+ │ │ ├── session-start.sh # Session initialization logic
308
+ │ │ ├── session-cleanup.sh # Cleanup and secret removal on exit
309
+ │ │ ├── stop-collect-context.sh # Collect context on interruption
310
+ │ │ └── notification.sh # Desktop notifications
311
+ │ └── runtime/ # Runtime Auto-detection
312
+ │ ├── detect.sh # Project type detection logic
313
+ │ └── adapters/ # Build adapters by language
314
+ │ ├── _interface.sh # Adapter interface definition
315
+ │ ├── _template.sh # Template for new adapters
316
+ │ ├── generic.sh # Generic fallback adapter
317
+ │ ├── go.sh # Go/Golang adapter
318
+ │ ├── jvm.sh # Java/Kotlin/JVM adapter
319
+ │ ├── node.sh # Node.js/JavaScript/TypeScript adapter
320
+ │ ├── python.sh # Python adapter
321
+ │ └── rust.sh # Rust adapter
322
+ └── project-templates/ # Language and Framework Templates
323
+ ├── backend/ # Backend project template
324
+ │ └── .claude/
325
+ │ ├── CLAUDE.md
326
+ │ └── settings.json
327
+ └── frontend/ # Frontend project template
328
+ └── .claude/
329
+ ├── CLAUDE.md
330
+ └── settings.json
331
+ ```
332
+
333
+ </details>
334
+
335
+ ## Supported Runtimes
336
+
337
+ | Runtime | Build Tool | Detection Files |
338
+ |--------|----------|----------|
339
+ | JVM | Gradle, Maven | `build.gradle.kts`, `pom.xml` |
340
+ | Node | npm, pnpm, yarn, bun | `package.json` |
341
+ | Rust | Cargo | `Cargo.toml` |
342
+ | Go | Go Modules | `go.mod` |
343
+ | Python | pip, poetry, uv | `pyproject.toml`, `setup.py`, `requirements.txt` |
344
+
345
+ To add a new runtime, copy and implement `scripts/runtime/adapters/_template.sh`.
346
+
347
+ ---
348
+
349
+ ## FAQ
350
+
351
+ <details>
352
+ <summary><strong>Q: How does this configuration optimize the Pro Plan quota?</strong></summary>
353
+
354
+ A: Anthropic's exact quota algorithm is not public. Optimization is based on three pillars:
355
+ - **Low-cost model-first path**: Start implementation with Haiku, and escalate to Sonnet/Opus only when needed.
356
+ - **Output-cost awareness**: Output tokens are priced higher than input, so response budgets/filtering reduce payload.
357
+ - **Workflow simplification**: Use `/do` and `/plan` by task type to avoid unnecessary high-cost turns.
358
+
359
+ For measured evidence, see [docs/CORE_STRATEGY_EXPERIMENT_ARCHIVE.md](docs/CORE_STRATEGY_EXPERIMENT_ARCHIVE.md).
360
+ </details>
361
+
362
+ <details>
363
+ <summary><strong>Q: Can I use Claude for the full 5 hours?</strong></summary>
364
+
365
+ A: **It is not guaranteed**. Session length depends on:
366
+ - Task complexity (simple fixes vs. large-scale refactoring).
367
+ - Model usage (mainly Haiku vs. mainly Opus).
368
+ - Context size (small files vs. entire codebase).
369
+
370
+ This configuration is designed to maximize session length within Pro Plan constraints, but it cannot bypass quota limits.
371
+ </details>
372
+
373
+ <details>
374
+ <summary><strong>Q: Can it be used on the Max Plan?</strong></summary>
375
+
376
+ A: Yes, but these optimizations may not be necessary. The Max Plan provides much higher usage limits, making Pro Plan constraints less relevant. For Max Plan users:
377
+ - Opus can be used as the default model without quota concerns.
378
+ - Git Worktrees and parallel sessions are practical.
379
+ - Output budgets and batch execution are still good practices, but not critical.
380
+
381
+ This configuration is specifically designed for the Pro Plan's 5-hour rolling reset and message-based quota system.
382
+ </details>
383
+
384
+ <details>
385
+ <summary><strong>Q: Does it conflict with existing Claude Code settings?</strong></summary>
386
+
387
+ A: It overwrites the `~/.claude/` directory, but `install.sh` automatically creates a backup as `~/.claude-backup-{timestamp}` before replacing it.
388
+ </details>
389
+
390
+ <details>
391
+ <summary><strong>Q: Which OS is supported?</strong></summary>
392
+
393
+ A: macOS and Linux are supported. Windows is available through WSL.
394
+ </details>
395
+
396
+ <details>
397
+ <summary><strong>Q: Why not use Opus for all tasks?</strong></summary>
398
+
399
+ A: API pricing (reflecting compute cost), Opus 4.6 ($5/MTok input) is much more expensive than Sonnet 4.6 ($3/MTok) or Haiku 4.5 ($1/MTok). While the exact Pro Plan quota impact is not public, using Opus 4.6 for all tasks would deplete the quota much faster. Explicit model selection (`/do-opus`) is used to ensure awareness when using expensive models.
400
+ </details>
401
+
402
+ <details>
403
+ <summary><strong>Q: What happens when /do fails mid-execution?</strong></summary>
404
+
405
+ A: CPMM uses **Atomic Rollback**. Before `/do` executes, `git stash push` saves a snapshot. If execution fails after 2 retries, `git stash pop` restores the working tree to its pre-execution state. This prevents dirty state and saves 2-4 messages that would otherwise be spent on manual cleanup.
406
+
407
+ - Cost: Zero (git stash is a local operation)
408
+ - Limitation: Only tracks existing (tracked) files. Newly created files require manual removal.
409
+ </details>
410
+
411
+ ---
412
+
413
+ ## References
414
+
415
+ - Archived experiment evidence for core strategy: [Core Strategy Experiment Archive](docs/CORE_STRATEGY_EXPERIMENT_ARCHIVE.md)
416
+ - Official pricing and usage docs:
417
+ - [Anthropic Pricing](https://docs.anthropic.com/en/docs/about-claude/pricing)
418
+ - [Usage Limit Best Practices](https://support.claude.com/en/articles/9797557-usage-limit-best-practices)
419
+ - [Understanding Usage and Length Limits](https://support.claude.com/en/articles/11647753-understanding-usage-and-length-limits)
420
+
421
+ ---
422
+
423
+ ## Credits
424
+
425
+ - **[affaan-m/everything-claude-code](https://github.com/affaan-m/everything-claude-code)** — Anthropic hackathon winner. The foundation of this project.
426
+ - **[@affaanmustafa](https://x.com/affaanmustafa)** — mgrep benchmark data ($0.49 → $0.23, ~50% savings) from [Longform Guide to Everything Claude Code](https://x.com/affaanmustafa/status/2014040193557471352).
427
+ - [Claude Code Official Documentation](https://code.claude.com/docs/en/)
428
+
429
+ ## Contributing
430
+
431
+ This is an open-source project. Contributions are welcome!
432
+
433
+ 1. Fork the repository
434
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
435
+ 3. Commit changes (`git commit -m 'feat: Add amazing feature'`)
436
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
437
+ 5. Create a Pull Request
438
+
439
+ ## License
440
+
441
+ MIT License
package/bin/cpmm.js ADDED
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+ const os = require("node:os");
6
+ const { spawnSync } = require("node:child_process");
7
+
8
+ const pkg = require("../package.json");
9
+ const argv = process.argv.slice(2);
10
+ const command = argv[0] || "install";
11
+ const installScript = path.resolve(__dirname, "..", "install.sh");
12
+ const HOME = os.homedir();
13
+
14
+ function printHelp() {
15
+ console.log(`CPMM CLI v${pkg.version}
16
+
17
+ Usage:
18
+ cpmm install Install CPMM to ~/.claude
19
+ cpmm doctor Verify installation
20
+ cpmm --help Show this help
21
+ cpmm --version Show version
22
+ `);
23
+ }
24
+
25
+ if (command === "--help" || command === "-h" || command === "help") {
26
+ printHelp();
27
+ process.exit(0);
28
+ }
29
+
30
+ if (command === "--version" || command === "-v" || command === "version") {
31
+ console.log(pkg.version);
32
+ process.exit(0);
33
+ }
34
+
35
+ if (process.platform === "win32") {
36
+ console.error(
37
+ "CPMM installer requires macOS/Linux. Windows users: use WSL (https://learn.microsoft.com/windows/wsl/install)"
38
+ );
39
+ process.exit(1);
40
+ }
41
+
42
+ if (command === "doctor") {
43
+ runDoctor();
44
+ process.exit(0);
45
+ }
46
+
47
+ if (!fs.existsSync(installScript)) {
48
+ console.error(`Install script not found: ${installScript}`);
49
+ process.exit(1);
50
+ }
51
+
52
+ if (command !== "install") {
53
+ console.error(`Unknown command: ${command}`);
54
+ printHelp();
55
+ process.exit(1);
56
+ }
57
+
58
+ const filteredEnv = buildFilteredEnv();
59
+ const result = spawnSync("bash", [installScript], {
60
+ stdio: "inherit",
61
+ env: filteredEnv,
62
+ });
63
+
64
+ if (result.error) {
65
+ console.error(result.error.message);
66
+ process.exit(1);
67
+ }
68
+
69
+ process.exit(result.status ?? 1);
70
+
71
+ function buildFilteredEnv() {
72
+ const allowed = [
73
+ "PATH", "HOME", "SHELL", "USER", "TERM",
74
+ "LANG", "LC_ALL", "TMPDIR", "XDG_CONFIG_HOME",
75
+ ];
76
+ return Object.fromEntries(
77
+ allowed
78
+ .filter((k) => process.env[k] !== undefined)
79
+ .map((k) => [k, process.env[k]])
80
+ );
81
+ }
82
+
83
+ function checkFile(filePath) {
84
+ return fs.existsSync(filePath);
85
+ }
86
+
87
+ function checkExecutable(filePath) {
88
+ if (!fs.existsSync(filePath)) return false;
89
+ try {
90
+ fs.accessSync(filePath, fs.constants.X_OK);
91
+ return true;
92
+ } catch {
93
+ return false;
94
+ }
95
+ }
96
+
97
+ function checkCli(name) {
98
+ const r = spawnSync("which", [name], { encoding: "utf8" });
99
+ return r.status === 0 && r.stdout.trim().length > 0;
100
+ }
101
+
102
+ function parseMcpServers() {
103
+ const claudeJson = path.join(HOME, ".claude.json");
104
+ if (!fs.existsSync(claudeJson)) return [];
105
+ try {
106
+ const data = JSON.parse(fs.readFileSync(claudeJson, "utf8"));
107
+ return Object.keys(data.mcpServers || {});
108
+ } catch {
109
+ return [];
110
+ }
111
+ }
112
+
113
+ function formatLine(symbol, label, note) {
114
+ const base = ` ${symbol} ${label}`;
115
+ return note ? base.padEnd(46) + note : base;
116
+ }
117
+
118
+ function runDoctor() {
119
+ const results = { pass: 0, fail: 0, warn: 0 };
120
+
121
+ function check(symbol, label, note) {
122
+ if (symbol === "✓") results.pass++;
123
+ else if (symbol === "✗") results.fail++;
124
+ else results.warn++;
125
+ console.log(formatLine(symbol, label, note));
126
+ }
127
+
128
+ function required(ok, label) {
129
+ check(ok ? "✓" : "✗", label, ok ? null : "(required — missing)");
130
+ }
131
+
132
+ function optional(ok, label, note) {
133
+ check(ok ? "✓" : "⚠", label, ok ? null : note);
134
+ }
135
+
136
+ console.log(`CPMM Doctor v${pkg.version}\n`);
137
+
138
+ console.log("Core Files:");
139
+ required(checkFile(`${HOME}/.claude/CLAUDE.md`), "~/.claude/CLAUDE.md");
140
+ required(checkFile(`${HOME}/.claude/settings.json`), "~/.claude/settings.json");
141
+
142
+ console.log("\nRules:");
143
+ required(checkFile(`${HOME}/.claude/rules/critical-actions.md`), "~/.claude/rules/critical-actions.md");
144
+ required(checkFile(`${HOME}/.claude/rules/security.md`), "~/.claude/rules/security.md");
145
+ required(checkFile(`${HOME}/.claude/rules/code-style.md`), "~/.claude/rules/code-style.md");
146
+ optional(checkFile(`${HOME}/.claude/rules/language.md`), "~/.claude/rules/language.md", "(optional)");
147
+
148
+ console.log("\nScripts:");
149
+ required(checkExecutable(`${HOME}/.claude/scripts/verify.sh`), "~/.claude/scripts/verify.sh");
150
+ required(checkExecutable(`${HOME}/.claude/scripts/runtime/detect.sh`), "~/.claude/scripts/runtime/detect.sh");
151
+
152
+ console.log("\nSkills:");
153
+ required(checkFile(`${HOME}/.claude/skills/`), "~/.claude/skills/");
154
+
155
+ const mcpServers = parseMcpServers();
156
+ console.log("\nMCP Servers:");
157
+ required(mcpServers.includes("context7"), "context7");
158
+ required(mcpServers.includes("sequential-thinking"), "sequential-thinking");
159
+ optional(mcpServers.includes("perplexity"), "perplexity", "(optional — set API key)");
160
+
161
+ console.log("\nCLI Tools:");
162
+ required(checkCli("claude"), "claude");
163
+ required(checkCli("jq"), "jq");
164
+ optional(checkCli("mgrep"), "mgrep", "(optional — npm install -g @mixedbread/mgrep)");
165
+ optional(checkCli("tmux"), "tmux", "(optional)");
166
+
167
+ const total = results.pass + results.fail + results.warn;
168
+ console.log(`\nResult: ${results.pass}/${total} passed, ${results.warn} optional skipped`);
169
+
170
+ if (results.fail > 0) process.exit(1);
171
+ }