agile-context-engineering 0.1.0 → 0.2.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.
Files changed (83) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +272 -78
  3. package/agents/ace-code-discovery-analyst.md +245 -0
  4. package/agents/ace-code-integration-analyst.md +248 -0
  5. package/agents/ace-code-reviewer.md +375 -0
  6. package/agents/ace-product-owner.md +361 -0
  7. package/agents/ace-project-researcher.md +606 -0
  8. package/agents/ace-research-synthesizer.md +228 -0
  9. package/agents/ace-technical-application-architect.md +287 -0
  10. package/agents/ace-wiki-mapper.md +334 -0
  11. package/agile-context-engineering/src/ace-tools.js +2881 -0
  12. package/agile-context-engineering/src/ace-tools.test.js +1089 -0
  13. package/agile-context-engineering/templates/_command.md +54 -0
  14. package/agile-context-engineering/templates/_workflow.xml +17 -0
  15. package/agile-context-engineering/templates/config.json +0 -0
  16. package/agile-context-engineering/templates/product/external-solution.xml +832 -0
  17. package/agile-context-engineering/templates/product/feature.xml +361 -0
  18. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  19. package/agile-context-engineering/templates/product/product-backlog.xml +231 -0
  20. package/agile-context-engineering/templates/product/product-vision.xml +227 -0
  21. package/agile-context-engineering/templates/product/story-integration-solution.xml +1014 -0
  22. package/agile-context-engineering/templates/product/story-technical-solution.xml +1025 -0
  23. package/agile-context-engineering/templates/product/story-wiki.xml +190 -0
  24. package/agile-context-engineering/templates/product/story.xml +451 -0
  25. package/agile-context-engineering/templates/wiki/coding-standards.xml +493 -0
  26. package/agile-context-engineering/templates/wiki/decizions.xml +115 -0
  27. package/agile-context-engineering/templates/wiki/guide.xml +137 -0
  28. package/agile-context-engineering/templates/wiki/module-discovery.xml +174 -0
  29. package/agile-context-engineering/templates/wiki/pattern.xml +159 -0
  30. package/agile-context-engineering/templates/wiki/subsystem-architecture.xml +343 -0
  31. package/agile-context-engineering/templates/wiki/subsystem-structure.xml +235 -0
  32. package/agile-context-engineering/templates/wiki/system-architecture.xml +254 -0
  33. package/agile-context-engineering/templates/wiki/system-cross-cutting.xml +197 -0
  34. package/agile-context-engineering/templates/wiki/system-structure.xml +178 -0
  35. package/agile-context-engineering/templates/wiki/system.xml +381 -0
  36. package/agile-context-engineering/templates/wiki/tech-debt-index.xml +125 -0
  37. package/agile-context-engineering/templates/wiki/testing-framework.xml +283 -0
  38. package/agile-context-engineering/utils/questioning.xml +111 -0
  39. package/agile-context-engineering/utils/ui-formatting.md +300 -0
  40. package/agile-context-engineering/workflows/execute-story.xml +1145 -0
  41. package/agile-context-engineering/workflows/help.xml +540 -0
  42. package/agile-context-engineering/workflows/init-coding-standards.xml +386 -0
  43. package/agile-context-engineering/workflows/map-story.xml +797 -0
  44. package/agile-context-engineering/workflows/map-subsystem.xml +1177 -0
  45. package/agile-context-engineering/workflows/map-system.xml +647 -0
  46. package/agile-context-engineering/workflows/plan-backlog.xml +1356 -0
  47. package/agile-context-engineering/workflows/plan-feature.xml +1495 -0
  48. package/agile-context-engineering/workflows/plan-product-vision.xml +342 -0
  49. package/agile-context-engineering/workflows/plan-story.xml +909 -0
  50. package/agile-context-engineering/workflows/research-external-solution.xml +659 -0
  51. package/agile-context-engineering/workflows/research-integration-solution.xml +712 -0
  52. package/agile-context-engineering/workflows/research-story-wiki.xml +474 -0
  53. package/agile-context-engineering/workflows/research-technical-solution.xml +762 -0
  54. package/agile-context-engineering/workflows/review-story.xml +281 -0
  55. package/bin/install.js +102 -166
  56. package/commands/ace/execute-story.md +137 -0
  57. package/commands/ace/help.md +93 -0
  58. package/commands/ace/init-coding-standards.md +83 -0
  59. package/commands/ace/map-story.md +156 -0
  60. package/commands/ace/map-subsystem.md +138 -0
  61. package/commands/ace/map-system.md +90 -0
  62. package/commands/ace/plan-backlog.md +83 -0
  63. package/commands/ace/plan-feature.md +89 -0
  64. package/commands/ace/plan-product-vision.md +81 -0
  65. package/commands/ace/plan-story.md +145 -0
  66. package/commands/ace/research-external-solution.md +138 -0
  67. package/commands/ace/research-integration-solution.md +135 -0
  68. package/commands/ace/research-story-wiki.md +116 -0
  69. package/commands/ace/research-technical-solution.md +147 -0
  70. package/commands/ace/review-story.md +109 -0
  71. package/package.json +5 -8
  72. package/agents/executor.md +0 -88
  73. package/agents/planner.md +0 -78
  74. package/agents/researcher.md +0 -77
  75. package/agents/verifier.md +0 -116
  76. package/commands/ace-execute-story.md +0 -114
  77. package/commands/ace-init.md +0 -254
  78. package/commands/ace-plan-epic.md +0 -79
  79. package/commands/ace-plan-feature.md +0 -78
  80. package/commands/ace-plan-project.md +0 -205
  81. package/commands/ace-plan-story.md +0 -97
  82. package/commands/ace-refine-story.md +0 -90
  83. package/commands/ace-verify-story.md +0 -127
