@sienklogic/plan-build-run 2.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 +56 -0
- package/CLAUDE.md +149 -0
- package/LICENSE +21 -0
- package/README.md +247 -0
- package/dashboard/bin/cli.js +25 -0
- package/dashboard/package.json +34 -0
- package/dashboard/public/.gitkeep +0 -0
- package/dashboard/public/css/layout.css +406 -0
- package/dashboard/public/css/status-colors.css +98 -0
- package/dashboard/public/js/htmx-title.js +5 -0
- package/dashboard/public/js/sidebar-toggle.js +20 -0
- package/dashboard/src/app.js +78 -0
- package/dashboard/src/middleware/errorHandler.js +52 -0
- package/dashboard/src/middleware/notFoundHandler.js +9 -0
- package/dashboard/src/repositories/planning.repository.js +128 -0
- package/dashboard/src/routes/events.routes.js +40 -0
- package/dashboard/src/routes/index.routes.js +31 -0
- package/dashboard/src/routes/pages.routes.js +195 -0
- package/dashboard/src/server.js +42 -0
- package/dashboard/src/services/dashboard.service.js +222 -0
- package/dashboard/src/services/phase.service.js +167 -0
- package/dashboard/src/services/project.service.js +57 -0
- package/dashboard/src/services/roadmap.service.js +171 -0
- package/dashboard/src/services/sse.service.js +58 -0
- package/dashboard/src/services/todo.service.js +254 -0
- package/dashboard/src/services/watcher.service.js +48 -0
- package/dashboard/src/views/coming-soon.ejs +11 -0
- package/dashboard/src/views/error.ejs +13 -0
- package/dashboard/src/views/index.ejs +5 -0
- package/dashboard/src/views/layout.ejs +1 -0
- package/dashboard/src/views/partials/dashboard-content.ejs +77 -0
- package/dashboard/src/views/partials/footer.ejs +3 -0
- package/dashboard/src/views/partials/head.ejs +21 -0
- package/dashboard/src/views/partials/header.ejs +12 -0
- package/dashboard/src/views/partials/layout-bottom.ejs +15 -0
- package/dashboard/src/views/partials/layout-top.ejs +8 -0
- package/dashboard/src/views/partials/phase-content.ejs +181 -0
- package/dashboard/src/views/partials/phases-content.ejs +117 -0
- package/dashboard/src/views/partials/roadmap-content.ejs +142 -0
- package/dashboard/src/views/partials/sidebar.ejs +38 -0
- package/dashboard/src/views/partials/todo-create-content.ejs +53 -0
- package/dashboard/src/views/partials/todo-detail-content.ejs +38 -0
- package/dashboard/src/views/partials/todos-content.ejs +53 -0
- package/dashboard/src/views/phase-detail.ejs +5 -0
- package/dashboard/src/views/phases.ejs +5 -0
- package/dashboard/src/views/roadmap.ejs +5 -0
- package/dashboard/src/views/todo-create.ejs +5 -0
- package/dashboard/src/views/todo-detail.ejs +5 -0
- package/dashboard/src/views/todos.ejs +5 -0
- package/package.json +57 -0
- package/plugins/pbr/.claude-plugin/plugin.json +13 -0
- package/plugins/pbr/UI-CONSISTENCY-GAPS.md +61 -0
- package/plugins/pbr/agents/codebase-mapper.md +271 -0
- package/plugins/pbr/agents/debugger.md +281 -0
- package/plugins/pbr/agents/executor.md +407 -0
- package/plugins/pbr/agents/general.md +164 -0
- package/plugins/pbr/agents/integration-checker.md +141 -0
- package/plugins/pbr/agents/plan-checker.md +280 -0
- package/plugins/pbr/agents/planner.md +358 -0
- package/plugins/pbr/agents/researcher.md +363 -0
- package/plugins/pbr/agents/synthesizer.md +230 -0
- package/plugins/pbr/agents/verifier.md +454 -0
- package/plugins/pbr/commands/begin.md +5 -0
- package/plugins/pbr/commands/build.md +5 -0
- package/plugins/pbr/commands/config.md +5 -0
- package/plugins/pbr/commands/continue.md +5 -0
- package/plugins/pbr/commands/debug.md +5 -0
- package/plugins/pbr/commands/discuss.md +5 -0
- package/plugins/pbr/commands/explore.md +5 -0
- package/plugins/pbr/commands/health.md +5 -0
- package/plugins/pbr/commands/help.md +5 -0
- package/plugins/pbr/commands/import.md +5 -0
- package/plugins/pbr/commands/milestone.md +5 -0
- package/plugins/pbr/commands/note.md +5 -0
- package/plugins/pbr/commands/pause.md +5 -0
- package/plugins/pbr/commands/plan.md +5 -0
- package/plugins/pbr/commands/quick.md +5 -0
- package/plugins/pbr/commands/resume.md +5 -0
- package/plugins/pbr/commands/review.md +5 -0
- package/plugins/pbr/commands/scan.md +5 -0
- package/plugins/pbr/commands/setup.md +5 -0
- package/plugins/pbr/commands/status.md +5 -0
- package/plugins/pbr/commands/todo.md +5 -0
- package/plugins/pbr/contexts/dev.md +27 -0
- package/plugins/pbr/contexts/research.md +28 -0
- package/plugins/pbr/contexts/review.md +36 -0
- package/plugins/pbr/hooks/hooks.json +183 -0
- package/plugins/pbr/references/agent-anti-patterns.md +24 -0
- package/plugins/pbr/references/agent-interactions.md +134 -0
- package/plugins/pbr/references/agent-teams.md +54 -0
- package/plugins/pbr/references/checkpoints.md +157 -0
- package/plugins/pbr/references/common-bug-patterns.md +13 -0
- package/plugins/pbr/references/continuation-format.md +212 -0
- package/plugins/pbr/references/deviation-rules.md +112 -0
- package/plugins/pbr/references/git-integration.md +226 -0
- package/plugins/pbr/references/integration-patterns.md +117 -0
- package/plugins/pbr/references/model-profiles.md +99 -0
- package/plugins/pbr/references/model-selection.md +31 -0
- package/plugins/pbr/references/pbr-rules.md +193 -0
- package/plugins/pbr/references/plan-authoring.md +181 -0
- package/plugins/pbr/references/plan-format.md +283 -0
- package/plugins/pbr/references/planning-config.md +213 -0
- package/plugins/pbr/references/questioning.md +214 -0
- package/plugins/pbr/references/reading-verification.md +127 -0
- package/plugins/pbr/references/stub-patterns.md +160 -0
- package/plugins/pbr/references/subagent-coordination.md +119 -0
- package/plugins/pbr/references/ui-formatting.md +399 -0
- package/plugins/pbr/references/verification-patterns.md +198 -0
- package/plugins/pbr/references/wave-execution.md +95 -0
- package/plugins/pbr/scripts/auto-continue.js +80 -0
- package/plugins/pbr/scripts/check-dangerous-commands.js +136 -0
- package/plugins/pbr/scripts/check-doc-sprawl.js +102 -0
- package/plugins/pbr/scripts/check-phase-boundary.js +196 -0
- package/plugins/pbr/scripts/check-plan-format.js +270 -0
- package/plugins/pbr/scripts/check-roadmap-sync.js +252 -0
- package/plugins/pbr/scripts/check-skill-workflow.js +262 -0
- package/plugins/pbr/scripts/check-state-sync.js +476 -0
- package/plugins/pbr/scripts/check-subagent-output.js +144 -0
- package/plugins/pbr/scripts/config-schema.json +251 -0
- package/plugins/pbr/scripts/context-budget-check.js +287 -0
- package/plugins/pbr/scripts/event-handler.js +151 -0
- package/plugins/pbr/scripts/event-logger.js +92 -0
- package/plugins/pbr/scripts/hook-logger.js +76 -0
- package/plugins/pbr/scripts/hooks-schema.json +79 -0
- package/plugins/pbr/scripts/log-subagent.js +152 -0
- package/plugins/pbr/scripts/log-tool-failure.js +88 -0
- package/plugins/pbr/scripts/pbr-tools.js +1301 -0
- package/plugins/pbr/scripts/post-write-dispatch.js +66 -0
- package/plugins/pbr/scripts/post-write-quality.js +207 -0
- package/plugins/pbr/scripts/pre-bash-dispatch.js +56 -0
- package/plugins/pbr/scripts/pre-write-dispatch.js +62 -0
- package/plugins/pbr/scripts/progress-tracker.js +228 -0
- package/plugins/pbr/scripts/session-cleanup.js +254 -0
- package/plugins/pbr/scripts/status-line.js +285 -0
- package/plugins/pbr/scripts/suggest-compact.js +119 -0
- package/plugins/pbr/scripts/task-completed.js +45 -0
- package/plugins/pbr/scripts/track-context-budget.js +119 -0
- package/plugins/pbr/scripts/validate-commit.js +200 -0
- package/plugins/pbr/scripts/validate-plugin-structure.js +172 -0
- package/plugins/pbr/skills/begin/SKILL.md +545 -0
- package/plugins/pbr/skills/begin/templates/PROJECT.md.tmpl +33 -0
- package/plugins/pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +18 -0
- package/plugins/pbr/skills/begin/templates/STATE.md.tmpl +49 -0
- package/plugins/pbr/skills/begin/templates/config.json.tmpl +63 -0
- package/plugins/pbr/skills/begin/templates/researcher-prompt.md.tmpl +19 -0
- package/plugins/pbr/skills/begin/templates/roadmap-prompt.md.tmpl +30 -0
- package/plugins/pbr/skills/begin/templates/synthesis-prompt.md.tmpl +16 -0
- package/plugins/pbr/skills/build/SKILL.md +962 -0
- package/plugins/pbr/skills/config/SKILL.md +241 -0
- package/plugins/pbr/skills/continue/SKILL.md +127 -0
- package/plugins/pbr/skills/debug/SKILL.md +489 -0
- package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +16 -0
- package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +27 -0
- package/plugins/pbr/skills/discuss/SKILL.md +338 -0
- package/plugins/pbr/skills/discuss/templates/CONTEXT.md.tmpl +61 -0
- package/plugins/pbr/skills/discuss/templates/decision-categories.md +9 -0
- package/plugins/pbr/skills/explore/SKILL.md +362 -0
- package/plugins/pbr/skills/health/SKILL.md +186 -0
- package/plugins/pbr/skills/health/templates/check-pattern.md.tmpl +30 -0
- package/plugins/pbr/skills/health/templates/output-format.md.tmpl +63 -0
- package/plugins/pbr/skills/help/SKILL.md +140 -0
- package/plugins/pbr/skills/import/SKILL.md +490 -0
- package/plugins/pbr/skills/milestone/SKILL.md +673 -0
- package/plugins/pbr/skills/milestone/templates/audit-report.md.tmpl +48 -0
- package/plugins/pbr/skills/milestone/templates/stats-file.md.tmpl +30 -0
- package/plugins/pbr/skills/note/SKILL.md +212 -0
- package/plugins/pbr/skills/pause/SKILL.md +235 -0
- package/plugins/pbr/skills/pause/templates/continue-here.md.tmpl +71 -0
- package/plugins/pbr/skills/plan/SKILL.md +628 -0
- package/plugins/pbr/skills/plan/decimal-phase-calc.md +98 -0
- package/plugins/pbr/skills/plan/templates/checker-prompt.md.tmpl +21 -0
- package/plugins/pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +32 -0
- package/plugins/pbr/skills/plan/templates/planner-prompt.md.tmpl +38 -0
- package/plugins/pbr/skills/plan/templates/researcher-prompt.md.tmpl +19 -0
- package/plugins/pbr/skills/plan/templates/revision-prompt.md.tmpl +23 -0
- package/plugins/pbr/skills/quick/SKILL.md +335 -0
- package/plugins/pbr/skills/resume/SKILL.md +388 -0
- package/plugins/pbr/skills/review/SKILL.md +652 -0
- package/plugins/pbr/skills/review/templates/debugger-prompt.md.tmpl +60 -0
- package/plugins/pbr/skills/review/templates/gap-planner-prompt.md.tmpl +40 -0
- package/plugins/pbr/skills/review/templates/verifier-prompt.md.tmpl +115 -0
- package/plugins/pbr/skills/scan/SKILL.md +269 -0
- package/plugins/pbr/skills/scan/templates/mapper-prompt.md.tmpl +201 -0
- package/plugins/pbr/skills/setup/SKILL.md +227 -0
- package/plugins/pbr/skills/shared/commit-planning-docs.md +35 -0
- package/plugins/pbr/skills/shared/config-loading.md +102 -0
- package/plugins/pbr/skills/shared/context-budget.md +40 -0
- package/plugins/pbr/skills/shared/context-loader-task.md +86 -0
- package/plugins/pbr/skills/shared/digest-select.md +79 -0
- package/plugins/pbr/skills/shared/domain-probes.md +125 -0
- package/plugins/pbr/skills/shared/error-reporting.md +79 -0
- package/plugins/pbr/skills/shared/gate-prompts.md +388 -0
- package/plugins/pbr/skills/shared/phase-argument-parsing.md +45 -0
- package/plugins/pbr/skills/shared/progress-display.md +53 -0
- package/plugins/pbr/skills/shared/revision-loop.md +81 -0
- package/plugins/pbr/skills/shared/state-loading.md +62 -0
- package/plugins/pbr/skills/shared/state-update.md +161 -0
- package/plugins/pbr/skills/shared/universal-anti-patterns.md +33 -0
- package/plugins/pbr/skills/status/SKILL.md +353 -0
- package/plugins/pbr/skills/todo/SKILL.md +181 -0
- package/plugins/pbr/templates/CONTEXT.md.tmpl +52 -0
- package/plugins/pbr/templates/INTEGRATION-REPORT.md.tmpl +151 -0
- package/plugins/pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -0
- package/plugins/pbr/templates/ROADMAP.md.tmpl +40 -0
- package/plugins/pbr/templates/SUMMARY.md.tmpl +81 -0
- package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +116 -0
- package/plugins/pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -0
- package/plugins/pbr/templates/codebase/CONCERNS.md.tmpl +93 -0
- package/plugins/pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -0
- package/plugins/pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -0
- package/plugins/pbr/templates/codebase/STACK.md.tmpl +78 -0
- package/plugins/pbr/templates/codebase/STRUCTURE.md.tmpl +80 -0
- package/plugins/pbr/templates/codebase/TESTING.md.tmpl +107 -0
- package/plugins/pbr/templates/continue-here.md.tmpl +73 -0
- package/plugins/pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -0
- package/plugins/pbr/templates/research/ARCHITECTURE.md.tmpl +124 -0
- package/plugins/pbr/templates/research/STACK.md.tmpl +71 -0
- package/plugins/pbr/templates/research/SUMMARY.md.tmpl +112 -0
- package/plugins/pbr/templates/research-outputs/phase-research.md.tmpl +81 -0
- package/plugins/pbr/templates/research-outputs/project-research.md.tmpl +99 -0
- package/plugins/pbr/templates/research-outputs/synthesis.md.tmpl +36 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Model Profiles Reference
|
|
2
|
+
|
|
3
|
+
How Plan-Build-Run maps agents to models and how to configure model selection.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Agent-to-Model Mapping
|
|
8
|
+
|
|
9
|
+
Each Plan-Build-Run agent has a default model specified in its agent definition frontmatter (`model:` field). These defaults are overridden by the `models` section of `config.json`.
|
|
10
|
+
|
|
11
|
+
### Default Agent Models
|
|
12
|
+
|
|
13
|
+
| Agent | Default Model | Rationale |
|
|
14
|
+
|-------|---------------|-----------|
|
|
15
|
+
| `researcher` | `sonnet` | Research requires strong reasoning for source evaluation and synthesis |
|
|
16
|
+
| `planner` | `inherit` | Planning is complex; inherits the session's primary model |
|
|
17
|
+
| `executor` | `inherit` | Execution needs the full capability of the session model |
|
|
18
|
+
| `verifier` | `sonnet` | Verification needs solid reasoning but not the heaviest model |
|
|
19
|
+
| `integration-checker` | `sonnet` | Cross-phase analysis requires strong pattern matching |
|
|
20
|
+
| `plan-checker` | `sonnet` | Plan quality analysis needs good analytical capability |
|
|
21
|
+
| `debugger` | `inherit` | Debugging is complex; inherits session model |
|
|
22
|
+
| `codebase-mapper` | `sonnet` | Codebase analysis requires thorough reasoning |
|
|
23
|
+
| `synthesizer` | `haiku` | Synthesis is mechanical combination; speed over depth |
|
|
24
|
+
| `general` | `inherit` | Lightweight utility; inherits session model |
|
|
25
|
+
|
|
26
|
+
The `inherit` value means the agent uses whatever model the parent session is running (typically the user's configured Claude model).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Model Profile Presets
|
|
31
|
+
|
|
32
|
+
The `/pbr:config model-profile {preset}` command sets all agent models at once using a preset:
|
|
33
|
+
|
|
34
|
+
| Profile | Researcher | Planner | Executor | Verifier | Int-Checker | Debugger | Mapper | Synthesizer |
|
|
35
|
+
|---------|-----------|---------|----------|----------|-------------|----------|--------|-------------|
|
|
36
|
+
| `quality` | opus | opus | opus | opus | sonnet | opus | sonnet | sonnet |
|
|
37
|
+
| `balanced` | sonnet | inherit | inherit | sonnet | sonnet | inherit | sonnet | haiku |
|
|
38
|
+
| `budget` | haiku | haiku | haiku | haiku | haiku | haiku | haiku | haiku |
|
|
39
|
+
| `adaptive` | sonnet | sonnet | inherit | sonnet | haiku | inherit | haiku | haiku |
|
|
40
|
+
|
|
41
|
+
### Preset Descriptions
|
|
42
|
+
|
|
43
|
+
- **quality**: Maximum capability across all agents. Best results but highest token cost. Use for critical projects or complex architectures.
|
|
44
|
+
- **balanced**: The default preset. Front-loads intelligence in research and verification, inherits session model for planning and execution. Good general-purpose choice.
|
|
45
|
+
- **budget**: All agents use haiku. Fastest and cheapest, but reduced quality for complex reasoning tasks. Suitable for well-defined, mechanical work.
|
|
46
|
+
- **adaptive**: Front-loads intelligence in research and planning (where decisions matter most), uses lighter models for mechanical execution and verification. Good cost-quality tradeoff.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Configuring Models
|
|
51
|
+
|
|
52
|
+
### Per-Agent Configuration
|
|
53
|
+
|
|
54
|
+
Set an individual agent's model via `/pbr:config`:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/pbr:config model executor sonnet
|
|
58
|
+
/pbr:config model verifier opus
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or edit `config.json` directly:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"models": {
|
|
66
|
+
"researcher": "sonnet",
|
|
67
|
+
"planner": "inherit",
|
|
68
|
+
"executor": "inherit",
|
|
69
|
+
"verifier": "sonnet",
|
|
70
|
+
"integration_checker": "sonnet",
|
|
71
|
+
"debugger": "inherit",
|
|
72
|
+
"mapper": "sonnet",
|
|
73
|
+
"synthesizer": "haiku"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Valid Model Values
|
|
79
|
+
|
|
80
|
+
| Value | Meaning |
|
|
81
|
+
|-------|---------|
|
|
82
|
+
| `sonnet` | Claude Sonnet (4.5/4.6) -- balanced speed and capability |
|
|
83
|
+
| `opus` | Claude Opus (4.6) -- highest capability, slower |
|
|
84
|
+
| `haiku` | Claude Haiku (4.5) -- fastest, lower capability |
|
|
85
|
+
| `inherit` | Use the session's primary model (whatever the user is running) |
|
|
86
|
+
|
|
87
|
+
Note: Claude Code 2.1.45+ supports Sonnet 4.6. Model values are abstract names — Claude Code resolves them to the latest available version.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Model Selection in Skill Orchestration
|
|
92
|
+
|
|
93
|
+
Skills that spawn subagents use the `model` parameter in `Task()` calls. Some skills hardcode a lighter model for specific tasks:
|
|
94
|
+
|
|
95
|
+
- **Build skill**: Spawns inline verifiers with `model: "haiku"` for quick spot-checks
|
|
96
|
+
- **Build skill**: Spawns codebase mapper updates with `model: "haiku"` for incremental map refreshes
|
|
97
|
+
- **Plan skill**: Uses the configured `planner` model for main planning work
|
|
98
|
+
|
|
99
|
+
The `subagent_type` parameter automatically loads the agent definition, and the model from `config.json` takes precedence over the agent's default `model:` frontmatter field.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Model Selection Reference
|
|
2
|
+
|
|
3
|
+
Plan-Build-Run uses adaptive model selection to balance cost and capability.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
1. The planner annotates each task with `complexity="simple|medium|complex"`
|
|
8
|
+
2. The build skill maps complexity to a model via `config.models.complexity_map`
|
|
9
|
+
3. The executor agent is spawned with the selected model
|
|
10
|
+
|
|
11
|
+
## Default Mapping
|
|
12
|
+
|
|
13
|
+
| Complexity | Model | Rationale |
|
|
14
|
+
|-----------|-------|-----------|
|
|
15
|
+
| simple | haiku | Fast, cheap — sufficient for mechanical changes |
|
|
16
|
+
| medium | sonnet | Good balance for standard feature work |
|
|
17
|
+
| complex | inherit | Uses session model — typically Opus for critical work |
|
|
18
|
+
|
|
19
|
+
## Override Mechanisms
|
|
20
|
+
|
|
21
|
+
1. **Per-task override**: Add `model="sonnet"` attribute to task XML in PLAN.md
|
|
22
|
+
2. **Config override**: Set `models.complexity_map` in config.json to change defaults
|
|
23
|
+
3. **Agent-level override**: Set `models.executor` in config.json to force a single model for all executor spawns (disables adaptive selection)
|
|
24
|
+
|
|
25
|
+
## Heuristics
|
|
26
|
+
|
|
27
|
+
The planner uses these signals to determine complexity:
|
|
28
|
+
- File count and types
|
|
29
|
+
- Task name keywords
|
|
30
|
+
- Dependency count
|
|
31
|
+
- Whether the task introduces new patterns vs. follows established ones
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Plan-Build-Run Rules
|
|
2
|
+
|
|
3
|
+
Authoritative rules for all Plan-Build-Run skills, agents, hooks, and workflows.
|
|
4
|
+
Condensed from the 3,100-line `docs/DEVELOPMENT-GUIDE.md`. When in doubt, these rules govern.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Philosophy
|
|
9
|
+
|
|
10
|
+
1. **Context is precious.** The orchestrator stays lean (~15% usage). Delegate heavy work to subagents.
|
|
11
|
+
2. **State lives on disk.** Skills and agents communicate through `.planning/` files, not messages.
|
|
12
|
+
3. **Agents are black boxes.** Clear input/output contracts. Agents never read other agent definitions.
|
|
13
|
+
4. **Gates provide safety.** Users control pace via config toggles. Never skip a gate.
|
|
14
|
+
5. **One task, one commit.** Atomic commits for clean history and easy rollback.
|
|
15
|
+
6. **Cross-platform always.** `path.join()`, CommonJS, test on Windows/macOS/Linux.
|
|
16
|
+
7. **Test everything.** 70% coverage minimum. All 9 CI matrix combinations must pass.
|
|
17
|
+
8. **PLAN-BUILD-RUN branding only.** Always use `PLAN-BUILD-RUN ►` prefix in banners.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Context Budget
|
|
22
|
+
|
|
23
|
+
9. Target 15% orchestrator context usage. Warn user at 30%.
|
|
24
|
+
10. **Never** read agent definitions (`agents/*.md`) in the orchestrator — `subagent_type` auto-loads them.
|
|
25
|
+
11. **Never** inline large files into `Task()` prompts — tell agents to read files from disk.
|
|
26
|
+
12. **Never** read full subagent output — read frontmatter only (first 10-20 lines).
|
|
27
|
+
13. Read STATE.md and config.json fully. Read ROADMAP.md by section. Read PLAN.md/SUMMARY.md/VERIFICATION.md frontmatter only.
|
|
28
|
+
14. Use the `limit` parameter on Read to restrict line counts.
|
|
29
|
+
15. Proactively suggest `/pbr:pause` when context gets heavy — before compaction, not after.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## State Management
|
|
34
|
+
|
|
35
|
+
16. STATE.md is the **single source of truth** for current position.
|
|
36
|
+
17. **Never** infer current phase from directory listings, git log, or conversation history.
|
|
37
|
+
18. Always read STATE.md before making state-dependent decisions.
|
|
38
|
+
19. Update STATE.md at: begin, plan, build, review, pause, continue, milestone.
|
|
39
|
+
20. **Never** commit STATE.md mid-skill — hooks handle session persistence.
|
|
40
|
+
21. Agents write artifacts (SUMMARY.md, VERIFICATION.md). Only the orchestrator writes STATE.md.
|
|
41
|
+
22. Every ROADMAP.md phase must have a matching `.planning/phases/` directory, and vice versa.
|
|
42
|
+
23. config.json is validated against `scripts/config-schema.json` on load.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Agent Spawning
|
|
47
|
+
|
|
48
|
+
24. Always use `subagent_type: "pbr:{name}"` to spawn agents.
|
|
49
|
+
25. Pass file paths to agents, not file contents.
|
|
50
|
+
26. Agents never read other agent definition files.
|
|
51
|
+
27. Each agent gets a fresh 200k token context window — let them do the heavy reading.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## User Interaction Patterns
|
|
56
|
+
|
|
57
|
+
28. Use `AskUserQuestion` for all structured gate checks — never plain-text "Type approved" prompts.
|
|
58
|
+
29. AskUserQuestion is an orchestrator-only tool. It **cannot** be called from subagents (Task contexts).
|
|
59
|
+
30. Max 4 options per AskUserQuestion call. If more options exist, split into a 2-step flow.
|
|
60
|
+
31. `header` field must be max 12 characters. Keep it a single word when possible.
|
|
61
|
+
32. `multiSelect` is always `false` for Plan-Build-Run gate checks.
|
|
62
|
+
33. Always handle the "Other" case — users may type freeform text instead of selecting an option.
|
|
63
|
+
34. Reuse patterns from `skills/shared/gate-prompts.md` by name. Do not reinvent prompts inline.
|
|
64
|
+
35. Do **not** use AskUserQuestion for freeform text input (symptom gathering, Socratic discussion, open-ended questions). Use plain conversation for those.
|
|
65
|
+
36. Skills that do not require user interaction (continue, health, help, pause) intentionally omit AskUserQuestion from allowed-tools.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Skill Authoring
|
|
70
|
+
|
|
71
|
+
37. Every SKILL.md starts with YAML frontmatter: `name`, `description`, `allowed-tools`, `argument-hint`.
|
|
72
|
+
38. Skills that spawn agents **must** have a `## Context Budget` section.
|
|
73
|
+
39. Mark each step as `(inline)` or `(delegate)` — inline for light work, delegate for analysis.
|
|
74
|
+
40. Reference templates and references by filename — never inline them.
|
|
75
|
+
41. Gate checks: read config toggle → display summary → ask user → proceed/abort/revise.
|
|
76
|
+
42. Use branded UI elements from `references/ui-formatting.md`.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Agent Authoring
|
|
81
|
+
|
|
82
|
+
43. Every agent file starts with YAML frontmatter: `name`, `description`, `model`, `memory`, `tools`.
|
|
83
|
+
44. Agent name matches the agent file name (no prefix needed).
|
|
84
|
+
45. `tools` array: only include tools the agent actually uses.
|
|
85
|
+
46. Agents write artifacts to disk. They never modify STATE.md or ROADMAP.md.
|
|
86
|
+
47. Agent definitions are self-contained — no cross-agent references.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Hook Development
|
|
91
|
+
|
|
92
|
+
48. All hooks use **CommonJS** (`require`), never ES modules (`import`).
|
|
93
|
+
49. All hooks call `logHook()` from `hook-logger.js`. No silent exits.
|
|
94
|
+
50. Exit codes: `0` = allow/success, `2` = block (PreToolUse only), other = error (logged, non-blocking).
|
|
95
|
+
51. Hooks receive JSON on stdin, write JSON to stdout.
|
|
96
|
+
52. Fail gracefully: wrap in try/catch, exit 0 on parse errors.
|
|
97
|
+
53. Every hook in `hooks.json` must have a `statusMessage` field (gerund form: "Validating...", keep short).
|
|
98
|
+
54. Windows file deletion: use 3-attempt retry loop to handle AV/indexer locks.
|
|
99
|
+
55. Every hook script must have a corresponding `tests/{name}.test.js`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Commits
|
|
104
|
+
|
|
105
|
+
56. Format: `{type}({scope}): {description}`.
|
|
106
|
+
57. Valid types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `wip`.
|
|
107
|
+
58. Valid scopes: `{NN}-{MM}` (phase-plan), `quick-{NNN}`, `planning`, or any lowercase word.
|
|
108
|
+
59. **Never** use `git add .` or `git add -A` — stage specific files only.
|
|
109
|
+
60. Blocked files: `.env` (not `.env.example`), `*.key`, `*.pem`, `*.pfx`, `*.p12`, `*credential*`, `*secret*` (unless in `tests/` or `*.example`).
|
|
110
|
+
61. TDD tasks: exactly 3 commits — RED (test), GREEN (feat), REFACTOR.
|
|
111
|
+
62. Executors: one atomic commit per task.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Templates
|
|
116
|
+
|
|
117
|
+
63. Default syntax: `{variable}` placeholders for string substitution.
|
|
118
|
+
64. Only use EJS (`<%= %>`, `<% %>`) when loops or conditionals are genuinely needed.
|
|
119
|
+
65. Template files use `.tmpl` extension. Name matches the output file (e.g., `SUMMARY.md.tmpl` → `SUMMARY.md`).
|
|
120
|
+
66. Templates live in `templates/` (global), `templates/codebase/` (scan), `templates/research/` (research), or `skills/{name}/templates/` (skill-specific).
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## File Naming
|
|
125
|
+
|
|
126
|
+
67. Skills: `plugins/pbr/skills/{skill-name}/SKILL.md` — lowercase hyphenated dir, uppercase `SKILL.md`.
|
|
127
|
+
68. Agents: `plugins/pbr/agents/{name}.md` — agent name matches file name.
|
|
128
|
+
69. Scripts: `plugins/pbr/scripts/{name}.js` — lowercase, hyphenated, CommonJS.
|
|
129
|
+
70. References: `plugins/pbr/references/{name}.md` — lowercase, hyphenated.
|
|
130
|
+
71. Tests: `tests/{script-name}.test.js` — mirrors the script name.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Testing
|
|
135
|
+
|
|
136
|
+
72. Test files mirror script names: `scripts/foo.js` → `tests/foo.test.js`.
|
|
137
|
+
73. Use the fixture project at `tests/fixtures/fake-project/` for integration tests.
|
|
138
|
+
74. Hook tests: use stdin/stdout protocol with `execSync()`, timeout 5000ms, run in temp dir.
|
|
139
|
+
75. Coverage target: 70% branches/functions/lines/statements.
|
|
140
|
+
76. CI matrix: Node 18/20/22 × ubuntu/macos/windows. All 9 must pass.
|
|
141
|
+
77. Local pre-push: `npm run lint && npm test && npm run validate`.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Cross-Platform
|
|
146
|
+
|
|
147
|
+
78. **Never** hardcode `/` or `\` — always `path.join()`.
|
|
148
|
+
79. Use `\n` in string literals — Node.js and Git normalize line endings.
|
|
149
|
+
80. In `hooks.json`, use `${CLAUDE_PLUGIN_ROOT}` — Claude Code expands this internally on all platforms.
|
|
150
|
+
81. **Never** use `$CLAUDE_PLUGIN_ROOT` (shell expansion is platform-dependent).
|
|
151
|
+
82. **Never** rely on execute bits — always invoke via `node script.js`.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Dependencies & Gates
|
|
156
|
+
|
|
157
|
+
83. Check all `depends_on` plans have SUMMARY.md files before executing.
|
|
158
|
+
84. Checkpoint tasks (`checkpoint:human-verify`) require STOP — write partial SUMMARY.md, return metadata.
|
|
159
|
+
85. Respect all `gates.confirm_*` config toggles. Never auto-proceed when a gate is enabled.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Logging
|
|
164
|
+
|
|
165
|
+
86. Hook scripts → `logHook()` (writes to `logs/hooks.jsonl`, max 200 entries).
|
|
166
|
+
87. Workflow milestones → `logEvent()` (writes to `logs/events.jsonl`, max 1,000 entries).
|
|
167
|
+
88. Rule of thumb: inside a hook? `logHook()`. Tracking a high-level event? `logEvent()`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Gotchas
|
|
172
|
+
|
|
173
|
+
89. JSDoc `*/` in glob patterns closes Babel comments early — use `//` line comments instead.
|
|
174
|
+
90. Regex anchors: use `\b` word boundaries, not `^` anchors (misses chained commands like `cd && git commit`).
|
|
175
|
+
91. Windows cwd locking in tests: use `cwd` option in `execSync()` instead of `process.chdir()`.
|
|
176
|
+
92. PLAN.md frontmatter must include all required fields: `phase`, `plan`, `type`, `wave`, `depends_on`, `files_modified`, `autonomous`, `must_haves`.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Quick Reference: Never Do This
|
|
181
|
+
|
|
182
|
+
| # | Anti-Pattern | Impact |
|
|
183
|
+
|---|-------------|--------|
|
|
184
|
+
| 1 | Read agent definitions in orchestrator | Context balloons 15% → 88% |
|
|
185
|
+
| 2 | Inline large files into Task() prompts | Wasted orchestrator context |
|
|
186
|
+
| 3 | Read full subagent output | Context bloat |
|
|
187
|
+
| 4 | Use non-Plan-Build-Run branding | User confusion |
|
|
188
|
+
| 5 | Hardcode path separators | Cross-platform breakage |
|
|
189
|
+
| 6 | Use ES modules in hooks | Hook fails to load |
|
|
190
|
+
| 7 | Skip hook logging | Silent failures |
|
|
191
|
+
| 8 | Modify STATE.md in agents | Race conditions, corruption |
|
|
192
|
+
| 9 | Use `git add .` | Sensitive data leaks |
|
|
193
|
+
| 10 | Skip tests for new scripts | CI failures, regressions |
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Plan Authoring Guide
|
|
2
|
+
|
|
3
|
+
Quality guidelines for writing executable plans. Used by planner and plan-checker.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Action Writing Guidelines
|
|
8
|
+
|
|
9
|
+
The `<action>` element is the most important part of the plan. It must be specific enough that the executor agent can follow it mechanically without making design decisions.
|
|
10
|
+
|
|
11
|
+
### Good Action
|
|
12
|
+
```xml
|
|
13
|
+
<action>
|
|
14
|
+
1. Create file `src/auth/discord.ts`
|
|
15
|
+
2. Import `OAuth2Client` from `discord-oauth2` package
|
|
16
|
+
3. Export async function `authenticateWithDiscord(code: string): Promise<User>`
|
|
17
|
+
- Create OAuth2Client with env vars: DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET
|
|
18
|
+
- Exchange authorization code for access token
|
|
19
|
+
- Fetch user profile from Discord API: GET /api/users/@me
|
|
20
|
+
- Return User object with fields: id, username, avatar, email
|
|
21
|
+
4. Export function `getDiscordAuthUrl(): string`
|
|
22
|
+
- Build OAuth2 authorization URL with scopes: identify, email
|
|
23
|
+
- Include redirect URI from env: DISCORD_REDIRECT_URI
|
|
24
|
+
- Return the URL string
|
|
25
|
+
5. Add to `.env.example`:
|
|
26
|
+
DISCORD_CLIENT_ID=
|
|
27
|
+
DISCORD_CLIENT_SECRET=
|
|
28
|
+
DISCORD_REDIRECT_URI=http://localhost:3000/auth/callback
|
|
29
|
+
</action>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Bad Action
|
|
33
|
+
```xml
|
|
34
|
+
<action>
|
|
35
|
+
Set up Discord OAuth authentication.
|
|
36
|
+
</action>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Action Rules
|
|
40
|
+
|
|
41
|
+
1. **Number the steps** -- executor follows them in order
|
|
42
|
+
2. **Name specific files** -- never say "create necessary files"
|
|
43
|
+
3. **Name specific functions/exports** -- never say "implement the auth logic"
|
|
44
|
+
4. **Include type signatures** -- when the project uses TypeScript
|
|
45
|
+
5. **Reference existing code** -- when modifying files, say what to modify
|
|
46
|
+
6. **Include code snippets** -- for complex patterns or configurations
|
|
47
|
+
7. **Specify environment variables** -- with example values
|
|
48
|
+
8. **Note error handling** -- only when it's a critical part of the task
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Verify Command Guidelines
|
|
53
|
+
|
|
54
|
+
The `<verify>` element must contain commands that the executor can run to check the task is complete.
|
|
55
|
+
|
|
56
|
+
### Good Verify
|
|
57
|
+
```xml
|
|
58
|
+
<verify>
|
|
59
|
+
npx tsc --noEmit
|
|
60
|
+
npm run test -- --grep "discord auth"
|
|
61
|
+
ls -la src/auth/discord.ts
|
|
62
|
+
</verify>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Bad Verify
|
|
66
|
+
```xml
|
|
67
|
+
<verify>
|
|
68
|
+
Check that authentication works.
|
|
69
|
+
</verify>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Verify Rules
|
|
73
|
+
|
|
74
|
+
1. **Must be executable** -- actual shell commands, not descriptions
|
|
75
|
+
2. **Must be deterministic** -- same result every time if code is correct
|
|
76
|
+
3. **Prefer automated checks** -- type checking, tests, linting
|
|
77
|
+
4. **Include existence checks** -- `ls` for created files
|
|
78
|
+
5. **Include build checks** -- `npx tsc --noEmit` for TypeScript
|
|
79
|
+
6. **Avoid interactive commands** -- no commands requiring user input
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Done Condition Guidelines
|
|
84
|
+
|
|
85
|
+
The `<done>` element describes the observable outcome, not the implementation activity.
|
|
86
|
+
|
|
87
|
+
### Good Done
|
|
88
|
+
- "User can authenticate via Discord OAuth and is redirected to dashboard"
|
|
89
|
+
- "Auth middleware rejects invalid tokens and passes valid tokens"
|
|
90
|
+
- "All 12 unit tests pass for the auth module"
|
|
91
|
+
|
|
92
|
+
### Bad Done
|
|
93
|
+
- "Code was written"
|
|
94
|
+
- "File was created"
|
|
95
|
+
- "Feature is implemented"
|
|
96
|
+
|
|
97
|
+
### Done Rules
|
|
98
|
+
|
|
99
|
+
1. **Maps to a must-have** -- every done condition traces back to a frontmatter must-have
|
|
100
|
+
2. **Observable** -- describes a state of the system, not an activity
|
|
101
|
+
3. **Falsifiable** -- you can check whether it's true or false
|
|
102
|
+
4. **User-oriented** -- prefer "user can..." over "code does..."
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Scope Limits
|
|
107
|
+
|
|
108
|
+
### Per-Plan Limits
|
|
109
|
+
|
|
110
|
+
| Constraint | Limit | Rationale |
|
|
111
|
+
|-----------|-------|-----------|
|
|
112
|
+
| Tasks per plan | **2-3** | Keeps plans atomic and recoverable |
|
|
113
|
+
| Files per plan | **5-8** | Limits blast radius of failures |
|
|
114
|
+
| Dependencies | **3 max** | Avoids deep dependency chains |
|
|
115
|
+
|
|
116
|
+
### When to Split
|
|
117
|
+
|
|
118
|
+
- More than 3 tasks? Split.
|
|
119
|
+
- More than 8 files? Split.
|
|
120
|
+
- Tasks in different functional areas? Split.
|
|
121
|
+
- Some tasks need human checkpoints, others don't? Split into autonomous and checkpoint plans.
|
|
122
|
+
|
|
123
|
+
### Split Signals
|
|
124
|
+
|
|
125
|
+
| Signal | Action |
|
|
126
|
+
|--------|--------|
|
|
127
|
+
| >3 tasks needed | Split by subsystem -- one plan per subsystem |
|
|
128
|
+
| Multiple unrelated subsystems | One plan per subsystem |
|
|
129
|
+
| >5 files per task | Task is too big -- break it down |
|
|
130
|
+
| Checkpoint + implementation in same plan | Separate the checkpoint into its own plan |
|
|
131
|
+
| Discovery research + implementation | Separate plans -- research plan first |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Discovery Levels
|
|
136
|
+
|
|
137
|
+
When a plan requires research before execution, set the `discovery` field in plan frontmatter. Default is 1 for most plans.
|
|
138
|
+
|
|
139
|
+
| Level | Name | Description | Executor Behavior |
|
|
140
|
+
|-------|------|-------------|-------------------|
|
|
141
|
+
| 0 | Skip | No research needed | Execute immediately |
|
|
142
|
+
| 1 | Quick | Fast verification | Check official docs for 1-2 specific questions |
|
|
143
|
+
| 2 | Standard | Normal research | Spawn researcher for phase research |
|
|
144
|
+
| 3 | Deep | Extensive investigation | Full research cycle before execution |
|
|
145
|
+
|
|
146
|
+
### Level 0 -- Skip
|
|
147
|
+
**When to use**: Simple refactors, documentation updates, file renames, configuration tweaks, or any task where the implementation approach is unambiguous from the plan's `<action>` steps alone.
|
|
148
|
+
|
|
149
|
+
### Level 1 -- Quick (default)
|
|
150
|
+
**When to use**: Standard feature work where the technology is known but specific API signatures, config options, or version-specific behavior need a quick check.
|
|
151
|
+
|
|
152
|
+
### Level 2 -- Standard
|
|
153
|
+
**When to use**: Work involving unfamiliar libraries, new integration patterns, or approaches the executor hasn't seen in this codebase before.
|
|
154
|
+
|
|
155
|
+
### Level 3 -- Deep
|
|
156
|
+
**When to use**: High-risk or architecturally significant work where getting the approach wrong would require substantial rework.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Dependency Graph Rules
|
|
161
|
+
|
|
162
|
+
### File Conflict Detection
|
|
163
|
+
|
|
164
|
+
Two plans CONFLICT if their `files_modified` lists overlap. Conflicting plans:
|
|
165
|
+
- MUST be in different waves (cannot run in parallel)
|
|
166
|
+
- MUST have explicit `depends_on` relationship
|
|
167
|
+
- Later plan's `<action>` must reference what the earlier plan produces
|
|
168
|
+
|
|
169
|
+
### Circular Dependencies
|
|
170
|
+
|
|
171
|
+
**NEVER create circular dependencies.** If you detect a potential cycle, restructure the plans to break it. Common resolution: merge the circular plans into one, or extract the shared dependency into its own plan.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Context Fidelity Checklist
|
|
176
|
+
|
|
177
|
+
Before writing plan files, verify context compliance:
|
|
178
|
+
|
|
179
|
+
1. **Locked decision coverage**: For each locked decision in CONTEXT.md, identify the task that implements it.
|
|
180
|
+
2. **Deferred idea exclusion**: Scan all tasks -- no task should implement a deferred idea.
|
|
181
|
+
3. **Discretion area handling**: Each "Claude's Discretion" item should be addressed in at least one task.
|