Skip to content

Commit 2fe4631

Browse files
Replaced AGENTS.md
Signed-off-by: Tom Wright <tom@inflatablecookie.com>
1 parent 4c01d6b commit 2fe4631

File tree

1 file changed

+72
-184
lines changed

1 file changed

+72
-184
lines changed

AGENTS.md

Lines changed: 72 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,126 @@
1-
# AGENTS Guide
1+
# AGENTS Guide (DecodeLabs Package)
22

3-
This document is for **tools and AI agents** (e.g. Cursor, Codex CLI, ChatGPT) and human contributors working in this repository.
3+
This file is a **bootstrap guide** for AI agents (Cursor, Codex CLI, ChatGPT) and human contributors working in this repository.
44

5-
This package is part of the **Decode Labs** ecosystem.
6-
Global architecture, coding standards, and documentation templates are defined in the **Chorus** repository.
7-
8-
Your primary goals when editing this repository are:
9-
10-
- Maintain **exceptional quality**.
11-
- Preserve **clarity, small responsibilities, and good documentation**.
12-
- Avoid **wide-ranging, cross-repository changes**.
5+
Most global rules and architectural expectations are defined centrally in the **Chorus** repository.
6+
This file only provides the minimal information needed to locate that guidance and apply it correctly within *this* package.
137

148
---
159

16-
## 1. Where to Find Chorus
10+
## 1. Locate Chorus (Required)
11+
12+
Before doing anything, an agent must locate the **Chorus** repository, which contains:
1713

18-
Chorus is the **meta / architecture** repository for Decode Labs.
14+
- global architecture & coding standards
15+
- the AI behaviour guide
16+
- development workflows
17+
- all templates (README, package spec, feature spec, change spec, AGENTS, etc.)
18+
- ecosystem metadata (`packages.json`)
19+
- the versioned migration pipeline
1920

20-
When working in this repository, look for Chorus in this order:
21+
Search for Chorus in this order:
2122

22-
1. **Sibling directory** (preferred, usually in local development):
23+
1. **Sibling directory** (most common in development):
2324

24-
```text
25+
```
2526
../chorus
2627
```
2728

28-
2. **Composer dev dependency** (if installed):
29+
2. **Composer dev dependency**:
2930

30-
```text
31+
```
3132
vendor/decodelabs/chorus
3233
```
3334

34-
3. **Remote repository** (read-only fallback):
35+
3. **Fallback (read-only):**
3536

36-
```text
3737
https://github.com/decodelabs/chorus
38-
```
39-
40-
Chorus is updated frequently. Always prefer a **local clone** (sibling directory or vendor copy) over remote browsing where possible.
41-
42-
---
43-
44-
## 2. What to Read Before Changing Code
45-
46-
Before making any changes in this repository, an agent should read:
4738

48-
### 2.1 In This Repository
49-
50-
- `AGENTS.md` (this file).
51-
- `README.md`.
52-
- `docs/meta/spec.md` (package specification, if present).
53-
- Any local `CONTRIBUTING.md` or relevant files under `docs/`.
54-
55-
These files explain **what this package is for**, its **public surface**, and any **package-specific constraints**.
56-
57-
### 2.2 In Chorus
58-
59-
In the Chorus repository (local or remote), read:
60-
61-
- `docs/architecture/principles.md`
62-
Overall architectural philosophy and design rules.
63-
64-
- `docs/architecture/package-taxonomy.md`
65-
How packages are grouped and where this repository fits conceptually.
39+
Once located, read:
6640

41+
- `docs/architecture/agents-guide.md`
42+
- `docs/architecture/ai-integration-workflow.md`
6743
- `docs/architecture/coding-standards.md`
68-
Global coding standards for PHP (including method signatures, nullable return conventions, properties vs getters, etc.).
69-
70-
- Templates under `docs/templates/` (if present), for example:
71-
- `docs/templates/README.md`
72-
- `docs/templates/package-spec.md`
73-
- `docs/templates/AGENTS.md`
44+
- any templates under `docs/templates/`
7445

