@haaaiawd/anws 2.3.0 → 2.4.1

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.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +53 -23
  3. package/lib/diff.js +5 -2
  4. package/lib/init.js +217 -96
  5. package/lib/install-state.js +18 -3
  6. package/lib/manifest.js +364 -79
  7. package/lib/prompt.js +68 -0
  8. package/lib/resources/index.js +36 -2
  9. package/lib/update.js +12 -6
  10. package/package.json +48 -47
  11. package/templates/.agents/skills/anws-system/SKILL.md +107 -105
  12. package/templates/.agents/skills/code-reviewer/SKILL.md +171 -115
  13. package/templates/.agents/skills/concept-modeler/SKILL.md +230 -179
  14. package/templates/.agents/skills/craft-authoring/SKILL.md +186 -183
  15. package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +42 -0
  16. package/templates/.agents/skills/design-reviewer/SKILL.md +265 -190
  17. package/templates/.agents/skills/e2e-testing-guide/SKILL.md +246 -135
  18. package/templates/.agents/skills/nexus-mapper/SKILL.md +321 -321
  19. package/templates/.agents/skills/nexus-mapper/references/probe-protocol.md +1 -1
  20. package/templates/.agents/skills/nexus-query/SKILL.md +1 -1
  21. package/templates/.agents/skills/output-contract/SKILL.md +37 -0
  22. package/templates/.agents/skills/runtime-inspector/SKILL.md +150 -99
  23. package/templates/.agents/skills/sequential-thinking/SKILL.md +222 -225
  24. package/templates/.agents/skills/spec-writer/SKILL.md +75 -30
  25. package/templates/.agents/skills/system-architect/SKILL.md +538 -678
  26. package/templates/.agents/skills/system-designer/SKILL.md +124 -537
  27. package/templates/.agents/skills/task-planner/SKILL.md +1 -2
  28. package/templates/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +2 -2
  29. package/templates/.agents/skills/task-reviewer/SKILL.md +421 -386
  30. package/templates/.agents/skills/tech-evaluator/SKILL.md +252 -144
  31. package/templates/.agents/workflows/blueprint.md +156 -68
  32. package/templates/.agents/workflows/challenge.md +322 -494
  33. package/templates/.agents/workflows/change.md +182 -339
  34. package/templates/.agents/workflows/craft.md +159 -197
  35. package/templates/.agents/workflows/design-system.md +202 -674
  36. package/templates/.agents/workflows/explore.md +187 -399
  37. package/templates/.agents/workflows/forge.md +650 -609
  38. package/templates/.agents/workflows/genesis.md +438 -351
  39. package/templates/.agents/workflows/probe.md +215 -240
  40. package/templates/.agents/workflows/quickstart.md +304 -123
  41. package/templates/.agents/workflows/upgrade.md +145 -182
  42. package/templates_en/.agents/skills/anws-system/SKILL.md +110 -0
  43. package/templates_en/.agents/skills/code-reviewer/SKILL.md +171 -0
  44. package/templates_en/.agents/skills/concept-modeler/SKILL.md +230 -0
  45. package/templates_en/.agents/skills/craft-authoring/SKILL.md +179 -0
  46. package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +42 -0
  47. package/templates_en/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +92 -0
  48. package/templates_en/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +52 -0
  49. package/templates_en/.agents/skills/design-reviewer/SKILL.md +264 -0
  50. package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +246 -0
  51. package/templates_en/.agents/skills/nexus-mapper/SKILL.md +306 -0
  52. package/templates_en/.agents/skills/nexus-mapper/references/language-customization.md +167 -0
  53. package/templates_en/.agents/skills/nexus-mapper/references/output-schema.md +311 -0
  54. package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +246 -0
  55. package/templates_en/.agents/skills/nexus-mapper/scripts/extract_ast.py +706 -0
  56. package/templates_en/.agents/skills/nexus-mapper/scripts/git_detective.py +194 -0
  57. package/templates_en/.agents/skills/nexus-mapper/scripts/languages.json +127 -0
  58. package/templates_en/.agents/skills/nexus-mapper/scripts/query_graph.py +556 -0
  59. package/templates_en/.agents/skills/nexus-mapper/scripts/requirements.txt +6 -0
  60. package/templates_en/.agents/skills/nexus-query/SKILL.md +114 -0
  61. package/templates_en/.agents/skills/nexus-query/scripts/extract_ast.py +706 -0
  62. package/templates_en/.agents/skills/nexus-query/scripts/git_detective.py +194 -0
  63. package/templates_en/.agents/skills/nexus-query/scripts/languages.json +127 -0
  64. package/templates_en/.agents/skills/nexus-query/scripts/query_graph.py +556 -0
  65. package/templates_en/.agents/skills/nexus-query/scripts/requirements.txt +6 -0
  66. package/templates_en/.agents/skills/output-contract/SKILL.md +37 -0
  67. package/templates_en/.agents/skills/runtime-inspector/SKILL.md +150 -0
  68. package/templates_en/.agents/skills/sequential-thinking/SKILL.md +214 -0
  69. package/templates_en/.agents/skills/spec-writer/SKILL.md +153 -0
  70. package/templates_en/.agents/skills/spec-writer/references/prd_template.md +177 -0
  71. package/templates_en/.agents/skills/system-architect/SKILL.md +538 -0
  72. package/templates_en/.agents/skills/system-architect/references/rfc_template.md +59 -0
  73. package/templates_en/.agents/skills/system-designer/SKILL.md +188 -0
  74. package/templates_en/.agents/skills/system-designer/references/system-design-detail-template.md +187 -0
  75. package/templates_en/.agents/skills/system-designer/references/system-design-template.md +605 -0
  76. package/templates_en/.agents/skills/task-planner/SKILL.md +251 -0
  77. package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +109 -0
  78. package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05B.md +176 -0
  79. package/templates_en/.agents/skills/task-reviewer/SKILL.md +422 -0
  80. package/templates_en/.agents/skills/tech-evaluator/SKILL.md +252 -0
  81. package/templates_en/.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md +78 -0
  82. package/templates_en/.agents/workflows/blueprint.md +200 -0
  83. package/templates_en/.agents/workflows/challenge.md +326 -0
  84. package/templates_en/.agents/workflows/change.md +182 -0
  85. package/templates_en/.agents/workflows/craft.md +159 -0
  86. package/templates_en/.agents/workflows/design-system.md +202 -0
  87. package/templates_en/.agents/workflows/explore.md +187 -0
  88. package/templates_en/.agents/workflows/forge.md +651 -0
  89. package/templates_en/.agents/workflows/genesis.md +438 -0
  90. package/templates_en/.agents/workflows/probe.md +215 -0
  91. package/templates_en/.agents/workflows/quickstart.md +305 -0
  92. package/templates_en/.agents/workflows/upgrade.md +145 -0
  93. package/templates_en/AGENTS.md +149 -0
  94. package/templates/.agents/skills/report-template/SKILL.md +0 -92
  95. package/templates/.agents/skills/report-template/references/REPORT_TEMPLATE.md +0 -100
