arey-pi 0.2.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
@@ -25,7 +25,7 @@ Arey Pi is built around these guarantees:
25
25
  - behaviour is captured in canonical Gherkin specs;
26
26
  - database projects keep canonical DBML specs precisely synchronised;
27
27
  - TDD is mandatory for production behaviour changes;
28
- - tests must be meaningful, reviewed, and strengthened with coverage or mutation testing where risk warrants it;
28
+ - tests must be meaningful, reviewed, kept outside production source directories, and strengthened with coverage or mutation testing where risk warrants it;
29
29
  - architecture and code must meet a senior engineering quality bar;
30
30
  - significant technical decisions are captured in high-quality ADRs;
31
31
  - specs, tests, code, DBML, ADRs, glossary, and architecture docs stay synchronised;
@@ -38,10 +38,12 @@ Arey Pi is built around these guarantees:
38
38
 
39
39
  ```txt
40
40
  agents/ # Arey Pi subagent role definitions for pi-subagents
41
- extensions/ # Slash commands for doctor, bootstrap, and workflows
41
+ extensions/ # Directory-style Pi extension for doctor, bootstrap, and workflows
42
+ docs/ # Package documentation
42
43
  skills/ # On-demand Arey Pi workflows and instructions
43
44
  prompts/ # Reusable Pi prompt workflows
44
45
  rules/ # Arey Pi operating rules
46
+ templates/ # Bootstrap templates for AGENTS.md, specs, ADRs, DBML, glossary, and reports
45
47
  ```
46
48
 
47
49
  The rules are the policy layer.
@@ -125,9 +127,12 @@ Arey Pi includes a polished extension-backed workflow:
125
127
 
126
128
  ```txt
127
129
  /arey-doctor # check package, subagent, prompt, skill, and project readiness setup
128
- /arey-bootstrap # install project-local Arey Pi agents
130
+ /arey-bootstrap # full safe bootstrap: agents, AGENTS.md, specs, docs, and templates
129
131
  /arey-bootstrap --agentsmd # also create a starter AGENTS.md if missing
130
- /arey-bootstrap --force # overwrite existing project-local Arey Pi agents
132
+ /arey-bootstrap --specs # scaffold starter specs directories and glossary
133
+ /arey-bootstrap --docs # scaffold starter docs directory
134
+ /arey-bootstrap --full # explicit alias for the default full bootstrap
135
+ /arey-bootstrap --force # full bootstrap and overwrite selected project-local files
131
136
  /arey-feature # run spec → TDD → sync → review for a feature
132
137
  /arey-bugfix # run regression-test-first bug fixing
133
138
  /arey-sync # verify specs, docs, tests, code, DBML, ADRs, and glossary alignment
@@ -138,7 +143,14 @@ Arey Pi includes a polished extension-backed workflow:
138
143
  The goal is that users can either speak naturally or use explicit commands,
139
144
  while Arey Pi handles the disciplined workflow behind the scenes.
140
145
 
141
- 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.
142
154
 
143
155
  ## Development
144
156
 
@@ -147,10 +159,11 @@ Arey Pi uses Bun as its package manager and Biome for extension formatting and l
147
159
  ```bash
148
160
  bun install
149
161
  bun run format
162
+ bun run test
150
163
  bun run check
151
164
  ```
152
165
 
153
- `bun run check` runs Biome linting and TypeScript type checking.
166
+ `bun run check` runs Biome linting, TypeScript type checking, and Bun tests.
154
167
 
155
168
  ## Rule categories
156
169
 
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
@@ -44,6 +44,7 @@ Check:
44
44
  - whether domain concepts and contracts are explicit;
45
45
  - whether error handling, security, privacy, and edge cases are appropriate;
46
46
  - whether tests assert behaviour and would catch plausible regressions;
47
+ - whether tests are kept in a dedicated test/spec directory rather than colocated with production source files without justification;
47
48
  - whether quality tooling ran and is sufficient for project risk;
48
49
  - whether durable decisions require ADRs;
49
50
  - whether DBML, Gherkin, glossary, architecture docs, README files, docs, AGENTS.md, skills, prompts, rules, agents, commands, or tooling instructions may need sync;
@@ -69,7 +70,7 @@ Return:
69
70
  Engineering review:
70
71
  - Blocking findings:
71
72
  - High/medium/low findings:
72
- - Test quality:
73
+ - Test quality and location:
73
74
  - Tooling/validation:
74
75
  - Architecture/code quality:
75
76
  - Security/privacy/operability:
@@ -22,6 +22,7 @@ Own:
22
22
 
23
23
  - deriving tests from accepted specs, bug reports, or explicit requirements;
24
24
  - writing failing tests before production behaviour;
25
+ - placing tests in a dedicated test/spec directory outside production source trees by default;
25
26
  - implementing the smallest high-quality production change that satisfies the tests;
26
27
  - refactoring after tests pass;
27
28
  - keeping tests meaningful and behaviour-focused;
@@ -56,6 +57,9 @@ If you cannot demonstrate Red-Green-Refactor because of project constraints, sta
56
57
  Tests must constrain behaviour.
57
58
  They should cover important success paths, edge cases, failure paths, permissions, contracts, and regressions where relevant.
58
59
 
60
+ Tests must not be colocated beside production files in `src/` or equivalent source directories unless an existing project convention, framework constraint, or user-approved exception requires it.
61
+ Prefer mirroring production module structure under `tests/`, `test/`, `__tests__/`, or `spec/`.
62
+
59
63
  Weak tests are not acceptable evidence merely because they pass.
60
64
  Use mutation testing, coverage, or explicit test review where appropriate to risk.
61
65
 
@@ -71,7 +75,7 @@ Return:
71
75
  ```txt
