agile-context-engineering 0.2.2 → 0.3.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 (51) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/LICENSE +51 -51
  3. package/README.md +324 -323
  4. package/agents/ace-research-synthesizer.md +228 -228
  5. package/agents/ace-technical-application-architect.md +28 -0
  6. package/agents/ace-wiki-mapper.md +445 -334
  7. package/agile-context-engineering/src/ace-tools.test.js +1089 -1089
  8. package/agile-context-engineering/templates/_command.md +53 -53
  9. package/agile-context-engineering/templates/_workflow.xml +16 -16
  10. package/agile-context-engineering/templates/product/product-backlog.xml +231 -231
  11. package/agile-context-engineering/templates/product/story-integration-solution.xml +1 -0
  12. package/agile-context-engineering/templates/product/story-wiki.xml +4 -0
  13. package/agile-context-engineering/templates/wiki/coding-standards.xml +38 -0
  14. package/agile-context-engineering/templates/wiki/decizions.xml +115 -115
  15. package/agile-context-engineering/templates/wiki/guide.xml +137 -137
  16. package/agile-context-engineering/templates/wiki/module-discovery.xml +174 -174
  17. package/agile-context-engineering/templates/wiki/pattern.xml +159 -159
  18. package/agile-context-engineering/templates/wiki/system-architecture.xml +254 -254
  19. package/agile-context-engineering/templates/wiki/system-cross-cutting.xml +197 -197
  20. package/agile-context-engineering/templates/wiki/system.xml +381 -381
  21. package/agile-context-engineering/templates/wiki/walkthrough.xml +255 -0
  22. package/agile-context-engineering/templates/wiki/wiki-readme.xml +297 -276
  23. package/agile-context-engineering/utils/questioning.xml +110 -110
  24. package/agile-context-engineering/workflows/execute-story.xml +1219 -1145
  25. package/agile-context-engineering/workflows/help.xml +540 -540
  26. package/agile-context-engineering/workflows/init-coding-standards.xml +386 -386
  27. package/agile-context-engineering/workflows/map-story.xml +1046 -797
  28. package/agile-context-engineering/workflows/map-subsystem.xml +2 -1
  29. package/agile-context-engineering/workflows/map-walkthrough.xml +457 -0
  30. package/agile-context-engineering/workflows/plan-feature.xml +1495 -1495
  31. package/agile-context-engineering/workflows/plan-story.xml +36 -1
  32. package/agile-context-engineering/workflows/research-integration-solution.xml +1 -0
  33. package/agile-context-engineering/workflows/research-story-wiki.xml +2 -1
  34. package/agile-context-engineering/workflows/research-technical-solution.xml +1 -0
  35. package/agile-context-engineering/workflows/review-story.xml +281 -281
  36. package/agile-context-engineering/workflows/update.xml +238 -207
  37. package/bin/install.js +8 -0
  38. package/commands/ace/execute-story.md +1 -0
  39. package/commands/ace/help.md +93 -93
  40. package/commands/ace/init-coding-standards.md +83 -83
  41. package/commands/ace/map-story.md +165 -156
  42. package/commands/ace/map-subsystem.md +140 -138
  43. package/commands/ace/map-system.md +92 -92
  44. package/commands/ace/map-walkthrough.md +127 -0
  45. package/commands/ace/plan-feature.md +89 -89
  46. package/commands/ace/plan-story.md +15 -1
  47. package/commands/ace/review-story.md +109 -109
  48. package/commands/ace/update.md +56 -54
  49. package/hooks/ace-check-update.js +62 -62
  50. package/hooks/ace-statusline.js +89 -89
  51. package/package.json +4 -3
