pi-orchestrator-config 4.1.5

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 (175) hide show
  1. package/README.md +808 -0
  2. package/agents/api-documenter.md +32 -0
  3. package/agents/bash-expert.md +53 -0
  4. package/agents/code-reviewer-docs.md +145 -0
  5. package/agents/code-reviewer-guidelines.md +97 -0
  6. package/agents/code-reviewer-quality.md +142 -0
  7. package/agents/code-reviewer-security.md +107 -0
  8. package/agents/code-reviewer-spec.md +164 -0
  9. package/agents/debugger.md +63 -0
  10. package/agents/docker-expert.md +40 -0
  11. package/agents/docs-fetcher.md +48 -0
  12. package/agents/git-expert.md +63 -0
  13. package/agents/github-expert.md +83 -0
  14. package/agents/go-expert.md +62 -0
  15. package/agents/issue-reviewer-feasibility.md +60 -0
  16. package/agents/issue-reviewer-scope.md +63 -0
  17. package/agents/issue-reviewer-spec.md +77 -0
  18. package/agents/java-expert.md +31 -0
  19. package/agents/jenkins-expert.md +38 -0
  20. package/agents/kubernetes-expert.md +40 -0
  21. package/agents/planner.md +42 -0
  22. package/agents/python-expert.md +61 -0
  23. package/agents/reviewer.md +26 -0
  24. package/agents/scout.md +40 -0
  25. package/agents/security-auditor.md +254 -0
  26. package/agents/technical-documentation-writer.md +37 -0
  27. package/agents/test-automator.md +55 -0
  28. package/agents/test-runner.md +47 -0
  29. package/agents/ts-expert.md +23 -0
  30. package/agents/worker.md +30 -0
  31. package/extensions/acpx-provider/index.ts +104 -0
  32. package/extensions/acpx-provider/load-runtime.ts +99 -0
  33. package/extensions/acpx-provider/runtime-models.ts +40 -0
  34. package/extensions/cli-provider/agents/claude.ts +128 -0
  35. package/extensions/cli-provider/agents/cursor.ts +84 -0
  36. package/extensions/cli-provider/agents/gemini.ts +100 -0
  37. package/extensions/cli-provider/discover.ts +77 -0
  38. package/extensions/cli-provider/index.ts +57 -0
  39. package/extensions/cli-provider/parsers.ts +304 -0
  40. package/extensions/cli-provider/providers.ts +58 -0
  41. package/extensions/cli-provider/runner.ts +225 -0
  42. package/extensions/cli-provider/runtime-models.ts +32 -0
  43. package/extensions/cli-provider/session-reaper.ts +122 -0
  44. package/extensions/cli-provider/sessions.ts +533 -0
  45. package/extensions/cli-provider/shared/discover-cache.ts +235 -0
  46. package/extensions/cli-provider/types.ts +48 -0
  47. package/extensions/coms/coms-net-server.ts +1642 -0
  48. package/extensions/coms/coms-net-wrapper.ts +521 -0
  49. package/extensions/coms/coms-net.ts +1589 -0
  50. package/extensions/coms/coms-p2p.ts +1879 -0
  51. package/extensions/coms/coms-shared.ts +510 -0
  52. package/extensions/coms/coms-wrapper.ts +138 -0
  53. package/extensions/coms/index.ts +20 -0
  54. package/extensions/coms/themeMap.ts +147 -0
  55. package/extensions/image-gen/image-gen.ts +332 -0
  56. package/extensions/image-gen/index.ts +14 -0
  57. package/extensions/orchestrator/agents.ts +134 -0
  58. package/extensions/orchestrator/ask-user.ts +293 -0
  59. package/extensions/orchestrator/async-agents.ts +1037 -0
  60. package/extensions/orchestrator/async-capability.ts +129 -0
  61. package/extensions/orchestrator/async-runner.ts +324 -0
  62. package/extensions/orchestrator/async-status-parse.ts +31 -0
  63. package/extensions/orchestrator/async-status-ui.ts +201 -0
  64. package/extensions/orchestrator/async-wait.ts +36 -0
  65. package/extensions/orchestrator/btw.ts +210 -0
  66. package/extensions/orchestrator/cron-status-format.ts +126 -0
  67. package/extensions/orchestrator/cron-status-ui.ts +132 -0
  68. package/extensions/orchestrator/cron.ts +730 -0
  69. package/extensions/orchestrator/dreaming.ts +355 -0
  70. package/extensions/orchestrator/enforcement-helpers.ts +530 -0
  71. package/extensions/orchestrator/enforcement-rules.ts +329 -0
  72. package/extensions/orchestrator/enforcement.ts +828 -0
  73. package/extensions/orchestrator/extended-autocomplete.ts +593 -0
  74. package/extensions/orchestrator/git-helpers.ts +420 -0
  75. package/extensions/orchestrator/github-autocomplete.ts +250 -0
  76. package/extensions/orchestrator/icons.ts +17 -0
  77. package/extensions/orchestrator/index.ts +100 -0
  78. package/extensions/orchestrator/memory-embeddings.ts +281 -0
  79. package/extensions/orchestrator/memory-promotion.ts +449 -0
  80. package/extensions/orchestrator/memory-provenance.ts +80 -0
  81. package/extensions/orchestrator/memory-query-class.ts +90 -0
  82. package/extensions/orchestrator/memory-scoring.ts +434 -0
  83. package/extensions/orchestrator/memory-tools.ts +883 -0
  84. package/extensions/orchestrator/memory-tree.ts +212 -0
  85. package/extensions/orchestrator/nvim.ts +169 -0
  86. package/extensions/orchestrator/overlay-dashboard-utils.ts +25 -0
  87. package/extensions/orchestrator/overlay-dashboard.ts +512 -0
  88. package/extensions/orchestrator/pi-config-review-state.ts +303 -0
  89. package/extensions/orchestrator/preference-extractor.ts +106 -0
  90. package/extensions/orchestrator/project-settings.ts +468 -0
  91. package/extensions/orchestrator/promotion-queue.ts +311 -0
  92. package/extensions/orchestrator/resolve-agent-model.ts +32 -0
  93. package/extensions/orchestrator/review-ui.ts +204 -0
  94. package/extensions/orchestrator/rule-placeholders.ts +12 -0
  95. package/extensions/orchestrator/rules.ts +481 -0
  96. package/extensions/orchestrator/session-search.ts +243 -0
  97. package/extensions/orchestrator/session-validation.ts +374 -0
  98. package/extensions/orchestrator/situation-report.ts +370 -0
  99. package/extensions/orchestrator/status-bar.ts +31 -0
  100. package/extensions/orchestrator/status-line.ts +192 -0
  101. package/extensions/orchestrator/status.ts +110 -0
  102. package/extensions/orchestrator/subagent-tool.ts +1748 -0
  103. package/extensions/orchestrator/task-lifecycle.ts +88 -0
  104. package/extensions/orchestrator/utils.ts +227 -0
  105. package/extensions/pidash/index.ts +15 -0
  106. package/extensions/pidash/pidash.ts +941 -0
  107. package/extensions/pidiff/index.ts +13 -0
  108. package/extensions/pidiff/pidiff.ts +369 -0
  109. package/extensions/providers/acpx-driver.ts +479 -0
  110. package/extensions/providers/built-in-drivers.ts +52 -0
  111. package/extensions/providers/claude-driver.ts +319 -0
  112. package/extensions/providers/cursor-acpx-driver.ts +398 -0
  113. package/extensions/providers/cursor-cli-driver.ts +484 -0
  114. package/extensions/providers/gemini-driver.ts +302 -0
  115. package/extensions/providers/index.ts +513 -0
  116. package/extensions/shared/build-system-prompt.ts +57 -0
  117. package/extensions/shared/create-runtime-provider.ts +190 -0
  118. package/extensions/shared/daemon-manager.ts +248 -0
  119. package/extensions/shared/file-logger.ts +115 -0
  120. package/extensions/shared/managed-refresh.ts +211 -0
  121. package/extensions/shared/provider-driver.ts +295 -0
  122. package/extensions/shared/provider-errors.ts +305 -0
  123. package/extensions/shared/provider-registry.ts +388 -0
  124. package/extensions/shared/stream-builder.ts +275 -0
  125. package/extensions/shared/types.ts +20 -0
  126. package/extensions/shared/ui/README.md +10 -0
  127. package/extensions/shared/ui/badge.tsx +52 -0
  128. package/extensions/shared/ui/button.tsx +58 -0
  129. package/extensions/shared/ui/collapsible.tsx +21 -0
  130. package/extensions/shared/ui/dropdown-menu.tsx +266 -0
  131. package/extensions/shared/ui/input.tsx +20 -0
  132. package/extensions/shared/ui/popover.tsx +114 -0
  133. package/extensions/shared/ui/resizable.tsx +48 -0
  134. package/extensions/shared/ui/scroll-area.tsx +53 -0
  135. package/extensions/shared/ui/select.tsx +201 -0
  136. package/extensions/shared/ui/separator.tsx +25 -0
  137. package/extensions/shared/ui/tooltip.tsx +64 -0
  138. package/extensions/shared/ws-client.ts +74 -0
  139. package/package.json +59 -0
  140. package/prompts/coderabbit-rate-limit.md +95 -0
  141. package/prompts/create-coms-feature-manager.md +186 -0
  142. package/prompts/create-skill.md +128 -0
  143. package/prompts/domain-model.md +109 -0
  144. package/prompts/external-ai.md +665 -0
  145. package/prompts/implement-and-review.md +25 -0
  146. package/prompts/implement.md +26 -0
  147. package/prompts/issue-review.md +256 -0
  148. package/prompts/pr-review.md +753 -0
  149. package/prompts/query-db.md +154 -0
  150. package/prompts/refine-review.md +208 -0
  151. package/prompts/release.md +235 -0
  152. package/prompts/remember.md +33 -0
  153. package/prompts/review-handler-status.md +27 -0
  154. package/prompts/review-handler.md +677 -0
  155. package/prompts/review-local.md +159 -0
  156. package/prompts/scout-and-plan.md +21 -0
  157. package/rules/00-orchestrator-core.md +42 -0
  158. package/rules/05-issue-first-workflow.md +119 -0
  159. package/rules/10-agent-routing.md +58 -0
  160. package/rules/15-mcp-launchpad.md +46 -0
  161. package/rules/20-code-review-loop.md +234 -0
  162. package/rules/25-documentation-updates.md +15 -0
  163. package/rules/30-prompt-templates.md +19 -0
  164. package/rules/35-memory.md +240 -0
  165. package/rules/40-critical-rules.md +124 -0
  166. package/rules/45-file-preview.md +29 -0
  167. package/rules/50-agent-bug-reporting.md +90 -0
  168. package/rules/55-coms-protocol.md +63 -0
  169. package/rules/60-task-tracking.md +66 -0
  170. package/skills/conflict-resolver/SKILL.md +213 -0
  171. package/skills/skill-creator/SKILL.md +85 -0
  172. package/skills/systematic-debugging/SKILL.md +353 -0
  173. package/skills/test-driven-development/SKILL.md +335 -0
  174. package/skills/update-agents-md/SKILL.md +282 -0
  175. package/templates/coms-feature-manager-prompt.md +313 -0
