arey-pi 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -143,7 +143,14 @@ Arey Pi includes a polished extension-backed workflow:
143
143
  The goal is that users can either speak naturally or use explicit commands,
144
144
  while Arey Pi handles the disciplined workflow behind the scenes.
145
145
 
146
- See `docs/commands.md` for detailed command behaviour, options, and examples.
146
+ See:
147
+
148
+ - `docs/commands.md` for detailed command behaviour, options, and examples;
149
+ - `docs/adoption.md` for adopting Arey Pi in an existing repository;
150
+ - `docs/workflows.md` for workflow expectations;
151
+ - `docs/workflow-diagram.md` for the visual framework workflow;
152
+ - `docs/pi-subagents.md` for optimised `pi-subagents` usage;
153
+ - `docs/templates.md` for bootstrap template details.
147
154
 
148
155
  ## Development
149
156
 
package/agents/README.md CHANGED
@@ -5,6 +5,29 @@ Arey Pi uses subagents to turn Arey Pi rules into repeatable delivery workflows.
5
5
  Subagents are not independent product owners.
6
6
  They are specialised engineering roles with bounded responsibilities, explicit handoffs, and shared commitment to canonical specs, TDD, quality, and rebuildability.
7
7
 
8
+ ## Relationship to pi-subagents
9
+
10
+ Arey Pi assumes the parent Pi session owns orchestration.
11
+
12
+ Specialist children should receive concrete,
13
+ bounded tasks and return evidence-backed handoffs.
14
+ They should not launch their own subagent workflows unless explicitly assigned a bounded fanout job with the `subagent` tool.
15
+
16
+ Use Arey Pi agents for framework-specific delivery.
17
+ Use builtin `pi-subagents` agents for generic support:
18
+
19
+ - `scout` for local codebase reconnaissance;
20
+ - `context-builder` for planning handoff context;
21
+ - `planner` for implementation plans;
22
+ - `worker` for approved generic implementation;
23
+ - `reviewer` for fresh independent review;
24
+ - `oracle` for second opinions and risky decisions;
25
+ - `researcher` for external evidence when web access is available.
26
+
27
+ Prefer fresh-context reviewers for adversarial review.
28
+ Use forked context for `oracle` when the parent conversation history matters.
29
+ Keep one writer in the active worktree at a time.
30
+
8
31
  ## Core Principles
9
32
 
10
33
  ### Specs remain canonical
@@ -179,14 +202,20 @@ Does not own:
179
202
  For meaningful feature or bug-fix work, use this sequence:
180
203
 
181
204
  ```txt
182
- 1. tech-lead classifies change mode and scope
183
- 2. spec-author writes or confirms canonical specs
184
- 3. tdd-implementer performs Red → Green → Refactor
185
- 4. spec-syncer verifies specs/tests/code and documentation alignment
186
- 5. engineering-reviewer performs adversarial review
187
- 6. tech-lead finalises evidence, risks, and commits
205
+ 1. parent tech lead classifies change mode and scope
206
+ 2. arey-pi.spec-author writes or confirms canonical specs
207
+ 3. arey-pi.tdd-implementer performs Red → Green → Refactor
208
+ 4. arey-pi.spec-syncer verifies specs/tests/code and documentation alignment
209
+ 5. fresh reviewers perform adversarial review when risk warrants it
210
+ 6. parent tech lead synthesises findings and finalises evidence, risks, and commits
188
211
  ```
189
212
 
213
+ For broad or risky work,
214
+ use builtin `scout`,
215
+ `context-builder`,
216
+ `planner`,
217
+ or `oracle` before the Arey Pi delivery sequence.
218
+
190
219
  Small direct changes may skip specialised agents only when the tech lead can explicitly justify that specs, tests, architecture, DBML, ADRs, and documentation are unaffected.
191
220
 
192
221
  ## Handoff Contracts
@@ -13,7 +13,10 @@ defaultReads: AGENTS.md, agents/README.md, rules/README.md, rules/core/principle
13
13
  You are the Arey Pi tech lead.
14
14
  Your job is to orchestrate high-quality software delivery under Arey Pi rules.
15
15
 
16
- You preserve scope, choose the correct change mode, coordinate specialist agents, and ensure final evidence satisfies Definition of Done.
16
+ You preserve scope, choose the correct change mode, coordinate specialist work, and ensure final evidence satisfies Definition of Done.
17
+
18
+ In normal Arey Pi use, the parent Pi session acts as the tech lead and calls specialist subagents.
19
+ If this `arey-pi.tech-lead` agent is itself launched as a child, produce an orchestration plan and evidence checklist; do not attempt nested delegation unless the parent explicitly gave you the `subagent` tool for a bounded fanout task.
17
20
 