@@ -12,6 +12,7 @@
12
12
  - patterns/*.md — reusable implementation patterns (via map-story)
13
13
  - cross-cutting/*.md — concerns spanning multiple systems (via map-story)
14
14
  - guides/*.md — step-by-step recipes for common tasks (via map-story)
15
+ - walkthroughs/*.md — deep tutorial-style flow explanations (via map-story)
15
16
  - decisions/*.md — architecture decision records (via map-story)
16
17
 
17
18
  Also produces `.ace/artifacts/subsystems/[subsystem-name]/module-discovery/module-discovery.md`.
@@ -1005,7 +1006,7 @@
1005
1006
 
1006
1007
  <instruction order="4" name="decide-docs">
1007
1008
  You decide what docs to create or update — systems/, patterns/, cross-cutting/,
1008
- guides/, decisions/ — based on what you find in the code files. One call may
1009
+ guides/, walkthroughs/, decisions/ — based on what you find in the code files. One call may
1009
1010
  produce multiple docs across different categories.
1010
1011
  </instruction>
1011
1012
 
@@ -0,0 +1,457 @@
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Create a deep tutorial-style walkthrough document in
5
+ `.docs/wiki/subsystems/[subsystem-name]/walkthroughs/`.
6
+
7
+ A walkthrough traces a single end-to-end flow from entry point to exit point, showing
8
+ ACTUAL code from the codebase at every step. Written for humans (especially new
9
+ developers) who need to UNDERSTAND a complex flow before working with it.
10
+
11
+ This workflow is executed directly — NO sub-agents are spawned.
12
+ The executing agent does everything: finding the entry point, LSP-driven flow tracing,
13
+ code reading, framework research, and document writing.
14
+ </purpose>
15
+
16
+ <mandatory-context>
17
+ Read all files referenced by the invoking command's execution-context before starting.
18
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
19
+ </mandatory-context>
20
+
21
+ <process>
22
+
23
+ <!-- ══════════════════════════════════════════════════════════════════ -->
24
+ <!-- STEP 1: SETUP AND VALIDATE -->
25
+ <!-- ══════════════════════════════════════════════════════════════════ -->
26
+
27
+ <step name="setup" order="1">
28
+
29
+ <substep order="1.1" name="display-banner">
30
+ Display stage banner:
31
+
32
+ ```
33
+ ╔══════════════════════════════════════════════════╗
34
+ ║ ACE > Map Walkthrough ║
35
+ ╚══════════════════════════════════════════════════╝
36
+ ```
37
+ </substep>
38
+
39
+ <substep order="1.2" name="parse-and-validate">
40
+ Parse $ARGUMENTS for: `flow`, `subsystem`, `emphasis-frameworks`.
41
+
42
+ **If `flow` is missing:** Ask the user:
43
+ - header: "Walkthrough"
44
+ - question: "Describe the flow to trace — where does it START and where does it END?\nE.g., 'tick data from bybit websocket to timescaledb'"
45
+
46
+ **If `subsystem` is missing:** Ask the user:
47
+ - header: "Walkthrough"
48
+ - question: "Which subsystem should this walkthrough live under?\n(The flow may span multiple subsystems — this just determines the wiki location.)"
49
+ </substep>
50
+
51
+ <substep order="1.3" name="resolve-subsystem">
52
+ Resolve the subsystem. Check if `.docs/wiki/subsystems/[subsystem-name]/` exists.
53
+
54
+ **If not found:**
55
+ ```
56
+ ! No wiki found for subsystem "[subsystem]".
57
+ Run /ace:map-subsystem first to create the subsystem wiki.
58
+ ```
59
+ Exit.
60
+
61
+ Ensure walkthroughs directory exists:
62
+ ```bash
63
+ mkdir -p .docs/wiki/subsystems/[subsystem_name]/walkthroughs
64
+ ```
65
+ </substep>
66
+
67
+ Display:
68
+ ```
69
+ i Flow: [flow description]
70
+ Subsystem: [subsystem-name]
71
+ Emphasis frameworks: [list, or "none"]
72
+ ```
73
+
74
+ Continue to step 2.
75
+ </step>
76
+
77
+ <!-- ══════════════════════════════════════════════════════════════════ -->
78
+ <!-- STEP 2: CHECK FOR EXISTING WALKTHROUGH -->
79
+ <!-- ══════════════════════════════════════════════════════════════════ -->
80
+
81
+ <step name="check-existing" order="2">
82
+
83
+ Scan for existing walkthroughs:
84
+
85
+ ```
86
+ Glob(pattern='*.md', path='.docs/wiki/subsystems/[subsystem_name]/walkthroughs')
87
+ ```
88
+
89
+ **If existing walkthroughs found:**
90
+ Read their titles (first line of each file). Check if any covers the same
91
+ or overlapping flow.
92
+
93
+ **If overlap detected:**
94
+ Use AskUserQuestion:
95
+ - header: "Walkthrough"
96
+ - question: "An existing walkthrough may cover a similar flow:\n\n- `[existing-file]`: [title]\n\nShould I update the existing walkthrough or create a new one?"
97
+ - options:
98
+ - "Update existing" — set MODE = update, set TARGET_FILE = existing path
99
+ - "Create new" — set MODE = create
100
+
101
+ **If no overlap or no existing walkthroughs:** Set MODE = create.
102
+
103
+ **If MODE = create:**
104
+ Derive file name from flow description in kebab-case.
105
+ Set TARGET_FILE = `.docs/wiki/subsystems/[subsystem_name]/walkthroughs/[flow-name].md`
106
+
107
+ Continue to step 3.
108
+ </step>
109
+
110
+ <!-- ══════════════════════════════════════════════════════════════════ -->
111
+ <!-- STEP 3: FIND ENTRY POINT AND TRACE THE ENTIRE FLOW -->
112
+ <!-- ══════════════════════════════════════════════════════════════════ -->
113
+
114
+ <step name="trace-flow" order="3">
115
+
116
+ The flow description tells you WHERE it starts and WHERE it ends.
117
+ Your job: find the entry point in the codebase, then follow EVERY SINGLE CALL
118
+ through the entire code until you reach the exit point.
119
+
120
+ **The flow may cross subsystem boundaries.** Do NOT stop tracing when
121
+ the code leaves the specified subsystem. Follow the call chain wherever
122
+ it goes — across projects, services, layers, subsystems. The `subsystem`
123
+ parameter only determines where the walkthrough FILE is placed.
124
+
125
+ <substep order="3.1" name="find-entry-point">
126
+ Read the subsystem's structure.md and architecture.md for context.
127
+
128
+ From the flow description, identify what the entry point is:
129
+ - A websocket handler? Grep for websocket/connection setup.
130
+ - An API endpoint? Grep for route/controller definitions.
131
+ - A SignalR hub method? Grep for Hub classes.
132
+ - A message consumer? Grep for queue/topic subscriptions.
133
+ - A scheduled job? Grep for cron/timer/scheduler setup.
134
+
135
+ Use Grep and Glob to find the specific file and class/method that
136
+ receives the initial input described in the flow.
137
+
138
+ Read the file. Confirm you have the right entry point.
139
+
140
+ **If you cannot confidently identify the entry point:** ASK the user.
141
+ Use AskUserQuestion:
142
+ - header: "Walkthrough"
143
+ - question: "I found these possible entry points for the flow:\n\n[candidates]\n\nWhich one starts the flow you described? Or point me to the right file/class."
144
+
145
+ **If the flow description is ambiguous or could mean multiple things:** ASK.
146
+ Do NOT guess. A wrong entry point means the entire walkthrough is wrong.
147
+ </substep>
148
+
149
+ <substep order="3.2" name="follow-every-call">
150
+ From the entry point, follow the COMPLETE call chain.
151
+
152
+ **THE RULE: follow EVERY significant method call until the flow terminates.**
153
+
154
+ WebSocket handler calls a service method? Follow it.
155
+ Service calls a repository? Follow it.
156
+ Repository calls the database? Follow it.
157
+ Service emits an event? Follow the handler.
158
+ Handler calls another service? Follow it.
159
+
160
+ For each method you encounter:
161
+ 1. Use LSP Go to Definition to find where it lives
162
+ 2. Read the target file and method
163
+ 3. Identify what IT calls next in the flow
164
+ 4. Follow that call too
165
+ 5. Use LSP Find References when tracing callbacks, events, or interface implementations
166
+ 6. Use Grep as fallback when LSP cannot resolve (dynamic dispatch, config-based wiring, DI)
167
+
168
+ **Stop when:** data reaches its final destination (database write, HTTP response
169
+ sent, message published to external system, UI updated) as described in the flow.
170
+
171
+ **If the call chain branches or you're unsure which path is the flow:** ASK.
172
+ Use AskUserQuestion:
173
+ - header: "Walkthrough"
174
+ - question: "The flow branches at [class.method]:\n\n[describe branches]\n\nWhich path should I follow?"
175
+
176
+ **If a call cannot be resolved** (dynamic dispatch, reflection, config-based):
177
+ Note it and ask the user only if it blocks the trace. Otherwise grep for
178
+ likely implementations and pick the one that matches the flow description.
179
+ </substep>
180
+
181
+ <substep order="3.3" name="build-flow-steps">
182
+ Build an ordered list of every step in the flow:
183
+
184
+ ```
185
+ FLOW_STEPS = [
186
+ { file, class, method, code_snippet, calls_next, framework_interactions },
187
+ ...
188
+ ]
189
+ ```
190
+
191
+ For each step:
192
+ - Read the full surrounding context (constructor, dependencies, class hierarchy)
193
+ - Extract a FOCUSED code snippet (the relevant portion, `// ...` for omitted parts)
194
+ - Note any emphasis framework interactions (classes, methods, APIs from those frameworks)
195
+ </substep>
196
+
197
+ Continue to step 4.
198
+ </step>
199
+
200
+ <!-- ══════════════════════════════════════════════════════════════════ -->
201
+ <!-- STEP 4: RESEARCH EMPHASIS FRAMEWORK USAGES -->
202
+ <!-- ══════════════════════════════════════════════════════════════════ -->
203
+
204
+ <step name="research-frameworks" order="4">
205
+
206
+ <variant condition="no emphasis-frameworks specified">
207
+ Skip to step 5.
208
+ </variant>
209
+
210
+ <variant condition="emphasis-frameworks specified">
211
+
212
+ <substep order="4.1" name="extract-usages">
213
+ From FLOW_STEPS, extract EVERY interaction with emphasis frameworks:
214
+
215
+ For each emphasis framework, compile:
216
+ ```
217
+ FRAMEWORK_USAGES[framework_name] = [
218
+ { step_index, class_name, method_name, api_call, context },
219
+ ...
220
+ ]
221
+ ```
222
+
223
+ E.g., for SignalR:
224
+ - Step 2: `TickHub` inherits `Hub` — SignalR Hub base class
225
+ - Step 2: `Clients.All.SendAsync("ReceiveTick", data)` — SignalR broadcast
226
+ - Step 5: `HubConnection.On("ReceiveTick", handler)` — SignalR client subscription
227
+
228
+ These are the SPECIFIC concepts that need info boxes.
229
+ </substep>
230
+
231
+ <substep order="4.2" name="research-specific-concepts">
232
+ For each unique framework concept found in the actual code, research it.
233
+
234
+ Each emphasis-frameworks entry is either a NAME (research it) or a
235
+ file path / URL (read it directly and infer the framework name from content).
236
+
237
+ <variant condition="entry is a file path or URL">
238
+ Read the document (Read for local files, WebFetch for URLs).
239
+ Infer the framework name from the document content.
240
+
241
+ The provided URL is typically a landing/overview page. You MUST
242
+ navigate deeper — follow internal links to find the specific pages
243
+ that document each concept extracted in 4.1. E.g., if the code uses
244
+ `Hub.SendAsync()` and the user gave the SignalR overview URL, follow
245
+ links from that page to find the Hubs documentation, then the
246
+ server-side API reference for `SendAsync`.
247
+
248
+ For each concept from 4.1:
249
+ 1. Scan the provided page for links to relevant sub-pages
250
+ 2. WebFetch those sub-pages
251
+ 3. Extract the specific documentation for the concept
252
+ 4. Record the exact URL where the concept is documented
253
+ </variant>
254
+
255
+ <variant condition="entry is a framework name — research needed">
256
+ For each unique concept, research using context7 first, then WebSearch:
257
+
258
+ ```
259
+ mcp__context7__resolve-library-id(libraryName="[framework name]")
260
+ ```
261
+
262
+ **If resolved:**
263
+ ```
264
+ mcp__context7__query-docs(
265
+ libraryId=[resolved ID],
266
+ query="[specific concept from the code, e.g. 'Hub base class SendAsync', 'HubConnection.On callback']"
267
+ )
268
+ ```
269
+
270
+ **If context7 fails or insufficient:**
271
+ ```
272
+ WebSearch(query="[framework] [specific concept] official documentation [language]")
273
+ ```
274
+ Then fetch the official doc page:
275
+ ```
276
+ WebFetch(url="[official docs URL]")
277
+ ```
278
+ </variant>
279
+
280
+ For each concept, store:
281
+ ```
282
+ CONCEPT_RESEARCH[concept] = {
283
+ framework: "[name]",
284
+ what_it_is: "[terse explanation]",
285
+ what_it_does_for_us: "[how it's used in THIS code]",
286
+ official_docs_url: "[URL]"
287
+ }
288
+ ```
289
+ </substep>
290
+ </variant>
291
+
292
+ Continue to step 5.
293
+ </step>
294
+
295
+ <!-- ══════════════════════════════════════════════════════════════════ -->
296
+ <!-- STEP 5: WRITE THE WALKTHROUGH -->
297
+ <!-- ══════════════════════════════════════════════════════════════════ -->
298
+
299
+ <step name="write-walkthrough" order="5">
300
+
301
+ Read ALL existing wiki docs under `.docs/wiki/subsystems/[subsystem_name]/`
302
+ for cross-referencing in the Related Documentation section.
303
+
304
+ Follow the walkthrough template structure exactly.
305
+
306
+ <substep order="5.1" name="write-header-and-file-map">
307
+ - Title: derived from flow description
308
+ - One-line description of what the flow does and when it triggers
309
+ - Files Involved: list all discovered files in execution order
310
+ </substep>
311
+
312
+ <substep order="5.2" name="write-flow-diagram">
313
+ Build the mermaid sequenceDiagram from FLOW_STEPS.
314
+ Participants = real classes/components.
315
+ Arrows = real method calls, labeled with method names.
316
+ </substep>
317
+
318
+ <substep order="5.3" name="write-steps">
319
+ For EACH entry in FLOW_STEPS, write one Step section:
320
+
321
+ - **File:** reference in `file:Class.Method` format
322
+ - 1-2 sentences: what this step does and WHY (no filler)
323
+ - Code snippet: actual code from the file, focused on what the step explains
324
+ - Post-snippet explanation: ONLY what's non-obvious
325
+ - **If this step has framework_interactions AND emphasis-frameworks specified:**
326
+ Add a framework info box immediately after the code snippet:
327
+
328
+ ```markdown
329
+ > **[Framework]: [Concept]**
330
+ >
331
+ > [From CONCEPT_RESEARCH: what_it_is + what_it_does_for_us. Dense. No filler.]
332
+ >
333
+ > *Source: [official_docs_url]*
334
+ ```
335
+
336
+ Each concept explained ONCE at its first appearance. Subsequent steps
337
+ reference the first: "See [Step N](#step-n-...) for [Concept] explanation."
338
+ </substep>
339
+
340
+ <substep order="5.4" name="write-framework-reference">
341
+ **If emphasis-frameworks specified:**
342
+ Write the Framework Concepts Reference table:
343
+
344
+ | Concept | Framework | What It Does | First Appearance |
345
+ |---------|-----------|-------------|------------------|
346
+ | [concept] | [framework] | [one-line from research] | [Step N](#step-n) |
347
+ </substep>
348
+
349
+ <substep order="5.5" name="write-related-docs">
350
+ Cross-reference related wiki docs:
351
+ - Relevant system docs under this subsystem
352
+ - Relevant pattern docs
353
+ - Relevant guides
354
+ - Official framework docs (from research URLs)
355
+ </substep>
356
+
357
+ <substep order="5.6" name="write-or-update">
358
+ **If MODE = create:** Write the complete document to TARGET_FILE.
359
+ **If MODE = update:** Read the existing walkthrough, merge changes
360
+ (update code snippets, add/remove steps, update diagram), write to TARGET_FILE.
361
+ </substep>
362
+
363
+ Continue to step 6.
364
+ </step>
365
+
366
+ <!-- ══════════════════════════════════════════════════════════════════ -->
367
+ <!-- STEP 6: VERIFY, COMMIT, AND REPORT -->
368
+ <!-- ══════════════════════════════════════════════════════════════════ -->
369
+
370
+ <step name="verify-and-report" order="6">
371
+
372
+ <substep order="6.1" name="quality-check">
373
+ Re-read TARGET_FILE and verify:
374
+
375
+ <verification-checklist>
376
+ <check>300+ lines (500+ for complex flows with 3+ frameworks)</check>
377
+ <check>Title + one-line description present</check>
378
+ <check>Files Involved lists all source files in execution order</check>
379
+ <check>Mermaid sequenceDiagram present and accurate</check>
380
+ <check>Every step has **File:** reference + code snippet</check>
381
+ <check>Code snippets are actual code (spot-check 2-3 against source files)</check>
382
+ <check>No pseudocode, no fabricated code, no filler phrases</check>
383
+ <check>[If emphasis-frameworks] Every framework interaction has an info box</check>
384
+ <check>[If emphasis-frameworks] Framework Concepts Reference table present</check>
385
+ <check>[If emphasis-frameworks] Info box links point to real official doc URLs</check>
386
+ <check>Related Documentation section present</check>
387
+ <check>Code references use `file:Symbol` format, not line numbers</check>
388
+ </verification-checklist>
389
+
390
+ Fix any failures by editing the document directly.
391
+ </substep>
392
+
393
+ <substep order="6.2" name="security-scan">
394
+ ```
395
+ Grep(
396
+ pattern="(sk-[a-zA-Z0-9]{20,}|sk_live_|sk_test_|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|-----BEGIN.*PRIVATE KEY)",
397
+ path="[TARGET_FILE]",
398
+ output_mode="content"
399
+ )
400
+ ```
401
+
402
+ <variant condition="matches found">SECRETS_FOUND — alert user, do NOT commit.</variant>
403
+ <variant condition="no matches">CLEAN.</variant>
404
+ </substep>
405
+
406
+ <substep order="6.3" name="commit">
407
+ ```bash
408
+ git add [TARGET_FILE]
409
+ git commit -m "docs([subsystem_name]): add walkthrough — [flow-name]"
410
+ ```
411
+ </substep>
412
+
413
+ <substep order="6.4" name="report">
414
+ Display:
415
+
416
+ ```
417
+ ╔══════════════════════════════════════════════════╗
418
+ ║ ACE > Map Walkthrough > Complete ║
419
+ ╚══════════════════════════════════════════════════╝
420
+
421
+ + [TARGET_FILE] ([line count] lines)
422
+
423
+ Flow: [flow description]
424
+ Steps: [step count]
425
+ Emphasis frameworks: [list or "none"]
426
+ Framework info boxes: [count]
427
+
428
+ Next > /clear first for a fresh context window, then:
429
+
430
+ /ace:map-walkthrough — create another walkthrough
431
+ /ace:map-subsystem [subsystem] — map or refresh an entire subsystem
432
+ Review file at [TARGET_FILE]
433
+ ```
434
+ </substep>
435
+
436
+ End workflow.
437
+ </step>
438
+
439
+ </process>
440
+
441
+ <success_criteria>
442
+ <criterion>Entry point found from flow description using subsystem docs + grep</criterion>
443
+ <criterion>EVERY call followed from entry to exit — no gaps in the trace</criterion>
444
+ <criterion>All source files in the flow discovered and read via LSP + code reading</criterion>
445
+ <criterion>Emphasis framework usages extracted from actual code (not generic research)</criterion>
446
+ <criterion>Each specific framework concept researched with official docs link</criterion>
447
+ <criterion>Walkthrough written to .docs/wiki/subsystems/[name]/walkthroughs/</criterion>
448
+ <criterion>Minimum 300 lines (500+ for complex flows)</criterion>
449
+ <criterion>Every step has actual code snippet verified against source file</criterion>
450
+ <criterion>Mermaid sequenceDiagram accurately reflects the traced flow</criterion>
451
+ <criterion>Framework info box at every emphasis framework interaction</criterion>
452
+ <criterion>Framework Concepts Reference table present (if emphasis-frameworks specified)</criterion>
453
+ <criterion>No pseudocode, no fabricated code, no filler</criterion>
454
+ <criterion>Security scan passed, document committed</criterion>
455
+ </success_criteria>
456
+
457
+ </workflow>