75-
> **Note:** Some templates may not exist yet.
76-
> When they do exist, they should be treated as the **canonical shape** for new or updated documentation.
77-
> When they do not, infer style and structure from existing Decode Labs repositories and documentation.
46+
These global rules override and supplement everything in this file.
7847

7948
---
8049

81-
## 3. Quality Expectations
82-
83-
Decode Labs libraries are **public-facing** and held to a **very high quality bar**.
50+
## 2. Read Local Documentation
8451

85-
When generating or editing code:
52+
In this repository, always read:
8653

87-
- Keep responsibilities **small and focused**.
88-
- Aim for **clear, self-documenting APIs** with consistent naming.
89-
- Avoid **code smells** (large classes, deeply nested conditionals, magic numbers, hidden side effects, etc.).
90-
- Avoid **security issues** (unvalidated input, unsafe evals, naive crypto, etc.).
91-
- Preserve or improve:
92-
- **Test coverage**, and
93-
- **Documentation quality**.
54+
- `README.md`
55+
- `docs/meta/spec.md` (package specification)
56+
- any feature specs under `docs/meta/features/`
57+
- any relevant files under `docs/`
9458

95-
Where possible:
96-
97-
- Respect the project's existing tooling:
98-
- `php-cs-fixer` configuration (baseline: `@PSR12,-method_argument_space,array_syntax`).
99-
- Static analysis tools (PHPStan/Psalm) if configured.
100-
- Test runner (phpunit/pest/etc.).
101-
- Do not introduce patterns that conflict with the principles and standards in Chorus.
59+
These describe this package's purpose, constraints, and public API.
10260

10361
---
10462

105-
## 4. Coding Standards (Summary)
106-
107-
This repository follows the **Decode Labs coding standards** as defined in Chorus.
63+
## 3. Single-Repository Rule (Critical)
10864

109-
Highlights (non-exhaustive; see Chorus for full details):
65+
When acting inside this repository:
11066

111-
- **Method signatures:**
112-
- Parameters on separate lines when parameters exist:
67+
- You may **only** modify this repository.
68+
- You may **not** modify Chorus or any sibling package.
69+
- You may **not** perform multi-repo refactors.
70+
- You may **not** propagate behavioural changes to frameworks or client projects from here.
11371

114-
```php
115-
public function doThing(
116-
string $name,
117-
int $count,
118-
): void {
119-
// ...
120-
}
121-
```
72+
If a required change spans multiple repos:
12273

123-
- No parameters → no extra lines, brace on its own line:
124-
125-
```php
126-
public function reset(): void
127-
{
128-
// ...
129-
}
130-
```
131-
132-
- **Nullable returns and `try*` methods:**
133-
- A method that returns `?Type` because the value "may not exist" should generally be named `trySomething()`.
134-
- A corresponding non-nullable `something()` method should exist that:
135-
- calls `trySomething()`, and
136-
- throws a domain-appropriate exception when no value is available.
137-
- Apply common sense; not every nullable return needs a `try*` pair, but this is the default pattern.
138-
139-
- **Properties over getters/setters:**
140-
- For simple data, prefer properties (especially readonly) over Java-style `getX()` / `setX()` instance methods.
141-
- Static methods remain acceptable where they act as factories or lookups, but should still be named as verbs.
142-
143-
- **Method names as verbs:**
144-
- Methods should be named as verbs or verb phrases (`handleRequest()`, `buildResponse()`, `loadConfig()`), not bare nouns.
145-
146-
For full details and examples, see:
147-
148-
- `docs/architecture/coding-standards.md` in Chorus.
74+
- Document it in Chorus (via a Change Spec), and
75+
- Stop making changes in this repository until instructed.
14976

15077
---
15178

152-
## 5. Scope of Changes
79+
## 4. Behaviour When Unsure
15380

154-
Agents must keep changes **scoped to a single repository at a time**.
81+
If anything is unclear:
15582

