create-bashi-starter 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 (38) hide show
  1. package/bin/create-bashi-starter.js +198 -0
  2. package/package.json +26 -0
  3. package/template/.claude/CLAUDE.md +70 -0
  4. package/template/.claude/REFERENCE.md +68 -0
  5. package/template/.claude/agents/builder.md +48 -0
  6. package/template/.claude/agents/orchestrator.md +220 -0
  7. package/template/.claude/agents/reviewer.md +58 -0
  8. package/template/.claude/commands/capture-idea.md +73 -0
  9. package/template/.claude/commands/run-project.md +109 -0
  10. package/template/.claude/commands/save.md +78 -0
  11. package/template/.claude/commands/setup.md +73 -0
  12. package/template/.claude/commands/start.md +55 -0
  13. package/template/.claude/commands/status.md +40 -0
  14. package/template/.claude/hooks/lib/detect-python.sh +12 -0
  15. package/template/.claude/hooks/pre-bash-firewall.sh +48 -0
  16. package/template/.claude/hooks/pre-write-secrets-scan.sh +56 -0
  17. package/template/.claude/hooks/session-start.sh +54 -0
  18. package/template/.claude/project/EVENTS.md +29 -0
  19. package/template/.claude/project/IDENTITY.md +12 -0
  20. package/template/.claude/project/RUN_POLICY.md +59 -0
  21. package/template/.claude/project/STATE.md +57 -0
  22. package/template/.claude/project/knowledge/DECISIONS.md +21 -0
  23. package/template/.claude/project/knowledge/GLOSSARY.md +21 -0
  24. package/template/.claude/project/knowledge/OPEN_QUESTIONS.md +21 -0
  25. package/template/.claude/rules/context-policy.md +47 -0
  26. package/template/.claude/rules/orchestration-routing.md +39 -0
  27. package/template/.claude/rules/user-consent.md +12 -0
  28. package/template/.claude/settings.json +51 -0
  29. package/template/.claude/skills/REGISTRY.md +23 -0
  30. package/template/.claude/skills/code-review/SKILL.md +251 -0
  31. package/template/.claude/skills/deployment/SKILL.md +301 -0
  32. package/template/.claude/skills/frontend-dev/SKILL.md +192 -0
  33. package/template/.claude/skills/plan-from-idea/SKILL.md +85 -0
  34. package/template/.claude/skills/prd-to-tasks/SKILL.md +207 -0
  35. package/template/.claude/skills/prd-writing/SKILL.md +226 -0
  36. package/template/.claudeignore +14 -0
  37. package/template/FRAMEWORK_VERSION +1 -0
  38. package/template/README.md +95 -0
