agile-context-engineering 0.2.2 → 0.5.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 (146) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/CHANGELOG.md +82 -0
  3. package/README.md +27 -18
  4. package/agents/ace-product-owner.md +1 -1
  5. package/agents/ace-technical-application-architect.md +28 -0
  6. package/agents/ace-wiki-mapper.md +144 -29
  7. package/bin/install.js +67 -63
  8. package/hooks/ace-check-update.js +17 -9
  9. package/package.json +7 -5
  10. package/shared/lib/ace-core.js +308 -0
  11. package/shared/lib/ace-core.test.js +308 -0
  12. package/shared/lib/ace-github.js +753 -0
  13. package/shared/lib/ace-story.js +400 -0
  14. package/shared/lib/ace-story.test.js +250 -0
  15. package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
  16. package/skills/execute-story/SKILL.md +110 -0
  17. package/skills/execute-story/script.js +305 -0
  18. package/skills/execute-story/script.test.js +261 -0
  19. package/skills/execute-story/walkthrough-template.xml +255 -0
  20. package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +83 -9
  21. package/skills/help/SKILL.md +69 -0
  22. package/skills/help/script.js +318 -0
  23. package/skills/help/script.test.js +183 -0
  24. package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +8 -8
  25. package/skills/init-coding-standards/SKILL.md +72 -0
  26. package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +38 -0
  27. package/skills/init-coding-standards/script.js +59 -0
  28. package/skills/init-coding-standards/script.test.js +70 -0
  29. package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +4 -9
  30. package/skills/map-cross-cutting/SKILL.md +89 -0
  31. package/skills/map-cross-cutting/workflow.xml +330 -0
  32. package/skills/map-guide/SKILL.md +89 -0
  33. package/skills/map-guide/workflow.xml +320 -0
  34. package/skills/map-pattern/SKILL.md +89 -0
  35. package/skills/map-pattern/workflow.xml +331 -0
  36. package/skills/map-story/SKILL.md +127 -0
  37. package/skills/map-story/templates/guide.xml +137 -0
  38. package/skills/map-story/templates/pattern.xml +159 -0
  39. package/skills/map-story/templates/system-cross-cutting.xml +197 -0
  40. package/skills/map-story/templates/walkthrough.xml +255 -0
  41. package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +258 -9
  42. package/skills/map-subsystem/SKILL.md +111 -0
  43. package/skills/map-subsystem/script.js +60 -0
  44. package/skills/map-subsystem/script.test.js +68 -0
  45. package/skills/map-subsystem/templates/decizions.xml +115 -0
  46. package/skills/map-subsystem/templates/guide.xml +137 -0
  47. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +3 -3
  48. package/skills/map-subsystem/templates/pattern.xml +159 -0
  49. package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
  50. package/skills/map-subsystem/templates/system.xml +381 -0
  51. package/skills/map-subsystem/templates/walkthrough.xml +255 -0
  52. package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +17 -21
  53. package/skills/map-sys-doc/SKILL.md +90 -0
  54. package/skills/map-sys-doc/system.xml +381 -0
  55. package/skills/map-sys-doc/workflow.xml +336 -0
  56. package/skills/map-system/SKILL.md +85 -0
  57. package/skills/map-system/script.js +84 -0
  58. package/skills/map-system/script.test.js +73 -0
  59. package/skills/map-system/templates/wiki-readme.xml +297 -0
  60. package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +11 -16
  61. package/skills/map-walkthrough/SKILL.md +92 -0
  62. package/skills/map-walkthrough/walkthrough.xml +255 -0
  63. package/skills/map-walkthrough/workflow.xml +457 -0
  64. package/skills/plan-backlog/SKILL.md +75 -0
  65. package/skills/plan-backlog/script.js +136 -0
  66. package/skills/plan-backlog/script.test.js +83 -0
  67. package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +13 -21
  68. package/skills/plan-feature/SKILL.md +76 -0
  69. package/skills/plan-feature/script.js +148 -0
  70. package/skills/plan-feature/script.test.js +80 -0
  71. package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +21 -29
  72. package/skills/plan-product-vision/SKILL.md +75 -0
  73. package/skills/plan-product-vision/script.js +60 -0
  74. package/skills/plan-product-vision/script.test.js +69 -0
  75. package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +4 -9
  76. package/skills/plan-story/SKILL.md +116 -0
  77. package/skills/plan-story/script.js +326 -0
  78. package/skills/plan-story/script.test.js +240 -0
  79. package/skills/plan-story/story-template.xml +451 -0
  80. package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1285 -909
  81. package/skills/research-external-solution/SKILL.md +107 -0
  82. package/skills/research-external-solution/script.js +238 -0
  83. package/skills/research-external-solution/script.test.js +134 -0
  84. package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +4 -6
  85. package/skills/research-integration-solution/SKILL.md +98 -0
  86. package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +1 -0
  87. package/skills/research-integration-solution/script.js +231 -0
  88. package/skills/research-integration-solution/script.test.js +134 -0
  89. package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +4 -5
  90. package/skills/research-story-wiki/SKILL.md +92 -0
  91. package/skills/research-story-wiki/script.js +231 -0
  92. package/skills/research-story-wiki/script.test.js +138 -0
  93. package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +4 -0
  94. package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +5 -6
  95. package/skills/research-technical-solution/SKILL.md +103 -0
  96. package/skills/research-technical-solution/script.js +231 -0
  97. package/skills/research-technical-solution/script.test.js +134 -0
  98. package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +4 -5
  99. package/skills/review-story/SKILL.md +100 -0
  100. package/skills/review-story/script.js +257 -0
  101. package/skills/review-story/script.test.js +169 -0
  102. package/skills/review-story/story-template.xml +451 -0
  103. package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +1 -3
  104. package/skills/update/SKILL.md +53 -0
  105. package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +237 -207
  106. package/agile-context-engineering/src/ace-tools.js +0 -2881
  107. package/agile-context-engineering/src/ace-tools.test.js +0 -1089
  108. package/agile-context-engineering/templates/_command.md +0 -54
  109. package/agile-context-engineering/templates/_workflow.xml +0 -17
  110. package/agile-context-engineering/templates/config.json +0 -0
  111. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  112. package/agile-context-engineering/templates/wiki/wiki-readme.xml +0 -276
  113. package/commands/ace/execute-story.md +0 -137
  114. package/commands/ace/help.md +0 -93
  115. package/commands/ace/init-coding-standards.md +0 -83
  116. package/commands/ace/map-story.md +0 -156
  117. package/commands/ace/map-subsystem.md +0 -138
  118. package/commands/ace/map-system.md +0 -92
  119. package/commands/ace/plan-backlog.md +0 -83
  120. package/commands/ace/plan-feature.md +0 -89
  121. package/commands/ace/plan-product-vision.md +0 -81
  122. package/commands/ace/plan-story.md +0 -145
  123. package/commands/ace/research-external-solution.md +0 -138
  124. package/commands/ace/research-integration-solution.md +0 -135
  125. package/commands/ace/research-story-wiki.md +0 -116
  126. package/commands/ace/research-technical-solution.md +0 -147
  127. package/commands/ace/review-story.md +0 -109
  128. package/commands/ace/update.md +0 -54
  129. /package/{agile-context-engineering → shared}/utils/questioning.xml +0 -0
  130. /package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +0 -0
  131. /package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +0 -0
  132. /package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +0 -0
  133. /package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +0 -0
  134. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +0 -0
  135. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +0 -0
  136. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +0 -0
  137. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +0 -0
  138. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +0 -0
  139. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +0 -0
  140. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +0 -0
  141. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +0 -0
  142. /package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +0 -0
  143. /package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +0 -0
  144. /package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +0 -0
  145. /package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +0 -0
  146. /package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +0 -0
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * init-coding-standards skill script — Entry point for ace-tools operations
5
+ * needed by the init-coding-standards skill.
6
+ *
7
+ * Subcommands:
8
+ * init [args] Environment detection for init-coding-standards workflow
9
+ *
10
+ * Usage: node script.js <subcommand> [args] [--raw]
11
+ */
12
+
13
+ const {
14
+ loadConfig, pathExists,
15
+ detectBrownfieldStatus, output, error,
16
+ } = require('../../shared/lib/ace-core');
17
+
18
+ // ─── CLI Dispatch ────────────────────────────────────────────────────────────
19
+
20
+ const cwd = process.cwd();
21
+ const args = process.argv.slice(2);
22
+ const raw = args.includes('--raw');
23
+ const cmd = args[0];
24
+
25
+ switch (cmd) {
26
+ case 'init':
27
+ cmdInit(cwd, raw, args.slice(1).filter(a => a !== '--raw'));
28
+ break;
29
+ default:
30
+ error(`Unknown command: ${cmd}\nAvailable: init`);
31
+ }
32
+
33
+ // ─── Init: Coding Standards ─────────────────────────────────────────────────
34
+
35
+ function cmdInit(cwd, raw) {
36
+ const config = loadConfig(cwd);
37
+ const brownfield = detectBrownfieldStatus(cwd);
38
+
39
+ const result = {
40
+ // Config
41
+ commit_docs: config.commit_docs,
42
+
43
+ // Brownfield detection
44
+ ...brownfield,
45
+
46
+ // Existing coding standards
47
+ has_coding_standards: pathExists(cwd, '.docs/wiki/system-wide/coding-standards.md'),
48
+ wiki_dir_exists: pathExists(cwd, '.docs/wiki/system-wide'),
49
+
50
+ // Existing wiki context (useful for cross-referencing)
51
+ has_system_architecture: pathExists(cwd, '.docs/wiki/system-wide/system-architecture.md'),
52
+ has_system_structure: pathExists(cwd, '.docs/wiki/system-wide/system-structure.md'),
53
+
54
+ // Git state
55
+ has_git: pathExists(cwd, '.git'),
56
+ };
57
+
58
+ output(result, raw);
59
+ }
@@ -0,0 +1,70 @@
1
+ const { describe, it, before, after } = require('node:test');
2
+ const assert = require('node:assert');
3
+ const { execSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const os = require('os');
7
+
8
+ const SCRIPT = path.join(__dirname, 'script.js');
9
+
10
+ function createTestProject() {
11
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ace-test-'));
12
+
13
+ const aceDir = path.join(tmpDir, '.ace');
14
+ fs.mkdirSync(aceDir, { recursive: true });
15
+ fs.writeFileSync(path.join(aceDir, 'config.json'), JSON.stringify({
16
+ version: '0.1.0',
17
+ projectName: 'test-project',
18
+ model_profile: 'quality',
19
+ commit_docs: true,
20
+ github: { enabled: false },
21
+ }, null, 2));
22
+
23
+ return tmpDir;
24
+ }
25
+
26
+ function runScript(subcommand, args, cwd) {
27
+ return execSync(`node "${SCRIPT}" ${subcommand} ${args}`, {
28
+ cwd,
29
+ encoding: 'utf-8',
30
+ timeout: 10000,
31
+ });
32
+ }
33
+
34
+ function cleanup(tmpDir) {
35
+ fs.rmSync(tmpDir, { recursive: true, force: true });
36
+ }
37
+
38
+ describe('init-coding-standards script', () => {
39
+ it('errors on unknown command', () => {
40
+ assert.throws(() => {
41
+ execSync(`node "${SCRIPT}" bogus`, { encoding: 'utf-8', stdio: 'pipe' });
42
+ });
43
+ });
44
+
45
+ describe('init', () => {
46
+ let tmpDir;
47
+
48
+ before(() => { tmpDir = createTestProject(); });
49
+ after(() => { cleanup(tmpDir); });
50
+
51
+ it('init returns valid JSON', () => {
52
+ const result = JSON.parse(runScript('init', '', tmpDir));
53
+ assert.ok(typeof result === 'object');
54
+ assert.strictEqual(typeof result.commit_docs, 'boolean');
55
+ assert.strictEqual(typeof result.has_git, 'boolean');
56
+ assert.strictEqual(typeof result.is_brownfield, 'boolean');
57
+ assert.strictEqual(typeof result.has_coding_standards, 'boolean');
58
+ assert.strictEqual(typeof result.wiki_dir_exists, 'boolean');
59
+ assert.strictEqual(typeof result.has_system_architecture, 'boolean');
60
+ assert.strictEqual(typeof result.has_system_structure, 'boolean');
61
+ });
62
+
63
+ it('returns brownfield detection fields', () => {
64
+ const result = JSON.parse(runScript('init', '', tmpDir));
65
+ assert.strictEqual(typeof result.is_brownfield, 'boolean');
66
+ assert.strictEqual(typeof result.is_greenfield, 'boolean');
67
+ assert.strictEqual(result.is_brownfield, !result.is_greenfield);
68
+ });
69
+ });
70
+ });
@@ -23,18 +23,13 @@
23
23
  <step name="setup" order="1">
24
24
  **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
25
25
 
26
- ```bash
27
- INIT=$(node ~/.claude/agile-context-engineering/src/ace-tools.js init coding-standards)
28
- ```
26
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
29
27
 
30
- Parse JSON for: `commit_docs`, `is_brownfield`, `is_greenfield`, `has_existing_code`,
28
+ Parse INIT JSON for: `commit_docs`, `is_brownfield`, `is_greenfield`, `has_existing_code`,
31
29
  `has_package_file`, `has_coding_standards`, `wiki_dir_exists`, `has_system_architecture`,
32
30
  `has_system_structure`, `has_git`.
33
31
 
34
- Also resolve the mapper model for spawning the wiki-mapper agent:
35
- ```bash
36
- MAPPER_MODEL=$(node ~/.claude/agile-context-engineering/src/ace-tools.js resolve-model ace-wiki-mapper --raw)
37
- ```
32
+ MAPPER_MODEL is available from INIT.mapper_model do NOT re-run resolve-model.
38
33
 
39
34
  Display stage banner:
40
35
 
@@ -275,7 +270,7 @@
275
270
 
276
271
  **Instructions:**
277
272
  1. Read the coding standards template:
278
- ~/.claude/agile-context-engineering/templates/wiki/coding-standards.xml
273
+ ${CLAUDE_SKILL_DIR}/coding-standards-template.xml
279
274
  2. Assemble the document following the template's assembly guidelines:
280
275
  - ALWAYS include universal-standards (adapt placeholders to the project's language)
281
276
  - Include paradigm modules based on context brief (OOP, functional, systems, or multiple)
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: map-cross-cutting
3
+ description: Create or update a cross-cutting concern doc in .docs/wiki/subsystems/[name]/cross-cutting/ — shared infrastructure spanning multiple systems
4
+ argument-hint: "text='Event system used across all drawing components' subsystem='qarc-charts-v2' commits=3"
5
+ disable-model-invocation: true
6
+ allowed-tools:
7
+ - Read
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Write
12
+ - Edit
13
+ - AskUserQuestion
14
+ model: opus
15
+ effort: max
16
+ context: fork
17
+ agent: ace-wiki-mapper
18
+ ---
19
+
20
+ # Map Cross-Cutting
21
+
22
+ Create or update a cross-cutting concern document for shared infrastructure spanning multiple systems.
23
+
24
+ ## When to Use
25
+
26
+ - When a cross-cutting concern needs dedicated documentation
27
+ - After implementing shared infrastructure that multiple systems depend on
28
+ - When agents need to understand how to register with or plug into shared concerns
29
+ - A concern spans multiple domain systems within a subsystem
30
+ - Multiple systems register with or depend on this infrastructure
31
+ - An agent needs to know WHERE to register and HOW to interact with the concern
32
+
33
+ ## Input
34
+
35
+ ### Required
36
+
37
+ - **`text`** (text) — Natural language description of the cross-cutting concern to document. Describes WHAT the concern addresses, which systems it spans. E.g.: "Event system used across all drawing components", "Dependency injection container and service registration", "Authentication middleware and authorization pipeline". If not provided, pause and ask the user.
38
+
39
+ - **`subsystem`** (path | text) — Subsystem where this cross-cutting doc belongs. Wiki location: `.docs/wiki/subsystems/[subsystem]/cross-cutting/`. If not provided, pause and ask the user.
40
+
41
+ ### Optional
42
+
43
+ - **`story-context`** (path | GitHub issue) — Path to story artifacts folder (in `.ace/artifacts/`) OR GitHub issue number/URL. Provides context about a story that introduced or modified this cross-cutting concern. When not provided, the agent discovers the concern from codebase analysis.
44
+
45
+ - **`commits`** (number | comma-separated commit SHAs) — Specifies which commits to analyze for understanding what was built/changed. As a number: analyze the N most recent commits (e.g., commits=3). As commit SHAs: analyze specific commits (e.g., commits='abc123,def456'). When not provided: search the codebase directly using the text description to find all registration points, usages, and integration points.
46
+
47
+ ## Supporting Resources
48
+
49
+ Read ALL of these before starting the workflow:
50
+
51
+ - **Workflow**: Read [workflow.xml](workflow.xml) — complete orchestration process with all steps
52
+ - **Cross-cutting template**: Read [system-cross-cutting.xml](system-cross-cutting.xml) — output format for the cross-cutting concern doc
53
+ - **Questioning guide**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/questioning.xml` — deep questioning techniques
54
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` — ACE output formatting rules
55
+
56
+ ## Process
57
+
58
+ Use the `ace-wiki-mapper` agent that's specialized in wiki exploration and documentation writing.
59
+
60
+ Read all supporting resources listed above, then execute the workflow defined in [workflow.xml](workflow.xml) end-to-end. Preserve all workflow gates (validation, user questions, commits).
61
+
62
+ **Objective:** Create or update a cross-cutting concern document that describes shared infrastructure spanning multiple systems — how it works, registration/setup points, usage patterns, current registrations, integration points, and gotchas. The document an AI agent reads to understand how to register with or plug into shared concerns when implementing new features.
63
+
64
+ ## Artifacts
65
+
66
+ ```
67
+ .docs/wiki/subsystems/[subsystem-name]/cross-cutting/[concern-name].md
68
+ ```
69
+
70
+ ## Example Usage
71
+
72
+ ```
73
+ # Basic cross-cutting concern
74
+ /ace:map-cross-cutting text='Event system used across all drawing components' subsystem='qarc-charts-v2'
75
+
76
+ # With recent commits for context
77
+ /ace:map-cross-cutting text='Dependency injection container' subsystem='api' commits=3
78
+
79
+ # With story context
80
+ /ace:map-cross-cutting text='Authentication middleware' subsystem='api' story-context='.ace/artifacts/product/e1-auth/f1-middleware/s1-setup/s1-setup.md'
81
+ ```
82
+
83
+ ## Next Steps
84
+
85
+ - `/clear` first for a fresh context window
86
+ - `/ace:map-cross-cutting` — create another cross-cutting concern doc
87
+ - `/ace:map-sys-doc` — document a system that uses this concern
88
+ - `/ace:map-guide` — create a guide that includes registration steps
89
+ - Review file at `.docs/wiki/subsystems/[subsystem-name]/cross-cutting/`
@@ -0,0 +1,330 @@
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Create or update a cross-cutting concern document in
5
+ `.docs/wiki/subsystems/[subsystem-name]/cross-cutting/`.
6
+
7
+ A cross-cutting doc describes shared infrastructure or mechanisms that multiple
8
+ domain systems depend on — DI registration, event systems, factory/registry,
9
+ serialization, error handling, auth middleware, caching.
10
+
11
+ The document an AI agent reads to understand how to register with or plug into
12
+ shared concerns.
13
+
14
+ This workflow is executed directly — NO sub-agents are spawned.
15
+ The executing agent does everything: finding registration points, tracing
16
+ usages, and writing the document.
17
+ </purpose>
18
+
19
+ <mandatory-context>
20
+ Read all files referenced by the invoking command's execution-context before starting.
21
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
22
+ </mandatory-context>
23
+
24
+ <process>
25
+
26
+ <!-- ══════════════════════════════════════════════════════════════════ -->
27
+ <!-- STEP 1: SETUP AND VALIDATE -->
28
+ <!-- ══════════════════════════════════════════════════════════════════ -->
29
+
30
+ <step name="setup" order="1">
31
+
32
+ <substep order="1.1" name="display-banner">
33
+ Display stage banner:
34
+
35
+ ```
36
+ ╔══════════════════════════════════════════════════╗
37
+ ║ ACE > Map Cross-Cutting ║
38
+ ╚══════════════════════════════════════════════════╝
39
+ ```
40
+ </substep>
41
+
42
+ <substep order="1.2" name="parse-and-validate">
43
+ Parse $ARGUMENTS for: `text`, `subsystem`, `story-context`, `commits`.
44
+
45
+ **If `text` is missing:** Ask the user:
46
+ - header: "Cross-Cutting"
47
+ - question: "Describe the cross-cutting concern to document — what shared infrastructure spans multiple systems?\nE.g., 'Event system used across all drawing components'"
48
+
49
+ **If `subsystem` is missing:** Ask the user:
50
+ - header: "Cross-Cutting"
51
+ - question: "Which subsystem does this concern belong to?"
52
+ </substep>
53
+
54
+ <substep order="1.3" name="resolve-subsystem">
55
+ Resolve the subsystem. Check if `.docs/wiki/subsystems/[subsystem-name]/` exists.
56
+
57
+ **If not found:**
58
+ ```
59
+ ! No wiki found for subsystem "[subsystem]".
60
+ Run /ace:map-subsystem first to create the subsystem wiki.
61
+ ```
62
+ Exit.
63
+
64
+ Ensure cross-cutting directory exists:
65
+ ```bash
66
+ mkdir -p .docs/wiki/subsystems/[subsystem_name]/cross-cutting
67
+ ```
68
+ </substep>
69
+
70
+ Display:
71
+ ```
72
+ i Concern: [text description]
73
+ Subsystem: [subsystem-name]
74
+ Story context: [path/issue, or "none"]
75
+ Commits: [value, or "search codebase directly"]
76
+ ```
77
+
78
+ Continue to step 2.
79
+ </step>
80
+
81
+ <!-- ══════════════════════════════════════════════════════════════════ -->
82
+ <!-- STEP 2: CHECK FOR EXISTING CROSS-CUTTING DOC -->
83
+ <!-- ══════════════════════════════════════════════════════════════════ -->
84
+
85
+ <step name="check-existing" order="2">
86
+
87
+ Scan for existing cross-cutting docs:
88
+
89
+ ```
90
+ Glob(pattern='*.md', path='.docs/wiki/subsystems/[subsystem_name]/cross-cutting')
91
+ ```
92
+
93
+ **If existing cross-cutting docs found:**
94
+ Read their titles and overview sections. Check if any covers the same
95
+ or overlapping concern.
96
+
97
+ **If overlap detected:**
98
+ Use AskUserQuestion:
99
+ - header: "Cross-Cutting"
100
+ - question: "An existing cross-cutting doc may cover a similar concern:\n\n- `[existing-file]`: [title]\n\nShould I update the existing doc or create a new one?"
101
+ - options:
102
+ - "Update existing" — set MODE = update, set TARGET_FILE = existing path
103
+ - "Create new" — set MODE = create
104
+
105
+ **If no overlap or no existing docs:** Set MODE = create.
106
+
107
+ **If MODE = create:**
108
+ Derive file name from concern name in kebab-case.
109
+ Set TARGET_FILE = `.docs/wiki/subsystems/[subsystem_name]/cross-cutting/[concern-name].md`
110
+
111
+ Continue to step 3.
112
+ </step>
113
+
114
+ <!-- ══════════════════════════════════════════════════════════════════ -->
115
+ <!-- STEP 3: GATHER CODE CONTEXT -->
116
+ <!-- ══════════════════════════════════════════════════════════════════ -->
117
+
118
+ <step name="gather-context" order="3">
119
+
120
+ <substep order="3.1" name="read-story-context">
121
+ <variant condition="story-context is a path">
122
+ Read all markdown files in the story artifacts folder.
123
+ Extract: what shared infrastructure was built/changed.
124
+ </variant>
125
+
126
+ <variant condition="story-context is a GitHub issue">
127
+ ```bash
128
+ gh issue view [issue-number] --json title,body,labels,comments
129
+ ```
130
+ Extract context about the cross-cutting concern.
131
+ </variant>
132
+
133
+ <variant condition="no story-context">
134
+ Skip — discover concern from codebase only.
135
+ </variant>
136
+ </substep>
137
+
138
+ <substep order="3.2" name="find-concern-code">
139
+ <variant condition="commits provided as number N">
140
+ ```bash
141
+ git diff --name-only HEAD~[N]..HEAD
142
+ ```
143
+ Filter to files within the subsystem. Read each file.
144
+ Then search for all other usages/registrations of this concern.
145
+ </variant>
146
+
147
+ <variant condition="commits provided as SHAs">
148
+ ```bash
149
+ git diff --name-only [first-sha]^..[last-sha]
150
+ ```
151
+ Filter to files within the subsystem. Read each file.
152
+ Then search for all other usages/registrations.
153
+ </variant>
154
+
155
+ <variant condition="no commits — search codebase directly">
156
+ Use the `text` description to find the cross-cutting concern:
157
+
158
+ 1. Read the subsystem's structure.md and architecture.md for orientation
159
+ 2. Grep for keywords from the text description (event, registry, factory,
160
+ container, middleware, etc.)
161
+ 3. Find the core infrastructure files (the concern itself)
162
+ 4. Find ALL registration points (where systems plug in)
163
+ 5. Find ALL usages (how consuming code interacts)
164
+ 6. Read each file to understand the mechanism
165
+ </variant>
166
+ </substep>
167
+
168
+ <substep order="3.3" name="analyze-concern">
169
+ From the code, understand:
170
+
171
+ 1. **How It Works**: The mechanism/pattern (event dispatch, DI resolution, etc.)
172
+ 2. **Registration / Setup**: WHERE and HOW components register
173
+ 3. **Usage**: How consuming code interacts with this concern
174
+ 4. **Current Registrations**: Complete list of everything registered
175
+ 5. **Integration Points**: Which systems depend on this concern
176
+ 6. **Gotchas**: Registration order, naming conventions, timing issues
177
+
178
+ Build a complete mental model of the concern.
179
+ </substep>
180
+
181
+ Continue to step 4.
182
+ </step>
183
+
184
+ <!-- ══════════════════════════════════════════════════════════════════ -->
185
+ <!-- STEP 4: WRITE THE CROSS-CUTTING DOC -->
186
+ <!-- ══════════════════════════════════════════════════════════════════ -->
187
+
188
+ <step name="write-doc" order="4">
189
+
190
+ Read ALL existing wiki docs under `.docs/wiki/subsystems/[subsystem_name]/`
191
+ for cross-referencing in Integration Points.
192
+
193
+ Follow the system-cross-cutting template structure exactly.
194
+
195
+ <substep order="4.1" name="write-overview">
196
+ - Title: "# [Cross-Cutting Concern]"
197
+ - Overview: ONE paragraph — what the concern addresses, why it exists
198
+ </substep>
199
+
200
+ <substep order="4.2" name="write-how-it-works">
201
+ Numbered steps explaining the mechanism.
202
+ Reference actual code locations — not theoretical descriptions.
203
+ If the mechanism has a flow (event dispatching, DI resolution),
204
+ show a mermaid sequence diagram.
205
+ </substep>
206
+
207
+ <substep order="4.3" name="write-registration">
208
+ The MOST CRITICAL section for AI agents.
209
+ List every registration point with exact file paths.
210
+ Show the registration pattern (inline code only if non-obvious).
211
+ </substep>
212
+
213
+ <substep order="4.4" name="write-usage">
214
+ How consuming code interacts with this concern.
215
+ Inline code snippet ONLY if usage pattern is non-obvious.
216
+ If straightforward (inject via constructor), a one-liner suffices.
217
+ </substep>
218
+
219
+ <substep order="4.5" name="write-current-registrations">
220
+ Complete list of everything currently registered/using this concern.
221
+ Agent uses this to verify consistency of new registrations.
222
+ </substep>
223
+
224
+ <substep order="4.6" name="write-integration-and-gotchas">
225
+ - Integration Points: cross-reference with markdown links to system docs
226
+ - Gotchas: registration order, naming conventions, initialization timing,
227
+ anything that silently fails if done wrong
228
+ </substep>
229
+
230
+ <substep order="4.7" name="write-or-update">
231
+ **If MODE = create:** Write the complete document to TARGET_FILE.
232
+ **If MODE = update:** Read the existing doc, add new registrations,
233
+ update mechanism if changed, add new gotchas. Write to TARGET_FILE.
234
+ </substep>
235
+
236
+ Continue to step 5.
237
+ </step>
238
+
239
+ <!-- ══════════════════════════════════════════════════════════════════ -->
240
+ <!-- STEP 5: VERIFY, COMMIT, AND REPORT -->
241
+ <!-- ══════════════════════════════════════════════════════════════════ -->
242
+
243
+ <step name="verify-and-report" order="5">
244
+
245
+ <substep order="5.1" name="quality-check">
246
+ Re-read TARGET_FILE and verify:
247
+
248
+ <verification-checklist>
249
+ <check>50+ lines of substantial content</check>
250
+ <check>Overview present (ONE paragraph)</check>
251
+ <check>"How It Works" has numbered steps with code references</check>
252
+ <check>"Registration / Setup" lists ALL registration points with exact file paths</check>
253
+ <check>"Current Registrations" lists ALL known registrations</check>
254
+ <check>"Integration Points" cross-references system docs with markdown links</check>
255
+ <check>"Gotchas" section present with practical warnings</check>
256
+ <check>Code references use `file:Symbol` format, not line numbers</check>
257
+ <check>If mechanism has a flow, mermaid diagram present</check>
258
+ <check>No filler phrases, no generic advice</check>
259
+ <check>No ASCII arrows for flows (all mermaid)</check>
260
+ </verification-checklist>
261
+
262
+ Fix any failures by editing the document directly.
263
+ </substep>
264
+
265
+ <substep order="5.2" name="security-scan">
266
+ ```
267
+ Grep(
268
+ 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)",
269
+ path="[TARGET_FILE]",
270
+ output_mode="content"
271
+ )
272
+ ```
273
+
274
+ <variant condition="matches found">SECRETS_FOUND — alert user, do NOT commit.</variant>
275
+ <variant condition="no matches">CLEAN.</variant>
276
+ </substep>
277
+
278
+ <substep order="5.3" name="commit">
279
+ ```bash
280
+ git add [TARGET_FILE]
281
+ git commit -m "docs([subsystem_name]): add cross-cutting — [concern-name]"
282
+ ```
283
+ </substep>
284
+
285
+ <substep order="5.4" name="report">
286
+ Display:
287
+
288
+ ```
289
+ ╔══════════════════════════════════════════════════╗
290
+ ║ ACE > Map Cross-Cutting > Complete ║
291
+ ╚══════════════════════════════════════════════════╝
292
+
293
+ + [TARGET_FILE] ([line count] lines)
294
+
295
+ Concern: [text description]
296
+ Registrations found: [count]
297
+ Integration points: [count]
298
+ Gotchas: [count]
299
+
300
+ Next > /clear first for a fresh context window, then:
301
+
302
+ /ace:map-cross-cutting — create another cross-cutting doc
303
+ /ace:map-sys-doc — document a system that uses this concern
304
+ /ace:map-guide — create a guide with registration steps
305
+ Review file at [TARGET_FILE]
306
+ ```
307
+ </substep>
308
+
309
+ End workflow.
310
+ </step>
311
+
312
+ </process>
313
+
314
+ <success_criteria>
315
+ <criterion>Concern description parsed and subsystem validated</criterion>
316
+ <criterion>Core infrastructure files discovered (from commits or codebase search)</criterion>
317
+ <criterion>All registration points found and documented</criterion>
318
+ <criterion>All current registrations listed</criterion>
319
+ <criterion>Existing cross-cutting docs checked to avoid duplication (create vs update)</criterion>
320
+ <criterion>Cross-cutting doc follows template structure from system-cross-cutting.xml</criterion>
321
+ <criterion>Registration / Setup section lists exact file paths</criterion>
322
+ <criterion>Integration Points cross-reference system docs with markdown links</criterion>
323
+ <criterion>Gotchas section present with practical warnings</criterion>
324
+ <criterion>Code references use file:Symbol format, no line numbers</criterion>
325
+ <criterion>If mechanism has a flow, mermaid diagram present</criterion>
326
+ <criterion>No filler, no generic advice, no pseudocode</criterion>
327
+ <criterion>Security scan passed, document committed</criterion>
328
+ </success_criteria>
329
+
330
+ </workflow>
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: map-guide
3
+ description: Create or update a step-by-step guide in .docs/wiki/subsystems/[name]/guides/ — recipes for common implementation tasks
4
+ argument-hint: "text='How to add a new drawing tool' subsystem='qarc-charts-v2' commits=3"
5
+ disable-model-invocation: true
6
+ allowed-tools:
7
+ - Read
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Write
12
+ - Edit
13
+ - AskUserQuestion
14
+ model: opus
15
+ effort: max
16
+ context: fork
17
+ agent: ace-wiki-mapper
18
+ ---
19
+
20
+ # Map Guide
21
+
22
+ Create or update a step-by-step guide — recipes for common implementation tasks.
23
+
24
+ ## When to Use
25
+
26
+ - When a recurring implementation task needs a step-by-step recipe
27
+ - After discovering a repeatable process that combines multiple patterns/systems
28
+ - When onboarding developers who need to perform common tasks
29
+ - A task is done repeatedly (add new endpoint, add new tool, add new entity)
30
+ - The task spans multiple files, registrations, and configuration steps
31
+ - An agent following the guide can complete the task end-to-end without guessing
32
+
33
+ ## Input
34
+
35
+ ### Required
36
+
37
+ - **`text`** (text) — Natural language description of the guide to create. Describes the recurring task and what the guide should teach. E.g.: "How to add a new drawing tool", "How to add a new CRUD endpoint with validation", "How to add a new indicator to the chart". If not provided, pause and ask the user.
38
+
39
+ - **`subsystem`** (path | text) — Subsystem where this guide belongs. Wiki location: `.docs/wiki/subsystems/[subsystem]/guides/`. If not provided, pause and ask the user.
40
+
41
+ ### Optional
42
+
43
+ - **`story-context`** (path | GitHub issue) — Path to story artifacts folder (in `.ace/artifacts/`) OR GitHub issue number/URL. Provides context about a specific implementation that exemplifies the task this guide describes. When not provided, the agent discovers the recipe from codebase patterns.
44
+
45
+ - **`commits`** (number | comma-separated commit SHAs) — Specifies which commits to analyze for understanding an example implementation. As a number: analyze the N most recent commits (e.g., commits=3). As commit SHAs: analyze specific commits (e.g., commits='abc123,def456'). When not provided: search the codebase directly to find existing implementations and derive the recipe from them.
46
+
47
+ ## Supporting Resources
48
+
49
+ Read ALL of these before starting the workflow:
50
+
51
+ - **Workflow**: Read [workflow.xml](workflow.xml) — complete orchestration process with all steps
52
+ - **Guide template**: Read [guide.xml](guide.xml) — output format for the guide
53
+ - **Questioning guide**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/questioning.xml` — deep questioning techniques
54
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` — ACE output formatting rules
55
+
56
+ ## Process
57
+
58
+ Use the `ace-wiki-mapper` agent that's specialized in wiki exploration and documentation writing.
59
+
60
+ Read all supporting resources listed above, then execute the workflow defined in [workflow.xml](workflow.xml) end-to-end. Preserve all workflow gates (validation, user questions, commits).
61
+
62
+ **Objective:** Create or update a step-by-step guide that combines knowledge from multiple systems, patterns, and cross-cutting concerns into one actionable recipe. Includes prerequisites, numbered ordered steps with "copy from" references, verification checklist, and common mistakes. The document an AI agent follows when performing a recurring task end-to-end.
63
+
64
+ ## Artifacts
65
+
66
+ ```
67
+ .docs/wiki/subsystems/[subsystem-name]/guides/[guide-name].md
68
+ ```
69
+
70
+ ## Example Usage
71
+
72
+ ```
73
+ # Basic guide
74
+ /ace:map-guide text='How to add a new drawing tool' subsystem='qarc-charts-v2'
75
+
76
+ # With recent commits as example
77
+ /ace:map-guide text='How to add a new CRUD endpoint with validation' subsystem='api' commits=3
78
+
79
+ # With story context as example implementation
80
+ /ace:map-guide text='How to add a new indicator to the chart' subsystem='qarc-charts-v2' story-context='.ace/artifacts/product/e2-charts/f1-indicators/s1-rsi/s1-rsi.md'
81
+ ```
82
+
83
+ ## Next Steps
84
+
85
+ - `/clear` first for a fresh context window
86
+ - `/ace:map-guide` — create another guide
87
+ - `/ace:map-pattern` — document a pattern referenced by this guide
88
+ - `/ace:map-sys-doc` — document a system referenced by this guide
89
+ - Review file at `.docs/wiki/subsystems/[subsystem-name]/guides/`