@@ -0,0 +1,493 @@
1
+ <coding-standards>
2
+
3
+ <purpose>
4
+ Template for `.docs/wiki/system-wide/coding-standards.md` — prescriptive rules that
5
+ ALL code in this project MUST follow. These are NOT descriptive conventions (observed patterns)
6
+ but MANDATED STANDARDS that prevent common AI and developer mistakes.
7
+
8
+ This template is paradigm-aware. It contains modular sections that the generating agent
9
+ assembles based on the project's detected language(s), paradigm(s), and user preferences.
10
+
11
+ Complements system-structure.md (which shows physical layout) and system-architecture.md
12
+ (which shows conceptual design). Coding standards tell you HOW to write code, not WHERE
13
+ it goes or WHY the architecture exists.
14
+
15
+ Output: `.docs/wiki/system-wide/coding-standards.md`
16
+ </purpose>
17
+
18
+ <!-- ═══════════════════════════════════════════════════════════════════════ -->
19
+ <!-- TEMPLATE SECTIONS -->
20
+ <!-- The generating agent assembles applicable sections into the output doc -->
21
+ <!-- ═══════════════════════════════════════════════════════════════════════ -->
22
+
23
+ <template>
24
+
25
+ <!-- ─────────────────────────────────────────────────────────────────── -->
26
+ <!-- UNIVERSAL — Always included regardless of language or paradigm -->
27
+ <!-- ─────────────────────────────────────────────────────────────────── -->
28
+
29
+ <universal-standards always-include="true">
30
+ # Coding Standards
31
+
32
+ ## Mandatory Rules — Zero Tolerance
33
+
34
+ These rules apply to ALL code. No exceptions. No "just this once."
35
+
36
+ ### No Dead Code
37
+ - **NEVER leave commented-out code** — Git has history. Delete it.
38
+ - **NEVER leave unused imports, variables, functions, or classes**
39
+ - **NEVER leave unreachable code paths**
40
+ - Dead code in a complex codebase misleads developers and AI agents into basing
41
+ new implementations on obsolete, unused code. It is actively harmful.
42
+
43
+ ### No Hardcoded Values
44
+ - **NEVER hardcode** magic strings, color codes, URLs, config values, numeric
45
+ thresholds, or any value that could change or has semantic meaning
46
+ - ALL values come from: constants, configuration, environment, or parameters
47
+ - Reference: consult `system-structure.md` (`.docs/wiki/system-wide/system-structure.md`)
48
+ and `[subsystem]-structure.md` (`.docs/wiki/subsystems/[subsystem-name]/structure.md`)
49
+ for where constants should live in this project
50
+
51
+ ### No Silent Failures
52
+ - **NEVER silently swallow errors** — When an operation fails, LET IT FAIL
53
+ - Do NOT catch exceptions and return fake/placeholder/garbage objects
54
+ - Do NOT hide errors by returning empty lists or default values
55
+ - Do NOT pretend an operation succeeded when it didn't
56
+ - Fail fast. Propagate up. Log with context if needed, then rethrow or return the error.
57
+
58
+ ### No Unimplemented Code
59
+ - **NEVER leave empty TODO comments** — If it needs doing, do it now or create a tracked issue
60
+ - **NEVER leave stub implementations** — No `throw NotImplemented`, no `pass`, no `...`
61
+ - If code exists in the codebase, it must be complete and functional
62
+
63
+ ### No Assumptions
64
+ - **Use LSPs first when available** — Check diagnostics, go-to-definition, and find-references before guessing. The LSP knows the codebase better than a text search.
65
+ - **NEVER assume** libraries, classes, models, methods, or APIs exist
66
+ - **ALWAYS verify by reading the codebase** before building on something
67
+ - **ALWAYS search for existing implementations** before writing new code
68
+ - If similar code exists, refactor it to support the new requirement instead of duplicating
69
+
70
+ ### No Code Duplication
71
+ - Before writing new code, search for existing implementations
72
+ - If you find code that does 80% of what you need, refactor it — don't duplicate it
73
+ - Duplication is a maintainability debt that compounds with every copy
74
+
75
+ ## File Organization
76
+
77
+ - **One primary [construct] per file** — One class, one module, one component.
78
+ Do not declare multiple classes, interfaces, or significant types in a single file.
79
+ [Construct name adapts: "class" for OOP, "module export" for FP, "component" for React,
80
+ "struct + impl" for Rust, "type + functions" for Go]
81
+
82
+ - **Maximum file length: [N] lines** — If a file approaches this limit, it has too many
83
+ responsibilities. Refactor by extracting. If you're following single responsibility,
84
+ you should rarely get close to this limit.
85
+
86
+ ## Engineering Principles
87
+
88
+ - **DRY (Don't Repeat Yourself)** — Every piece of knowledge must have a single,
89
+ unambiguous, authoritative representation within the system. If you change one thing
90
+ and have to change it in multiple places, the design is wrong. Extract shared logic.
91
+
92
+ - **KISS (Keep It Simple, Stupid)** — The simplest solution that works is the best
93
+ solution. Avoid over-engineering, excessive abstractions, and clever tricks.
94
+ Code is read far more often than it is written — optimize for clarity.
95
+
96
+ - **YAGNI (You Aren't Gonna Need It)** — Do NOT implement functionality until it is
97
+ actually needed. Do not design for hypothetical future requirements. Do not add
98
+ configuration points, extension hooks, or abstractions "just in case."
99
+
100
+ - **Separation of Concerns** — Each unit of code (function, class, module) should
101
+ address one concern. Mixing concerns creates code that is hard to test, hard to
102
+ change, and hard to understand.
103
+
104
+ - **Principle of Least Surprise** — Code should behave as other developers would
105
+ expect. Method names should describe what they do. Side effects should be obvious.
106
+ Conventions should be consistent across the codebase.
107
+
108
+ - **Fail Fast** — Detect and report errors as early as possible. Validate inputs
109
+ at boundaries. Assert invariants. The further an error propagates from its source,
110
+ the harder it is to diagnose.
111
+
112
+ ## Code Quality Mindset
113
+
114
+ - **Think like an architect operating within a complex codebase** — Every coding
115
+ decision must consider: will this be easy to extend? Can another developer understand it?
116
+ Does it follow existing patterns?
117
+
118
+ - **No hacks, no shortcuts** — Especially when fixing bugs. The pressure to
119
+ "just make it work" is strongest during bug fixes. Resist. Fix it properly.
120
+
121
+ - **No over-engineering** — Don't add features, abstractions, or configurability
122
+ beyond what's needed. Three similar lines of code is better than a premature abstraction.
123
+ The right amount of complexity is the minimum needed for the current task.
124
+
125
+ - **All code must be testable** — Structure code so it can be tested in isolation.
126
+ [Paradigm-specific testability guidance goes in the paradigm section]
127
+ </universal-standards>
128
+
129
+ <!-- ─────────────────────────────────────────────────────────────────── -->
130
+ <!-- OOP MODULE — Include when project uses object-oriented paradigm -->
131
+ <!-- ─────────────────────────────────────────────────────────────────── -->
132
+
133
+ <paradigm-oop include-when="Project uses OOP as primary or significant paradigm (C#, Java, TypeScript with classes, Python with classes, Kotlin, Swift, Dart, Ruby, PHP)">
134
+ ## Object-Oriented Programming Standards
135
+
136
+ ### SOLID Principles — Non-Negotiable
137
+
138
+ - **Single Responsibility Principle** — Each class has ONE reason to change.
139
+ If you can describe a class purpose with "and", it does too much. Split it.
140
+
141
+ - **Open/Closed Principle** — Open for extension, closed for modification.
142
+ Use abstractions and composition to add behavior without changing existing code.
143
+
144
+ - **Liskov Substitution Principle** — Derived classes must be fully substitutable
145
+ for their base classes. No surprises, no broken contracts.
146
+
147
+ - **Interface Segregation Principle** — No client should depend on interfaces it
148
+ doesn't use. Prefer many small, focused interfaces over few large ones.
149
+
150
+ - **Dependency Inversion Principle** — Depend on abstractions, not concretions.
151
+ High-level modules must not depend on low-level modules.
152
+
153
+ ### Code Against Abstractions
154
+
155
+ - **ALWAYS code against interfaces** — Every service, repository, and significant
156
+ collaborator must have an interface. This enables testing, swapping implementations,
157
+ and respecting DIP.
158
+
159
+ - **Dependency injection for ALL services** — No instantiating dependencies directly
160
+ inside other services. Wire dependencies through constructors. Register in the
161
+ DI container.
162
+ Reference: consult `system-structure.md` (`.docs/wiki/system-wide/system-structure.md`)
163
+ and `[subsystem]-structure.md` (`.docs/wiki/subsystems/[subsystem-name]/structure.md`)
164
+ for where DI configuration lives in this project
165
+
166
+ ### OOP Best Practices
167
+
168
+ - **Composition over inheritance** — Prefer composing behaviors via injected
169
+ collaborators over deep inheritance hierarchies. Inheritance creates tight coupling.
170
+
171
+ - **Encapsulation** — Keep internal state private. Expose behavior through methods,
172
+ not raw data through public fields and getters.
173
+
174
+ - **Polymorphism over conditionals** — When you see `if/switch` checking a type
175
+ discriminator, consider whether polymorphism is the proper solution.
176
+
177
+ - **Small, focused classes** — A class should be easily describable in one sentence.
178
+ If the description needs "and", extract a collaborator.
179
+
180
+ ### Design Patterns — Use Where They Fit
181
+
182
+ Apply proven patterns to solve recurring design problems. Do NOT force patterns
183
+ where a simpler solution exists — a pattern used without justification is an anti-pattern.
184
+
185
+ - **Strategy** — Encapsulate interchangeable algorithms behind an interface. Use when
186
+ behavior varies by context and you want to swap implementations without modifying callers.
187
+
188
+ - **Repository** — Mediate between domain and data mapping layers using a collection-like
189
+ interface. Keeps domain logic ignorant of persistence details.
190
+
191
+ - **Factory / Abstract Factory** — Encapsulate object creation when construction is
192
+ complex or the concrete type depends on runtime conditions. Avoid when a simple
193
+ constructor call is sufficient.
194
+
195
+ - **Observer / Event** — Decouple producers from consumers when one action must trigger
196
+ multiple reactions. Use for cross-cutting concerns like logging, notifications, or
197
+ cache invalidation.
198
+
199
+ - **Decorator** — Add behavior to objects dynamically without modifying their class.
200
+ Prefer over inheritance when combining behaviors in varying combinations.
201
+
202
+ - **Adapter** — Convert one interface to another so incompatible classes can work together.
203
+ Use at system boundaries to integrate external libraries or legacy code.
204
+
205
+ - **Command** — Encapsulate a request as an object, enabling undo, queuing, logging,
206
+ or deferred execution. Use when operations need to be treated as first-class objects.
207
+
208
+ - **Template Method** — Define the skeleton of an algorithm in a base class, letting
209
+ subclasses override specific steps. Use sparingly — composition is often better.
210
+
211
+ **WARNING:** Do NOT use patterns preemptively. A pattern is justified ONLY when the
212
+ problem it solves actually exists in your code. "We might need it later" is not
213
+ justification — that violates YAGNI.
214
+
215
+ ### OOP Anti-Patterns — Never Do These
216
+
217
+ - **God Class** — A class that knows too much and does too much. If a class name
218
+ contains "Manager", "Handler", "Processor", or "Service" and it's over 300 lines,
219
+ it's probably a God Class. Split it by responsibility.
220
+
221
+ - **Anemic Domain Model** — Domain objects reduced to mere data containers (getters
222
+ and setters only) with all logic in separate "service" classes. This is procedural
223
+ programming disguised as OOP. Put behavior where the data is.
224
+
225
+ - **Feature Envy** — A method that uses more data from another class than its own.
226
+ This means the method belongs in the other class. Move it.
227
+
228
+ - **Tight Coupling** — Classes directly instantiating or depending on concrete
229
+ implementations instead of abstractions. Makes testing impossible and changes ripple
230
+ across the codebase. Code against interfaces.
231
+
232
+ - **Poltergeist / Useless Classes** — Classes with no real responsibility that merely
233
+ delegate to other classes or add unnecessary abstraction layers. Every class must
234
+ justify its existence with real behavior.
235
+
236
+ - **Singleton Abuse** — Using Singleton as a convenient global variable. Singletons
237
+ hide dependencies, prevent testing, create concurrency issues, and violate DIP.
238
+ Use dependency injection instead.
239
+
240
+ - **Premature Abstraction** — Creating interfaces, base classes, or generic frameworks
241
+ before having two concrete use cases. Wait until duplication emerges, then abstract.
242
+ Wrong abstractions are worse than duplication.
243
+ </paradigm-oop>
244
+
245
+ <!-- ─────────────────────────────────────────────────────────────────── -->
246
+ <!-- FUNCTIONAL MODULE — Include when project uses functional paradigm -->
247
+ <!-- ─────────────────────────────────────────────────────────────────── -->
248
+
249
+ <paradigm-functional include-when="Project uses FP as primary or significant paradigm (Elixir, Haskell, Clojure, F#, Elm, OCaml, or FP style in TypeScript/JavaScript/Python/Kotlin/Scala)">
250
+ ## Functional Programming Standards
251
+
252
+ ### Core Principles
253
+
254
+ - **Pure functions by default** — Functions should be deterministic: same input →
255
+ same output, no side effects. Isolate side effects at the boundaries
256
+ (IO, database, API calls, user interaction).
257
+
258
+ - **Immutability by default** — Do not mutate data. Create new values from old ones.
259
+ Mutable state is opt-in and must be justified with a comment explaining why.
260
+
261
+ - **Function composition over imperative flow** — Build complex behavior by composing
262
+ small, focused functions. Prefer pipelines and transformations over step-by-step
263
+ mutation.
264
+
265
+ ### Data Modeling
266
+
267
+ - **Make illegal states unrepresentable** — Use discriminated unions / sum types /
268
+ algebraic data types to model domain states. The type system should prevent
269
+ invalid state combinations at compile time.
270
+
271
+ - **Pattern matching over conditionals** — Use pattern matching to destructure data
272
+ and handle variants. It's exhaustive, self-documenting, and catches missing cases.
273
+
274
+ - **Data transformation pipelines** — Prefer `map`, `filter`, `reduce`, pipe operators,
275
+ or function composition over loops with mutable accumulators.
276
+
277
+ ### Error Handling
278
+
279
+ - **Result/Either types for expected failures** — Reserve exceptions for truly
280
+ exceptional, unrecoverable conditions. Expected failures (validation, not-found,
281
+ conflict) should be expressed in the return type.
282
+
283
+ - **Railway-oriented error handling** — Chain operations that can fail without nested
284
+ try/catch. Let the error path carry failures through the pipeline.
285
+
286
+ ### Module Design
287
+
288
+ - **Modules as namespaces with clear purpose** — Group related functions into modules.
289
+ Each module has a single, focused responsibility.
290
+
291
+ - **Explicit dependencies** — Functions receive dependencies as parameters.
292
+ No hidden global state, no module-level singletons with side effects.
293
+
294
+ - **Public API at module boundary** — Export only what consumers need.
295
+ Keep internal helpers private.
296
+ </paradigm-functional>
297
+
298
+ <!-- ─────────────────────────────────────────────────────────────────── -->
299
+ <!-- SYSTEMS MODULE — Include for Rust, Go, C, C++ -->
300
+ <!-- ─────────────────────────────────────────────────────────────────── -->
301
+
302
+ <paradigm-systems include-when="Project uses systems languages (Rust, Go, C, C++)">
303
+ ## Systems Programming Standards
304
+
305
+ ### Rust (include if Rust project)
306
+
307
+ - **Respect the borrow checker** — Do not fight it with unnecessary `clone()` or
308
+ `Rc&lt;RefCell&lt;&gt;&gt;`. If the borrow checker complains, rethink your data flow.
309
+
310
+ - **`Result&lt;T, E&gt;` for all fallible operations** — Use the `?` operator for
311
+ propagation. Reserve `panic!` for unrecoverable invariant violations only.
312
+
313
+ - **No unnecessary `unwrap()`** — Every `unwrap()` is a potential panic. Use `?`,
314
+ `unwrap_or`, `unwrap_or_else`, `map`, or proper match/if-let handling.
315
+
316
+ - **Traits for polymorphism** — Use traits to define behavior contracts. Use
317
+ `dyn Trait` for dynamic dispatch only when static dispatch won't work.
318
+
319
+ - **Derive what you can** — Use `#[derive(...)]` for standard traits. Implement
320
+ manually only when custom behavior is needed.
321
+
322
+ ### Go (include if Go project)
323
+
324
+ - **Accept interfaces, return structs** — Function parameters should use interfaces
325
+ for flexibility. Return concrete types for clarity.
326
+
327
+ - **Check every error** — Never ignore `err` returns. Use `fmt.Errorf("context: %w", err)`
328
+ for wrapping. Use sentinel errors or custom types for typed error handling.
329
+
330
+ - **Package-level organization** — Each package has a clear, focused purpose.
331
+ Avoid mega-packages. Package name should describe what it provides, not what it contains.
332
+
333
+ - **No unnecessary interfaces** — Define interfaces where they're consumed, not where
334
+ they're implemented. Don't create interfaces for single implementations.
335
+
336
+ - **Short names for small scopes** — `i`, `ctx`, `err`, `db` for local variables.
337
+ Longer, descriptive names for package-level and exported identifiers.
338
+
339
+ ### C/C++ (include if C/C++ project)
340
+
341
+ - **RAII in C++** — Acquire resources in constructors, release in destructors.
342
+ Use smart pointers (`unique_ptr`, `shared_ptr`) instead of raw `new/delete`.
343
+
344
+ - **Bounds checking** — Validate array indices and buffer sizes. Use safe alternatives
345
+ (`std::array`, `std::vector`, `std::string`) over raw C arrays and `char*`.
346
+
347
+ - **No raw `new/delete` in C++** — Use smart pointers and containers.
348
+ Manual memory management is a bug waiting to happen.
349
+ </paradigm-systems>
350
+
351
+ <!-- ─────────────────────────────────────────────────────────────────── -->
352
+ <!-- LANGUAGE-SPECIFIC CONVENTIONS — Generated from codebase detection -->
353
+ <!-- ─────────────────────────────────────────────────────────────────── -->
354
+
355
+ <language-conventions generate-from="codebase detection or user input">
356
+ ## Language and Framework Conventions
357
+
358
+ [Generate this section from detected language, frameworks, and existing configs.
359
+ Check .prettierrc, .eslintrc, ruff.toml, .editorconfig, etc. for existing rules.
360
+ Examine 5-10 representative source files for naming patterns.]
361
+
362
+ ### Naming Conventions
363
+ [Document project's actual naming patterns. Be prescriptive:
364
+ - File naming: kebab-case.ts, PascalCase.cs, snake_case.py, etc.
365
+ - Functions/methods: camelCase, snake_case, PascalCase depending on language
366
+ - Variables: language convention
367
+ - Constants: UPPER_SNAKE_CASE universally
368
+ - Types/interfaces: PascalCase universally, with/without prefix based on project]
369
+
370
+ ### Import / Dependency Organization
371
+ [Document the project's import ordering and grouping.
372
+ Check for linter rules enforcing import order.]
373
+
374
+ ### Framework-Specific Rules
375
+ [Only include if project uses a framework with its own patterns:
376
+ - React: hooks rules, component patterns, state management approach
377
+ - Angular: module structure, service patterns, change detection
378
+ - ASP.NET: controller patterns, middleware, model binding
379
+ - Django: app structure, view patterns, ORM usage
380
+ - Spring: bean patterns, annotation usage
381
+ Generate based on what's actually detected, not a generic list.]
382
+ </language-conventions>
383
+
384
+ <!-- ─────────────────────────────────────────────────────────────────── -->
385
+ <!-- PROJECT-SPECIFIC RULES — From user interview -->
386
+ <!-- ─────────────────────────────────────────────────────────────────── -->
387
+
388
+ <project-specific-rules generate-from="user interview">
389
+ ## Project-Specific Rules
390
+
391
+ [Rules from the user interview that don't fit neatly in other sections.
392
+ These capture the team's hard-won lessons and specific pain points.
393
+
394
+ This is often the MOST VALUABLE section because it's unique to this project.
395
+ Write these with the same emphatic, direct tone as the universal rules.
396
+
397
+ Examples of what might go here:
398
+ - "If a method has LESS than 7 parameters, keep them on ONE line"
399
+ - "All API responses must use the shared ApiResponse wrapper"
400
+ - "Never use library X for Y — use Z instead"
401
+ - "All database queries must go through the repository pattern"
402
+ - Specific patterns, conventions, or constraints unique to this project]
403
+ </project-specific-rules>
404
+
405
+ </template>
406
+
407
+ <guidelines>
408
+
409
+ **Assembly rules for the generating agent:**
410
+
411
+ 1. **ALWAYS include universal-standards** — These apply to every project regardless
412
+ of language or paradigm. Adapt the [bracketed placeholders] to the detected language.
413
+
414
+ 2. **Include paradigm modules based on detection AND user preference:**
415
+ - Project uses OOP → include paradigm-oop
416
+ - Project uses FP → include paradigm-functional
417
+ - Project uses systems language → include paradigm-systems
418
+ - Project uses multi-paradigm → include whichever modules the user prefers
419
+ - User explicitly declines a paradigm → respect that, do not include it
420
+
421
+ 3. **Generate language-conventions from codebase analysis** — Read actual config files,
422
+ examine source files, document what's in use. Be prescriptive, not descriptive.
423
+
424
+ 4. **Include project-specific-rules from interview** — Capture the user's pain points
425
+ and custom rules. These are the most unique and valuable part of the document.
426
+
427
+ 5. **Tone: DIRECT and EMPHATIC** — Use bold for emphasis, caps for critical words.
428
+ This is not a suggestion document — it's a mandate. AI agents (especially Claude)
429
+ respect authoritative, unambiguous instructions more than polite suggestions.
430
+ Match the tone of the universal-standards section.
431
+
432
+ 6. **Length: 150-350 lines** — Enough to be comprehensive, short enough to be loaded
433
+ as context without waste. Universal (~60 lines) + one paradigm module (~40 lines) +
434
+ language conventions (~40 lines) + project-specific (~30 lines) = ~170 lines typical.
435
+ Two paradigm modules or extensive project rules may push to ~300.
436
+
437
+ 7. **Be prescriptive** — "NEVER do X" not "We typically avoid X". "ALWAYS do Y" not
438
+ "It's recommended to do Y". Standards are mandates, not suggestions.
439
+
440
+ 8. **Include rationale for non-obvious rules** — "No dead code" needs a why
441
+ (misleads AI and developers into building on obsolete code). "Use camelCase" doesn't
442
+ need a why (it's a convention, not a principle).
443
+
444
+ 9. **Use concrete examples for ambiguous rules** — When a rule could be misinterpreted,
445
+ show a brief good/bad example inline.
446
+
447
+ 10. **Cross-reference project structure** — Reference actual file paths for constants
448
+ directories, DI configuration, shared utilities, etc. Use backtick formatting for paths.
449
+
450
+ **What does NOT belong in coding-standards.md:**
451
+ - File/directory structure (that's system-structure.md / subsystem-structure.md)
452
+ - Architecture decisions and patterns (that's system-architecture.md)
453
+ - Technology stack choices (that's system-architecture.md tech-stack section)
454
+ - Test framework setup and patterns (that's a separate testing doc)
455
+ - Deployment, CI/CD, or infrastructure concerns
456
+
457
+ **What DOES belong:**
458
+ - Rules about HOW to write code (quality, style, patterns)
459
+ - Rules about code organization WITHIN files (not directory layout)
460
+ - Rules about naming, formatting, error handling, testability
461
+ - Rules about paradigm adherence (SOLID, FP principles, systems idioms)
462
+ - Rules that prevent known AI mistakes (the highest-value rules)
463
+ - Rules that maintain codebase integrity at scale
464
+
465
+ </guidelines>
466
+
467
+ <evolution>
468
+
469
+ This document evolves when coding standards change — not with every feature or fix.
470
+
471
+ **Update triggers:**
472
+ - New language or paradigm added to the project
473
+ - New framework that introduces its own coding patterns
474
+ - Team discovers a recurring mistake → add a rule to prevent it
475
+ - Existing rule proven too strict or too loose → adjust it
476
+ - Architecture shift that changes how code should be written
477
+ - Onboarding feedback reveals ambiguous or missing rules
478
+
479
+ **NOT an update trigger:**
480
+ - New features (should follow existing standards)
481
+ - Bug fixes (should already follow standards)
482
+ - Dependency updates (unless they fundamentally change coding patterns)
483
+ - New files or directories (that's structure docs)
484
+
485
+ **After update:**
486
+ 1. Review all paradigm modules — still accurate?
487
+ 2. Review project-specific rules — any new pain points to capture?
488
+ 3. Check line count — still under 350 lines?
489
+ 4. Verify cross-references to file paths are still valid
490
+
491
+ </evolution>
492
+
493
+ </coding-standards>
@@ -0,0 +1,115 @@
1
+ <decisions>
2
+ <purpose>
3
+ Template for `.docs/wiki/subsystems/[subsystem-name]/decisions/<decision-name>.md` — an
4
+ Architecture Decision Record (ADR) capturing WHY a significant choice was made.
5
+ Answers "Why did we choose X over Y?"
6
+
7
+ Each decision doc captures one significant technical decision with its context and
8
+ trade-offs. It is the document an AI agent reads to understand WHY things are built
9
+ a certain way, preventing it from making the wrong choice.
10
+
11
+ Create an ADR ONLY when a significant "why" decision was made:
12
+ - Choosing one approach over another with meaningful trade-offs
13
+ - Deviating from an established pattern for a specific reason
14
+ - Adopting a new technology, pattern, or architectural approach
15
+ - Rejecting a seemingly obvious solution for non-obvious reasons
16
+
17
+ Do NOT create ADRs for trivial or obvious decisions.
18
+
19
+ Complements:
20
+ - systems/ docs (WHAT exists — systems reference decisions that shaped them)
21
+ - patterns/ docs (HOW things work — patterns reference decisions that defined them)
22
+ - cross-cutting/ docs (shared infrastructure shaped by architectural decisions)
23
+ </purpose>
24
+
25
+ <template>
26
+ <decision-record>
27
+ # ADR-NNN: [Decision Title]
28
+
29
+ **Status**: Accepted | Superseded by [ADR-MMM](./ADR-MMM-slug.md)
30
+ **Date**: YYYY-MM-DD
31
+ **Story**: [story reference, if applicable]
32
+
33
+ ## Context
34
+ What situation prompted this decision. 2-3 sentences max.
35
+
36
+ ## Decision
37
+ What was decided. 2-3 sentences max.
38
+
39
+ ## Alternatives Considered
40
+ - **[Alternative A]**: [Why rejected — 1 sentence]
41
+ - **[Alternative B]**: [Why rejected — 1 sentence]
42
+
43
+ ## Consequences
44
+ - Pro: [positive outcome]
45
+ - Pro: [positive outcome]
46
+ - Con: [trade-off accepted]
47
+ </decision-record>
48
+ </template>
49
+
50
+ <guidelines>
51
+
52
+ **Documentation Style:**
53
+ - EXTREMELY SUCCINCT — each ADR should be under 30 lines
54
+ - NO FLUFF — every sentence must convey a decision, reason, or consequence
55
+ - Bullet points for alternatives and consequences
56
+ - Code references as `file-path:ClassName` only when the decision is about specific code
57
+
58
+ **ADR Numbering:**
59
+ - Sequential within the subsystem: ADR-001, ADR-002, etc.
60
+ - Filename format: `ADR-NNN-kebab-case-slug.md`
61
+ - To find the next number, read existing ADRs in the decisions/ directory.
62
+
63
+ **Status:**
64
+ - `Accepted` — the decision is in effect
65
+ - `Superseded by ADR-MMM` — replaced by a later decision (link to it)
66
+ - ADRs are IMMUTABLE — never edit an accepted ADR. Create a new one that supersedes it.
67
+
68
+ **Context:**
69
+ - 2-3 sentences. What problem or situation forced a choice.
70
+ - Reference the system or pattern this decision affects.
71
+
72
+ **Decision:**
73
+ - 2-3 sentences. What was chosen and at what scope.
74
+ - Be specific — "We use X for Y" not "We decided to improve things."
75
+
76
+ **Alternatives Considered:**
77
+ - List each rejected alternative with ONE sentence explaining why.
78
+ - If there were no meaningful alternatives, omit this section.
79
+
80
+ **Consequences:**
81
+ - Bullet list of pros and cons.
82
+ - Be honest about trade-offs — future agents need to know the downsides.
83
+ - Include migration/compatibility consequences if applicable.
84
+
85
+ **What does NOT belong here:**
86
+ - Implementation details (that's in systems/ and patterns/ docs)
87
+ - Step-by-step instructions (that's in guides/)
88
+ - Full analysis or research documents (those are in .ace/artifacts/)
89
+ - Revision history or meeting notes
90
+
91
+ </guidelines>
92
+
93
+ <evolution>
94
+
95
+ ADRs are IMMUTABLE once accepted. They are historical records.
96
+
97
+ **When to create a new ADR:**
98
+ - A significant architectural or pattern choice is made during a story
99
+ - An existing decision is reversed or significantly modified (supersede the old one)
100
+ - A new technology, pattern, or approach is adopted
101
+
102
+ **When NOT to create an ADR:**
103
+ - Routine implementation following existing patterns
104
+ - Bug fixes or refactoring that don't change architectural direction
105
+ - Trivial decisions with no meaningful trade-offs
106
+ - Decisions already captured in an existing ADR
107
+
108
+ **Superseding:**
109
+ - Create the new ADR with its own number
110
+ - Update the old ADR's Status to: `Superseded by [ADR-MMM](./ADR-MMM-slug.md)`
111
+ - This is the ONLY edit allowed on an accepted ADR
112
+
113
+ </evolution>
114
+
115
+ </decisions>