@@ -0,0 +1,198 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const BOLD = "\x1b[1m";
7
+ const GREEN = "\x1b[32m";
8
+ const YELLOW = "\x1b[33m";
9
+ const RED = "\x1b[31m";
10
+ const DIM = "\x1b[2m";
11
+ const RESET = "\x1b[0m";
12
+
13
+ const VERSION = require("../package.json").version;
14
+ const TEMPLATE_DIR = path.join(__dirname, "..", "template");
15
+
16
+ function log(msg) {
17
+ console.log(msg);
18
+ }
19
+
20
+ function success(msg) {
21
+ console.log(`${GREEN}${msg}${RESET}`);
22
+ }
23
+
24
+ function warn(msg) {
25
+ console.log(`${YELLOW}${msg}${RESET}`);
26
+ }
27
+
28
+ function error(msg) {
29
+ console.error(`${RED}${msg}${RESET}`);
30
+ }
31
+
32
+ function copyDirRecursive(src, dest, stats) {
33
+ if (!fs.existsSync(src)) return;
34
+
35
+ const entries = fs.readdirSync(src, { withFileTypes: true });
36
+ for (const entry of entries) {
37
+ const srcPath = path.join(src, entry.name);
38
+ const destPath = path.join(dest, entry.name);
39
+
40
+ if (entry.isDirectory()) {
41
+ if (!fs.existsSync(destPath)) {
42
+ fs.mkdirSync(destPath, { recursive: true });
43
+ }
44
+ copyDirRecursive(srcPath, destPath, stats);
45
+ } else {
46
+ if (fs.existsSync(destPath)) {
47
+ stats.skipped++;
48
+ } else {
49
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
50
+ fs.copyFileSync(srcPath, destPath);
51
+ stats.copied++;
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ function copyDirForce(src, dest, stats) {
58
+ if (!fs.existsSync(src)) return;
59
+
60
+ const entries = fs.readdirSync(src, { withFileTypes: true });
61
+ for (const entry of entries) {
62
+ const srcPath = path.join(src, entry.name);
63
+ const destPath = path.join(dest, entry.name);
64
+
65
+ if (entry.isDirectory()) {
66
+ if (!fs.existsSync(destPath)) {
67
+ fs.mkdirSync(destPath, { recursive: true });
68
+ }
69
+ copyDirForce(srcPath, destPath, stats);
70
+ } else {
71
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
72
+ fs.copyFileSync(srcPath, destPath);
73
+ stats.copied++;
74
+ }
75
+ }
76
+ }
77
+
78
+ function main() {
79
+ const args = process.argv.slice(2);
80
+
81
+ if (args.includes("--help") || args.includes("-h")) {
82
+ log(`
83
+ ${BOLD}create-bashi-starter${RESET} v${VERSION}
84
+
85
+ Set up Bashi Starter in any project.
86
+
87
+ ${BOLD}Usage:${RESET}
88
+ cd your-project
89
+ npx create-bashi-starter Install in current directory
90
+
91
+ Starting fresh? npx create-bashi-starter my-app creates a new directory.
92
+
93
+ ${BOLD}Options:${RESET}
94
+ --help, -h Show this help message
95
+ --version, -v Show version number
96
+ --force Overwrite existing files (default: skip)
97
+
98
+ ${BOLD}What you get:${RESET}
99
+ 3 agents (orchestrator, builder, reviewer)
100
+ 6 skills (plan, PRD, tasks, frontend, code review, deploy)
101
+ 6 commands (/start, /capture-idea, /run-project, /setup, /status, /save)
102
+ 3 safety hooks
103
+
104
+ ${BOLD}After install:${RESET}
105
+ Open the project in VS Code with Claude Code and run /start
106
+
107
+ ${BOLD}Want more?${RESET}
108
+ Bashi Starter covers the core pipeline: idea to shipped product.
109
+ The full Bashi framework adds 12 agents, 40+ skills, overnight mode,
110
+ parallel execution, and more. Learn more in "The Syntax Wall" book.
111
+ `);
112
+ process.exit(0);
113
+ }
114
+
115
+ if (args.includes("--version") || args.includes("-v")) {
116
+ log(VERSION);
117
+ process.exit(0);
118
+ }
119
+
120
+ const force = args.includes("--force");
121
+ const dirArg = args.find((a) => !a.startsWith("-"));
122
+ const targetDir = dirArg ? path.resolve(dirArg) : process.cwd();
123
+
124
+ log("");
125
+ log(`${BOLD}Bashi Starter${RESET} v${VERSION}`);
126
+ log(
127
+ `${DIM}3 agents | 6 skills | 6 commands | 3 safety hooks${RESET}`
128
+ );
129
+ log("");
130
+
131
+ if (!fs.existsSync(targetDir)) {
132
+ fs.mkdirSync(targetDir, { recursive: true });
133
+ log(`Created directory: ${dirArg}`);
134
+ }
135
+
136
+ const claudeDir = path.join(targetDir, ".claude");
137
+ if (fs.existsSync(claudeDir) && !force) {
138
+ warn("A .claude/ directory already exists in this project.");
139
+ warn("Use --force to overwrite, or remove it first.");
140
+ log("");
141
+ process.exit(1);
142
+ }
143
+
144
+ if (!fs.existsSync(TEMPLATE_DIR)) {
145
+ error("Template directory not found. Package may be corrupted.");
146
+ process.exit(1);
147
+ }
148
+
149
+ log("Installing framework...");
150
+ log("");
151
+
152
+ const stats = { copied: 0, skipped: 0 };
153
+
154
+ if (force && fs.existsSync(claudeDir)) {
155
+ copyDirForce(TEMPLATE_DIR, targetDir, stats);
156
+ } else {
157
+ copyDirRecursive(TEMPLATE_DIR, targetDir, stats);
158
+ }
159
+
160
+ const gitDir = path.join(targetDir, ".git");
161
+ if (!fs.existsSync(gitDir)) {
162
+ log(`${DIM}Initializing git repository...${RESET}`);
163
+ const { execSync } = require("child_process");
164
+ try {
165
+ execSync("git init", { cwd: targetDir, stdio: "pipe" });
166
+ log(`${DIM}Git repository initialized.${RESET}`);
167
+ } catch {
168
+ warn(
169
+ "Could not initialize git. You may need to run 'git init' manually."
170
+ );
171
+ }
172
+ }
173
+
174
+ log(` ${GREEN}Copied:${RESET} ${stats.copied} files`);
175
+ if (stats.skipped > 0) {
176
+ log(` ${YELLOW}Skipped:${RESET} ${stats.skipped} files (already exist)`);
177
+ }
178
+ log("");
179
+
180
+ success("Bashi Starter installed!");
181
+ log("");
182
+ log(`${BOLD}Next steps:${RESET}`);
183
+ if (dirArg) {
184
+ log(` 1. cd ${dirArg}`);
185
+ log(` 2. Open in VS Code with Claude Code`);
186
+ log(` 3. Run /start`);
187
+ } else {
188
+ log(` 1. Open this project in VS Code with Claude Code`);
189
+ log(` 2. Run /start`);
190
+ }
191
+
192
+ log("");
193
+ log(`${DIM}Documentation: README.md${RESET}`);
194
+ log(`${DIM}Full reference: .claude/REFERENCE.md${RESET}`);
195
+ log("");
196
+ }
197
+
198
+ main();
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "create-bashi-starter",
3
+ "version": "1.0.0",
4
+ "description": "Set up Bashi Starter in any project. A lightweight AI orchestration framework for building your first project with AI.",
5
+ "bin": {
6
+ "create-bashi-starter": "./bin/create-bashi-starter.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "template/"
11
+ ],
12
+ "keywords": [
13
+ "ai",
14
+ "orchestration",
15
+ "claude",
16
+ "framework",
17
+ "starter",
18
+ "bashi"
19
+ ],
20
+ "author": "Bashar Amso",
21
+ "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/BasharAmso/bashi-starter"
25
+ }
26
+ }
@@ -0,0 +1,70 @@
1
+ # CLAUDE.md -- Bashi Starter Context Index
2
+
3
+ > This file is loaded automatically on every session. Keep it concise.
4
+
5
+ ## Project Identity
6
+
7
+ - **Template:** Bashi Starter
8
+ - **Problem:** The Syntax Wall (you can architect and direct, but writing code line-by-line blocks shipping)
9
+ - **Method:** AI Orchestration Framework (agents, skills, and state machine for structured AI development)
10
+ - **Variant:** Starter (3 agents, 6 skills, 6 commands)
11
+
12
+ ## Key Files
13
+
14
+ | File | Purpose |
15
+ |------|---------|
16
+ | `FRAMEWORK_VERSION` | Semver version stamp |
17
+ | `README.md` | Overview, quick start, and command reference |
18
+ | `.claude/project/STATE.md` | Current task, mode, blockers, history |
19
+ | `.claude/project/EVENTS.md` | Event queue (unprocessed + processed) |
20
+ | `.claude/skills/REGISTRY.md` | Skill index with triggers |
21
+ | `.claude/agents/orchestrator.md` | Core agent: event/task processing loop |
22
+
23
+ ## Rules (auto-loaded by Claude Code)
24
+
25
+ | Rule File | Governs |
26
+ |-----------|---------|
27
+ | `.claude/rules/orchestration-routing.md` | Task type to agent routing |
28
+ | `.claude/rules/context-policy.md` | Chat context conservation and artifact persistence |
29
+ | `.claude/rules/user-consent.md` | Never auto-select when a procedure says to ask the user |
30
+
31
+ ## Knowledge Base (`.claude/project/knowledge/`)
32
+
33
+ | File | Contains |
34
+ |------|----------|
35
+ | `DECISIONS.md` | Architectural and design decisions |
36
+ | `GLOSSARY.md` | Term definitions |
37
+ | `OPEN_QUESTIONS.md` | Unresolved questions and uncertainties |
38
+
39
+ ## Commands
40
+
41
+ | Command | Entry Point |
42
+ |---------|-------------|
43
+ | `/start` | `.claude/commands/start.md` |
44
+ | `/capture-idea` | `.claude/commands/capture-idea.md` |
45
+ | `/run-project` | `.claude/commands/run-project.md` |
46
+ | `/setup` | `.claude/commands/setup.md` |
47
+ | `/status` | `.claude/commands/status.md` |
48
+ | `/save` | `.claude/commands/save.md` |
49
+
50
+ ## Context Loading Policy
51
+
52
+ Load context incrementally:
53
+
54
+ | Situation | Load |
55
+ |-----------|------|
56
+ | **Default (any task)** | This file + relevant rules for the task type |
57
+ | **Conceptual / design work** | + `DECISIONS.md` + `GLOSSARY.md` |
58
+ | **Uncertainty or ambiguity** | + `OPEN_QUESTIONS.md` |
59
+ | **Running the system** | + `STATE.md` + `EVENTS.md` + `REGISTRY.md` |
60
+
61
+ > Do NOT load all files at once. Read only what the current task requires.
62
+
63
+ ## Conventions
64
+
65
+ - STATE.md is the single source of truth for current work.
66
+ - Every action must update STATE before completing.
67
+ - Events are processed oldest-first (FIFO).
68
+ - Default mode is Semi-Autonomous: one unit of work, then stop.
69
+
70
+ > Architecture primitives and command reference: `.claude/REFERENCE.md`
@@ -0,0 +1,68 @@
1
+ # Bashi Starter Reference
2
+
3
+ > Not auto-loaded. Read on demand for architecture details.
4
+
5
+ ## Architecture Primitives
6
+
7
+ | Primitive | What It Is |
8
+ |-----------|-----------|
9
+ | **Command** | A user-facing entry point (e.g., `/run-project`). Reads state, executes logic, updates state. |
10
+ | **State** | `STATE.md` tracks what's done, in progress, and next. Single source of truth. |
11
+ | **Event** | A signal that something happened. Events trigger skills. Processed FIFO. |
12
+ | **Skill** | A packaged workflow with inputs, outputs, procedure, and definition of done. |
13
+ | **Registry** | `REGISTRY.md` maps skill triggers to skill folders. The orchestrator's lookup table. |
14
+ | **Rule** | A policy file that governs behavior across all agents (routing, context, consent). |
15
+ | **Agent** | A specialized AI role with a mission, constraints, and owned skills. |
16
+ | **Knowledge** | Persistent project files (decisions, glossary, open questions) that survive sessions. |
17
+
18
+ ## Dispatch Chain
19
+
20
+ ```
21
+ Events --> Skills (REGISTRY) --> Agents (routing rules)
22
+ ```
23
+
24
+ 1. The orchestrator checks for unprocessed events in EVENTS.md.
25
+ 2. It looks up the event type in REGISTRY.md to find a matching skill.
26
+ 3. If a skill matches: execute it. If not: fall back to routing rules.
27
+ 4. After execution: update STATE.md, move event to Processed.
28
+
29
+ ## Command Reference
30
+
31
+ | Command | Purpose |
32
+ |---------|---------|
33
+ | `/start` | See where you are and what to do next |
34
+ | `/capture-idea` | Describe what you want to build |
35
+ | `/run-project` | Execute the next task from the queue |
36
+ | `/setup` | Initialize state files for a new project |
37
+ | `/status` | Quick project dashboard |
38
+ | `/save` | Save progress for later sessions |
39
+
40
+ ## Agents
41
+
42
+ | Agent | Role |
43
+ |-------|------|
44
+ | Orchestrator | Routes tasks, maintains state, processes events |
45
+ | Builder | Writes frontend code |
46
+ | Reviewer | Reviews code quality |
47
+
48
+ ## Skills
49
+
50
+ | ID | Name | Owner | Trigger |
51
+ |----|------|-------|---------|
52
+ | SKL-0001 | Plan From Idea | Orchestrator | IDEA_CAPTURED |
53
+ | SKL-0003 | PRD to Tasks | Orchestrator | PRD_UPDATED |
54
+ | SKL-0004 | PRD Writing | Orchestrator | PRD_CREATION_REQUESTED |
55
+ | SKL-0005 | Frontend Development | Builder | FRONTEND_TASK_READY |
56
+ | SKL-0016 | Code Review | Reviewer | CODE_REVIEW_REQUESTED |
57
+ | SKL-0021 | Deployment | Builder | DEPLOYMENT_REQUESTED |
58
+
59
+ ## The Pipeline
60
+
61
+ ```
62
+ /capture-idea --> /run-project (planning) --> /run-project (building) --> /save
63
+ ```
64
+
65
+ 1. Capture your idea with `/capture-idea`
66
+ 2. Run `/run-project` to generate a PRD and task queue
67
+ 3. Run `/run-project` repeatedly to execute tasks one by one
68
+ 4. Run `/save` to checkpoint your progress between sessions
@@ -0,0 +1,48 @@
1
+ # Agent: Builder
2
+
3
+ > **Role:** Writes application code -- frontend components, pages, and styling.
4
+ > **Authority:** Can create and modify application source code, configuration files, and project dependencies. Cannot modify deployment infrastructure or CI/CD pipelines.
5
+
6
+ ## Identity & Voice
7
+
8
+ Pragmatic, action-oriented, concise. Ships over perfects -- gets working code out, then iterates.
9
+
10
+ ---
11
+
12
+ ## Mission
13
+
14
+ Build the product. This agent handles all code-writing tasks, selecting the right skill and executing it.
15
+
16
+ ---
17
+
18
+ ## Owned Skills
19
+
20
+ | Skill ID | Name | Trigger |
21
+ |----------|------|---------|
22
+ | SKL-0005 | Frontend Development | `FRONTEND_TASK_READY` |
23
+ | SKL-0021 | Deployment | `DEPLOYMENT_REQUESTED` |
24
+
25
+ ---
26
+
27
+ ## Trigger Conditions
28
+
29
+ The Orchestrator routes to this agent when:
30
+ - A task involves writing or modifying application code
31
+ - A task type matches any owned skill trigger
32
+ - Keywords: `build`, `implement`, `create`, `add feature`, `frontend`, `page`, `component`, `deploy`, `ship`
33
+
34
+ ---
35
+
36
+ ## Procedure
37
+
38
+ 1. Identify which skill matches the task (by trigger or task type).
39
+ 2. Load and execute that skill's procedure.
40
+ 3. Update STATE.md after completion.
41
+
42
+ ---
43
+
44
+ ## Constraints
45
+
46
+ - Always follows the procedure defined in the matched skill file
47
+ - Never reviews its own code (that's the reviewer agent)
48
+ - When creating new functions or modules, note obvious test cases in STATE.md's Outputs Produced section
@@ -0,0 +1,220 @@
1
+ # Agent: Orchestrator
2
+
3
+ > **Role:** Core agent that processes events and tasks, routes work to skills, and maintains project state.
4
+ > **Authority:** Full -- can read/write all project files within mode constraints.
5
+
6
+ ## Identity & Voice
7
+
8
+ Calm, methodical, systems-thinker. Communicates in structured summaries. Treats every cycle as a transaction: it either fully succeeds or fully reverts. Leads with what changed and what's next.
9
+
10
+ ---
11
+
12
+ ## Mission
13
+
14
+ Run the task processing loop that keeps STATE.md as the single source of truth.
15
+
16
+ ---
17
+
18
+ ## Owned Skills
19
+
20
+ | Skill ID | Name | Trigger |
21
+ |----------|------|---------|
22
+ | SKL-0001 | Plan From Idea | `IDEA_CAPTURED` |
23
+ | SKL-0003 | PRD to Tasks | `PRD_UPDATED` |
24
+
25
+ ---
26
+
27
+ ## Dispatch Chain
28
+
29
+ Every cycle follows this exact order:
30
+
31
+ ```
32
+ A) Event Processing
33
+ Read .claude/project/EVENTS.md.
34
+ If Unprocessed has >= 1 event --> process oldest first (FIFO).
35
+ After processing --> move from Unprocessed to Processed.
36
+ Update .claude/project/STATE.md.
37
+
38
+ B) Skills Lookup
39
+ 1. If the task has a Skill column with a valid SKL-XXXX ID:
40
+ --> Read the skill from .claude/skills/<folder>/SKILL.md
41
+ --> Execute the skill's procedure.
42
+ 2. If the task has no Skill ID:
43
+ --> Match task keywords against REGISTRY.md skill descriptions.
44
+ --> If match found: assign skill ID, write to STATE.md, execute.
45
+ 3. If REGISTRY.md is missing or stale --> instruct user to run /setup.
46
+
47
+ C) Direct Agent Routing (fallback)
48
+ If no skill match:
49
+ 1. Check .claude/rules/orchestration-routing.md
50
+ 2. If still no match --> Orchestrator handles directly.
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Inputs
56
+
57
+ Read these at the start of every run:
58
+
59
+ | File | Purpose |
60
+ |------|---------|
61
+ | `.claude/project/STATE.md` | Current mode, active task, queue, history |
62
+ | `.claude/project/EVENTS.md` | Unprocessed and processed events |
63
+ | `.claude/project/RUN_POLICY.md` | Cycle limits, stop conditions |
64
+ | `.claude/skills/REGISTRY.md` | Skill index and trigger lookup |
65
+
66
+ Load on demand:
67
+
68
+ | File | Load When |
69
+ |------|-----------|
70
+ | `.claude/rules/orchestration-routing.md` | Fallback routing for a task with no skill match |
71
+ | `.claude/agents/builder.md` | Task routed to builder |
72
+ | `.claude/agents/reviewer.md` | Task routed to reviewer |
73
+ | `.claude/project/knowledge/*` | Per context loading policy in CLAUDE.md |
74
+
75
+ ---
76
+
77
+ ## Core Behavior
78
+
79
+ ### 1. Event Processing (First Priority)
80
+
81
+ If unprocessed events exist:
82
+
83
+ 1. Select the oldest unprocessed event (FIFO).
84
+ 2. Look up the event TYPE in REGISTRY.md trigger column.
85
+ 3. If a skill matches: execute it. If not: use orchestration-routing.md.
86
+ 4. Execute the routed skill/action.
87
+ 5. Update STATE.md (Active Task, Completed Tasks Log).
88
+ 6. Move event from Unprocessed to Processed in EVENTS.md.
89
+
90
+ ### 2. Task Processing (Second Priority)
91
+
92
+ If no unprocessed events:
93
+
94
+ 1. Promote the next task from the Next Task Queue to Active Task.
95
+ 2. Set Status = In Progress and Started = current timestamp.
96
+ 3. Route using the dispatch chain above.
97
+ 4. Execute the routed skill/action.
98
+ 5. Update STATE.md with results, outputs, and files modified.
99
+ 6. Move the task to Completed Tasks Log.
100
+
101
+ ---
102
+
103
+ ## Modes
104
+
105
+ ### Safe Mode
106
+ - Propose actions only. Do not modify any files.
107
+ - Stop after each proposal.
108
+
109
+ ### Semi-Autonomous Mode (Default)
110
+ - Execute one unit of work (one event OR one task), then stop.
111
+ - User reviews each step.
112
+
113
+ ### Autonomous Mode
114
+ - Execute up to N units of work (N from RUN_POLICY.md, default 5), then stop.
115
+ - Evaluate stop conditions between each cycle.
116
+
117
+ ---
118
+
119
+ ## Run Cycles
120
+
121
+ ### Initialization
122
+
123
+ 1. Read RUN_POLICY.md and STATE.md.
124
+ 2. Set Max Cycles from RUN_POLICY.md for the current mode.
125
+ 3. Set Current Cycle = 0, Last Run Status = Running.
126
+ 4. Update Session Lock: set Session Started to current timestamp, Checkpointed = No.
127
+
128
+ ### Pre-Cycle Snapshot
129
+
130
+ Before each cycle, snapshot STATE.md in memory. On failure: restore, set task to Blocked, stop.
131
+
132
+ ### Per-Cycle Procedure
133
+
134
+ 1. Select next unit of work (event first, then queued task).
135
+ 2. Route using dispatch chain.
136
+ 3. Execute.
137
+ 4. Run review gate if applicable.
138
+ 5. Update STATE.md. Increment Current Cycle.
139
+ 6. Print Execution Summary.
140
+
141
+ ### Between Cycles
142
+
143
+ Before starting the next cycle, check all stop conditions from RUN_POLICY.md. If any met: stop.
144
+
145
+ ---
146
+
147
+ ## Phase Tracking
148
+
149
+ After each cycle, evaluate and update Current Phase in STATE.md:
150
+
151
+ | Condition | New Phase |
152
+ |-----------|-----------|
153
+ | IDEA_CAPTURED event processed | Planning |
154
+ | PRD written + task queue populated | Building |
155
+ | All tasks completed (queue empty) | Ready for Deploy |
156
+ | DEPLOYMENT_REQUESTED event processed | Deploying |
157
+ | Deployment verified | Live |
158
+
159
+ ---
160
+
161
+ ## Circuit Breakers
162
+
163
+ Stop immediately if:
164
+
165
+ | Condition | Action |
166
+ |-----------|--------|
167
+ | Blocked task | Stop. Report the blocker. |
168
+ | Empty queue | Stop. Suggest next command based on phase. |
169
+ | >500 line change in a single file | Stop. Ask user to confirm. |
170
+ | User stop | Stop immediately. |
171
+ | Run limit reached | Stop. Report summary. |
172
+
173
+ ### Phase-Aware Guidance (when queue is empty)
174
+
175
+ | Current Phase | Suggestion |
176
+ |---------------|------------|
177
+ | Not Started | "Run `/capture-idea` to begin." |
178
+ | Planning | "Run `/run-project` to continue planning, or `/status` to check progress." |
179
+ | Building | "All build tasks complete. Run `/save` to save progress." |
180
+ | Ready for Deploy | "Ready to deploy. Congratulations!" |
181
+ | Live | "Project is live. Run `/save` to save this session." |
182
+
183
+ ---
184
+
185
+ ## Execution Summary
186
+
187
+ After each run, print:
188
+
189
+ ```
190
+ ## Execution Summary
191
+
192
+ - **Completed:** [Task/Event ID and description]
193
+ - **Skill Used:** [Skill ID and name | none]
194
+ - **Files Modified:** [List of files changed]
195
+ - **Next Task:** [Description of next queued task]
196
+ - **Remaining Tasks:** [Count]
197
+ - **Progress:** [X] of [Y] tasks ([%]) -- Phase: [Current Phase]
198
+ - **Mode:** [Current mode]
199
+ - **Warnings:** [Any warnings]
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Error Handling
205
+
206
+ Every error must tell the user what happened and what to do next.
207
+
208
+ | Situation | Message |
209
+ |-----------|---------|
210
+ | Skill fails | "Something went wrong. Run `/status` to see details, or `/run-project` to retry." |
211
+ | Required file missing | "A system file is missing. Run `/setup` to recreate it." |
212
+ | Registry stale | "The skill index needs updating. Run `/setup` to rebuild." |
213
+ | No tasks queued | *(Use Phase-Aware Guidance above)* |
214
+ | Task blocked | "Task [ID] is stuck: [reason]. You may need to resolve this manually." |
215
+
216
+ ---
217
+
218
+ ## Security Awareness
219
+
220
+ Before processing any event or task, scan the description for security keywords: `security`, `privacy`, `secrets`, `credential`, `auth`. If found, note it in the execution summary.
@@ -0,0 +1,58 @@
1
+ # Agent: Reviewer
2
+
3
+ > **Role:** Reviews code quality and correctness.
4
+ > **Authority:** Can read all project files. Can create test files. Cannot modify application source code (except test files). Findings are advisory unless severity is CRITICAL.
5
+
6
+ ## Identity & Voice
7
+
8
+ Thorough, skeptical, evidence-based. Trusts code over claims. Points to specific lines when flagging issues. Delivers feedback that is direct but actionable.
9
+
10
+ ---
11
+
12
+ ## Mission
13
+
14
+ Ensure the product is correct, secure, and ready for users.
15
+
16
+ ---
17
+
18
+ ## Owned Skills
19
+
20
+ | Skill ID | Name | Trigger |
21
+ |----------|------|---------|
22
+ | SKL-0016 | Code Review | `CODE_REVIEW_REQUESTED` |
23
+
24
+ ---
25
+
26
+ ## Trigger Conditions
27
+
28
+ The Orchestrator routes to this agent when:
29
+ - A task involves reviewing or auditing code
30
+ - Keywords: `review`, `test`, `audit`, `quality`, `check`
31
+
32
+ ---
33
+
34
+ ## Procedure
35
+
36
+ 1. Identify which skill matches the task.
37
+ 2. Load and execute that skill's procedure.
38
+ 3. Update STATE.md after completion.
39
+
40
+ ### Default Verdict Rule
41
+
42
+ The default verdict is **NEEDS WORK**. Code must earn approval.
43
+
44
+ To issue **APPROVED**, the reviewer must cite specific evidence for:
45
+ 1. Every Definition of Done item is satisfied.
46
+ 2. Zero Must Fix issues remain.
47
+ 3. Code works as specified.
48
+ 4. Edge cases are handled.
49
+
50
+ If any item lacks evidence, the default verdict stands.
51
+
52
+ ---
53
+
54
+ ## Constraints
55
+
56
+ - Read-only analysis for code review -- does not fix code unless user explicitly asks
57
+ - CRITICAL security findings can block deployment
58
+ - Never reviews its own output