@leing2021/super-pi 0.22.1 → 0.23.1

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 (117) hide show
  1. package/README.md +66 -293
  2. package/extensions/ce-core/index.ts +276 -48
  3. package/extensions/ce-core/tools/parallel-subagent.ts +3 -3
  4. package/extensions/ce-core/tools/subagent.ts +2 -2
  5. package/package.json +4 -20
  6. package/rules/common/naming.md +154 -0
  7. package/skills/01-brainstorm/SKILL.md +42 -79
  8. package/skills/01-brainstorm/references/ce-brainstorm-mode.md +47 -0
  9. package/skills/02-plan/SKILL.md +43 -61
  10. package/skills/02-plan/references/solution-search.md +46 -0
  11. package/skills/03-work/SKILL.md +34 -52
  12. package/skills/03-work/references/completion-report.md +51 -0
  13. package/skills/04-review/SKILL.md +44 -51
  14. package/skills/04-review/references/solution-search.md +46 -0
  15. package/skills/06-next/SKILL.md +35 -20
  16. package/skills/06-next/references/recommendation-logic.md +47 -2
  17. package/skills/07-worktree/SKILL.md +21 -20
  18. package/skills/08-help/SKILL.md +46 -0
  19. package/skills/08-help/references/workflow-sequence.md +135 -0
  20. package/skills/references/language-detection.md +44 -0
  21. package/LICENSE +0 -21
  22. package/THIRD-PARTY-NOTICES.md +0 -35
  23. package/extensions/subagent/__tests__/async-job-tracker.test.ts +0 -21
  24. package/extensions/subagent/__tests__/execution-activity.test.ts +0 -15
  25. package/extensions/subagent/__tests__/parallel-render-stress.test.ts +0 -82
  26. package/extensions/subagent/__tests__/render-dedup.test.ts +0 -98
  27. package/extensions/subagent/__tests__/render-widget.test.ts +0 -28
  28. package/extensions/subagent/__tests__/throttle.test.ts +0 -90
  29. package/extensions/subagent/agent-management.ts +0 -596
  30. package/extensions/subagent/agent-manager-chain-detail.ts +0 -163
  31. package/extensions/subagent/agent-manager-detail.ts +0 -232
  32. package/extensions/subagent/agent-manager-edit.ts +0 -391
  33. package/extensions/subagent/agent-manager-list.ts +0 -279
  34. package/extensions/subagent/agent-manager-parallel.ts +0 -305
  35. package/extensions/subagent/agent-manager.ts +0 -706
  36. package/extensions/subagent/agent-scope.ts +0 -9
  37. package/extensions/subagent/agent-selection.ts +0 -26
  38. package/extensions/subagent/agent-serializer.ts +0 -124
  39. package/extensions/subagent/agent-templates.ts +0 -63
  40. package/extensions/subagent/agents/context-builder.md +0 -37
  41. package/extensions/subagent/agents/delegate.md +0 -9
  42. package/extensions/subagent/agents/oracle.md +0 -73
  43. package/extensions/subagent/agents/planner.md +0 -52
  44. package/extensions/subagent/agents/researcher.md +0 -50
  45. package/extensions/subagent/agents/reviewer.md +0 -38
  46. package/extensions/subagent/agents/scout.md +0 -48
  47. package/extensions/subagent/agents/worker.md +0 -52
  48. package/extensions/subagent/agents.ts +0 -762
  49. package/extensions/subagent/artifacts.ts +0 -101
  50. package/extensions/subagent/async-execution.ts +0 -521
  51. package/extensions/subagent/async-job-tracker.ts +0 -240
  52. package/extensions/subagent/async-status.ts +0 -242
  53. package/extensions/subagent/chain-clarify.ts +0 -1365
  54. package/extensions/subagent/chain-execution.ts +0 -854
  55. package/extensions/subagent/chain-serializer.ts +0 -127
  56. package/extensions/subagent/completion-dedupe.ts +0 -66
  57. package/extensions/subagent/doctor.ts +0 -201
  58. package/extensions/subagent/execution.ts +0 -748
  59. package/extensions/subagent/file-coalescer.ts +0 -43
  60. package/extensions/subagent/fork-context.ts +0 -64
  61. package/extensions/subagent/formatters.ts +0 -123
  62. package/extensions/subagent/frontmatter.ts +0 -32
  63. package/extensions/subagent/index.ts +0 -586
  64. package/extensions/subagent/intercom-bridge.ts +0 -241
  65. package/extensions/subagent/jsonl-writer.ts +0 -84
  66. package/extensions/subagent/model-fallback.ts +0 -109
  67. package/extensions/subagent/notify.ts +0 -111
  68. package/extensions/subagent/parallel-utils.ts +0 -109
  69. package/extensions/subagent/pi-args.ts +0 -139
  70. package/extensions/subagent/pi-spawn.ts +0 -101
  71. package/extensions/subagent/post-exit-stdio-guard.ts +0 -88
  72. package/extensions/subagent/prompt-template-bridge.ts +0 -400
  73. package/extensions/subagent/prompts/gather-context-and-clarify.md +0 -13
  74. package/extensions/subagent/prompts/parallel-cleanup.md +0 -42
  75. package/extensions/subagent/prompts/parallel-research.md +0 -50
  76. package/extensions/subagent/prompts/parallel-review.md +0 -40
  77. package/extensions/subagent/render-helpers.ts +0 -83
  78. package/extensions/subagent/render.ts +0 -908
  79. package/extensions/subagent/result-intercom.ts +0 -238
  80. package/extensions/subagent/result-watcher.ts +0 -172
  81. package/extensions/subagent/run-history.ts +0 -58
  82. package/extensions/subagent/run-status.ts +0 -137
  83. package/extensions/subagent/schemas.ts +0 -165
  84. package/extensions/subagent/session-tokens.ts +0 -51
  85. package/extensions/subagent/settings.ts +0 -368
  86. package/extensions/subagent/single-output.ts +0 -98
  87. package/extensions/subagent/skills.ts +0 -627
  88. package/extensions/subagent/slash-bridge.ts +0 -177
  89. package/extensions/subagent/slash-commands.ts +0 -304
  90. package/extensions/subagent/slash-live-state.ts +0 -295
  91. package/extensions/subagent/subagent-control.ts +0 -151
  92. package/extensions/subagent/subagent-executor.ts +0 -1915
  93. package/extensions/subagent/subagent-prompt-runtime.ts +0 -76
  94. package/extensions/subagent/subagent-runner.ts +0 -1471
  95. package/extensions/subagent/subagents-status.ts +0 -473
  96. package/extensions/subagent/text-editor.ts +0 -273
  97. package/extensions/subagent/throttle.ts +0 -77
  98. package/extensions/subagent/top-level-async.ts +0 -16
  99. package/extensions/subagent/types.ts +0 -624
  100. package/extensions/subagent/utils.ts +0 -457
  101. package/extensions/subagent/worktree.ts +0 -580
  102. package/extensions/super-pi-extension/agents/ce-oracle.md +0 -109
  103. package/extensions/super-pi-extension/agents/ce-planner.md +0 -116
  104. package/extensions/super-pi-extension/agents/ce-reviewer.md +0 -99
  105. package/extensions/super-pi-extension/agents/ce-scout.md +0 -80
  106. package/extensions/super-pi-extension/agents/ce-worker.md +0 -78
  107. package/extensions/super-pi-extension/chains/ce-parallel-review.chain.md +0 -34
  108. package/extensions/super-pi-extension/chains/ce-review-only.chain.md +0 -12
  109. package/extensions/super-pi-extension/chains/ce-standard.chain.md +0 -28
  110. package/extensions/super-pi-extension/index.ts +0 -129
  111. package/extensions/super-pi-extension/model-sync.ts +0 -204
  112. package/skills/08-status/SKILL.md +0 -41
  113. package/skills/08-status/references/artifact-locations.md +0 -10
  114. package/skills/09-help/SKILL.md +0 -37
  115. package/skills/09-help/references/workflow-sequence.md +0 -9
  116. package/skills/10-rules/SKILL.md +0 -76
  117. package/skills/pi-subagents/SKILL.md +0 -566