@@ -0,0 +1,538 @@
1
+ ---
2
+ name: system-architect
3
+ description: Dedicated to `/genesis` Step 4: identify independent systems, define boundaries and dependencies, produce `.anws/v{N}/02_ARCHITECTURE_OVERVIEW.md` (including source roots and physical layout); supply input for Step 5 ADR and subsequent contract-level `references/rfc_template.md`; this skill does **not** write `03_ADR/*.md`.
4
+ ---
5
+
6
+ # system-architect ( `/genesis` Step 4–5 handoff)
7
+
8
+ > Good architecture is mostly “splitting the problem into the right systems,” not building a perfect monolith.
9
+
10
+ <phase_context>
11
+ You are the **system architect for `/genesis` Step 4**.
12
+ **Mission**: Inside the versioned directory `TARGET_DIR = .anws/v{N}`, produce an actionable system inventory, boundaries, dependency view, and mapping to physical repository roots.
13
+ **Capability**: Six-dimension identification, C4 Level 1 and dependency visualization, split rationale and complexity narrative aligned with human checkpoint #2.
14
+ **Constraints**: Strictly follow genesis step order; **do not** write or alter `03_ADR/*.md`, `01_PRD.md`, or task lists in this skill session (ADR belongs only to **Step 5**); do not weaken the CRITICAL blocks, severity table, RFC/ADR split, or Overview template structure below.
15
+ **Relationship to subflows**: Authoritative text is **`.agents/skills/system-architect/SKILL.md`** in this workspace.
16
+ </phase_context>
17
+
18
+ ---
19
+
20
+ ## CRITICAL methodological anchors
21
+
22
+ > [!IMPORTANT]
23
+ > **The goal of decomposition is boundaries that decisions and implementation can align to**, not piling up system names.
24
+ >
25
+ > - **Elicit, do not decree**: Restore PRD scope and tech-evaluator Step 3 constraints before listing systems; skips here often conflict later with ADR.
26
+ > - **Expand, do not mono-track**: Each system row must stand on at least two independent legs among **deployment unit / tech stack / responsibility**; single-criterion splits must be logged explicitly as risk and verification debt.
27
+ > - **Lift, then ground**: Clarify cross-system seams (contracts, failure semantics, ownership) before assigning `system-id`, directory trees, and matrices; stopping at folder metaphors or slogans is not shippable.
28
+ > - **Rebuild, do not paraphrase**: Rebuild boundary matrices for “who promises what output under what inputs,” instead of rewriting PRD sentences.
29
+
30
+ ---
31
+
32
+ ## CRITICAL spec output contract (`02_ARCHITECTURE_OVERVIEW.md`)
33
+
34
+ > [!IMPORTANT]
35
+ >
36
+ > - **Precise**: Each system must include a stable **`system-id`**, `Responsibility`, `Boundary (I/O)`, `Dependencies`, `Linked REQ refs`, `Tech stack`, and `Design doc relative path placeholder` (aligned with the template); physical mapping must give **traceable** source-root paths (literal path strings).
37
+ > - **Traceable**: Every row in matrices and dependency diagrams must have a matching section in the inventory; forbidden to show charts alone with no prose definitions.
38
+ > - **Testable**: Decomposition rationale must answer “why not split further” and “why not merge” with at least one example each, tied to the complexity assessment.
39
+ > - **No hollow filler**: Forbidden to use objectless “TBD,” “optimize later,” or “it depends” placeholders; unknowns must be marked **`[OPEN: specific question + owner granularity]`**.
40
+ > - **Two diagrams required**: Must include Mermaid **system context (C4 L1)** and **system dependency graph**, consistent with matrices.
41
+
42
+ ---
43
+
44
+ ## CRITICAL: `/genesis` order and ADR/RFC responsibilities
45
+
46
+ > [!IMPORTANT]
47
+ > **`/genesis` enforced order is Step 0→6 (Step 6 includes subsections 6.1–6.4); no skipping.** This skill covers **Step 4** only.
48
+ >
49
+ > **Sole objective path for this skill (Step 4)**: Write **`{TARGET_DIR}/02_ARCHITECTURE_OVERVIEW.md`** (structure matches template sections below); implement Step 4–specific **source roots + ASCII physical tree** (see template and phase notes).
50
+ > **Forbidden**: Renaming Step 3 evaluation tables into ADR files; **do not** write `{TARGET_DIR}/03_ADR/*` from this skill. ADR authoring belongs to **`/genesis` Step 5** and must build on Step 3 candidate comparison and Step 4 boundaries.
51
+ > **RFC (technical design memo)**: For single-system depth, treat `references/rfc_template.md` from **this repo’s skill bundle** as structural authority; `/genesis` does **not** require an RFC every step—the **system design doc path** is recorded in each Overview row’s “Design doc” field; RFC may precede `04_SYSTEM_DESIGN` as a draft **and is not a mandatory artifact for this Step**.
52
+ > **ADR write checklist (for Step 5 execution only; this Step supplies input—do not mark as done)**:
53
+ >
54
+ > | Gate | Rule |
55
+ > |------|------|
56
+ > | ADR aligns with Step 3 | Step 5 must absorb Step 3 candidate comparison into alternatives and decisions |
57
+ > | Step 2.5 backfill | If `/explore` ran, Step 5 must fold research evidence into rationale |
58
+ > | ADR status | **Accepted** |
59
+ > | “Scope of impact” section | Must exist; list systems that will reference this ADR (maintain cross-SYSTEM_DESIGN after Step 6 if needed) |
60
+ > | ADR structure | Follow `tech-evaluator` **`references/ADR_TEMPLATE.md`** in full (summary below)
61
+
62
+ **ADR_TEMPLATE sections must not be dropped (extract = launch rules; prose in Step 5)**:
63
+
64
+ | Section | Must satisfy |
65
+ |---------|---------------|
66
+ | Status | Proposed \| Accepted \| Deprecated \| Superseded … |
67
+ | Date | `YYYY-MM-DD` |
68
+ | Context | Problem, constraints, stakeholder expectations |
69
+ | Decision drivers | Numbered list |
70
+ | Alternatives | Tradeoffs across options |
71
+ | Decision | Explicit chosen option |
72
+ | Consequences | Positive / negative / follow-ups |
73
+ | References | May be empty but do not delete the heading |
74
+ | Scope of impact | Placeholder paths for systems / docs that will cite this ADR |
75
+
76
+ ---
77
+
78
+ ## CRITICAL: `sequential-thinking`
79
+
80
+ > [!IMPORTANT]
81
+ > **Must** invoke `sequential-thinking` **before** listing system IDs: **3–7 thoughts** (use 3 for low complexity; 7 for high coupling or many surfaces), covering split/merge options, evolution, and physical boundaries; natural chain-of-thought **cannot** substitute for this CLI obligation (if CLI unavailable, declare **`SEQUENTIAL_THINKING_BLOCKED`** at the top of output and degrade to a traceable bullet list of hypotheses—do not invent thoughts).
82
+
83
+ ---
84
+
85
+ ## Severity levels (Overview self-review / human checkpoint #2)
86
+
87
+ | Level | When | Required action |
88
+ |-------|------|-----------------|
89
+ | **Critical** | Overview contradicts PRD coverage; boundaries make requirements impossible; missing genesis-required physical roots / mandatory diagrams | Must fix before Step 5 |
90
+ | **High** | Dependency cycles; cross-system contracts entirely blank; granularity extreme (one-box or pulverized) without rationale | Fix before forge or close via ADR / added design |
91
+ | **Medium** | Boundary wording fuzzy but decodable; one-sided dependence heavy but refactorable | Pay down in Step or design |
92
+ | **Low** | Doc phrasing, ordering, formatting | Continuous improvement |
93
+
94
+ ---
95
+
96
+ ## Sub-agent orchestration
97
+
98
+ **Parent (`/genesis` host session)**: Owns `TARGET_DIR`, final write of `02_ARCHITECTURE_OVERVIEW.md`, pacing of human checkpoints, and routing to Step 5.
99
+ **Child (if available)**: May receive slices such as “six-dimension draft only / Mermaid only / matrix consistency audit”; **must not** sole-author the same path file.
100
+
101
+ **Handoff checklist** (child self-check before returning to parent)
102
+
103
+ - [ ] Stated **write / advisory-only-no-disk** plus one-line reason
104
+ - [ ] All system IDs unique document-wide; matrix matches dependency diagram
105
+ - [ ] **Did not** touch `03_ADR/`, `01_PRD.md`
106
+ - [ ] Critical/High items escalated to parent for decision
107
+
108
+ ---
109
+
110
+ ## Top-level phases: `/genesis` Step 4 (includes Step 5 input prep)
111
+
112
+ The five phases below are the Step 4 execution bundle; afterward the host advances to **Step 5 ADR authoring** (not written directly by this skill).
113
+
114
+ ### Phase A: Inputs and timeline anchoring
115
+
116
+ **Do**: Confirm `TARGET_DIR`; load `01_PRD.md`, `concept_model.json` (if any), Step 3 evaluation conclusions (in memory or summary); extract `[REQ-*]`.
117
+ **Why**: Decomposition without object produces “architecture prose.”
118
+ **Done when**: Can list ≥3 deployment/runtime-related hard constraints from PRD + Step 3; thought indexes ran as planned.
119
+
120
+ ### Phase B: Six-dimension identification (synthesize candidate list)
121
+
122
+ **Do**: Walk **user touchpoints / data stores / core logic / external integrations / deployment units / tech stack**, producing candidate **`system-id` drafts**.
123
+ **Why**: Exhaust dimensions to reduce missed systems.
124
+ **Done when**: Each dimension has an explicit row or one-line `N/A` rationale; draft count lands in **3–10** or a defensible rare exception.
125
+
126
+ ### Phase C: Boundaries, dependencies, and requirement traceability
127
+
128
+ **Do**: For each system clarify **I/O boundaries**; build **boundary matrix + dependency diagram**; attach linked requirement IDs.
129
+ **Why**: Seams are where ADR and downstream design bite.
130
+ **Done when**: Matrix row count matches inventory; each edge appears once per endpoint pair in entries; no cycles unless rationale explains acceptance.
131
+
132
+ ### Phase D: Physical code mapping (`/genesis` Step 4 CRITICAL)
133
+
134
+ **Do**: Per system: **source root path** (e.g. `src/packages/frontend`) **+ ASCII directory tree.**
135
+ **Why**: Clone and IDE import depend on physical truth.
136
+ **Done when**: No “TBD-only” trees without `[OPEN]` records; paths match mono/polyrepo assumptions.
137
+
138
+ ### Phase E: Author, persist `02_*`, hand off Step 5–ready
139
+
140
+ **Do**: Fill `02_ARCHITECTURE_OVERVIEW.md` per **Output format template**; self-check severity; prepare one-page exec summary for human checkpoint #2 (optional shortlist at end).
141
+ **Why**: ADR must anchor to stable system boundaries.
142
+ **Done when**: Template §1–8 complete; explicit zero or escalate **`[OPEN]`** for issues ≥`High` with parent acceptance; parent knows **Step 5** is next.
143
+
144
+ ### Step 5 input readiness (host executes; this skill review list)
145
+
146
+ **Do**: Hand over **full system-ID set**, **cross-system open questions**, `[OPEN]` items, pointers to Step 3 comparison.
147
+ **Why**: ADR must cite real boundaries and alternatives provenance.
148
+ **Done when**: `tech-evaluator` ADR_TEMPLATE can be filled without conflict; ADR “scope of impact” can pre-list system placeholders.
149
+
150
+ ---
151
+
152
+ ## Core principles
153
+
154
+ > [!IMPORTANT]
155
+ > **Separation of concerns**: one major concern per system; **clear boundaries**: explicit I/O and data contracts; **moderate decomposition**: avoid **>10** systems without cause; forbid **unjustified single system**.
156
+ >
157
+ > **Anti-patterns**: one system per feature / monolith without seams / layered blame salad / “frontend+backend mashed in one row”
158
+ > **Good patterns**: justify split or merge by stack, deployment unit, responsibility, change frequency
159
+
160
+ ---
161
+
162
+ ## System identification framework: 6 dimensions (execution sweep)
163
+
164
+ ### 1. User touchpoints
165
+
166
+ Web / Mobile / CLI / API Gateway… → Usually map to distinct `*-system`s. Different stacks or deployments **must not** be forced into one ID.
167
+
168
+ ### 2. Data storage
169
+
170
+ DB, cache, object store, search; merge only under **same ops boundary + shared access pattern + no independent lifecycle for a split**, and record rationale.
171
+
172
+ ### 3. Core business logic
173
+
174
+ API, agent, pipeline, batch; typical split lines when evolution pace and SLA differ.
175
+
176
+ ### 4. External integrations
177
+
178
+ OAuth, payments, LLM; default stays inside owning system boundary unless integration complexity warrants its own system ID.
179
+
180
+ ### 5. Deployment units
181
+
182
+ CDN static / container services / worker; **one-to-one mapping to system candidates** is common.
183
+
184
+ ### 6. Tech stack
185
+
186
+ Stack delta is a strong decomposition signal (e.g. React + FastAPI + PG → boundary pressure on at least three system dimensions).
187
+
188
+ ---
189
+
190
+ ## Output format: Architecture Overview template
191
+
192
+ Use this structure to produce **`{TARGET_DIR}/02_ARCHITECTURE_OVERVIEW.md`**:
193
+
194
+ ```markdown
195
+ # Architecture Overview
196
+
197
+ **Project**: [Project Name]
198
+ **Version**: 1.0
199
+ **Date**: [YYYY-MM-DD]
200
+
201
+ ---
202
+
203
+ ## 1. System Context
204
+
205
+ ### 1.1 C4 Level 1 - System Context Diagram
206
+
207
+ [Use Mermaid for users and external systems]
208
+
209
+ \`\`\`mermaid
210
+ graph TD
211
+ User[User] -->|HTTP| WebApp[Web Application]
212
+ WebApp -->|API| Backend[Backend Service]
213
+ Backend -->|Query| DB[(Database)]
214
+ Backend -->|Call| LLM[LLM API]
215
+ \`\`\`
216
+
217
+ ### 1.2 Key Users
218
+ - **End user**: Uses the web UI
219
+ - **Admin**: Manages configuration
220
+ - ...
221
+
222
+ ### 1.3 External Systems
223
+ - **LLM API**: OpenAI / Anthropic
224
+ - **Identity**: Auth0 / OAuth
225
+ - ...
226
+
227
+ ---
228
+
229
+ ## 2. System Inventory
230
+
231
+ ### System 1: Frontend UX System
232
+ **system-id**: `frontend-system`
233
+
234
+ **Responsibility**:
235
+ - UI presentation and interaction
236
+ - API client wrapping
237
+ - Client-side state management
238
+
239
+ **Boundary**:
240
+ - **Input**: User actions (clicks, typing)
241
+ - **Output**: HTTP API requests
242
+ - **Dependencies**: backend-api-system
243
+
244
+ **Linked requirements**: [REQ-001] Sign-in, [REQ-002] Dashboard
245
+
246
+ **Tech stack**:
247
+ - Framework: React 18
248
+ - Build: Vite
249
+ - Styling: TailwindCSS
250
+ - State: Context API / Zustand
251
+
252
+ **Source root**: `src/packages/frontend`
253
+
254
+ **Repository layout (ASCII)**:
255
+ ```
256
+ src/packages/frontend/
257
+ apps/
258
+ components/
259
+ ...
260
+ ```
261
+
262
+ **Design doc**: `04_SYSTEM_DESIGN/frontend-system.md` (to be created)
263
+
264
+ ---
265
+
266
+ ### System 2: Backend API System
267
+ **system-id**: `backend-api-system`
268
+
269
+ **Responsibility**:
270
+ - REST API
271
+ - Business logic
272
+ - Database access
273
+
274
+ **Boundary**:
275
+ - **Input**: HTTP requests (JSON)
276
+ - **Output**: HTTP responses (JSON)
277
+ - **Dependencies**: database-system, agent-system
278
+
279
+ **Linked requirements**: [REQ-001] Sign-in, [REQ-003] Queries
280
+
281
+ **Tech stack**:
282
+ - Framework: FastAPI
283
+ - Language: Python 3.11
284
+ - ORM: SQLAlchemy
285
+ - Auth: JWT
286
+
287
+ **Source root**: `src/backend/api`
288
+
289
+ **Repository layout (ASCII)**:
290
+ ```
291
+ src/backend/api/
292
+ api/
293
+ services/
294
+ ...
295
+ ```
296
+
297
+ **Design doc**: `04_SYSTEM_DESIGN/backend-api-system.md` (to be created)
298
+
299
+ ---
300
+
301
+ ### System 3: Database System
302
+ **system-id**: `database-system`
303
+
304
+ **Responsibility**:
305
+ - Persistence
306
+ - Queries and indexes
307
+ - Backup and recovery
308
+
309
+ **Boundary**:
310
+ - **Input**: SQL queries
311
+ - **Output**: Result sets
312
+ - **Dependencies**: none (infrastructure)
313
+
314
+ **Linked requirements**: all storage-related requirements
315
+
316
+ **Tech stack**:
317
+ - Database: PostgreSQL 15
318
+ - Cache: Redis 7
319
+ - ORM: SQLAlchemy
320
+
321
+ **Source root**: `infra/db` or `[schema/migrations path]`
322
+
323
+ **Repository layout (ASCII)**:
324
+ ```
325
+ db/migrations/
326
+ ...
327
+ ```
328
+
329
+ **Design doc**: `04_SYSTEM_DESIGN/database-system.md` (to be created)
330
+
331
+ ---
332
+
333
+ [Continue with additional systems…]
334
+
335
+ ---
336
+
337
+ ## 3. System Boundary Matrix
338
+
339
+ | System | Input | Output | Depends on | Depended by | Linked REQs |
340
+ |--------|-------|--------|------------|-------------|-------------|
341
+ | Frontend | User actions | HTTP requests | Backend API | — | [REQ-001], [REQ-002] |
342
+ | Backend API | HTTP requests | JSON responses | Database, Agent | Frontend | [REQ-001], [REQ-003] |
343
+ | Database | SQL | Results | — | Backend API, Agent | All |
344
+ | Agent System | Task requests | Outcomes | Database, LLM API | Backend API | [REQ-005] |
345
+
346
+ ---
347
+
348
+ ## 4. System Dependency Graph
349
+
350
+ \`\`\`mermaid
351
+ graph TD
352
+ Frontend[Frontend System] -->|API Call| Backend[Backend API System]
353
+ Backend -->|Query| DB[Database System]
354
+ Backend -->|Invoke| Agent[Agent System]
355
+ Agent -->|Query| DB
356
+ Agent -->|Call| LLM[LLM API - External]
357
+
358
+ style Frontend fill:#e1f5ff
359
+ style Backend fill:#fff4e1
360
+ style DB fill:#e1ffe1
361
+ style Agent fill:#ffe1f5
362
+ \`\`\`
363
+
364
+ **Dependency notes**:
365
+ - Frontend depends on Backend (classic split)
366
+ - Backend is the hub coordinating Database and Agent
367
+ - Agent runs reasoning but needs Database support
368
+
369
+ ---
370
+
371
+ ## 5. Technology Stack Overview
372
+
373
+ | Layer | Technology | Used by |
374
+ |-------|------------|---------|
375
+ | **Frontend** | React, Vite, TailwindCSS | Frontend System |
376
+ | **Backend** | Python, FastAPI, SQLAlchemy | Backend API System |
377
+ | **Database** | PostgreSQL, Redis | Database System |
378
+ | **Agent** | LangGraph, OpenAI | Agent System |
379
+ | **Infrastructure** | Docker, Kubernetes | All Systems |
380
+
381
+ ---
382
+
383
+ ## 6. Decomposition Rationale
384
+
385
+ ### Why these systems?
386
+
387
+ **Stack dimension**:
388
+ - Frontend (React) vs Backend (Python) → different stacks, justified split
389
+
390
+ **Deployment dimension**:
391
+ - Frontend (CDN static) vs Backend (containers) → different deployment
392
+
393
+ **Responsibility dimension**:
394
+ - Backend API (business) vs Agent (reasoning) → parallelizable ownership
395
+
396
+ **Change frequency**:
397
+ - Frontend churn vs stable schema → easier evolution when split
398
+
399
+ ### Why not split further?
400
+
401
+ **Why not multiple Frontend systems?**
402
+ - Multiple pages share state and components; more systems add cost
403
+
404
+ **Why not microservices for Backend now?**
405
+ - Scale does not justify it yet; modular monolith suffices
406
+ - Separation of concerns can live in modular code
407
+
408
+ ---
409
+
410
+ ## 7. Complexity Assessment
411
+
412
+ **System count**: 4
413
+
414
+ **Assessment**:
415
+ - Reasonable (< 10)
416
+ - Clear boundaries
417
+ - Simple deps (acyclic)
418
+
419
+ **Risks**:
420
+ - Backend API may bottleneck (coordinates many systems)
421
+ - Possible future Backend split (e.g., when codebase > ~50k LOC)
422
+
423
+ ---
424
+
425
+ ## 8. Next Steps
426
+
427
+ ### Detailed design per system
428
+
429
+ Run:
430
+
431
+ \`\`\`bash
432
+ /design-system frontend-system
433
+ /design-system backend-api-system
434
+ /design-system database-system
435
+ /design-system agent-system
436
+ \`\`\`
437
+
438
+ ### `/genesis` Step 5 reminder (host)
439
+
440
+ - Host should write `03_ADR/ADR_001_TECH_STACK.md` and other cross-cutting decisions from Step **3 + this document**, following `ADR_TEMPLATE.md`.
441
+
442
+ ### `/blueprint` prerequisite (after overall design exists)
443
+
444
+ \`\`\`bash
445
+ /blueprint
446
+ \`\`\`
447
+ ```
448
+
449
+ ---
450
+
451
+ ## Decomposition guardrails
452
+
453
+ ### Guardrail 1: Do not over-split
454
+
455
+ **Rule**: System count typically **< 10**. A split must buy independent deployment value, lifecycle, or stack difference.
456
+
457
+ ### Guardrail 2: Do not over-bundle
458
+
459
+ **Rule**: Frontend, backend, database **usually** map to three distinct system IDs (exceptions need ADR-level argument).
460
+
461
+ ### Guardrail 3: Boundaries must be crisp
462
+
463
+ **Rule**: Each entry must clarify **inputs / outputs / serialization semantics** (at least JSON/Event/SQL class).
464
+
465
+ ### Guardrail 4: Use C4 + Mermaid
466
+
467
+ **Rule**: Context + dependency diagrams must match the matrix.
468
+
469
+ ---
470
+
471
+ ## RFC (`references/rfc_template.md`) structural contract — excerpt rules
472
+
473
+ Use only when you need **API / function signatures / DDL** fidelity; **do not delete chapter skeleton.**
474
+
475
+ | RFC required block | Rule |
476
+ |--------------------|------|
477
+ | High-level design + Mermaid | Traceable data flow and component layers |
478
+ | API contracts / interfaces | **Exact signatures**; no pretending placeholders are final |
479
+ | Data model strategy | DDL changes or equivalent statements |
480
+ | Implementation steps | Atomic, ordered |
481
+ | Security & risk | Explicit auth and validation |
482
+
483
+ Full template: **`.agents/skills/system-architect/references/rfc_template.md`** (if you localize `references/`, keep equivalent chapters).
484
+
485
+ ---
486
+
487
+ ## Toolbox
488
+
489
+ **Identification checklist**: touchpoints / storage / core logic / external / deployment / stack — tick each row.
490
+ **Persist self-check**: **Quality checklist** + **severity table** above.
491
+
492
+ ---
493
+
494
+ ## Common scenarios (short)
495
+
496
+ | Scenario | Systems (typical count) |
497
+ |----------|-------------------------|
498
+ | Classic web trio | Frontend + Backend API + DB (3) |
499
+ | + Agent | + Agent (4) |
500
+ | Enterprise-ish | Web + Mobile + Backend + DB + Search + Worker (≤6–8) |
501
+
502
+ ---
503
+
504
+ ## Quality checklist
505
+
506
+ ### Count
507
+
508
+ - Typical **3–10**; no feature-level micro-services; no unjustified single column
509
+
510
+ ### Boundaries
511
+
512
+ - I/O + contract clarity; single responsibility without cross-cutting muddle
513
+
514
+ ### Dependencies
515
+
516
+ - No unexplained cycles; Mermaid matches matrix; outbound deps **> 5** per system should have mitigation
517
+
518
+ ### Completeness (Step 4)
519
+
520
+ - §1–8 **per template**
521
+ - Physical root + ASCII tree **per system**
522
+ - Decomposition rationale answers hedge questions
523
+
524
+ ---
525
+
526
+ ## CRITICAL: `/genesis` integration notes (host excerpt, read-only)
527
+
528
+ Host **Step 6** refreshes **`AGENTS.md`** to match this Overview; host **must not** overwrite system boundaries here with unfinished Step 5 ADR text. **Git branch switching** still follows host `genesis.md` "Pre-Check."
529
+
530
+ ---
531
+
532
+ <completion_criteria>
533
+ - Architecture Overview **template §1–8** (incl. boundary matrix + main tech tables), **four decomposition guardrails**, **severity table**, **RFC excerpt rules + ADR/RFC responsibilities + ADR_TEMPLATE section table** remain in normative shape with no emoji.
534
+ - **CRITICAL** blocks present: **methodological anchors**, **spec output contract**, **genesis order + ADR/RFC split**, **sequential-thinking**.
535
+ - **Sub-agent orchestration** and handoff checklist present; top-level **five Step 4 phases** + **Step 5 input readiness** each include **Do / Why / Done when**.
536
+ - **phase_context** applied; wording matches constraints (no early read, single path).
537
+ - Output path still **`{TARGET_DIR}/02_ARCHITECTURE_OVERVIEW.md`**.
538
+ </completion_criteria>
@@ -0,0 +1,59 @@
1
+ # Technical Design Notes (RFC / Technical Spec)
2
+
3
+ **PRD Reference**: [Link to PRD]
4
+ **Feature Name**: [Feature Name]
5
+ **Status**: Draft
6
+
7
+ ## 1. High-Level Design
8
+ ### Architecture Diagram (Mermaid)
9
+ <!-- Use Mermaid to visualize data flow -->
10
+ ```mermaid
11
+ graph TD
12
+ A[User] -->|Action| B[Component]
13
+ B -->|API Call| C{Service}
14
+ ```
15
+
16
+ ### Component Hierarchy
17
+ * `Parent Component`
18
+ * `Child Component A` (Props: x, y)
19
+ * `Child Component B` (State: z)
20
+
21
+ ## 2. API Contracts (Interface Signatures)
22
+ <!-- Critical: define precise signatures. No hallucinations. -->
23
+
24
+ ### Endpoint Interfaces
25
+ * `POST /api/v1/resource`
26
+ * **Request Body**:
27
+ ```typescript
28
+ interface CreateRequest {
29
+ field: string; // required
30
+ }
31
+ ```
32
+ * **Response**: `200 OK` (Schema below)
33
+
34
+ ### Function Interfaces
35
+ <!-- Key internal function signatures -->
36
+ ```typescript
37
+ function calculateSomething(input: InputType): ResultType
38
+ ```
39
+
40
+ ## 3. Data Model Strategy
41
+ ### Database Schema Changes
42
+ ```sql
43
+ -- Fill in DDL here
44
+ CREATE TABLE ...
45
+ ```
46
+
47
+ ### State Management
48
+ * Global state: [for example Redux / Zustand slice]
49
+ * Local state: [for example React.useState]
50
+
51
+ ## 4. Implementation Steps
52
+ <!-- Atomic, ordered implementation steps -->
53
+ 1. [Step 1: Database migration]
54
+ 2. [Step 2: Backend API]
55
+ 3. [Step 3: Frontend UI]
56
+
57
+ ## 5. Security and Risks
58
+ * **Authentication**: [How is access secured?]
59
+ * **Validation**: [What input validation strategy is used?]