Skip to content

Commit b1433e8

Browse files
committed
first iteration
1 parent 854b669 commit b1433e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6805
-124
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: mcaf-adr-writing
3+
description: "Create or update an ADR (Architecture Decision Record) under `docs/ADR/` using `docs/templates/ADR-Template.md`: context, decision, alternatives, consequences, rollout, and verification. Use when changing architecture, boundaries, dependencies, data model, or cross-cutting patterns; ensure it is self-contained, has a Mermaid diagram, and defines testable invariants."
4+
compatibility: "Requires repository write access; produces Markdown docs with Mermaid diagrams."
5+
---
6+
7+
# MCAF: ADR Writing
8+
9+
## Outputs
10+
11+
- `docs/ADR/ADR-XXXX-<short-title>.md` (create or update)
12+
- Update `docs/Architecture/Overview.md` when boundaries/interactions change
13+
14+
## Decision Quality (anti-guesswork checklist)
15+
16+
Before writing, make the ADR executable (no placeholders, no hand-waving):
17+
18+
- **Decision**: one sentence. If you can’t write it, you don’t have a decision yet.
19+
- **Scope**: what changes / what does not + which module(s) are affected (match `docs/Architecture/Overview.md` names).
20+
- **No invented reality**: every component you mention exists in the repo today, or is explicitly part of this change (named + where it will live).
21+
- **Invariants**: write as **MUST / MUST NOT** statements and say how we prove each (test or static analysis).
22+
- **Verification**: use exact commands from `AGENTS.md` and link scenarios → test IDs.
23+
- **Stakeholders**: Product / Dev / DevOps / QA — what each role must know to execute safely.
24+
25+
## Workflow
26+
27+
1. Confirm the decision scope:
28+
- what changes (and what does not)
29+
- what module(s) are affected
30+
- follow `AGENTS.md` scoping rules: Architecture map → linked ADR/Feature → entry points (do not scan everything)
31+
2. Start from `docs/templates/ADR-Template.md`.
32+
- keep the ADR’s `## Implementation plan (step-by-step)` updated while executing
33+
3. Write the ADR as a decision record:
34+
- **Context**: constraints + why this is needed now
35+
- **Decision**: a short, direct statement
36+
- **Diagram** (mandatory): include at least one Mermaid diagram for the decision (boundaries/modules/interactions)
37+
- **Alternatives**: 1–3 realistic options with pros/cons
38+
- **Consequences**: trade-offs, risks, mitigations
39+
4. Make it executable for the team:
40+
- follow `AGENTS.md` Task Delivery rules (analysis → plan → execute → verify)
41+
- include the invariants that must be proven by tests
42+
- include verification commands copied from `AGENTS.md`
43+
- include rollout/rollback and “how we know it’s safe”
44+
5. Make impacts explicit:
45+
- code/modules affected
46+
- data/config changes (including migration/rollback)
47+
- backwards compatibility strategy
48+
6. Add verification that proves the decision:
49+
- which tests must exist/change
50+
- which suites must stay green
51+
7. If the decision changes boundaries, update `docs/Architecture/Overview.md` (diagram, modules table, dependency rules).
52+
53+
## Guardrails
54+
55+
- ADRs are self-contained: no hidden context, no “as discussed”.
56+
- ADRs justify *why*; feature docs describe *what the system does*.
57+
- If you can’t state the decision in 1–2 sentences, the ADR is not ready.
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# ADR Formats (templates)
2+
3+
This file is for **copy/paste**. Pick one of the templates below and fill it with real repo facts.
4+
5+
Rules (MCAF):
6+
7+
- ADRs are self-contained (no “as discussed”).
8+
- At least one Mermaid diagram is mandatory.
9+
- ADRs define testable invariants + verification commands (not vibes).
10+
11+
---
12+
13+
## Template 1: MCAF ADR (full)
14+
15+
Use this as the default template. Save as `docs/ADR/ADR-XXXX-title-in-kebab-case.md`.
16+
17+
````md
18+
# ADR-XXXX: Title
19+
20+
Status: Proposed | Accepted | Implemented | Rejected | Superseded
21+
Date: YYYY-MM-DD
22+
Related Features: `docs/Features/...` (recommended)
23+
Supersedes: `docs/ADR/ADR-....md` (delete if none)
24+
Superseded by: `docs/ADR/ADR-....md` (delete if none)
25+
26+
Rules:
27+
28+
- This ADR is **self-contained** — avoid “as discussed”; include all critical context and links.
29+
- At least **one Mermaid diagram is mandatory** (boundaries/modules/interactions for this decision).
30+
31+
---
32+
33+
## Context
34+
35+
- Current situation (what exists today).
36+
- Constraints (tech/legal/time/org constraints that matter).
37+
- Problem statement (what is failing / what you must enable).
38+
- Goals (what success looks like).
39+
- Non-goals (what this ADR is not trying to solve).
40+
41+
---
42+
43+
## Stakeholders (who needs this to be clear)
44+
45+
| Role | What they need to know | Questions this ADR must answer |
46+
| --- | --- | --- |
47+
| Product / Owner | User/business impact, scope, rollout risk | What changes for users? What’s out of scope? |
48+
| Engineering | Boundaries/modules, data/contract changes, edge cases | What do we change, where, and why? |
49+
| DevOps / SRE | Deployability, config, monitoring, rollback | How do we ship safely and observe it? |
50+
| QA | Test scenarios + environment assumptions | What must be proven by automated tests? |
51+
52+
---
53+
54+
## Decision
55+
56+
- One sentence decision statement.
57+
58+
Key points:
59+
60+
- Key point 1
61+
- Key point 2
62+
63+
---
64+
65+
## Diagram (Mandatory)
66+
67+
```mermaid
68+
%% Show the boundaries/modules that change, and how they interact.
69+
%% Prefer 1 clear diagram over many noisy ones.
70+
```
71+
72+
---
73+
74+
## Alternatives considered
75+
76+
### Option A
77+
78+
- Pros:
79+
- Cons:
80+
- Rejected because:
81+
82+
### Option B
83+
84+
- Pros:
85+
- Cons:
86+
- Rejected because:
87+
88+
---
89+
90+
## Consequences
91+
92+
### Positive
93+
94+
- Benefit
95+
96+
### Negative / risks
97+
98+
- Risk
99+
- Mitigation:
100+
101+
---
102+
103+
## Impact
104+
105+
### Code
106+
107+
- Affected modules / services:
108+
- New boundaries / responsibilities:
109+
- Feature flags / toggles (names, defaults, removal plan):
110+
111+
### Data / configuration
112+
113+
- Data model / schema changes:
114+
- Config changes (keys, defaults, secrets handling):
115+
- Backwards compatibility strategy:
116+
117+
### Documentation
118+
119+
- Feature docs to update:
120+
- Testing docs to update:
121+
- Architecture docs to update:
122+
- `docs/Architecture/Overview.md` updates (what must change):
123+
- Notes for `AGENTS.md` (new rules/patterns):
124+
125+
---
126+
127+
## Verification (Mandatory: describe how to test this decision)
128+
129+
### Objectives
130+
131+
- What behaviour / qualities must be proven.
132+
- Which invariants from this ADR must be encoded as tests (happy path + negative/forbidden + edge cases).
133+
- Link each objective/scenario to the specific automated test(s) that prove it.
134+
135+
### Test environment
136+
137+
- Environment (local compose / staging / prod-like):
138+
- Data and reset strategy (seed data, migrations, rollback plan):
139+
- External dependencies (real / sandbox / fake services required):
140+
141+
### Test commands
142+
143+
- build: (paste from `AGENTS.md`)
144+
- test: (paste from `AGENTS.md`)
145+
- format: (paste from `AGENTS.md`)
146+
- coverage: (paste from `AGENTS.md` if separate; otherwise delete)
147+
148+
### New or changed tests
149+
150+
| ID | Scenario | Level (Unit / Int / API / UI) | Expected result | Notes / Data |
151+
| --- | --- | --- | --- | --- |
152+
| TST-001 | Happy path / negative / edge | Integration | Observable outcome | Fixtures / seed data |
153+
154+
### Regression and analysis
155+
156+
- Regression suites to run (must stay green):
157+
- Static analysis (tools/configs that must pass):
158+
- Monitoring during rollout (logs/metrics/alerts to watch):
159+
160+
---
161+
162+
## Rollout and migration
163+
164+
- Migration steps:
165+
- Backwards compatibility:
166+
- Rollback:
167+
168+
---
169+
170+
## References
171+
172+
- Issues / tickets:
173+
- External docs / specs:
174+
- Related ADRs:
175+
176+
---
177+
178+
## Filing checklist
179+
180+
- [ ] File saved under `docs/ADR/ADR-XXXX-title-in-kebab-case.md` (not in `docs/templates/`).
181+
- [ ] Status reflects real state (`Proposed`, `Accepted`, `Rejected`, `Superseded`).
182+
- [ ] Links to related features, tests, and ADRs are filled in.
183+
- [ ] Diagram section contains at least one Mermaid diagram.
184+
- [ ] `docs/Architecture/Overview.md` updated if module boundaries or interactions changed.
185+
````
186+
187+
---
188+
189+
## Template 2: Mini ADR (small, safe decision)
190+
191+
Use this when the decision is real but the scope is contained (still needs a diagram + verification).
192+
193+
````md
194+
# ADR-XXXX: Title
195+
196+
Status: Proposed | Accepted | Implemented | Rejected | Superseded
197+
Date: YYYY-MM-DD
198+
Related Features: `docs/Features/...` (delete if none)
199+
200+
## Decision
201+
202+
- One sentence.
203+
204+
## Why (context + constraints)
205+
206+
- Why now:
207+
- Constraints:
208+
209+
## Diagram (Mandatory)
210+
211+
```mermaid
212+
%% Boundaries/modules that change + their interaction.
213+
```
214+
215+
## Alternatives (at least one)
216+
217+
- Alternative A (why not):
218+
219+
## Consequences
220+
221+
- Positive:
222+
- Negative / risks + mitigations:
223+
224+
## Verification (Mandatory)
225+
226+
- Invariants to test:
227+
- Tests to add/update:
228+
- Commands to run (from `AGENTS.md`):
229+
````
230+
231+
---
232+
233+
## Template 3: Options Matrix ADR (when choosing between 2–4 options)
234+
235+
Use this when you need to evaluate trade-offs explicitly and keep the decision auditable.
236+
237+
````md
238+
# ADR-XXXX: Title
239+
240+
Status: Proposed | Accepted | Implemented | Rejected | Superseded
241+
Date: YYYY-MM-DD
242+
243+
## Decision
244+
245+
- One sentence.
246+
247+
## Decision drivers (what matters)
248+
249+
- Driver 1:
250+
- Driver 2:
251+
252+
## Options
253+
254+
| Option | Summary | Pros | Cons | Risk | Why/why not |
255+
| --- | --- | --- | --- | --- | --- |
256+
| A | | | | | |
257+
| B | | | | | |
258+
259+
## Diagram (Mandatory)
260+
261+
```mermaid
262+
%% Diagram the chosen option (and the most important alternative if helpful).
263+
```
264+
265+
## Verification (Mandatory)
266+
267+
- Invariants to protect:
268+
- Test plan:
269+
````
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: mcaf-architecture-overview
3+
description: "Create or update `docs/Architecture/Overview.md` (architecture diagrams): maintain Mermaid diagrams for system/modules, interfaces/contracts, and key classes/types; document dependency rules; link to ADRs/features. Use when onboarding, refactoring, or adding modules/boundaries."
4+
compatibility: "Requires repository write access; produces Markdown docs with Mermaid diagrams."
5+
---
6+
7+
# MCAF: Architecture Overview
8+
9+
## Output
10+
11+
- `docs/Architecture/Overview.md` (create or update)
12+
13+
## Architecture Thinking (keep it a map)
14+
15+
This doc is the **global map**: boundaries, modules, and dependency rules.
16+
17+
- Keep it lean and structural:
18+
- modules/boundaries + responsibility + dependency direction
19+
- Mermaid diagrams are the primary context:
20+
- system/module map (blocks + dependency direction)
21+
- interfaces/contracts map (how modules talk)
22+
- key classes/types map (high-signal only; not exhaustive)
23+
- Treat it as the main “start here” card for humans and AI agents:
24+
- diagram elements must use real names (no placeholders)
25+
- every diagram element must have an explicit reference link (docs/code) so an agent can navigate without repo-wide scanning
26+
- keep diagrams readable; if a diagram becomes “spaghetti”, split by boundary and link out
27+
- Keep behaviour out of the overview:
28+
- feature flows live in `docs/Features/*`
29+
- decision-specific diagrams/invariants live in `docs/ADR/*`
30+
- Anti-“AI slop” rule: never invent components/services/DBs — only document what exists (or what this change will explicitly add).
31+
32+
## Workflow
33+
34+
1. Open `docs/Architecture/Overview.md` if it exists; otherwise start from `docs/templates/Architecture-Template.md`.
35+
- Ensure it contains a short `## Scoping (read first)` section (this is how we prevent “scan everything” behaviour).
36+
2. Identify the **real** top-level boundaries:
37+
- entry points (HTTP/API, CLI, UI, jobs, events)
38+
- modules/layers (group by folders/namespaces, not individual files)
39+
- external dependencies (only those that actually exist)
40+
3. Fill the **Summary** so a new engineer can orient in ~1 minute.
41+
4. Maintain the Mermaid diagrams (the map people and agents start from):
42+
- **system/module map**: keep it small (roughly 8–15 nodes), label arrows (calls/events/reads/writes)
43+
- **interfaces/contracts map**: show ports/interfaces, APIs, events, queues, file formats (only what exists)
44+
- **key classes/types map**: capture the main types that matter across modules (avoid inventories)
45+
- don’t invent DB/queues/services/modules that aren’t present
46+
5. Fill the module index:
47+
- one row per diagram node (not every internal module/class)
48+
- responsibilities and “depends on” must be concrete
49+
- prefer a short navigation list with links over big tables/inventories
50+
6. Write explicit dependency rules:
51+
- what is allowed
52+
- what is forbidden
53+
- how integration happens (sync / async / shared lib)
54+
7. Add a short “Key decisions (ADRs)” section:
55+
- link to the ADRs that define boundaries, dependencies, and major cross-cutting patterns
56+
- keep it link-based (no detailed flows here)
57+
8. Link out to deeper docs:
58+
- ADRs for key decisions
59+
- Features for behaviour details
60+
- Testing/Development for how to run and verify
61+
62+
## Guardrails
63+
64+
- Do not list every file/class. This is a **map**, not an inventory (key classes/types only).
65+
- Keep the document stable: update it when boundaries or interactions change.

0 commit comments

Comments
 (0)