@@ -0,0 +1,154 @@
1
+ # Naming Convention
2
+
3
+ > One rule: **use simple, everyday, low-ambiguity words. Avoid jargon, avoid vagueness.**
4
+
5
+ ---
6
+
7
+ ## Word Selection Priority
8
+
9
+ When naming anything — variables, types, states, API fields, database columns, queues, errors — follow this order:
10
+
11
+ | Priority | Strategy | Why |
12
+ |----------|----------|-----|
13
+ | 1 | Pick an everyday word first | Short, direct, anyone can understand |
14
+ | 2 | Check it's not vague | `good`, `ready`, `ok`, `normal` are too ambiguous |
15
+ | 3 | Check cross-role clarity | Engineers, reviewers, operators, auditors all understand it |
16
+ | 4 | Use a technical term only when precision demands it | Last resort |
17
+
18
+ **In short: clarity first, stability second, terminology last.**
19
+
20
+ ---
21
+
22
+ ## Recommended vs. Avoid
23
+
24
+ ### ✅ Prefer — short, direct, unambiguous
25
+
26
+ ```
27
+ Revise Blocked Reject Approve
28
+ Queue Escalate Notify Cancel
29
+ reason owner action next_fix
30
+ recheck_when
31
+ ```
32
+
33
+ ### ❌ Avoid — too vague
34
+
35
+ ```
36
+ good ready ok normal done
37
+ ```
38
+
39
+ Simple but not specific enough for system fields.
40
+
41
+ ### ❌ Avoid — too technical / abstract
42
+
43
+ ```
44
+ orchestration_resolution_state
45
+ deferred_adjudication_mode
46
+ remediation_projection
47
+ resolution_artifact
48
+ operationalized_exception_payload
49
+ ```
50
+
51
+ May be precise, but poor for cross-role collaboration and audit replay.
52
+
53
+ ### ❌ Avoid — too decorative / emotional
54
+
55
+ System fields must be stable. Don't use literary, emotional, or decorative names.
56
+
57
+ ---
58
+
59
+ ## Style by Context
60
+
61
+ | Context | Style | Example |
62
+ |---------|-------|---------|
63
+ | File names | kebab-case | `task-orchestrator.ts` |
64
+ | Type names | PascalCase | `TaskEnvelope` |
65
+ | Zod/TypeBox schema variables | PascalCase + `Schema` suffix | `TaskEnvelopeSchema` |
66
+ | Function names | camelCase | `evaluatePolicy` |
67
+ | Exported constants | camelCase | `stateTransitions`, `finalStates` |
68
+ | Database table names | snake_case | `task_records` |
69
+ | Database column names | snake_case | `state_version` |
70
+ | Environment variables | UPPER_SNAKE_CASE | `DATABASE_URL` |
71
+ | Package names | scoped kebab-case | `@org/types` |
72
+ | State / enum values | lowercase everyday words, snake_case for multi-word | `created`, `executing`, `result_ready` |
73
+ | Error classes | `*Error` (never `*Exception`) | `BudgetExhaustedError` |
74
+ | Queue names | semantic, kebab-case | `'task-execution'` (not `'execution_requested'`) |
75
+ | API routes | kebab-case, plural nouns | `/api/tasks`, `/api/audit-events` |
76
+
77
+ ---
78
+
79
+ ## Naming by Role
80
+
81
+ ### Public states — conversational
82
+
83
+ ```
84
+ Revise Blocked Reject Approved
85
+ Pending Executing Committed Cancelled
86
+ ```
87
+
88
+ ### Governance actions — direct verbs
89
+
90
+ ```
91
+ Notify Approve Queue Escalate
92
+ Pause Resume Discard Delegate
93
+ ```
94
+
95
+ ### Supporting fields — read like speech
96
+
97
+ ```
98
+ next_fix → what to fix next
99
+ recheck_when → when to re-check
100
+ reason → why
101
+ owner → who's responsible
102
+ action → what to do
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Two-Layer Naming
108
+
109
+ When a name needs different expressions in schema vs. UI:
110
+
111
+ | Layer | Strategy | Example |
112
+ |-------|----------|---------|
113
+ | Schema / code / database | More stable, precise | `state: 'revise_requested'` |
114
+ | UI / audit log / replay | More human-readable | "Revision needed" |
115
+
116
+ Connect the two layers with a mapping table. Don't define semantics twice.
117
+
118
+ ---
119
+
120
+ ## Self-Check Checklist
121
+
122
+ For every name, confirm:
123
+
124
+ ```
125
+ □ Can you understand it in 5 seconds?
126
+ □ Will different roles (engineer, reviewer, operator, auditor) interpret it the same way?
127
+ □ Is it readable in audit replay / logs?
128
+ □ Is it NOT a vague word (good/ok/ready/normal)?
129
+ □ Is it NOT over-technical jargon?
130
+ □ Does it follow the style rules above (case, separator)?
131
+ □ Is it consistent with existing names in the same domain?
132
+ ```
133
+
134
+ If any answer is "no" → pick a different word and re-check.
135
+
136
+ ---
137
+
138
+ ## Common Anti-Patterns & Fixes
139
+
140
+ | Anti-pattern | Problem | Fix |
141
+ |--------------|---------|-----|
142
+ | `status: 'good'` | Too vague | `status: 'passed'` |
143
+ | `state: 'orchestration_pending_resolution'` | Too technical | `state: 'waiting_approval'` |
144
+ | `action: 'the_moon_is_rising_retry'` | Too decorative | `action: 'retry'` |
145
+ | `flag: 'ok'` | Too vague | `flag: 'valid'` |
146
+ | `type: 'thing'` | Too generic | Use a concrete domain word |
147
+ | `err: SomethingException(...)` | Wrong convention | `err: SomethingError(...)` |
148
+ | `QUEUE = 'exec_req'` | Unclear abbreviation | `QUEUE = 'task-execution'` |
149
+
150
+ ---
151
+
152
+ ## One-Sentence Rule
153
+
154
+ > **Default to simple, conversational, low-ambiguity everyday words. If that creates ambiguity, keep the schema term stable and the UI / audit wording more human.**
@@ -5,120 +5,83 @@ description: "Brainstorm requirements with three modes: CE discovery, Startup Di
5
5
 
6
6
  # Brainstorm
7
7
 
8
- Use this skill when the request is ambiguous, needs requirements discovery before planning, or the user describes a new idea/product.
8
+ Use this skill when the request is ambiguous, needs requirements discovery, or the user describes a new idea/product.
9
9
 
10
10
  See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
11
 
12
12
  ## Core rules
13
13
 
14
- - Use **`brainstorm_dialog`** to manage multi-round conversations.
15
- - Start with `start` operation: present initial analysis and open questions.
16
- - Use `refine` operation: incorporate user responses and produce refined analysis with new questions.
17
- - Repeat refine rounds until all open questions are resolved.
18
- - End with `summarize` operation: finalize into a requirements-ready artifact.
19
- - Ask **one question at a time** within each round.
14
+ - Use **`brainstorm_dialog`** to manage multi-round conversations (`start` → `refine` → `summarize`).
15
+ - Ask **one question at a time**.
20
16
  - Compare **2-3 approaches** when multiple directions are plausible.
21
- - Keep the artifact focused on **what** should be built, not implementation details by default.
22
- - Write the result to `docs/brainstorms/` as a durable requirements document.
23
- - End by recommending `02-plan` when the requirements are ready.
24
- - **Do not proceed to planning without explicit user approval** of the design.
17
+ - Keep focused on **what** to build, not implementation details.
18
+ - **Explicit user approval required** before handoff to `02-plan`.
19
+ - Write result to `docs/brainstorms/` as durable requirements document.
25
20
 
26
21
  ## Mode selection
27
22
 
28
- After initial context gathering, determine which mode to use. Use `ask_user_question`:
23
+ After initial context, determine mode via `ask_user_question`:
29
24
 
30
- > Before we dig in, what's your goal with this?
31
- >
32
- > - **Building a startup** (or thinking about it)
33
- > - **Intrapreneurship** internal project, need to ship fast
34
- > - **Side project / hackathon / learning** building for fun or exploration
35
- > - **Adding a feature** — already have a project, need to design a change
25
+ > What's your goal?
26
+ > - **Building a startup** → Startup Diagnostic
27
+ > - **Intrapreneurship** Startup Diagnostic
28
+ > - **Side project / hackathon** Builder Mode
29
+ > - **Adding a feature** CE Brainstorm
36
30
 
37
- **Mode mapping:**
38
- - Startup, intrapreneurship → **Startup Diagnostic** (see `references/startup-diagnostic.md`)
39
- - Side project, hackathon, learning → **Builder Mode** (see `references/builder-mode.md`)
40
- - Adding a feature → **CE Brainstorm** (the existing requirements discovery flow below)
41
-
42
- If the user's request already makes the mode obvious (e.g., "I have a startup idea"), skip the question and go directly to the matching mode.
43
-
44
- ## Startup Diagnostic mode
45
-
46
- Read `references/startup-diagnostic.md` for the full YC-style forcing questions, pushback patterns, and anti-sycophancy rules.
47
-
48
- Key differences from CE mode:
49
- - **Operating principles:** Specificity is the only currency. Interest is not demand. The status quo is your real competitor. Narrow beats wide, early.
50
- - **Ask the six forcing questions** one at a time, pushing until answers are specific and uncomfortable.
51
- - **Smart routing:** Pre-product (Q1-Q3), Has users (Q2, Q4, Q5), Paying customers (Q4, Q5, Q6).
52
- - **End with the assignment:** One concrete action the founder should take next.
31
+ Skip question if mode is obvious from request.
53
32
 
54
- After the diagnostic, run Premise Challenge (see `references/premise-challenge.md`), then proceed to Alternatives Generation and design checklist.
55
-
56
- ## Builder Mode
57
-
58
- Read `references/builder-mode.md` for the full generative question set and response posture.
59
-
60
- Key differences from CE mode:
61
- - **Operating principles:** Delight is the currency. Ship something you can show. Solve your own problem. Explore before you optimize.
62
- - **Ask generative questions** one at a time (coolest version, who would you show, fastest path, what's different, 10x version).
63
- - **End with concrete build steps**, not business validation tasks.
64
- - **Vibe shift detection:** If the user starts talking about customers/revenue, upgrade to Startup Diagnostic.
65
-
66
- After the questions, run Premise Challenge (see `references/premise-challenge.md`), then proceed to Alternatives Generation and design checklist.
33
+ **Mode mapping:**
34
+ - Startup / intrapreneurship → **Startup Diagnostic** (see `references/startup-diagnostic.md`)
35
+ - Side project / hackathon → **Builder Mode** (see `references/builder-mode.md`)
36
+ - Feature addition → **CE Brainstorm** (see `references/ce-brainstorm-mode.md`)
67
37
 
68
- ## CE Brainstorm mode (existing flow)
38
+ ## Mode summaries
69
39
 
70
- This is the original Compound Engineering brainstorm. Use when adding a feature to an existing project.
40
+ | Mode | Key principle | End goal |
41
+ |---|---|---|
42
+ | Startup Diagnostic | Specificity is currency, narrow beats wide | One concrete next action |
43
+ | Builder Mode | Delight is currency, ship something showable | Concrete build steps |
44
+ | CE Brainstorm | Requirements clarity | Implementation-ready spec |
71
45
 
72
- 1. Scan the repository for nearby context.
73
- 2. Use `brainstorm_dialog` `start` to begin multi-round refinement.
74
- 3. Present initial analysis and open questions to the user.
75
- 4. Use `brainstorm_dialog` `refine` to incorporate user responses and refine analysis.
76
- 5. Repeat step 4 until all questions are resolved.
46
+ See reference files for full question sets and patterns.
77
47
 
78
- ## Premise Challenge (all modes)
48
+ ## Premise Challenge
79
49
 
80
- After the mode-specific questions are complete, run the Premise Challenge. See `references/premise-challenge.md`.
50
+ After mode-specific questions, run Premise Challenge. See `references/premise-challenge.md`.
81
51
 
82
52
  ## Design checklist
83
53
 
84
54
  Before summarizing, ensure the design answers:
85
55
  - What are we building?
86
56
  - Why does it exist?
87
- - What files/modules are likely to change?
88
- - What are the boundaries between responsibilities?
89
- - What can fail, and how should failure be handled?
57
+ - What files/modules will change?
58
+ - What are the responsibility boundaries?
59
+ - What can fail, and how?
90
60
  - How will we verify success?
91
61
 
92
62
  ## Stop conditions
93
63
 
94
- Stop and ask the user instead of guessing when:
95
- - requirements conflict
96
- - success criteria are unclear
97
- - the task spans multiple independent systems
98
- - the user has not approved the design yet
64
+ Stop and ask instead of guessing when: requirements conflict, success criteria unclear, task spans multiple systems, or user hasn't approved design.
99
65
 
100
66
  ## Approval gate
101
67
 
102
- Before handing off to `02-plan`:
103
- 1. Present the final design to the user.
104
- 2. Ask for explicit approval.
105
- 3. Only proceed after the user confirms.
68
+ **Required:** Explicit user approval before handoff to `02-plan`.
106
69
 
107
70
  ## Workflow
108
71
 
109
- 1. Scan the repository for nearby context.
110
- 2. Determine mode (Startup / Builder / CE) via the mode selection step.
111
- 3. Run mode-specific questions using the appropriate reference file.
112
- 4. Run Premise Challenge.
113
- 5. Generate 2-3 alternatives (at least one "minimal viable" and one "ideal architecture").
114
- 6. Validate against the design checklist.
115
- 7. Use `brainstorm_dialog` `summarize` to finalize the conversation.
116
- 8. Capture the agreed direction in a requirements artifact under `docs/brainstorms/`.
117
- 9. Get explicit user approval before handing off.
118
- 10. Hand off to `02-plan` using `references/handoff.md`.
72
+ 1. Scan repository for nearby context
73
+ 2. Determine mode (Startup / Builder / CE)
74
+ 3. Run mode-specific questions (use reference files)
75
+ 4. Run Premise Challenge
76
+ 5. Generate 2-3 alternatives (minimal viable + ideal architecture)
77
+ 6. Validate against design checklist
78
+ 7. Use `brainstorm_dialog` `summarize` to finalize
79
+ 8. Capture requirements in `docs/brainstorms/`
80
+ 9. Get explicit user approval
81
+ 10. Handoff to `02-plan` using `references/handoff.md`
119
82
 
120
83
  ## Artifact contract
121
84
 
122
- Use `references/requirements-template.md` to structure the requirements document. Keep implementation details out unless the brainstorm is specifically about architecture or technical direction.
85
+ Use `references/requirements-template.md` to structure the document. Keep implementation details out unless specifically about architecture.
123
86
 
124
87
  Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -0,0 +1,47 @@
1
+ # CE Brainstorm Mode
2
+
3
+ Standard requirements discovery flow for feature additions to existing projects.
4
+
5
+ ## When to use
6
+
7
+ - Adding a feature to an existing project
8
+ - User has a project but unclear about what to build
9
+ - Request is somewhat specific but needs elaboration
10
+
11
+ ## Operating principle
12
+
13
+ **Requirements clarity** — the goal is to produce implementation-ready specifications.
14
+
15
+ ## Workflow
16
+
17
+ 1. Scan the repository for nearby context
18
+ 2. Use `brainstorm_dialog` `start` to begin multi-round refinement
19
+ 3. Present initial analysis and open questions to the user
20
+ 4. Use `brainstorm_dialog` `refine` to incorporate user responses and refine analysis
21
+ 5. Repeat step 4 until all questions are resolved
22
+
23
+ ## Key questions
24
+
25
+ Ask one at a time:
26
+ - What problem does this feature solve?
27
+ - Who is the user/consumer?
28
+ - What does success look like?
29
+ - What are the boundaries?
30
+ - What could go wrong?
31
+
32
+ ## End state
33
+
34
+ Requirements document covering:
35
+ - Feature purpose and scope
36
+ - User-facing behavior
37
+ - Edge cases and failure modes
38
+ - Success criteria
39
+ - Likely file changes
40
+
41
+ ## Difference from other modes
42
+
43
+ | Aspect | CE Brainstorm | Startup Diagnostic | Builder Mode |
44
+ |---|---|---|---|
45
+ | Goal | Implementation clarity | Business validation | Buildable prototype |
46
+ | Questions | Requirements-focused | Problem-first | Solution-first |
47
+ | Output | Spec document | One action | Build steps |
@@ -11,76 +11,58 @@ See [shared pipeline instructions](../references/pipeline-config.md) for model r
11
11
 
12
12
  ## Core rules
13
13
 
14
- - Before planning, read the `10-rules` skill and load:
15
- 1. `rules/common/development-workflow.md` and `rules/common/testing.md`
16
- 2. **Detect the project's primary language** (check for `tsconfig.json` → typescript, `package.json` without tsconfig → javascript, `Cargo.toml` → rust, `go.mod` → golang, `pubspec.yaml` → dart, `pom.xml`/`build.gradle` → java, `*.sln`/`*.csproj` → csharp, `Package.swift` → swift, `requirements.txt`/`pyproject.toml`/`setup.py` → python, `composer.json` → php, `Makefile.PL`/`cpanfile` → perl, `build.gradle.kts` → kotlin)
17
- 3. Load all files in the matching language-specific rules directory (e.g. `rules/typescript/`)
18
- 4. If the task involves frontend/browser concerns, also load `rules/web/` files
19
- - Search `docs/brainstorms/` for a relevant requirements artifact first.
20
- - Search solutions with grep-first strategy: extract keywords from the task → `bash grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/` → read only frontmatter (first 15 lines) of matching files → score by severity + tag relevance → fully read top 3. Search both project-level (`docs/solutions/`) and global-level (`~/.pi/agent/docs/solutions/`). If no matches, report "No relevant solutions found" and proceed.
21
- - Write the final plan to `docs/plans/`.
22
- - Break the work into implementation units instead of writing an execution script.
23
- - If a plan already exists, use **`plan_diff`** to compare existing units with new requirements and apply incremental changes instead of rewriting.
24
- - End by recommending `03-work` once the plan is ready.
14
+ 1. Load project rules (4 steps):
15
+ - Load `rules/common/development-workflow.md` and `rules/common/testing.md`
16
+ - Detect project language via [language detection](../references/language-detection.md)
17
+ - Load matching language-specific rules (e.g., `rules/typescript/`)
18
+ - If frontend/browser concerns, also load `rules/web/` files
19
+ 2. **Priority:** project-level `{repo-root}/rules/` overrides package defaults
20
+ 3. Search `docs/brainstorms/` for relevant requirements first
21
+ 4. Run solution search (see `references/solution-search.md`):
22
+ - Extract keywords `grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/`
23
+ - Read **frontmatter** only (first 15 lines) of matches score by severity + tag relevance
24
+ - Fully read top 3 candidates
25
+ 5. Write plan to `docs/plans/`
26
+ 6. If plan exists, use **`plan_diff`** to compare and patch incrementally
27
+ 7. End by recommending `03-work`
25
28
 
26
29
  ## Hard gates — TDD enforcement
27
30
 
28
- Every implementation unit must follow **RED, GREEN, REFACTOR**:
29
- - No production code step may appear before a failing test step.
30
- - Every unit must include exact verification commands.
31
- - No placeholders allowed — replace "handle edge cases" with concrete steps.
31
+ Every unit follows **RED GREEN REFACTOR**:
32
32
 
33
- **TDD violation rejection criteria** — stop and revise the plan if any unit:
34
- - implements code before a failing test
35
- - lacks a command proving the RED step
36
- - lacks a command proving the GREEN step
37
- - skips verification
38
- - relies on unstated tools or assumptions
33
+ **TDD violation rejection criteria** — reject and revise if any unit:
34
+ - Implements code before failing test
35
+ - Lacks RED step verification
36
+ - Lacks GREEN step verification
37
+ - Skips verification
38
+ - Uses placeholders or unstated assumptions
39
39
 
40
40
  ## Planning flow
41
41
 
42
- 1. Read the most relevant brainstorm artifact from `docs/brainstorms/` when one exists.
43
- 2. Execute the solution search strategy: extract keywords → grep frontmatter fields (tags, title) in `docs/solutions/` and `~/.pi/agent/docs/solutions/` → read frontmatter of candidates only → score and rank → fully read top 3.
44
- 3. Gather repository context from the affected areas.
45
- 4. If a plan already exists:
46
- a. Use `plan_diff` `compare` to identify added, removed, modified, and unchanged units.
47
- b. Review the diff with the user.
48
- c. Use `plan_diff` `patch` to apply approved changes.
49
- 5. If no plan exists, write a new plan artifact under `docs/plans/` using `references/plan-template.md`.
50
- 6. Structure the work using `references/implementation-unit-template.md`.
51
- 7. Verify every unit follows strict TDD — reject units that violate the gates above.
42
+ 1. Read relevant brainstorm from `docs/brainstorms/`
43
+ 2. Run solution search (keywords → grep frontmatter → read top 3)
44
+ 3. Gather repository context
45
+ 4. If plan exists: use `plan_diff` `compare` → review with user → `patch`
46
+ 5. If no plan: write new plan under `docs/plans/` using `references/plan-template.md`
47
+ 6. Structure work using `references/implementation-unit-template.md`
48
+ 7. Verify every unit follows TDD gates
52
49
 
53
50
  ## Optional: CEO Review
54
51
 
55
- After the plan artifact is written (step 5 or 6 above), offer the user a strategic review:
56
-
57
- > Plan ready. How do you want to review it?
58
- >
59
- > - **A) Just go** — trust the plan, skip review
60
- > - **B) CEO Review** — challenge premises, check for better alternatives, dream-state mapping
61
- > - **C) Strict Review** — full CEO Review plus error maps, failure modes, test diagrams
62
-
63
- If the user picks A, proceed directly to the `03-work` handoff.
64
- If the user picks B or C, read `references/ceo-review-mode.md` and execute the review flow.
65
-
66
- After CEO/Strict Review:
67
- 1. Update the plan artifact with any changes the user approved.
68
- 2. Note the review mode and key decisions in the plan.
69
- 3. Proceed to the `03-work` handoff.
70
-
71
- ## Implementation unit format
72
-
73
- Every unit must include:
74
- - **Purpose**: what this unit accomplishes
75
- - **Files**: exact paths to create, modify, or test
76
- - **Steps** as checkboxes:
77
- 1. Write or update a failing test
78
- 2. Run the targeted test and confirm it fails for the expected reason (RED)
79
- 3. Write the minimal implementation needed to pass
80
- 4. Run the targeted test and confirm it passes (GREEN)
81
- 5. Refactor if needed while keeping tests green
82
- 6. Run unit-level verification
83
- - **Verification commands**: exact commands to run
84
- - **Expected results**: what success looks like
52
+ After plan is written, offer strategic review:
53
+
54
+ > Plan ready. How to review?
55
+ > - **A) Just go** — trust the plan
56
+ > - **B) CEO Review** — challenge premises, dream-state mapping
57
+ > - **C) Strict Review** — CEO + error maps, failure modes, test diagrams
58
+
59
+ If B or C: read `references/ceo-review-mode.md` and execute review flow.
60
+ After review: update plan artifact, then handoff to `03-work`.
61
+
62
+ ## Artifact output
63
+
64
+ - Plan: `docs/plans/<slug>.md`
65
+ - Use `references/plan-template.md` structure
66
+ - Implementation units follow `references/implementation-unit-template.md`
85
67
 
86
68
  Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -0,0 +1,46 @@
1
+ # Solution Search Strategy
2
+
3
+ Grep-first strategy for finding relevant solutions before planning or reviewing.
4
+
5
+ ## Steps
6
+
7
+ 1. **Extract keywords** from the task description
8
+ 2. **Grep frontmatter** fields (tags, title) in both locations:
9
+ ```bash
10
+ grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/
11
+ ```
12
+ 3. **Read frontmatter only** (first 15 lines) of matching files
13
+ 4. **Score by:**
14
+ - Severity match (higher severity = higher priority)
15
+ - Tag relevance (exact matches rank higher)
16
+ 5. **Fully read top 3** candidates
17
+ 6. If no matches: report "No relevant solutions found" and proceed
18
+
19
+ ## Search locations
20
+
21
+ | Level | Path | Use for |
22
+ |---|---|---|
23
+ | Project | `docs/solutions/` | Project-specific learnings |
24
+ | Global | `~/.pi/agent/docs/solutions/` | Cross-project patterns |
25
+
26
+ ## Scoring rubric
27
+
28
+ | Score | Criteria |
29
+ |---|---|
30
+ | 5 | Exact tag match + high severity + same language |
31
+ | 4 | Tag match + same category |
32
+ | 3 | Partial tag match |
33
+ | 2 | Same category, no tag match |
34
+ | 1 | Worth reading for context |
35
+ | 0 | No relevance |
36
+
37
+ ## Output
38
+
39
+ - List of relevant solutions with paths and relevance scores
40
+ - Key takeaways from top solutions
41
+ - How they apply to current task
42
+
43
+ ## When to use
44
+
45
+ - `02-plan`: Before creating implementation units, check for existing patterns
46
+ - `04-review`: Before reviewing, check for known failure modes or solutions
@@ -5,70 +5,52 @@ description: Execute plan-driven work in a controlled Phase 1 workflow.
5
5
 
6
6
  # Work
7
7
 
8
- Use this skill when there is a plan path or a tightly scoped bare prompt ready for execution.
8
+ Use this skill when there is a plan path or tightly scoped bare prompt ready for execution.
9
9
 
10
10
  See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
11
 
12
12
  ## Core rules
13
13
 
14
- - Before execution, read the `10-rules` skill and load:
15
- 1. `rules/common/development-workflow.md` and `rules/common/testing.md`
16
- 2. **Detect the project's primary language** (check for `tsconfig.json` → typescript, `package.json` without tsconfig → javascript, `Cargo.toml` → rust, `go.mod` → golang, `pubspec.yaml` → dart, `pom.xml`/`build.gradle` → java, `*.sln`/`*.csproj` → csharp, `Package.swift` → swift, `requirements.txt`/`pyproject.toml`/`setup.py` → python, `composer.json` → php, `Makefile.PL`/`cpanfile` → perl, `build.gradle.kts` → kotlin)
17
- 3. Load all files in the matching language-specific rules directory (e.g. `rules/typescript/`)
18
- 4. If the task involves frontend/browser concerns, also load `rules/web/` files
19
- - Distinguish between a **plan path** input and a **bare prompt** input before doing work.
20
- - Prefer deriving execution tasks from plan **implementation units**.
21
- - Use **serial subagents** (via `subagent` tool from pi-subagents) for tasks with dependencies.
22
- - Use **`subagent` tool in parallel mode** (via pi-subagents) for independent tasks that can run concurrently.
23
- - Use **`session_checkpoint`** to track plan execution progress. On start, load the checkpoint and skip completed units. After each unit, save the checkpoint.
24
- - On execution failure, use `session_checkpoint` `fail` to record the error, then `retry` to get a retry strategy. Follow the suggested strategy to recover.
25
- - Use **`task_splitter`** to analyze implementation units for file-level dependencies before execution. Run independent units via parallel subagents and dependent units serially.
26
- - If inside a **worktree** (created via `07-worktree`), execute within it. Otherwise, consider recommending `07-worktree` for isolation.
27
- - End by recommending `04-review`.
14
+ 1. Load project rules (4 steps):
15
+ - Load `rules/common/development-workflow.md` and `rules/common/testing.md`
16
+ - Detect project language via [language detection](../references/language-detection.md)
17
+ - Load matching language-specific rules
18
+ - If frontend/browser concerns, also load `rules/web/` files
19
+ 2. **Priority:** project-level `{repo-root}/rules/` overrides package defaults
20
+ 3. **Distinguish input:** plan path vs bare prompt
21
+ 4. Derive tasks from plan **implementation units**
22
+ 5. **Execution mode:**
23
+ - **Inline mode** for small/scoped units
24
+ - **`ce_parallel_subagent`** for independent CE skill units
25
+ - **`ce_subagent`** only for dependent serial chains
26
+ 6. Use **`session_checkpoint`** to track progress and enable resume
27
+ 7. Use **`task_splitter`** to analyze dependencies before execution
28
+ 8. If in **worktree** (via `07-worktree`), execute inside it
29
+ 9. End by recommending `04-review`
28
30
 
29
31
  ## Hard gates — TDD enforcement
30
32
 
31
- Every execution step must follow **RED → GREEN → REFACTOR**:
32
- - No production code before a verified failing test.
33
- - No skipping RED or GREEN verification.
34
- - No completion claim without command output evidence.
35
- - Evidence before assertions — always.
33
+ Every step follows **RED → GREEN → REFACTOR**:
36
34
 
37
35
  **Blocking violations** — stop and ask if:
38
- - code is written before the RED test
39
- - a RED step fails for the wrong reason
40
- - missing evidence that the test failed before implementation
41
- - missing evidence that the test passed after implementation
42
- - tests added only after code
36
+ - Code written before RED test
37
+ - RED fails for wrong reason
38
+ - Missing evidence test failed before implementation
39
+ - Missing evidence test passed after implementation
40
+ - Tests added only after code
43
41
 
44
42
  ## Workflow
45
43
 
46
- 1. Detect whether the input is a plan path or a bare prompt.
47
- 2. If it is a plan path, read the implementation units and execute from them.
48
- 3. If it is a bare prompt, do a small scope scan before deciding whether to proceed.
49
- 4. Use `session_checkpoint` to load progress and skip completed units.
50
- 5. Use `task_splitter` to identify parallel-safe vs dependent units.
51
- 6. Execute in inline mode, serial subagents, or parallel subagents depending on task dependencies.
52
- 7. For each unit, follow strict TDD:
53
- a. Run the RED test and confirm expected failure.
54
- b. Apply minimal implementation.
55
- c. Run the GREEN test and confirm pass.
56
- d. Refactor only while tests stay green.
57
- e. Run unit-level verification.
58
- 8. Record progress using `references/progress-update-format.md`.
59
- 9. After each unit, save `session_checkpoint`.
60
- 10. On failure, use `session_checkpoint` `fail` then `retry`.
61
- 11. Provide a **completion report** when done.
62
- 12. Hand off to `04-review` using `references/handoff.md`.
63
-
64
- ## Completion report
65
-
66
- When all units are done, provide:
67
-
68
- - **Completed units**: list of unit names
69
- - **Files changed**: all files created or modified
70
- - **Commands run**: all verification commands executed
71
- - **Verification results**: pass/fail status for each
72
- - **Follow-up work**: any remaining risks or open questions
44
+ 1. Detect input type (plan path vs bare prompt)
45
+ 2. Read implementation units if plan path
46
+ 3. Load `session_checkpoint` to skip completed units
47
+ 4. Use `task_splitter` for dependency analysis
48
+ 5. Execute: **inline mode** by default, `ce_parallel_subagent` for independent units
49
+ 6. Follow TDD per unit: RED minimal code GREEN refactor → unit-level **verification**
50
+ 7. Record progress via `references/progress-update-format.md`
51
+ 8. Save `session_checkpoint` after each unit
52
+ 9. On failure: `session_checkpoint` `fail` → `retry` → follow strategy
53
+ 10. Provide completion report (see `references/completion-report.md`)
54
+ 11. Handoff to `04-review` using `references/handoff.md`
73
55
 
74
56
  Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).