156-
- Do **not** perform multi-repository refactors or sweeping changes.
157-
- Do **not** open or edit sibling repositories automatically.
158-
- If a change logically spans multiple packages:
159-
- Document the need (e.g. in comments, commit messages, or a short note in the spec).
160-
- Leave cross-repo coordination to human architects (who will drive those changes with separate, repo-specific prompts).
83+
- Stop and ask, **or**
84+
- Add a safe TODO comment:
85+
```php
86+
// TODO: clarify expected behaviour here
87+
```
88+
```markdown
89+
<!-- TODO: determine correct nullability or error-handling semantics -->
90+
```
16191

162-
Within this repository:
92+
Agents must **never** invent new behaviour, APIs, configuration, or semantics not present in:
16393

164-
- Prefer small, focused pull requests / change sets.
165-
- Avoid unnecessary renaming or reformatting that obscures the behavioural change.
94+
- this repository's code/spec, or
95+
- Chorus documentation.
16696

16797
---
16898

169-
## 6. Behaviour When Unsure
170-
171-
If you are uncertain about:
172-
173-
- the intended behaviour of a function or class,
174-
- whether a change may break backwards compatibility,
175-
- or how a global rule from Chorus should apply here,
176-
177-
then:
178-
179-
1. Prefer **not** to make the change, or
180-
2. Make a minimal change and add a clear note, for example:
99+
## 5. Summary Checklist for Agents
181100

182-
```php
183-
// TODO: clarify whether this should throw or return null in this case.
184-
```
185-
186-
or in documentation:
187-
188-
```markdown
189-
<!-- TODO: clarify the intended error-handling behaviour for this operation. -->
190-
```
191-
192-
Do **not** invent behaviour, API endpoints, or configuration options that are not present in the code or documented in Chorus.
193-
194-
---
101+
Before making any change:
195102

196-
## 7. Documentation and Templates
103+
- [ ] Found Chorus (sibling/vendor/remote)
104+
- [ ] Read global agent rules in `agents-guide.md`
105+
- [ ] Read local `README.md` and package spec
106+
- [ ] Confirm this is a **single-repo** change
107+
- [ ] Identify relevant templates from Chorus
108+
- [ ] Ensure SemVer, behaviour, and scope are understood
197109

198-
When creating or updating documentation in this repository:
110+
While acting:
199111

200-
- Prefer using templates from Chorus when available (e.g. README, package spec, AGENTS).
201-
- Match:
202-
- tone,
203-
- structure,
204-
- level of detail
205-
seen in other Decode Labs packages.
112+
- [ ] Follow coding standards and architectural rules
113+
- [ ] Keep changes small, focused, and high quality
114+
- [ ] Add TODOs rather than guessing
115+
- [ ] Do not propagate changes outside this repo
206116

207-
If a suitable template does not yet exist:
117+
After acting:
208118

209-
- Follow the structure already present in this repository or other Decode Labs repos.
210-
- Keep documentation:
211-
- **Concise but clear**,
212-
- **Task-oriented** (how to use, what it does, what it does *not* do),
213-
- **Aligned** with the architecture principles in Chorus.
119+
- [ ] Update docs/spec/tests where appropriate
120+
- [ ] Ensure consistency with Chorus documentation
121+
- [ ] Maintain exceptional clarity and code quality
214122

215123
---
216124

217-
## 8. Summary for Agents
218-
219-
Before you change anything in this repository:
220-
221-
1. Locate and read Chorus (sibling `chorus/`, `vendor/decodelabs/chorus`, or remote).
222-
2. Read:
223-
- Chorus architecture principles,
224-
- Coding standards,
225-
- Package taxonomy.
226-
3. Read this repository's:
227-
- `AGENTS.md`,
228-
- `README.md`,
229-
- `docs/meta/spec.md`.
230-
4. Make **small, scoped, high-quality changes** that:
231-
- respect existing architecture,
232-
- follow the global coding standards,
233-
- and keep tests and docs in good shape.
234-
5. Do not perform multi-repo refactors.
235-
If a wider change is needed, leave a note for human architects.
236-
237-
If in doubt, stop and ask for clarification rather than guessing.
238-
125+
This file intentionally contains **no package-specific content**.
126+
All cross-repo rules and architectural details live centrally in the Chorus repository.

0 commit comments

Comments
 (0)