18
21
  ## Operating principles
19
22
 
@@ -30,7 +33,7 @@ Own:
30
33
 
31
34
  - classifying work as Spec-Driven Mode, Direct Change Mode, Rebuild Mode, Bootstrap Mode, or Assessment Mode;
32
35
  - decomposing work into spec, TDD, implementation, sync, review, and finalisation phases;
33
- - deciding when to use `spec-author`, `tdd-implementer`, `spec-syncer`, `engineering-reviewer`, or `project-evaluator`;
36
+ - deciding when the parent should use `arey-pi.spec-author`, `arey-pi.tdd-implementer`, `arey-pi.spec-syncer`, `arey-pi.engineering-reviewer`, `arey-pi.project-evaluator`, or builtin `pi-subagents` roles such as `scout`, `planner`, `worker`, `reviewer`, and `oracle`;
34
37
  - making handoffs explicit and evidence-backed;
35
38
  - resolving conflicts only when the canonical source is clear;
36
39
  - asking the user when product intent or policy is ambiguous;
@@ -62,15 +65,20 @@ Small direct changes may skip specialist agents only when you can explicitly jus
62
65
 
63
66
  ## Delegation guidance
64
67
 
65
- Use `spec-author` when specs are missing, behaviour changes, DBML might change, ADRs may be warranted, or domain language changes.
68
+ Use `arey-pi.spec-author` when specs are missing, behaviour changes, DBML might change, ADRs may be warranted, or domain language changes.
69
+
70
+ Use `arey-pi.tdd-implementer` when accepted specs or bug reports need implementation through Red-Green-Refactor.
66
71
 
67
- Use `tdd-implementer` when accepted specs or bug reports need implementation through Red-Green-Refactor.
72
+ Use `arey-pi.spec-syncer` near completion or whenever drift is suspected.
68
73
 
69
- Use `spec-syncer` near completion or whenever drift is suspected.
74
+ Use `arey-pi.engineering-reviewer` for material implementation, generated code, high-risk tests, architecture concerns, security/privacy/operability risk, or missing quality-tooling evidence.
70
75
 
71
- Use `engineering-reviewer` for material implementation, generated code, high-risk tests, architecture concerns, security/privacy/operability risk, or missing quality-tooling evidence.
76
+ Use `arey-pi.project-evaluator` for read-only repository readiness assessment.
72
77
 
73
- Use `project-evaluator` for read-only repository readiness assessment.
78
+ Use builtin `scout`, `context-builder`, or `planner` before large changes when more context or planning is needed.
79
+ Use builtin `oracle` for risky decisions and second opinions.
80
+ Use fresh-context `reviewer` agents for independent adversarial review.
81
+ Keep one writer in the active worktree at a time.
74
82
 
75
83
  ## Final response format
76
84
 