72
76
  Implementation handoff:
73
77
  - Changed files:
74
- - Tests added/updated:
78
+ - Tests added/updated and location:
75
79
  - Red-Green-Refactor evidence:
76
80
  - Validation commands:
77
81
  - Spec impact:
@@ -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.
package/docs/commands.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Arey Pi Commands
2
2
 
3
3
  Arey Pi ships a Pi extension that registers native slash commands.
4
+ The extension uses Pi's documented directory style at `extensions/arey-pi/index.ts`.
4
5
 
5
6
  The commands are designed for two modes of use:
6
7
 
@@ -11,7 +12,7 @@ The commands are designed for two modes of use:
11
12
 
12
13
  ```txt
13
14
  /arey-doctor
14
- /arey-bootstrap [--agentsmd] [--force]
15
+ /arey-bootstrap [--agentsmd] [--specs] [--docs] [--full] [--force]
15
16
  /arey-feature <feature request>
16
17
  /arey-bugfix <bug description>
17
18
  /arey-sync [scope]
@@ -28,6 +29,7 @@ It reports:
28
29
  - Arey Pi package version;
29
30
  - current project path;
30
31
  - whether packaged rules are present;
32
+ - whether packaged templates are present;
31
33
  - whether packaged agents are present;
32
34
  - whether `pi-subagents` appears to be installed;
33
35
  - whether project-local Arey Pi agents exist in `.pi/agents/arey-pi/`;
@@ -49,15 +51,23 @@ or when subagent workflows are not behaving as expected.
49
51
 
50
52
  ## `/arey-bootstrap`
51
53
 
52
- Installs Arey Pi's packaged subagent definitions into the current project.
54
+ Installs Arey Pi's packaged subagent definitions into the current project and performs a safe starter scaffold.
53
55
 
54
- Default target:
56
+ With no flags, `/arey-bootstrap` runs the full bootstrap path:
57
+
58
+ ```txt
59
+ --agentsmd --specs --docs
60
+ ```
61
+
62
+ Default agent target:
55
63
 
56
64
  ```txt
57
65
  .pi/agents/arey-pi/
58
66
  ```
59
67
 
60
- By default, existing project-local agent files are not overwritten.
68
+ By default, existing project-local agent files and scaffold files are not overwritten.
69
+ Starter scaffold files are copied from the packaged `templates/` directory.
70
+ Selective flags are available when you only want one part of the scaffold.
61
71
 
62
72
  Usage:
63
73
 
@@ -65,6 +75,24 @@ Usage:
65
75
  /arey-bootstrap
66
76
  ```
67
77
 
78
+ This creates or installs, where missing:
79
+
80
+ ```txt
81
+ .pi/agents/arey-pi/
82
+ AGENTS.md
83
+ specs/README.md
84
+ specs/features/README.md
85
+ specs/features/example.feature
86
+ specs/database/README.md
87
+ specs/database/schema.dbml
88
+ specs/architecture/README.md
89
+ specs/decisions/README.md
90
+ specs/decisions/0001-record-architecture-decision.md
91
+ specs/glossary.md
92
+ docs/README.md
93
+ docs/project-readiness-report.md
94
+ ```
95
+
68
96
  Options:
69
97
 
70
98
  ```txt
@@ -73,13 +101,61 @@ Options:
73
101
 
74
102
  Also creates a starter root `AGENTS.md` when one does not already exist.
75
103
 
104
+ ```txt
105
+ /arey-bootstrap --specs
106
+ ```
107
+
108
+ Creates starter Arey Pi spec structure when files do not already exist:
109
+
110
+ ```txt
111
+ specs/README.md
112
+ specs/features/README.md
113
+ specs/features/example.feature
114
+ specs/database/README.md
115
+ specs/database/schema.dbml
116
+ specs/architecture/README.md
117
+ specs/decisions/README.md
118
+ specs/decisions/0001-record-architecture-decision.md
119
+ specs/glossary.md
120
+ ```
121
+
122
+ ```txt
123
+ /arey-bootstrap --docs
124
+ ```
125
+
126
+ Creates starter project documentation structure when files do not already exist:
127
+
128
+ ```txt
129
+ docs/README.md
130
+ docs/project-readiness-report.md
131
+ ```
132
+
133
+ ```txt
134
+ /arey-bootstrap --full
135
+ ```
136
+
137
+ Explicitly runs the same combined bootstrap path as `/arey-bootstrap` with no flags:
138
+
139
+ ```txt
140
+ --agentsmd --specs --docs
141
+ ```
142
+
76
143
  ```txt
77
144
  /arey-bootstrap --force
78
145
  ```
79
146
 
80
- Overwrites existing project-local Arey Pi agent files.
147
+ Overwrites existing project-local Arey Pi agent files and scaffold files selected by the other flags.
148
+ When used alone, it applies to the default full bootstrap path.
81
149
  It also creates a starter `AGENTS.md` when one does not already exist.
82
150
 
151
+ Examples:
152
+
153
+ ```txt
154
+ /arey-bootstrap --specs --docs
155
+ /arey-bootstrap --full
156
+ /arey-bootstrap --full --force
157
+ ```
158
+
83
159
  Use this command after installing Arey Pi and `pi-subagents` in a repository where you want the Arey Pi agents to be discoverable by `pi-subagents`.
84
160
 
85
161
  ## `/arey-feature`