@@ -0,0 +1,159 @@
1
+ ---
2
+ description: Review uncommitted changes or changes compared to a branch
3
+ argument-hint: "[base branch]"
4
+ ---
5
+
6
+ ## Raw Arguments
7
+
8
+ ```text
9
+ $ARGUMENTS
10
+ ```
11
+
12
+ # Local Code Review Command
13
+
14
+ > **Bug Reporting Policy:** If you encounter ANY error, unexpected behavior, or reproducible bug
15
+ > while executing this command — DO NOT work around it silently. Ask the user:
16
+ > "Should I create a GitHub issue for this?" Route to:
17
+ > `myk-org/pi-config` for plugin/command spec or `myk-pi-tools` CLI issues.
18
+ > Do not silently skip steps or apply manual fixes that hide the root cause.
19
+
20
+ Review uncommitted changes or changes compared to a specified branch.
21
+
22
+ ## Usage
23
+
24
+ - `/review-local` - Review uncommitted changes (staged + unstaged)
25
+ - `/review-local main` - Review changes compared to main branch
26
+ - `/review-local feature/branch` - Review changes compared to specified branch
27
+
28
+ ## Task Plan
29
+
30
+ Before starting any work, create ALL tasks upfront using `TaskCreate`, then set their dependencies
31
+ using `TaskUpdate` with `addBlockedBy`. The task system enforces execution order — blocked tasks cannot start.
32
+
33
+ ### Task List
34
+
35
+ | Task | Title | blockedBy |
36
+ |------|-------|-----------|
37
+ | 1 | Get diff | — |
38
+ | 2 | Review — Code Quality | 1 |
39
+ | 3 | Review — Guidelines | 1 |
40
+ | 4 | Review — Security | 1 |
41
+ | 5 | Review — Docs | 1 |
42
+ | 6 | Review — Spec | 1 |
43
+ | 7 | Merge & deduplicate findings | 2, 3, 4, 5, 6 |
44
+ | 8 | Present review | 7 |
45
+
46
+ ### Dependency Graph
47
+
48
+ ```text
49
+ Task 1 (Get diff)
50
+ ├── Task 2 (Review: Code Quality) ──┐
51
+ ├── Task 3 (Review: Guidelines) ──┤
52
+ ├── Task 4 (Review: Security) ──┤
53
+ ├── Task 5 (Review: Docs) ──┤
54
+ └── Task 6 (Review: Spec) ──┤
55
+ ▼
56
+ Task 7 (Merge findings)
57
+ │
58
+ Task 8 (Present review)
59
+ ```
60
+
61
+ Create all 8 tasks using `TaskCreate` NOW, before starting any work.
62
+ Then IMMEDIATELY set dependencies using `TaskUpdate` with `addBlockedBy` for each task per the table above.
63
+
64
+ `TaskCreate` does NOT accept `addBlockedBy` — dependencies MUST be set via `TaskUpdate` after creation.
65
+
66
+ Example two-step flow:
67
+
68
+ ```text
69
+ # Step 1: Create all tasks
70
+ TaskCreate(subject="Get diff", ...) → Task 1
71
+ TaskCreate(subject="Review — Code Quality", ...) → Task 2
72
+ TaskCreate(subject="Review — Guidelines", ...) → Task 3
73
+ TaskCreate(subject="Review — Security", ...) → Task 4
74
+ TaskCreate(subject="Review — Docs", ...) → Task 5
75
+ TaskCreate(subject="Review — Spec", ...) → Task 6
76
+ TaskCreate(subject="Merge & deduplicate findings", ...)→ Task 7
77
+ TaskCreate(subject="Present review", ...) → Task 8
78
+
79
+ # Step 2: Set dependencies
80
+ TaskUpdate(taskId="2", addBlockedBy=["1"])
81
+ TaskUpdate(taskId="3", addBlockedBy=["1"])
82
+ TaskUpdate(taskId="4", addBlockedBy=["1"])
83
+ TaskUpdate(taskId="5", addBlockedBy=["1"])
84
+ TaskUpdate(taskId="6", addBlockedBy=["1"])
85
+ TaskUpdate(taskId="7", addBlockedBy=["2", "3", "4", "5", "6"])
86
+ TaskUpdate(taskId="8", addBlockedBy=["7"])
87
+ ```
88
+
89
+ > 🚨 **HARD RULE: NEVER start a task while its `blockedBy` tasks are incomplete.**
90
+ > The task system enforces this via `addBlockedBy` — but even if you could bypass it, **DON'T**.
91
+ > Merging findings from partial reviewer results is a **CRITICAL violation**.
92
+ > ALL 5 reviewers (Tasks 2, 3, 4, 5, 6) MUST complete before merging findings (Task 7).
93
+
94
+ ## Workflow
95
+
96
+ ### Phase 1: Get Diff — Task 1
97
+
98
+ **If the raw arguments are not empty:**
99
+
100
+ Compare current branch against the specified branch:
101
+
102
+ ```bash
103
+ git diff "<raw_arguments>"...HEAD
104
+ ```
105
+
106
+ **If no argument provided:**
107
+
108
+ Get all uncommitted changes (staged + unstaged):
109
+
110
+ ```bash
111
+ git diff HEAD
112
+ ```
113
+
114
+ ### Phase 2: Code Analysis — Tasks 2, 3, 4, 5, 6
115
+
116
+ Spawn ALL 5 review agents as async subagents
117
+ with `taskId` linking each to its task.
118
+ Use the actual task IDs returned by `TaskCreate` — do NOT hardcode IDs.
119
+
120
+ ```text
121
+ subagent(tasks=[
122
+ {agent: "code-reviewer-quality", task: "Review diff for code quality...", cwd: "...", name: "Review Quality", taskId: "<actual task 2 ID>"},
123
+ {agent: "code-reviewer-guidelines", task: "Review diff for guidelines...", cwd: "...", name: "Review Guidelines", taskId: "<actual task 3 ID>"},
124
+ {agent: "code-reviewer-security", task: "Review diff for security...", cwd: "...", name: "Review Security", taskId: "<actual task 4 ID>"},
125
+ {agent: "code-reviewer-docs", task: "Review diff for documentation quality...", cwd: "...", name: "Review Docs", taskId: "<actual task 5 ID>"},
126
+ {agent: "code-reviewer-spec", task: "Review diff for spec compliance...", cwd: "...", name: "Review Spec", taskId: "<actual task 6 ID>"},
127
+ ])
128
+ ```
129
+
130
+ Provide each agent with the diff content from Phase 1 and ask them to analyze for:
131
+
132
+ 1. Code quality and best practices
133
+ 2. Potential bugs or logic errors
134
+ 3. Security vulnerabilities
135
+ 4. Performance issues
136
+ 5. Naming conventions and readability
137
+ 6. Missing error handling
138
+ 7. Code duplication
139
+ 8. Suggestions for improvement
140
+
141
+ **After spawning, verify the response confirms all 5 agents were spawned.**
142
+ If any spawn fails, STOP and report the error — do NOT continue waiting.
143
+
144
+ **After spawning, your turn is DONE.** Do NOT poll, sleep, call TaskOutput,
145
+ or check status. Results arrive automatically as follow-up messages.
146
+ When each reviewer finishes, its task is auto-completed via `taskId`.
147
+ Task 7 (Merge findings) auto-unblocks when all 5 reviewer tasks complete.
148
+
149
+ ### Phase 3: Merge & Deduplicate Findings — Task 7
150
+
151
+ Merge and deduplicate the findings from all 5 reviewers into a single combined findings list.
152
+
153
+ ### Phase 4: Present Review — Task 8
154
+
155
+ Display findings grouped by severity:
156
+
157
+ - **Critical issues** (must fix)
158
+ - **Warnings** (should fix)
159
+ - **Suggestions** (nice to have)
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: "Scout → plan without implementing — /scout-and-plan <task>"
3
+ argument-hint: "<task>"
4
+ ---
5
+
6
+ ## Raw Arguments
7
+
8
+ ```text
9
+ $ARGUMENTS
10
+ ```
11
+
12
+ Use the subagent tool with a chain of 2 agents:
13
+
14
+ 1. **scout** — Explore the codebase to find all relevant code for the task from the raw arguments above.
15
+ Return a compressed summary of file locations, key functions, and dependencies.
16
+
17
+ 2. **planner** — Based on {previous}, create a detailed implementation plan:
18
+ - Files to modify/create
19
+ - Step-by-step changes
20
+ - Edge cases to handle
21
+ - Testing approach
@@ -0,0 +1,42 @@
1
+ # Orchestrator Core Rules
2
+
3
+ ## Scope
4
+
5
+ > **If you are a SPECIALIST AGENT** (python-expert, git-expert, etc.):
6
+ > IGNORE all rules below. Do your work directly using edit/write/bash.
7
+ > These rules are for the ORCHESTRATOR only.
8
+
9
+ ---
10
+
11
+ ## Delegation Model
12
+
13
+ The orchestrator delegates — never implements directly.
14
+ ⚠️ Pi does not enforce these restrictions — you SHOULD NOT violate them.
15
+
16
+ **Allowed direct actions:** read files, run `mcpl`, ask questions, analyze, plan,
17
+ route to agents via `subagent`, execute slash commands AND all their internal operations.
18
+
19
+ Outside slash commands, never use edit, write, or bash directly (except `mcpl`) — delegate to specialists.
20
+
21
+ **Always delegate via `subagent`:**
22
+
23
+ - Code changes (edit/write) → language specialist
24
+ - Git commands → git-expert
25
+ - MCP tools → manager agents
26
+ - Multi-file exploration → worker
27
+
28
+ **Never delegate:** slash commands — execute them directly (see slash command rules).
29
+
30
+ ---
31
+
32
+ ## Before Implementation (MANDATORY)
33
+
34
+ Before ANY code changes, run the pre-implementation checklist:
35
+
36
+ → **See the "Pre-Implementation Checklist" section below** — Do NOT skip this step.
37
+
38
+ **Quick check** (when issue-first workflow applies — see `rules/05-issue-first-workflow.md` for skip conditions):
39
+
40
+ - [ ] Root cause investigated? (read relevant code, understand the problem)
41
+ - [ ] GitHub issue created?
42
+ - [ ] On issue branch (`feat/issue-N-...` or `fix/issue-N-...`)?
@@ -0,0 +1,119 @@
1
+ # Issue-First Workflow
2
+
3
+ ## Scope
4
+
5
+ > **If you are a SPECIALIST AGENT:**
6
+ > IGNORE this rule. This is for the ORCHESTRATOR only.
7
+
8
+ ---
9
+
10
+ ## Pre-Implementation Checklist (START HERE)
11
+
12
+ Before ANY code changes, complete this checklist:
13
+
14
+ 1. **Should this workflow be skipped?** (see "SKIP" list below)
15
+ - YES → Do directly, skip remaining steps
16
+ - NO → Continue checklist
17
+
18
+ 2. **Root cause investigated?**
19
+ - Read the relevant source code — identify files, functions, and lines involved
20
+ - Understand the current behavior and why it happens
21
+ - Know what the fix looks like (at least conceptually)
22
+ - If the user's request is based on a misunderstanding, clarify before proceeding
23
+ - NO → Investigate first.
24
+ - YES → Continue
25
+
26
+ 3. **GitHub issue created?**
27
+ - NO → Create issue first (delegate to `github-expert`)
28
+ - YES → Continue
29
+
30
+ 4. **On correct branch?** (`feat/issue-N-...` or `fix/issue-N-...`)
31
+ - NO → Create branch from origin/main (delegate to `git-expert`)
32
+ - YES → Continue
33
+
34
+ 5. **User confirmed "work on it now"?**
35
+ - NO → Ask user
36
+ - YES → Proceed with implementation
37
+
38
+ 🚨 **NEVER create issues blindly from user requests.** Before creating ANY issue:
39
+
40
+ - Read and understand the relevant code
41
+ - Verify the problem exists (don't take the user's word — check the code)
42
+ - Know what files/functions are involved
43
+ - Have a conceptual fix in mind
44
+ - If a fix PR already exists, link to it instead of creating a duplicate issue
45
+
46
+ An issue without root cause analysis is a TODO, not a useful issue.
47
+
48
+ ---
49
+
50
+ ## When This Workflow Applies
51
+
52
+ **USE for:**
53
+
54
+ - New features, enhancements, bug fixes requiring code changes
55
+ - Refactoring tasks
56
+ - Multi-file modifications
57
+ - Tasks benefiting from tracking/documentation
58
+
59
+ **SKIP for:**
60
+
61
+ - Trivial fixes (typos, single-line changes)
62
+ - Questions, explanations, exploration (no code changes)
63
+ - User says "just do it" / "quick fix"
64
+ - Urgent hotfixes with time pressure
65
+
66
+ ---
67
+
68
+ ## Branch Workflow
69
+
70
+ When user confirms, **delegate to git-expert**: fetch main (`git fetch origin main`), create branch (`git checkout -b <type>/issue-<N>-<short-desc> origin/main`).
71
+
72
+ Branch types: `feat/`, `fix/`, `refactor/`, `docs/` — always prefixed with `issue-<N>-`.
73
+
74
+ After creating the issue, present the issue number, title, and URL, then ask:
75
+ 'Do you want to work on it now?' Wait for explicit confirmation before creating the branch or starting implementation.
76
+
77
+ ---
78
+
79
+ ## Issue Format
80
+
81
+ Delegate to `github-expert` with: type (fix/feat/refactor/docs), problem description, root cause analysis for bugs/fixes
82
+ (affected files, functions, lines, and why), proposed approach, and requirements.
83
+
84
+ **Every issue MUST include a `## Done` section with checkboxes** — the contract for when the issue can be closed:
85
+
86
+ ```markdown
87
+ ## Done
88
+
89
+ - [ ] Deliverable 1
90
+ - [ ] Deliverable 2
91
+ - [ ] Deliverable 3
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Tracking Progress
97
+
98
+ Check off deliverables in the issue as you complete them.
99
+ All code changes go through the review loop (see `rules/20-code-review-loop.md`).
100
+ When all deliverables are complete, verify all `## Done` checkboxes are checked, ensure reviews/tests pass, then close with a summary comment.
101
+ 🚨 **NEVER close an issue with unchecked deliverables** — remove or mark N/A first if no longer needed.
102
+
103
+ ---
104
+
105
+ ## Integration with Code Review Loop
106
+
107
+ Each deliverable follows the code review loop defined in `rules/20-code-review-loop.md`; once all deliverables pass review, close the issue.
108
+
109
+ ---
110
+
111
+ ## Edge Cases
112
+
113
+ | Scenario | Behavior |
114
+ |---|---|
115
+ | User says "just fix it" | Skip workflow, do directly |
116
+ | Partial requirements | Ask clarifying questions, then create issue |
117
+ | Issue already exists | Ask to continue existing issue |
118
+ | Urgent/hotfix | Skip workflow, note in commit message |
119
+ | Multiple unrelated requests | Create separate issues for each |
@@ -0,0 +1,58 @@
1
+ # Agent Routing
2
+
3
+ ## Routing Table
4
+
5
+ | Domain/Tool | Agent |
6
+ |---|---|
7
+ | Python (.py) | `python-expert` |
8
+ | Go (.go) | `go-expert` |
9
+ | Frontend (JS/TS/React/Vue/Angular) | `ts-expert` |
10
+ | Java (.java) | `java-expert` |
11
+ | Shell scripts (.sh) | `bash-expert` |
12
+ | Markdown (.md) | `technical-documentation-writer` |
13
+ | Docker | `docker-expert` |
14
+ | Kubernetes/OpenShift | `kubernetes-expert` |
15
+ | Jenkins/CI/Groovy | `jenkins-expert` |
16
+ | Git operations (local) | `git-expert` |
17
+ | GitHub (PRs, issues, releases, workflows) | `github-expert` |
18
+ | Tests | `test-automator` |
19
+ | Debugging | `debugger` |
20
+ | API docs | `api-documenter` |
21
+ | External repo security audit | `security-auditor` |
22
+ | External AI agents (cursor, codex, gemini, claude, copilot, etc.) | `/acpx-prompt` |
23
+ | External library/framework docs (React, FastAPI, Django, etc.) | `docs-fetcher` |
24
+
25
+ ## Routing by Intent, Not Tool
26
+
27
+ Route based on the task intent, not just the tool being used.
28
+
29
+ - Running Python tests? → `python-expert` (not bash-expert)
30
+ - Editing Python files? → `python-expert` (even with sed/awk)
31
+ - Creating a PR? → `github-expert` (not git-expert)
32
+ - External library docs? → `docs-fetcher` (not direct fetch)
33
+
34
+ ## Documentation Routing (MANDATORY)
35
+
36
+ The orchestrator MUST NEVER fetch external docs directly — always delegate to `docs-fetcher`, which tries `llms.txt` first and extracts only relevant sections.
37
+
38
+ **Spawn `docs-fetcher` when:**
39
+
40
+ - Fetching library/framework docs (React, FastAPI, Django, etc.)
41
+ - Looking up config guides or API references for external tools
42
+
43
+ **Skip when:**
44
+
45
+ - Standard library only (no external dependencies)
46
+ - Already fetched docs in current conversation
47
+
48
+ ## Agents Not in Routing Table
49
+
50
+ Some agents are dispatched internally by rules or prompt templates, not by the routing table:
51
+
52
+ - `code-reviewer-quality`, `code-reviewer-guidelines`, `code-reviewer-security`, `code-reviewer-docs`, `code-reviewer-spec` — dispatched via `rules/20-code-review-loop.md`
53
+ - `issue-reviewer-spec`, `issue-reviewer-feasibility`, `issue-reviewer-scope` — dispatched via `prompts/issue-review.md`
54
+ - `reviewer` — dispatched via prompt templates
55
+
56
+ ## Fallback
57
+
58
+ **Fallback:** No specialist? → `worker` agent
@@ -0,0 +1,46 @@
1
+ # MCP Launchpad (mcpl)
2
+
3
+ Use the `mcpl` command for all MCP server interactions.
4
+ If a task requires functionality outside current capabilities, check `mcpl` for available tools.
5
+ Orchestrator discovers tools via `mcpl search`/`mcpl list` and delegates execution to agents.
6
+
7
+ ---
8
+
9
+ ## mcpl Commands
10
+
11
+ | Command | Purpose |
12
+ |----------------------------------------------|-----------------------------------------------------|
13
+ | `mcpl search "<query>"` | Search all tools (shows required params, 5 results) |
14
+ | `mcpl search "<query>" --limit N` | Search with more results |
15
+ | `mcpl list` | List all MCP servers |
16
+ | `mcpl list <server>` | List tools for a server (shows required params) |
17
+ | `mcpl list --refresh` | Refresh and list all MCP servers |
18
+ | `mcpl inspect <server> <tool>` | Get full schema |
19
+ | `mcpl inspect <server> <tool> --example` | Get schema + example call |
20
+ | `mcpl call <server> <tool> '{}'` | Execute tool (no arguments) |
21
+ | `mcpl call <server> <tool> '{"param": "v"}'` | Execute tool with arguments |
22
+ | `mcpl call <server> <tool> '{}' --no-daemon` | Bypass daemon for debugging |
23
+ | `mcpl verify` | Test all server connections |
24
+ | `mcpl session status` | Check daemon and server connection status |
25
+ | `mcpl session stop` | Restart daemon (stops current, auto-restarts) |
26
+ | `mcpl config` | Show current configuration |
27
+
28
+ ---
29
+
30
+ ## Workflow
31
+
32
+ **Never guess tool names** — always discover first.
33
+
34
+ 1. **Search** → `mcpl search "list projects"` (or `mcpl list <server>` if you know the server)
35
+ 2. **Inspect** → `mcpl inspect sentry search_issues --example` (for complex tools)
36
+ 3. **Call** → `mcpl call vercel list_projects '{"teamId": "team_xxx"}'`
37
+
38
+ ---
39
+
40
+ ## Error Recovery
41
+
42
+ On failure, mcpl suggests fixes: similar tool names (not found), required params + example (missing params), or expected types (validation errors).
43
+
44
+ ## Troubleshooting
45
+
46
+ - **Server not connecting**: `mcpl verify` → **Stale connections**: `mcpl session stop` then retry → **Timeouts**: set `MCPL_CONNECTION_TIMEOUT=120`
@@ -0,0 +1,234 @@
1
+ # Code Review Loop (MANDATORY)
2
+
3
+ After ANY code change, send to ALL 6 agents (5 reviewers + test-automator) IN PARALLEL. **Never skip the first review.**
4
+
5
+ ## Commit enforcement
6
+
7
+ When `review_loop_enforcement` is enabled, the enforcement rule in `enforcement.ts` blocks `git commit` unless:
8
+
9
+ - Review status is `clean` (all reviewers returned 0 findings)
10
+ - `tests_passed: true` (test-automator or test command succeeded)
11
+
12
+ **You MUST run the review loop BEFORE attempting `git commit`.** The enforcement rule will reject the commit otherwise.
13
+ Do NOT try to work around it — run the actual review agents to reach `clean` status.
14
+
15
+ 🚫 **NEVER manipulate review state directly.** Do not import `pi-config-review-state.ts`,
16
+ call `addReviewerPending`/`recordReviewerResult` from bash, write to the JSON file,
17
+ or use any method to fake a clean state. The enforcement system detects and blocks this.
18
+ The ONLY way to reach `clean` status is to run the actual review agents.
19
+
20
+ Resolution: project `.pi/pi-config-settings.json` → global `~/.pi/pi-config-settings.json` → `PI_REVIEW_LOOP_ENFORCEMENT` env var → `false`.
21
+
22
+ - MUST loop until clean or the max cycle cap is reached — see "Cycle Definition & Max Cycles" below.
23
+
24
+ If disabled:
25
+
26
+ - Single review pass is sufficient
27
+ - No commit blocking
28
+
29
+ **In both cases, all 6 agents are always called.** `review_loop_enforcement` controls whether the loop repeats; when enabled,
30
+ `review_loop_max_cycles` caps **total** cycles including the first (see Cycle Definition below).
31
+
32
+ ### Cycle Definition & Max Cycles
33
+
34
+ One **cycle** = call all 6 reviewers (in parallel) → fix/explain findings → end of cycle.
35
+
36
+ **The cycle count IS the `cycle` field in `pi-config-review-state.json`** — the same counter shown by
37
+ `/review-status` and the review UI status card. It increments each time reviewers are (re-)dispatched
38
+ for a fresh pass. Step 5's branches below MUST compare against that same counter — do not track cycles
39
+ mentally or separately.
40
+
41
+ The review loop repeats for at most `review_loop_max_cycles` cycles (default `3`, range `1`-`10` only;
42
+ current value: `{{REVIEW_LOOP_MAX_CYCLES}}`), including the first cycle. Invalid values fall through to the
43
+ next resolution layer / default `3` — see `dev-docs/project-settings.md` for the full resolution order.
44
+ Disable the review loop via `review_loop_enforcement: false` — not via max_cycles.
45
+
46
+ Cap check is after 5a; it only blocks `go to 2` (re-dispatch of step 2 / all 6 agents,
47
+ including test-automator), not completing the current cycle's fix/explain.
48
+
49
+ **After 5a completes on the max cycle, two outcomes — neither unblocks `git commit`**
50
+ (still controlled solely by `review_loop_enforcement`; status must be `clean` + `tests_passed: true`):
51
+
52
+ - **Not fixed** (explained why not) → outstanding — report them.
53
+ - **Fixed** (verification blocked by the cap) → cannot re-dispatch to confirm clean — report that
54
+ verification is blocked by the cap, NOT "leftovers from skipping 5a".
55
+
56
+ **Example (`max_cycles=3`):**
57
+
58
+ ```text
59
+ cycle1: dispatch → findings → 5a (fix|explain) → re-dispatch (cycle < max)
60
+ cycle2: dispatch → findings → 5a (fix|explain) → re-dispatch (cycle < max)
61
+ cycle3: dispatch → findings → 5a (fix|explain) → cycle >= max → stop (no cycle4)
62
+ ```
63
+
64
+ ```text
65
+ 1. Specialist writes/fixes code
66
+ 2. Send ALL 6 agents IN PARALLEL (async): 5 reviewers + test-automator
67
+ 3. Wait for all 6 to complete
68
+ 4. Merge & deduplicate review findings
69
+ 5. Has findings OR tests failed?
70
+ ── Neither? ↓ status: clean, tests_passed: true
71
+ ── Findings and/or tests failed? → ALWAYS run 5a first: fix code OR explain why not, for EACH finding;
72
+ fix code for failing tests. Then check state.cycle (from `pi-config-review-state.json`):
73
+ · cycle < {{REVIEW_LOOP_MAX_CYCLES}}? → go to 2 (re-run all 6 with prior findings + responses)
74
+ · cycle >= {{REVIEW_LOOP_MAX_CYCLES}}? → **STOP** (terminal): report the two-outcome result
75
+ (see "Cycle Definition & Max Cycles" above). Do NOT proceed to step 6.
76
+ 6. NOW you can commit — the pre-commit hook will pass (only when status is `clean` AND `tests_passed: true`)
77
+ ✅ DONE — commit/push allowed (enforcement checks status: clean AND tests_passed: true)
78
+ ```
79
+
80
+ 🚨 **Step 6 applies only when clean.** Do NOT attempt `git commit` before reaching `clean` + `tests_passed: true`.
81
+ The enforcement rule blocks commits until this is satisfied — if it blocks you, run the reviewers.
82
+ **After a cap stop:** report the two-outcome result (**Not fixed** → outstanding, **Fixed** → verification
83
+ blocked); raise `review_loop_max_cycles` or disable `review_loop_enforcement` if needed — do **not**
84
+ return to step 2 (re-dispatch of all 6 agents, including test-automator).
85
+
86
+ ## Review Agents
87
+
88
+ Six agents run in parallel for comprehensive coverage:
89
+
90
+ | Agent | Focus |
91
+ |---|---|
92
+ | `code-reviewer-quality` | General code quality and maintainability |
93
+ | `code-reviewer-guidelines` | Project guidelines and style adherence (AGENTS.md) |
94
+ | `code-reviewer-security` | Bugs, logic errors, and security vulnerabilities |
95
+ | `code-reviewer-docs` | Documentation quality, completeness, and accuracy |
96
+ | `code-reviewer-spec` | Code/PR/issue spec alignment and compliance |
97
+ | `test-automator` | Run project tests (pytest, node tests, pre-commit) |
98
+
99
+ **All 6 MUST be invoked as async subagents (`async: true`) in the same assistant turn.
100
+ Do NOT block waiting for results — continue working while they run.**
101
+
102
+ Send reviewers "Review the code changes" — never mention `git diff HEAD` in the task prompt.
103
+ Reviewers get `$PI_REVIEW_BASE_BRANCH` env var and use `git diff origin/$PI_REVIEW_BASE_BRANCH...HEAD` themselves.
104
+
105
+ Reviewers return structured JSON: `{"findings": [{"severity": "...", "file": "...", "line": N, "description": "...", "suggestion": "..."}]}`.
106
+ The async runner validates the output is valid JSON and retries if not (up to 3 times).
107
+
108
+ Overlapping scope is intentional for comprehensive coverage; step 4's deduplication handles duplicates.
109
+
110
+ ## Deduplication Criteria
111
+
112
+ Same file/line + same issue or root cause = duplicate — keep the most actionable version.
113
+ Conflicts follow priority: security > correctness > performance > style; complementary findings on the same code are kept.
114
+
115
+ **Spec findings are never deduplicated against non-spec findings.** Findings from `code-reviewer-spec`
116
+ (missing deliverables, scope creep, spec misalignment) are never suppressed by findings from other
117
+ reviewers, even on the same file/line. A quality finding about *how* code is written does not
118
+ address *whether* the code matches the spec. Always keep both. Spec findings CAN still be
119
+ deduplicated against other spec findings when they are truly the same issue.
120
+
121
+ ## Step 5a: Respond to Findings (when `review_loop_enforcement` is enabled)
122
+
123
+ For each finding from step 4, do ONE of:
124
+
125
+ 1. **Fix it** — change the code to address the finding
126
+ 2. **Explain why not** — provide a specific technical reason (e.g., "pre-existing pattern,
127
+ changing it would break X", "intentional for performance", "out of scope for this PR")
128
+
129
+ **Every finding MUST get a response. No silent ignoring.**
130
+
131
+ When re-running reviewers (step 2, cycle N+1), pass the prior cycle's findings and
132
+ responses in each reviewer's task prompt using this format:
133
+
134
+ ```text
135
+ <prior-review-cycle>
136
+ The following findings were raised in review cycle {N}. Each has been either fixed or
137
+ explained. Do NOT re-raise findings that were adequately addressed. Only re-raise if:
138
+ - The code fix is incorrect or incomplete
139
+ - The explanation is invalid or factually wrong
140
+ - You disagree with the reasoning (explain why)
141
+
142
+ Findings with valid explanations that you accept → do not re-raise.
143
+ Findings that were fixed in code → verify the fix, do not re-raise if correct.
144
+
145
+ {numbered list of findings with their fix/explanation}
146
+ </prior-review-cycle>
147
+ ```
148
+
149
+ **Reviewers MUST respect valid responses:**
150
+
151
+ - If a finding was fixed → verify the fix is correct, don't re-raise
152
+ - If a finding was explained with a valid technical reason → accept it, don't re-raise
153
+ - If the explanation is wrong or the fix is incomplete → re-raise with specific pushback
154
+
155
+ **When `review_loop_enforcement` is disabled:** Step 5a is optional. Single review pass
156
+ is sufficient — fix what you agree with, skip what you don't. No need to explain skips.
157
+
158
+ ## Key Rules
159
+
160
+ Never skip code review — all 6 agents always run (5 reviewers + test-automator).
161
+ When `review_loop_enforcement` is enabled: loop, respond to each finding (fix or explain), and re-run all 6 from step 2
162
+ until clean or the cycle cap is reached — see "Cycle Definition & Max Cycles" above for the exact stop conditions.
163
+ When disabled: single pass is sufficient; no mandatory re-loop or explanations.
164
+ Minor test/config-only fixes skip re-review (go to step 5); substantive code changes require full re-review.
165
+
166
+ ## Test Tracking
167
+
168
+ Test results are tracked in `pi-config-review-state.json` via the `tests_passed` field.
169
+ This is **code-enforced** — commit/push is blocked unless `tests_passed: true` (when `review_loop_enforcement` is enabled).
170
+
171
+ **How `tests_passed` gets set:**
172
+
173
+ - **Bash hook detection:** When any agent runs a test command (`pytest`, `npm test`, `npx tsx --test`, `tox`, `go test`, `vitest`, `jest`, `mocha`),
174
+ the enforcement hook detects it and auto-marks `tests_passed` based on exit code.
175
+ - **Agent completion:** When `test-automator` or `test-runner` agents complete, their result auto-marks `tests_passed`.
176
+ - **Reset on edit:** Any file edit triggers `markNeedsReview()`, which resets `tests_passed: false` —
177
+ preventing stale results.
178
+
179
+ **Duplicate test run avoidance:** If a specialist already ran tests before the review loop, `tests_passed` may already be `true`.
180
+ Any file edit resets it, so test-automator in the parallel batch always validates the latest code.
181
+
182
+ ## Baseline Test Comparison (Step 5)
183
+
184
+ Compare against baseline before declaring test failures as blockers:
185
+
186
+ ```bash
187
+ BASELINE_DIR="${PROJECT_TMP_DIR}"
188
+ mkdir -p "$BASELINE_DIR"
189
+
190
+ # 1. Save ALL changes (staged + unstaged + untracked)
191
+ git diff HEAD > "$BASELINE_DIR/baseline.patch"
192
+ git ls-files --others --exclude-standard > "$BASELINE_DIR/untracked.list"
193
+
194
+ # 2. Reset to clean state
195
+ git reset --hard HEAD
196
+ xargs -r -d '\n' rm -f < "$BASELINE_DIR/untracked.list" 2>/dev/null || true
197
+
198
+ # 3. Run tests → record baseline failure count
199
+
200
+ # 4. Restore changes
201
+ git apply "$BASELINE_DIR/baseline.patch" \
202
+ || git apply --3way "$BASELINE_DIR/baseline.patch"
203
+
204
+ # 5. Clean up
205
+ rm -f "$BASELINE_DIR/baseline.patch" "$BASELINE_DIR/untracked.list"
206
+
207
+ # 6. Run tests → record current failure count
208
+ ```
209
+
210
+ Only **new failures** (current minus baseline) block the review; pre-existing failures are noted but don't block.
211
+ If both `git apply` methods fail, skip baseline comparison and note "baseline comparison unavailable" — do NOT block on all failures.
212
+
213
+ ## Staged Review Mode (Automated Workflows)
214
+
215
+ For automated review flows (autorabbit, autoqodo), use **two-stage order** instead of parallel:
216
+
217
+ 1. **Stage 1 — Spec Compliance:** Does code meet requirements? All deliverables implemented? No scope creep?
218
+ Loop Stage 1 until passed OR the shared cycle cap is reached.
219
+ 2. **Stage 2 — Code Quality:** Quality, security, guidelines adherence.
220
+ Loop Stage 2 until passed OR the shared cycle cap is reached.
221
+
222
+ **Staged cycle definition:** one **cycle** = one pass of the *current* stage's reviewers (in parallel)
223
+ → fix/explain that stage's findings → end of cycle. This mirrors the parallel-mode cycle definition
224
+ (see "Cycle Definition & Max Cycles" above), scoped to one stage's reviewers instead of all 6.
225
+
226
+ **The `review_loop_max_cycles` cap is shared across both stages — one total budget, not one per stage.**
227
+ Stage 1 and Stage 2 both draw from and increment the same `cycle` counter in
228
+ `pi-config-review-state.json`. Cap check, 5a-before-cap, and two-outcome reporting follow
229
+ "Cycle Definition & Max Cycles" above. Stage-specific stops: if Stage 1 is **not clean** when the cap is hit, stop entirely — do not proceed
230
+ to Stage 2 (covers both **Not fixed** and **Fixed** (verification blocked)). If hit during Stage 2,
231
+ stop looping Stage 2.
232
+
233
+ Don't polish code that doesn't meet spec — it wastes work.
234
+ Parallel mode (all 6 agents at once) remains default for manual reviews.