arey-pi 0.1.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.
@@ -0,0 +1,257 @@
1
+ # Architecture Decision Records
2
+
3
+ ## Purpose
4
+
5
+ Architecture Decision Records persist meaningful technical decisions that shape the system over time.
6
+
7
+ ADRs are not meeting notes, implementation diaries, or paperwork.
8
+ They exist to preserve decisions with real architectural, operational, product, or long-term maintenance impact.
9
+
10
+ ## Core Rule
11
+
12
+ Create an ADR when a decision is significant enough that a future senior engineer or agent would need to understand why the system works that way.
13
+
14
+ Do not create ADRs for trivial choices, obvious implementation details, or decisions that can be safely inferred from local code.
15
+
16
+ ## Quality Bar
17
+
18
+ An ADR must be useful after the original conversation is forgotten.
19
+
20
+ A high-quality ADR explains:
21
+
22
+ - the context that made the decision necessary;
23
+ - the decision that was made;
24
+ - the options seriously considered;
25
+ - the tradeoffs and consequences;
26
+ - the constraints that shaped the decision;
27
+ - the expected impact on architecture, operations, data, security, testing, or delivery;
28
+ - when the decision should be revisited.
29
+
30
+ If an ADR does not clarify future work, it should not exist.
31
+
32
+ ## When to Create an ADR
33
+
34
+ Create or update an ADR for decisions involving:
35
+
36
+ - major framework or platform choices;
37
+ - persistence or database strategy;
38
+ - API contracts or integration patterns;
39
+ - authentication, authorisation, security, or privacy models;
40
+ - eventing, queues, background jobs, or distributed systems;
41
+ - deployment, runtime, infrastructure, or operational constraints;
42
+ - data ownership, tenancy, retention, or migration strategy;
43
+ - module boundaries or dependency direction;
44
+ - substantial performance, reliability, or scalability tradeoffs;
45
+ - accepted technical debt with meaningful consequences;
46
+ - deviations from Arey Pi rules;
47
+ - irreversible or expensive-to-reverse choices.
48
+
49
+ ## When Not to Create an ADR
50
+
51
+ Do not create ADRs for:
52
+
53
+ - tiny local refactors;
54
+ - routine bug fixes;
55
+ - obvious library usage within an existing standard;
56
+ - formatting or tooling changes with no durable tradeoff;
57
+ - implementation steps that are already clear from code and tests;
58
+ - temporary notes that belong in a task plan;
59
+ - decisions that have no meaningful future consequence.
60
+
61
+ If the decision is too small for an ADR but still worth remembering, consider updating comments, docs, glossary, or existing architecture notes instead.
62
+
63
+ ## Required Structure
64
+
65
+ Use this structure unless the project already has an equivalent ADR template:
66
+
67
+ ```md
68
+ # ADR-NNNN: Title
69
+
70
+ ## Status
71
+
72
+ Proposed | Accepted | Superseded | Deprecated
73
+
74
+ ## Relationship
75
+
76
+ Supersedes:
77
+ Superseded by:
78
+ Amends:
79
+ Amended by:
80
+ Narrows:
81
+ Expands:
82
+ Depends on:
83
+ Related:
84
+
85
+ ## Scope
86
+
87
+ Where does this decision apply?
88
+ Where does it not apply?
89
+
90
+ ## Context
91
+
92
+ What problem, constraint, or opportunity forced a decision?
93
+
94
+ ## Decision
95
+
96
+ What did we decide?
97
+
98
+ ## Options Considered
99
+
100
+ What realistic alternatives were considered?
101
+ Why were they not chosen?
102
+
103
+ ## Consequences
104
+
105
+ What improves?
106
+ What gets worse?
107
+ What new constraints or responsibilities exist?
108
+
109
+ ## Impact
110
+
111
+ Which areas are affected?
112
+ Consider architecture, data, security, operations, testing, specs, and delivery.
113
+
114
+ ## Revisit When
115
+
116
+ What signals should cause this decision to be reviewed?
117
+ ```
118
+
119
+ ## Location and Naming
120
+
121
+ Default location:
122
+
123
+ ```txt
124
+ specs/decisions/
125
+ ```
126
+
127
+ Recommended naming:
128
+
129
+ ```txt
130
+ ADR-0001-use-postgresql-for-primary-storage.md
131
+ ADR-0002-adopt-event-driven-billing-integration.md
132
+ ```
133
+
134
+ Use semantic line breaks and UK English.
135
+
136
+ ## Status Lifecycle
137
+
138
+ ADRs should have a clear status:
139
+
140
+ - **Proposed:** not yet accepted;
141
+ - **Accepted:** current decision;
142
+ - **Superseded:** replaced by a newer ADR;
143
+ - **Deprecated:** no longer recommended but not directly replaced.
144
+
145
+ Do not silently edit history when a major decision changes.
146
+ Prefer adding a new ADR that relates to the old one explicitly.
147
+
148
+ ## Relationships Between ADRs
149
+
150
+ ADRs may overlap, refine, or replace earlier decisions.
151
+ Those relationships must be explicit.
152
+
153
+ Use relationship fields consistently:
154
+
155
+ - **Supersedes:** the new ADR fully replaces an older ADR.
156
+ - **Superseded by:** the old ADR points to the newer replacing ADR.
157
+ - **Amends:** the new ADR partially changes an older ADR while leaving the rest valid.
158
+ - **Amended by:** the old ADR points to a newer partial amendment.
159
+ - **Narrows:** the new ADR restricts where an older decision applies.
160
+ - **Expands:** the new ADR applies an older decision to additional scope.
161
+ - **Depends on:** the new ADR relies on another decision still being valid.
162
+ - **Related:** the ADRs are relevant to each other but do not change each other's status or scope.
163
+
164
+ ## Supersession and Overlap
165
+
166
+ When a new ADR replaces an older decision:
167
+
168
+ 1. Create a new ADR explaining why the decision changed.
169
+ 2. Set the new ADR relationship to `Supersedes: ADR-NNNN`.
170
+ 3. Update the old ADR status to `Superseded`.
171
+ 4. Set the old ADR relationship to `Superseded by: ADR-NNNN`.
172
+ 5. Update architecture docs, Gherkin, DBML, glossary, or tests when the current system truth changes.
173
+
174
+ When a new ADR only partially changes an older decision, do not mark the older ADR as fully superseded.
175
+ Use `Amends`, `Narrows`, or `Expands`, and make the affected scope explicit in both ADRs where practical.
176
+
177
+ Historical ADRs should remain readable.
178
+ Do not delete or rewrite meaningful context to make history look cleaner.
179
+
180
+ ## Conflict Handling
181
+
182
+ Accepted newer ADRs only override older ADRs when the relationship is explicit.
183
+
184
+ If two accepted ADRs appear to conflict and no relationship explains the overlap, agents must stop and report the conflict.
185
+ They must not silently choose the newer, older, or easier decision.
186
+
187
+ Report conflicts with evidence:
188
+
189
+ ```txt
190
+ ADR conflict detected:
191
+ - ADR-0004 says: ...
192
+ - ADR-0010 says: ...
193
+ - No supersession, amendment, narrowing, or expansion relationship found.
194
+ Decision required.
195
+ ```
196
+
197
+ ## Current Architecture Truth
198
+
199
+ ADRs preserve decision history.
200
+ Architecture overview docs describe the current architecture.
201
+
202
+ The current decision set is derived from:
203
+
204
+ - accepted ADRs;
205
+ - minus superseded or deprecated ADRs;
206
+ - plus explicit amendments, narrowing, expansions, and dependencies.
207
+
208
+ Because deriving current truth from many ADRs can become difficult, durable current-state architecture docs should be updated when ADRs materially change the system.
209
+
210
+ ## Relationship to Specs
211
+
212
+ ADRs explain why durable technical decisions were made.
213
+ They do not replace:
214
+
215
+ - Gherkin behaviour specs;
216
+ - DBML database specs;
217
+ - tests;
218
+ - glossary entries;
219
+ - architecture overview docs.
220
+
221
+ When a decision affects behaviour, update Gherkin.
222
+ When it affects the data model, update DBML.
223
+ When it introduces domain language, update the glossary.
224
+ When it changes system structure, update architecture docs.
225
+
226
+ ## Agent Behaviour
227
+
228
+ Agents must identify whether their work includes a meaningful architectural decision.
229
+
230
+ If it does, they must either:
231
+
232
+ - create or update an ADR;
233
+ - update an existing ADR's status;
234
+ - or explicitly report why an ADR is not warranted.
235
+
236
+ Agents must not create low-value ADRs just to satisfy process.
237
+
238
+ ## Review Checklist
239
+
240
+ Before accepting an ADR, check:
241
+
242
+ - Does it capture a real decision, not just an implementation step?
243
+ - Is the impact significant enough to justify an ADR?
244
+ - Is the context understandable without chat history?
245
+ - Are alternatives and tradeoffs honest?
246
+ - Are consequences explicit?
247
+ - Does it say when to revisit the decision?
248
+ - Does it declare relationships to overlapping ADRs?
249
+ - Does it avoid silent conflict with accepted ADRs?
250
+ - Does it link to affected specs, DBML, architecture docs, or follow-up work where useful?
251
+ - Is it written with semantic line breaks and UK English?
252
+
253
+ ## Acceptance Rule
254
+
255
+ An ADR is valuable only if it improves future decision-making.
256
+
257
+ A change is not complete when it makes or changes a significant technical decision but leaves no high-quality ADR or explicit no-ADR rationale.
@@ -0,0 +1,55 @@
1
+ # Architecture Memory
2
+
3
+ ## Purpose
4
+
5
+ Architecture memory preserves durable technical decisions and system constraints outside implementation code.
6
+
7
+ It ensures future agents can understand not just what the system does, but why it is shaped that way.
8
+
9
+ ## Canonical Architecture Sources
10
+
11
+ Use:
12
+
13
+ - architecture docs for current system structure and constraints;
14
+ - ADRs for decisions, tradeoffs, and consequences;
15
+ - glossary for domain language;
16
+ - Gherkin for observable behaviour affected by architecture.
17
+
18
+ Recommended locations:
19
+
20
+ ```txt
21
+ specs/architecture/
22
+ specs/decisions/
23
+ specs/glossary.md
24
+ ```
25
+
26
+ ## When to Update Architecture Memory
27
+
28
+ Update architecture memory when work introduces or changes:
29
+
30
+ - component boundaries;
31
+ - data ownership;
32
+ - persistence strategy;
33
+ - public API shape;
34
+ - integration patterns;
35
+ - queues/events/background jobs;
36
+ - auth/security model;
37
+ - deployment/runtime assumptions;
38
+ - performance or reliability constraints;
39
+ - important dependencies;
40
+ - accepted technical debt;
41
+ - major tradeoffs or rejected alternatives.
42
+
43
+ ## ADR Rule
44
+
45
+ Create or update a high-quality ADR for non-trivial decisions that future maintainers should not have to rediscover.
46
+
47
+ ADRs should be meaningful, decision-focused, and useful after the original conversation is forgotten.
48
+
49
+ Use `architecture/adrs.md` as the quality bar for when ADRs are warranted and how they should be written.
50
+
51
+ ## Agent Behaviour
52
+
53
+ Agents must not leave important architecture decisions only in code comments, task summaries, or chat history.
54
+
55
+ If a task makes an architectural decision, persist it before marking the work complete.
@@ -0,0 +1,224 @@
1
+ # Project Readiness
2
+
3
+ ## Purpose
4
+
5
+ Project Readiness evaluates whether a repository is aligned with Arey Pi.
6
+
7
+ It is a meta-assessment across the Arey Pi rules. AI Harness, Language Style, Database Specs, and ADR quality are evaluated as first-class concerns alongside specs, TDD, test quality, quality tooling, architecture, spec sync, rebuildability, and process.
8
+
9
+ ## Core Rule
10
+
11
+ Projects should be periodically evaluated against Arey Pi rules.
12
+
13
+ Assessment is read-only by default. Findings should produce evidence, scores, risks, and a prioritised improvement plan before any changes are made.
14
+
15
+ ## Assessment Areas
16
+
17
+ Evaluate the project across these Arey Pi areas.
18
+
19
+ ### Canonical Specs
20
+
21
+ Check whether:
22
+
23
+ - `specs/features/` exists where applicable;
24
+ - Gherkin specs describe meaningful observable behaviour;
25
+ - specs avoid incidental implementation details;
26
+ - important domains, APIs, CLIs, errors, permissions, and edge cases are covered;
27
+ - glossary, architecture docs, and ADRs exist when project complexity requires them.
28
+
29
+ ### Gherkin Authoring
30
+
31
+ Check whether:
32
+
33
+ - scenarios are readable and domain-focused;
34
+ - scenarios are testable;
35
+ - `Feature`, `Rule`, `Scenario`, and `Scenario Outline` are used clearly;
36
+ - specs avoid duplicative or low-value scenarios;
37
+ - scenarios can be traced to tests where practical.
38
+
39
+ ### Tests and TDD
40
+
41
+ Check whether:
42
+
43
+ - there is a clear test suite;
44
+ - tests are easy to run;
45
+ - tests can be traced to specs or requirements where practical;
46
+ - bug fixes have regression tests;
47
+ - test structure supports TDD;
48
+ - tests are meaningful rather than shallow generated assertions.
49
+
50
+ ### Test Quality
51
+
52
+ Check whether:
53
+
54
+ - coverage is available or intentionally absent;
55
+ - mutation testing is configured for critical code or proposed as an improvement;
56
+ - tests assert behaviour rather than implementation mechanics;
57
+ - edge cases and failure paths are covered for important behaviour;
58
+ - surviving mutants or weak assertions are triaged when evidence exists.
59
+
60
+ ### Quality Tooling
61
+
62
+ Check whether the project defines:
63
+
64
+ - formatter;
65
+ - linter/static analyser;
66
+ - type checking where applicable;
67
+ - test command;
68
+ - composed check/validation command;
69
+ - relevant dynamic analysis for project risk.
70
+
71
+ If tooling is absent, assessment must recommend options and mark the project as not fully aligned.
72
+
73
+ ### Engineering Quality
74
+
75
+ Check whether:
76
+
77
+ - architecture is understandable;
78
+ - boundaries and responsibilities are clear;
79
+ - code follows consistent patterns;
80
+ - complexity is justified;
81
+ - the implementation reflects senior engineering standards;
82
+ - generated or agent-authored code has been reviewed for quality.
83
+
84
+ ### Spec Sync
85
+
86
+ Check whether:
87
+
88
+ - specs, tests, and code appear aligned;
89
+ - behaviour changes have corresponding Gherkin updates or no-impact reasoning;
90
+ - database changes have precise DBML updates or no-impact reasoning;
91
+ - architecture/ADR/glossary updates exist when durable knowledge changed;
92
+ - Definition of Done expectations are documented.
93
+
94
+ ### Database Specs
95
+
96
+ Evaluate Database Specs as a normal Arey Pi rule when the project uses persistent storage.
97
+
98
+ Check whether:
99
+
100
+ - DBML exists in `specs/database/` or another documented canonical location;
101
+ - DBML reflects tables, columns, types, keys, relationships, constraints, indexes, and relevant notes;
102
+ - migrations, ORM models, SQL DDL, and DBML agree;
103
+ - database-related changes update DBML in the same change set;
104
+ - DBML validation tooling exists or its absence is reported.
105
+
106
+ ### Rebuildability
107
+
108
+ Check whether:
109
+
110
+ - important behaviour can be reconstructed from specs and tests;
111
+ - durable decisions are outside code;
112
+ - modules are not understandable only by reading implementation;
113
+ - architecture and domain knowledge are persisted.
114
+
115
+ ### Architecture Memory and ADRs
116
+
117
+ Check whether:
118
+
119
+ - architecture docs exist when needed;
120
+ - ADRs capture meaningful non-trivial decisions rather than irrelevant process noise;
121
+ - ADRs explain context, options, tradeoffs, consequences, impact, and revisit conditions;
122
+ - low-value ADRs are avoided;
123
+ - glossary captures domain language;
124
+ - integrations, boundaries, ownership, and constraints are documented.
125
+
126
+ ### Incremental Commits
127
+
128
+ Check whether:
129
+
130
+ - Conventional Commits are used;
131
+ - commits are incremental and coherent;
132
+ - unrelated changes are not mixed together;
133
+ - history supports review and rollback.
134
+
135
+ ### AI Harness
136
+
137
+ Evaluate AI Harness as a normal Arey Pi rule.
138
+
139
+ Check whether:
140
+
141
+ - root `AGENTS.md` exists and is useful;
142
+ - nested `AGENTS.md` files exist for subtrees that need local technology, domain, command, or safety instructions;
143
+ - Arey Pi installation/reference is discoverable;
144
+ - project-local skills, prompts, and subagents exist where useful;
145
+ - technology-specific guidance is available;
146
+ - validation/setup commands are discoverable;
147
+ - safety rails for agents are documented.
148
+
149
+ Missing AI harness setup is an Arey Pi alignment gap because it prevents agents from applying the other rules consistently.
150
+
151
+ ### Language Style
152
+
153
+ Evaluate Language Style as a normal Arey Pi rule.
154
+
155
+ Check whether:
156
+
157
+ - project-facing prose uses UK English by default;
158
+ - specs always use semantic line breaks;
159
+ - touched docs preserve or improve semantic line breaks;
160
+ - specs, docs, prompts, skills, reports, and harness instructions are consistent;
161
+ - US spellings are avoided unless required by identifiers, APIs, quoted material, tooling, or customer terminology;
162
+ - widespread inconsistency is captured as a follow-up rather than silently expanded.
163
+
164
+ ## Scoring
165
+
166
+ Use a 0-5 score for each rule area:
167
+
168
+ | Score | Meaning |
169
+ | --- | --- |
170
+ | 0 | Missing |
171
+ | 1 | Poor |
172
+ | 2 | Partial |
173
+ | 3 | Adequate |
174
+ | 4 | Strong |
175
+ | 5 | Excellent |
176
+
177
+ Avoid false precision. Scores are meant to prioritise improvement, not gamify compliance.
178
+
179
+ ## Required Report
180
+
181
+ A readiness report should include:
182
+
183
+ ```txt
184
+ Project Readiness Report
185
+ - Overall readiness:
186
+ - Rule scores:
187
+ - Blockers:
188
+ - Quick wins:
189
+ - Recommended plan:
190
+ ```
191
+
192
+ For each rule area, include:
193
+
194
+ ```txt
195
+ - Score:
196
+ - Evidence:
197
+ - Findings:
198
+ - Recommendations:
199
+ ```
200
+
201
+ ## Assessment Modes
202
+
203
+ ### Audit Mode
204
+
205
+ Read-only. Produce findings and recommendations. Do not modify project files.
206
+
207
+ ### Bootstrap Mode
208
+
209
+ After audit and user approval, implement selected improvements such as:
210
+
211
+ - adding or updating `AGENTS.md`;
212
+ - adding missing validation scripts;
213
+ - adding spec skeletons;
214
+ - adding Arey Pi prompts or skills;
215
+ - documenting quality tooling;
216
+ - creating ADR/glossary structure.
217
+
218
+ Bootstrap Mode must still follow Arey Pi policies, including TDD where applicable, quality tooling, DoD, and incremental Conventional Commits.
219
+
220
+ ## Acceptance Rule
221
+
222
+ A project is not fully ready for Arey Pi until its relevant Arey Pi rules score adequate or better for its risk and complexity.
223
+
224
+ AI Harness readiness is one of those rules, not a separate external assessment.
@@ -0,0 +1,63 @@
1
+ # Change Modes
2
+
3
+ ## Purpose
4
+
5
+ Arey Pi supports both full Spec-Driven Development and direct changes. The goal is to avoid unnecessary ceremony while preserving TDD, spec sync, and rebuildability.
6
+
7
+ ## Spec-Driven Mode
8
+
9
+ Use Spec-Driven Mode for:
10
+
11
+ - new features;
12
+ - non-trivial behaviour changes;
13
+ - ambiguous requirements;
14
+ - business rule changes;
15
+ - public API or CLI changes;
16
+ - architectural changes;
17
+ - module rewrites;
18
+ - security, permission, persistence, or integration behaviour;
19
+ - work where future rebuildability depends on capturing intent first.
20
+
21
+ Default flow:
22
+
23
+ ```txt
24
+ Intent → Gherkin/Canonical Spec → Test → Code → Refactor → Spec Sync → Review
25
+ ```
26
+
27
+ ## Direct Change Mode
28
+
29
+ Use Direct Change Mode for:
30
+
31
+ - small obvious fixes;
32
+ - local implementation cleanup;
33
+ - mechanical refactors;
34
+ - formatting or naming changes;
35
+ - changes fully covered by existing specs/tests;
36
+ - low-risk internal changes with no observable behaviour change.
37
+
38
+ Default flow:
39
+
40
+ ```txt
41
+ Intent → Test/Coverage Check → Code → Validation → Spec Sync Check → Done
42
+ ```
43
+
44
+ ## Non-Negotiables
45
+
46
+ Direct Change Mode does not allow agents to skip:
47
+
48
+ - TDD for production behaviour;
49
+ - regression tests for bug fixes;
50
+ - final spec sync;
51
+ - conflict resolution;
52
+ - reporting residual risks.
53
+
54
+ ## Escalation
55
+
56
+ Switch from Direct Change Mode to Spec-Driven Mode when:
57
+
58
+ - intent becomes ambiguous;
59
+ - behaviour changes more than expected;
60
+ - specs are missing or stale;
61
+ - tests are inadequate for the risk;
62
+ - architectural or domain decisions appear;
63
+ - the change grows beyond the original small scope.
@@ -0,0 +1,56 @@
1
+ # Conflict Resolution
2
+
3
+ ## Purpose
4
+
5
+ This policy defines what to do when user requests, specs, tests, and code disagree.
6
+
7
+ ## Authority Order
8
+
9
+ Default authority order:
10
+
11
+ 1. Explicit current user instruction.
12
+ 2. Canonical specs.
13
+ 3. Tests.
14
+ 4. Existing code.
15
+ 5. Agent inference.
16
+
17
+ This order does not mean every user instruction should silently overwrite specs. If a user instruction changes intended behaviour, specs must be updated explicitly.
18
+
19
+ ## Spec vs Code
20
+
21
+ If canonical specs and code disagree, specs define intended behaviour by default.
22
+
23
+ Agents should either align code with specs or ask whether the spec should change.
24
+
25
+ ## Spec vs Tests
26
+
27
+ If tests and specs disagree, resolve the mismatch before relying on either one.
28
+
29
+ Possible outcomes:
30
+
31
+ - update tests to match specs;
32
+ - update specs with explicit approval;
33
+ - ask for clarification.
34
+
35
+ ## User Request vs Specs
36
+
37
+ If the user requests behaviour that conflicts with canonical specs, the agent must treat it as a possible spec change.
38
+
39
+ The task should include spec updates unless the user explicitly says not to persist the new behaviour, in which case the agent should clarify the intended lifecycle of the change.
40
+
41
+ ## Code vs Tests
42
+
43
+ If tests fail against current code, agents must determine whether:
44
+
45
+ - the code is wrong;
46
+ - the test is stale or incorrect;
47
+ - the spec is missing or ambiguous;
48
+ - the environment is broken.
49
+
50
+ Do not delete or weaken tests without understanding the mismatch.
51
+
52
+ ## Ambiguity
53
+
54
+ Ask for clarification when resolving the conflict would require a product, domain, or architectural decision that is not already clear.
55
+
56
+ Do not hide uncertainty by choosing the easiest implementation path.