Binary file
@@ -0,0 +1,218 @@
1
+ # Adopting Arey Pi
2
+
3
+ This guide explains how to introduce Arey Pi into an existing repository.
4
+
5
+ Arey Pi adoption should be incremental.
6
+ Do not rewrite a project just to satisfy the framework.
7
+ Start by making project intent,
8
+ validation,
9
+ and agent instructions discoverable.
10
+
11
+ ## Recommended Adoption Path
12
+
13
+ ### 1. Install the package
14
+
15
+ Install Arey Pi in the project:
16
+
17
+ ```bash
18
+ pi install -l npm:arey-pi
19
+ ```
20
+
21
+ For subagent-backed workflows,
22
+ install `pi-subagents` too:
23
+
24
+ ```bash
25
+ pi install -l npm:pi-subagents
26
+ ```
27
+
28
+ Optionally install `pi-intercom` when background subagents may need to ask the parent for blocking decisions:
29
+
30
+ ```bash
31
+ pi install -l npm:pi-intercom
32
+ ```
33
+
34
+ Reload Pi after installation:
35
+
36
+ ```txt
37
+ /reload
38
+ ```
39
+
40
+ ### 2. Run doctor
41
+
42
+ Check what Pi can discover:
43
+
44
+ ```txt
45
+ /arey-doctor
46
+ /subagents-doctor
47
+ ```
48
+
49
+ Use these before and after bootstrap.
50
+
51
+ ### 3. Bootstrap safely
52
+
53
+ Run:
54
+
55
+ ```txt
56
+ /arey-bootstrap
57
+ ```
58
+
59
+ With no flags,
60
+ this creates a safe starter harness where files do not already exist:
61
+
62
+ ```txt
63
+ .pi/agents/arey-pi/
64
+ AGENTS.md
65
+ specs/
66
+ docs/
67
+ ```
68
+
69
+ It does not overwrite existing files unless `--force` is used.
70
+
71
+ ### 4. Fill project-specific commands
72
+
73
+ Edit `AGENTS.md` and replace command placeholders with real project commands.
74
+
75
+ At minimum,
76
+ agents should be able to discover:
77
+
78
+ - dependency installation;
79
+ - formatter;
80
+ - lint/static analysis;
81
+ - typecheck;
82
+ - tests;
83
+ - full validation command;
84
+ - database validation or migration checks when applicable.
85
+
86
+ ### 5. Assess readiness
87
+
88
+ Run:
89
+
90
+ ```txt
91
+ /arey-assess
92
+ ```
93
+
94
+ or:
95
+
96
+ ```txt
97
+ /assess-project
98
+ ```
99
+
100
+ Treat the report as a prioritised improvement plan,
101
+ not as a reason to stop work.
102
+
103
+ ### 6. Adopt specs incrementally
104
+
105
+ Start with high-value behaviour:
106
+
107
+ - risky workflows;
108
+ - customer-visible behaviour;
109
+ - bug-prone areas;
110
+ - persistence boundaries;
111
+ - permissions and security-sensitive logic;
112
+ - APIs and CLI contracts.
113
+
114
+ Use Gherkin for behaviour specs.
115
+ Use DBML for database specs when the project has persistence.
116
+
117
+ ### 7. Keep tests outside source trees
118
+
119
+ Prefer dedicated test roots:
120
+
121
+ ```txt
122
+ tests/
123
+ test/
124
+ __tests__/
125
+ spec/
126
+ ```
127
+
128
+ Mirror production module structure inside the test root where useful.
129
+
130
+ Example:
131
+
132
+ ```txt
133
+ src/domain/accounts/password-reset.ts
134
+ tests/domain/accounts/password-reset.test.ts
135
+ ```
136
+
137
+ Do not colocate new tests inside `src/` unless the project or framework requires it.
138
+
139
+ ## Adoption Modes
140
+
141
+ ### Light adoption
142
+
143
+ Use this for small projects or early evaluation.
144
+
145
+ - Install Arey Pi.
146
+ - Run `/arey-bootstrap`.
147
+ - Fill `AGENTS.md` commands.
148
+ - Add specs only for new or risky changes.
149
+
150
+ ### Standard adoption
151
+
152
+ Use this for active product repositories.
153
+
154
+ - Complete light adoption.
155
+ - Add Gherkin specs for core behaviours.
156
+ - Add DBML if persistence exists.
157
+ - Add ADRs for significant decisions.
158
+ - Require `/arey-sync` before completing non-trivial work.
159
+
160
+ ### Strict adoption
161
+
162
+ Use this for high-risk or agent-heavy projects.
163
+
164
+ - Complete standard adoption.
165
+ - Require TDD evidence for every production behaviour change.
166
+ - Require separate test directories.
167
+ - Require readiness assessment follow-ups.
168
+ - Use engineering review for significant changes.
169
+ - Consider coverage and mutation testing for critical behaviour.
170
+
171
+ ## Subagent Adoption Notes
172
+
173
+ See `docs/pi-subagents.md` for deeper guidance.
174
+
175
+ In short:
176
+
177
+ - keep orchestration in the parent Pi session;
178
+ - use Arey Pi agents for framework-specific delivery;
179
+ - use builtin `scout`,
180
+ `planner`,
181
+ `worker`,
182
+ `reviewer`,
183
+ `oracle`,
184
+ `context-builder`,
185
+ and `researcher` for generic support;
186
+ - prefer fresh reviewers for independent review;
187
+ - use `oracle` when the decision itself is risky;
188
+ - keep one writer in the active worktree at a time;
189
+ - use `.pi/settings.json` `subagents.agentOverrides` for model/thinking tweaks instead of copying builtin agents.
190
+
191
+ ## What Not To Do
192
+
193
+ Do not:
194
+
195
+ - create low-value ADRs for trivial choices;
196
+ - generate broad specs that nobody will maintain;
197
+ - move all tests or docs in a single unrelated change;
198
+ - accept shallow generated tests as proof of quality;
199
+ - overwrite existing project conventions without review;
200
+ - treat bootstrap as a substitute for project-specific instructions.
201
+
202
+ ## Completion Standard
203
+
204
+ After adoption work,
205
+ run:
206
+
207
+ ```txt
208
+ /arey-doctor
209
+ /arey-assess
210
+ ```
211
+
212
+ A good first adoption result is not perfection.
213
+ It is a repository where humans and agents can discover how to work safely,
214
+ validate changes,
215
+ and keep specs,
216
+ docs,
217
+ tests,
218
+ and code aligned.
@@ -0,0 +1,292 @@
1
+ # Using pi-subagents with Arey Pi
2
+
3
+ Arey Pi is designed to work well with `pi-subagents`.
4
+
5
+ `pi-subagents` gives the parent Pi session focused child agents for scouting,
6
+ planning,
7
+ implementation,
8
+ review,
9
+ and advisory second opinions.
10
+ Arey Pi adds an opinionated delivery framework around specs,
11
+ TDD,
12
+ quality,
13
+ and synchronisation.
14
+
15
+ ## Install
16
+
17
+ Install both packages in the project:
18
+
19
+ ```bash
20
+ pi install -l npm:arey-pi
21
+ pi install -l npm:pi-subagents
22
+ ```
23
+
24
+ Optional:
25
+
26
+ ```bash
27
+ pi install -l npm:pi-intercom
28
+ ```
29
+
30
+ `pi-intercom` is useful when background child agents may need to ask the parent for a blocking decision instead of guessing.
31
+ It is not required for normal use.
32
+
33
+ Reload Pi after installation:
34
+
35
+ ```txt
36
+ /reload
37
+ ```
38
+
39
+ Then check setup:
40
+
41
+ ```txt
42
+ /arey-doctor
43
+ /subagents-doctor
44
+ ```
45
+
46
+ ## Bootstrap
47
+
48
+ Run:
49
+
50
+ ```txt
51
+ /arey-bootstrap
52
+ ```
53
+
54
+ This installs Arey Pi's project-local subagent definitions into:
55
+
56
+ ```txt
57
+ .pi/agents/arey-pi/
58
+ ```
59
+
60
+ The runtime names include the package prefix:
61
+
62
+ ```txt
63
+ arey-pi.tech-lead
64
+ arey-pi.spec-author
65
+ arey-pi.tdd-implementer
66
+ arey-pi.spec-syncer
67
+ arey-pi.engineering-reviewer
68
+ arey-pi.project-evaluator
69
+ ```
70
+
71
+ ## Parent Owns Orchestration
72
+
73
+ The parent Pi session should own orchestration.
74
+
75
+ Child agents should receive concrete,
76
+ bounded tasks.
77
+ They should not create their own subagent workflows unless explicitly launched with the `subagent` tool for a bounded fanout task.
78
+
79
+ Good parent request:
80
+
81
+ ```txt
82
+ Implement password reset following Arey Pi.
83
+ Use specialist subagents where useful.
84
+ ```
85
+
86
+ Good child handoff:
87
+
88
+ ```txt
89
+ Use arey-pi.tdd-implementer to implement the accepted password-reset scenarios.
90
+ Write tests under tests/,
91
+ not beside production files.
92
+ Report Red-Green-Refactor evidence and validation commands.
93
+ ```
94
+
95
+ Poor child handoff:
96
+
97
+ ```txt
98
+ Figure out everything and use more subagents if needed.
99
+ ```
100
+
101
+ ## Recommended Arey Pi Orchestration
102
+
103
+ For meaningful feature work:
104
+
105
+ ```txt
106
+ clarify → spec-author → tdd-implementer → fresh reviewers → sync/fix → finalise
107
+ ```
108
+
109
+ For risky decisions:
110
+
111
+ ```txt
112
+ oracle → parent decision → worker or Arey Pi implementer
113
+ ```
114
+
115
+ For hard codebase discovery:
116
+
117
+ ```txt
118
+ scout/context-builder → planner → Arey Pi implementation workflow
119
+ ```
120
+
121
+ For review loops:
122
+
123
+ ```txt
124
+ worker → fresh reviewers → parent synthesis → single fix worker
125
+ ```
126
+
127
+ Keep one writer in the active worktree at a time.
128
+ Use parallel agents for read-only scouting,
129
+ planning,
130
+ and review.
131
+
132
+ ## Context Choices
133
+
134
+ Use fresh context for independent review:
135
+
136
+ ```txt
137
+ fresh reviewers for correctness,
138
+ tests,
139
+ and simplicity
140
+ ```
141
+
142
+ Fresh reviewers are less likely to inherit the parent agent's assumptions.
143
+
144
+ Use forked context for decision review where conversation history matters:
145
+
146
+ ```txt
147
+ oracle reviewing current plan and assumptions
148
+ ```
149
+
150
+ Forked context is useful when the child should understand prior reasoning,
151
+ but it is not a substitute for a focused task prompt.
152
+
153
+ ## Builtin Agents and Arey Pi Agents
154
+
155
+ Use builtin `pi-subagents` agents for generic support:
156
+
157
+ - `scout` for local codebase reconnaissance;
158
+ - `context-builder` for implementation handoff context;
159
+ - `planner` for implementation plans;
160
+ - `worker` for generic approved implementation;
161
+ - `reviewer` for generic review and small fixes;
162
+ - `oracle` for second opinions and decision challenges;
163
+ - `researcher` for external evidence when web access is available.
164
+
165
+ Use Arey Pi agents for framework-specific delivery:
166
+
167
+ - `arey-pi.spec-author` for Gherkin,
168
+ DBML,
169
+ ADR,
170
+ and glossary impact;
171
+ - `arey-pi.tdd-implementer` for strict Red-Green-Refactor;
172
+ - `arey-pi.spec-syncer` for spec and documentation sync;
173
+ - `arey-pi.engineering-reviewer` for Arey Pi quality review;
174
+ - `arey-pi.project-evaluator` for readiness audits.
175
+
176
+ ## Prompting Pattern
177
+
178
+ A strong subagent task should include:
179
+
180
+ - goal;
181
+ - relevant files,
182
+ diffs,
183
+ specs,
184
+ plans,
185
+ or decisions;
186
+ - success criteria;
187
+ - hard constraints;
188
+ - validation expectations;
189
+ - expected output format;
190
+ - stop rules.
191
+
192
+ Example:
193
+
194
+ ```txt
195
+ Review the current diff as arey-pi.engineering-reviewer.
196
+ Focus on correctness,
197
+ test quality and location,
198
+ simplicity,
199
+ security,
200
+ and documentation sync.
201
+ Do not modify files.
202
+ Return blocking findings first with file references.
203
+ ```
204
+
205
+ ## Async and Background Work
206
+
207
+ Use background subagents for long-running implementation,
208
+ large reviews,
209
+ or broad audits.
210
+
211
+ If the parent has no useful independent work while a background child runs,
212
+ end the turn and wait for completion rather than polling repeatedly.
213
+
214
+ Use status checks when needed:
215
+
216
+ ```txt
217
+ Show active async runs.
218
+ ```
219
+
220
+ or:
221
+
222
+ ```txt
223
+ /subagents-doctor
224
+ ```
225
+
226
+ ## Model Overrides
227
+
228
+ Builtin `pi-subagents` agents inherit the current Pi default model.
229
+ For normal tweaks,
230
+ prefer `subagents.agentOverrides` in settings rather than copying builtin agents.
231
+
232
+ Project-local example:
233
+
234
+ ```json
235
+ {
236
+ "subagents": {
237
+ "agentOverrides": {
238
+ "reviewer": {
239
+ "thinking": "high",
240
+ "fallbackModels": ["openai/gpt-5-mini"]
241
+ }
242
+ }
243
+ }
244
+ }
245
+ ```
246
+
247
+ Use `.pi/settings.json` for project overrides.
248
+ Use `~/.pi/agent/settings.json` for user-wide overrides.
249
+
250
+ ## Recommended Natural Language Requests
251
+
252
+ ```txt
253
+ Ask oracle to challenge this plan before we edit.
254
+ ```
255
+
256
+ ```txt
257
+ Use scout to map the auth flow,
258
+ then ask me the clarification questions that matter.
259
+ ```
260
+
261
+ ```txt
262
+ Run parallel reviewers on this diff:
263
+ one for correctness,
264
+ one for tests,
265
+ and one for unnecessary complexity.
266
+ ```
267
+
268
+ ```txt
269
+ Have a worker implement this approved plan,
270
+ then run fresh reviewers and apply only fixes worth doing now.
271
+ ```
272
+
273
+ ```txt
274
+ Run a review loop on this change with a max of 3 rounds.
275
+ ```
276
+
277
+ ## Arey Pi Completion Rule
278
+
279
+ Subagents can contribute evidence,
280
+ but the parent session finalises.
281
+
282
+ The final response should still include:
283
+
284
+ ```txt
285
+ - Specs:
286
+ - Tests/TDD, including test location:
287
+ - Validation:
288
+ - Spec sync:
289
+ - Documentation sync:
290
+ - Quality review:
291
+ - Residual risks:
292
+ ```