arcane-cli 0.14.0 → 0.15.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 (65) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +253 -253
  3. package/dist/assets/.arcane/agents/agent-policies-template.md +414 -414
  4. package/dist/assets/.arcane/governance/agent-policies.md +414 -414
  5. package/dist/assets/.arcane/governance/agent-work-queue-model.md +61 -61
  6. package/dist/assets/.arcane/governance/cicd-standards.md +227 -227
  7. package/dist/assets/.arcane/governance/development-methodology.md +384 -384
  8. package/dist/assets/.arcane/governance/git-conventions.md +759 -759
  9. package/dist/assets/.arcane/governance/naming-conventions.md +142 -142
  10. package/dist/assets/.arcane/governance/new-business-setup.md +182 -182
  11. package/dist/assets/.arcane/governance/portable-bootstrap.md +101 -101
  12. package/dist/assets/.arcane/governance/product-excellence-standards.md +211 -211
  13. package/dist/assets/.arcane/governance/testing-standards.md +158 -158
  14. package/dist/assets/.arcane/governance/universal-agent-rules.md +108 -108
  15. package/dist/assets/.arcane/image-prompts/adelaide-image-prompt.md +140 -140
  16. package/dist/assets/.arcane/image-prompts/alexander-image-prompt.md +138 -138
  17. package/dist/assets/.arcane/image-prompts/bess-image-prompt.md +139 -139
  18. package/dist/assets/.arcane/image-prompts/circe-image-prompt.md +143 -143
  19. package/dist/assets/.arcane/image-prompts/custodio-image-prompt.md +140 -140
  20. package/dist/assets/.arcane/image-prompts/iris-image-prompt.md +139 -139
  21. package/dist/assets/.arcane/image-prompts/kellar-image-prompt.md +141 -141
  22. package/dist/assets/.arcane/image-prompts/lafayette-image-prompt.md +140 -140
  23. package/dist/assets/.arcane/image-prompts/lince-image-prompt.md +142 -142
  24. package/dist/assets/.arcane/image-prompts/mercurio-image-prompt.md +140 -140
  25. package/dist/assets/.arcane/image-prompts/merlin-image-prompt.md +139 -139
  26. package/dist/assets/.arcane/image-prompts/prospero-image-prompt.md +141 -141
  27. package/dist/assets/.claude/commands/spell-enchant.md +9 -9
  28. package/dist/assets/.github/agents/adelaide.agent.md +44 -44
  29. package/dist/assets/.github/agents/alexander.agent.md +43 -43
  30. package/dist/assets/.github/agents/bess.agent.md +42 -42
  31. package/dist/assets/.github/agents/circe.agent.md +43 -43
  32. package/dist/assets/.github/agents/custodio.agent.md +44 -44
  33. package/dist/assets/.github/agents/iris.agent.md +43 -43
  34. package/dist/assets/.github/agents/kellar.agent.md +43 -43
  35. package/dist/assets/.github/agents/lafayette.agent.md +42 -42
  36. package/dist/assets/.github/agents/lince.agent.md +43 -43
  37. package/dist/assets/.github/agents/mercurio.agent.md +43 -43
  38. package/dist/assets/.github/agents/merlin.agent.md +44 -44
  39. package/dist/assets/.github/agents/prospero.agent.md +43 -43
  40. package/dist/assets/.github/prompts/spell-close-session.prompt.md +17 -5
  41. package/dist/assets/.github/prompts/spell-commit-work.prompt.md +24 -6
  42. package/dist/assets/.github/prompts/spell-create-pull-request.prompt.md +12 -3
  43. package/dist/assets/.github/prompts/spell-enchant.prompt.md +385 -385
  44. package/dist/assets/.github/prompts/spell-feedback.prompt.md +113 -113
  45. package/dist/assets/.github/prompts/spell-full-cycle.prompt.md +202 -201
  46. package/dist/assets/.github/prompts/spell-implement.prompt.md +101 -101
  47. package/dist/assets/.github/prompts/spell-open-session.prompt.md +20 -5
  48. package/dist/assets/.github/prompts/spell-scope.prompt.md +263 -263
  49. package/dist/assets/agents/architecture-lead.yaml +61 -61
  50. package/dist/assets/agents/collaborator.yaml +59 -59
  51. package/dist/assets/agents/devops.yaml +60 -60
  52. package/dist/assets/agents/frontend-dev.yaml +60 -60
  53. package/dist/assets/agents/fullstack-dev.yaml +59 -59
  54. package/dist/assets/agents/marketing-strategist.yaml +60 -60
  55. package/dist/assets/agents/mobile-dev.yaml +59 -59
  56. package/dist/assets/agents/operations-comms.yaml +58 -58
  57. package/dist/assets/agents/orchestrator.yaml +60 -60
  58. package/dist/assets/agents/qa-lead.yaml +60 -60
  59. package/dist/assets/agents/research-analyst.yaml +59 -59
  60. package/dist/assets/agents/security-ops.yaml +61 -61
  61. package/dist/index.js +323 -7
  62. package/dist/index.js.map +1 -1
  63. package/package.json +72 -72
  64. package/dist/assets/.claude/commands/spell-eas-ios-deploy.md +0 -9
  65. package/dist/assets/.github/prompts/spell-eas-ios-deploy.prompt.md +0 -183
@@ -1,384 +1,384 @@
1
- ---
2
- title: Development Methodology — The Spell Loop
3
- audience: both
4
- last_updated: YYYY-MM-DD
5
- status: active
6
- tags: [methodology, spell-loop, development, workflow]
7
- ---
8
-
9
- # Development Methodology — The Spell Loop
10
-
11
- A structured development methodology combining progressive context phases and an autonomous implementation loop, delivered through the Arcane spell system. Designed for multi-agent infrastructure.
12
-
13
- ## Executive Summary
14
-
15
- - The Spell Loop is the standard development methodology for all projects that adopt it.
16
- - It combines two proven patterns: the autonomous implementation loop and the spell system (operational workflows), with structured planning phases.
17
- - Work flows through phases: Plan → [Enchant] → [Assess] → Architect → [Implement → Test → Review]\* → Ship.
18
- - Optional enchantment phase uses Alexander (research) and Circe (marketing) to proactively enhance PRD quality.
19
- - The implementation phase is an autonomous loop — agents iterate until all stories pass quality gates.
20
-
21
- ---
22
-
23
- ## The Spell Loop Flow
24
-
25
- ```mermaid
26
- flowchart TD
27
- A[spell-plan] -->|PRD.md| AE{Enchant?}
28
- AE -->|Yes| AF[spell-enchant]
29
- AF -->|Enhanced PRD| AA{Large PRD?}
30
- AE -->|No| AA{Large PRD?}
31
- AA -->|Yes| AB[spell-scope]
32
- AB -->|execution-plan.md| B[spell-architect]
33
- AA -->|No| B[spell-architect]
34
- B -->|architecture.md + stories.json| C[spell-implement]
35
- C -->|code changes| D[spell-test]
36
- D -->|test results| E{All tests pass?}
37
- E -->|No| C
38
- E -->|Yes| F[spell-review]
39
- F -->|issues found| G{Critical issues?}
40
- G -->|Yes| C
41
- G -->|No| H[spell-ship]
42
- H -->|merge + deploy| I[Done]
43
-
44
- style A fill:#4a90d9,color:#fff
45
- style AE fill:#d4a017,color:#fff
46
- style AF fill:#d4a017,color:#fff
47
- style AA fill:#4a90d9,color:#fff
48
- style AB fill:#4a90d9,color:#fff
49
- style B fill:#4a90d9,color:#fff
50
- style C fill:#e67e22,color:#fff
51
- style D fill:#27ae60,color:#fff
52
- style F fill:#8e44ad,color:#fff
53
- style H fill:#2c3e50,color:#fff
54
- ```
55
-
56
- ### Phase Overview
57
-
58
- | Phase | Spell | Agent Owner | Input | Output |
59
- | ------------------ | ----------------- | ------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
60
- | **Planning** | `spell-plan` | Alexander (research) + Kellar (product) | Feature description or TODO item | `PRD.md` — requirements, acceptance criteria, constraints |
61
- | **Enchantment** | `spell-enchant` | Alexander (research) + Circe (marketing) | PRD.md | Enhanced PRD — proactive quality improvements, competitive analysis, UX/a11y/perf/security gaps filled |
62
- | **Assessment** | `spell-scope` | Merlin + Alexander + Lince | Large PRD | `execution-plan.md` — epics, dependency graph, ADR candidates, security flags, agent assignments |
63
- | **Solutioning** | `spell-architect` | Merlin (architecture) | PRD.md (or single epic from execution plan) | `architecture.md` + `stories.json` — tech decisions, epic/story breakdown |
64
- | **Implementation** | `spell-implement` | Lafayette / Mercurio / Adelaide (build team) | stories.json | Working code, committed per story |
65
- | **Quality** | `spell-test` | Lince (QA) + dev agent | Code changes | Test results, coverage report, evidence |
66
- | **Quality** | `spell-review` | Lince (QA) or Merlin (arch) | Code diff | Adversarial review findings |
67
- | **Delivery** | `spell-ship` | Human (approval) + Prospero (infra) | Passing code + reviews | Merged PR, deployed artifact |
68
-
69
- ---
70
-
71
- ## Key Concepts
72
-
73
- ### Work Tracking Modes
74
-
75
- Arcane supports two work-tracking modes selected early (during `spell-open-session` or `spell-plan`):
76
-
77
- - **`tracking_mode: internal`** — source of truth is repository artifacts (`PRD.md`, `execution-plan.md`, `stories.json`, `TODO.md`), with no external tracker dependency.
78
- - **`tracking_mode: external`** — source of truth is still repository artifacts, but selected milestones/work items are mirrored to an external tracker.
79
-
80
- For backward compatibility with existing Azure DevOps workflows, if tracking mode is not explicitly set and an ADO context is already present (work item ID, org, and project), default to:
81
-
82
- ```yaml
83
- tracking_mode: external
84
- external_provider: ado
85
- ```
86
-
87
- Persist tracking configuration in PRD frontmatter (and in `.arcane.json` when available) so downstream spells do not lose context:
88
-
89
- ```yaml
90
- tracking:
91
- tracking_mode: external # internal | external
92
- external_provider: ado # ado | jira | other
93
- ado:
94
- org: "{ADO_ORG}"
95
- project: "{ADO_PROJECT}"
96
- process_template: "Agile"
97
- ```
98
-
99
- ### Process-Template-Aware ADO Hierarchy Rules
100
-
101
- When `tracking_mode=external` and `external_provider=ado`, do not hardcode work item types. Resolve types from the project's process template and currently enabled types first:
102
-
103
- ```bash
104
- az devops project show \
105
- --org https://dev.azure.com/{org} \
106
- --project {project} \
107
- --query "capabilities.processTemplate.templateName" \
108
- --output tsv
109
-
110
- az boards work-item-type list \
111
- --org https://dev.azure.com/{org} \
112
- --project {project} \
113
- --output json \
114
- --query "[].name"
115
- ```
116
-
117
- Use this fallback order against the discovered type list (baseline observed options: `Bug`, `Epic`, `Feature`, `Issue`, `Task`, `Test Case`, `User Story`):
118
-
119
- | Logical level | Preferred type order |
120
- | --- | --- |
121
- | Epic-level | Epic → Feature → User Story → Issue |
122
- | Feature-level | Feature → User Story → Issue |
123
- | Story-level | User Story → Issue → Task |
124
- | Task-level | Task → Issue |
125
- | Defect-level | Bug → Issue → Task |
126
-
127
- Child linkage rules:
128
-
129
- 1. Preserve logical hierarchy order (Epic-level parent of Feature-level, Feature-level parent of Story-level, Story-level parent of Task/Bug-level).
130
- 2. Attempt native ADO parent/child hierarchy links first.
131
- 3. If the selected fallback type combination cannot be linked as parent/child in that process template, use `Related` links and prefix titles with logical level tags (for example: `[EPIC]`, `[FEATURE]`) to preserve intent.
132
- 4. Never silently flatten hierarchy. Document fallback/link decisions in `execution-plan.md` notes.
133
-
134
- ### External Provider TODOs
135
-
136
- - **Jira (`external_provider=jira`)** — TODO: define issue-type mapping, parent-child/epic linkage strategy, and command examples.
137
- - **Other providers (`external_provider=other`)** — TODO: define required metadata contract and fallback behavior before enabling automation.
138
-
139
- ### Fresh Context Per Iteration
140
-
141
- Each implementation iteration starts with clean context. The only memory between iterations is:
142
-
143
- - **`stories.json`** — which stories are done (`passes: true/false`)
144
- - **`progress.txt`** — append-only learnings from previous iterations
145
- - **Git history** — commits from previous iterations
146
-
147
- This prevents context poisoning — where an agent's failed approach poisons subsequent attempts.
148
-
149
- ### Progressive Context Chain
150
-
151
- Each phase produces artifacts that inform the next phase:
152
-
153
- ```
154
- Feature idea
155
- → PRD.md (requirements, acceptance criteria)
156
- → architecture.md (tech decisions, ADRs)
157
- → stories.json (implementable work units)
158
- → code (guided by architecture + story context)
159
- → test results (validates requirements)
160
- → review findings (validates architecture compliance)
161
- ```
162
-
163
- Without this chain, agents make conflicting decisions across stories (e.g., one uses REST, another uses GraphQL).
164
-
165
- ### Adversarial Review
166
-
167
- `spell-review` requires the reviewer to **find issues**. "Looks good" is not an acceptable review. The reviewer must:
168
-
169
- 1. Find a minimum of 3 issues (or explain why fewer exist)
170
- 2. Classify each as HIGH / MEDIUM / LOW severity
171
- 3. Check for missing test coverage, architecture violations, security issues
172
- 4. Defer unrelated findings to a backlog (don't derail the current change)
173
-
174
- ### Append-Only Progress
175
-
176
- `progress.txt` is never edited, only appended. Each iteration adds:
177
-
178
- ```
179
- ## Iteration N — [story-id] — [timestamp]
180
- ### What was done
181
- - [summary of changes]
182
- ### What was learned
183
- - [patterns discovered, gotchas, conventions]
184
- ### What to watch for
185
- - [warnings for future iterations]
186
- ```
187
-
188
- ---
189
-
190
- ## Story Format (stories.json)
191
-
192
- The Arcane story schema for autonomous implementation:
193
-
194
- ```json
195
- {
196
- "feature": "Feature Name",
197
- "branchName": "lafayette/feat/feature-name",
198
- "assignedAgent": "lafayette",
199
- "trackingMode": "external",
200
- "externalProvider": "ado",
201
- "adoWorkItemId": 541,
202
- "userStories": [
203
- {
204
- "id": "STORY-001",
205
- "title": "Short description",
206
- "description": "Detailed requirements",
207
- "acceptanceCriteria": ["Criterion 1", "Criterion 2"],
208
- "priority": 1,
209
- "passes": false,
210
- "assignedTo": "lafayette",
211
- "testEvidence": null
212
- }
213
- ]
214
- }
215
- ```
216
-
217
- ### Schema Validation
218
-
219
- `spell-architect` must output stories.json using **exactly** this schema — all required fields must be present. Missing fields break `spell-implement`'s autonomous loop. Merlin must validate before outputting:
220
-
221
- - `feature`, `branchName`, `assignedAgent`, `trackingMode` — top-level required
222
- - `externalProvider` — required when `trackingMode=external`; optional otherwise
223
- - `adoWorkItemId` — required only when `trackingMode=external` and `externalProvider=ado`
224
- - Per story: `id`, `title`, `description`, `acceptanceCriteria`, `priority`, `passes: false`, `assignedTo`, `testEvidence: null`
225
-
226
- If the output is missing required tracking fields, `passes`, `assignedTo`, `priority`, or `testEvidence`, it is malformed and must be regenerated.
227
-
228
- ### Story Sizing
229
-
230
- Each story must be small enough to complete in one context window:
231
-
232
- **Right-sized:**
233
-
234
- - Add a database column and migration
235
- - Add a UI component to an existing page
236
- - Implement a single API endpoint
237
- - Add a filter dropdown to a list
238
-
239
- **Too big (split these):**
240
-
241
- - "Build the entire dashboard"
242
- - "Add authentication"
243
- - "Refactor the API layer"
244
-
245
- ---
246
-
247
- ## Full Cycle (Autonomous Pipeline)
248
-
249
- For features that should run end-to-end with minimal human intervention, use `spell-full-cycle`:
250
-
251
- ```
252
- spell-full-cycle = spell-plan → [spell-enchant] → spell-architect → [spell-implement → spell-test → spell-review]* → spell-ship
253
- ```
254
-
255
- The entire pipeline runs autonomously with a single human gate at PR approval. Includes optional PRD enchantment between Plan and Architect (runs automatically if any quality dimension scores Bronze, or if `--enchant` is specified). Requires three inputs: feature description, tracking configuration (`tracking_mode` and optional `external_provider`), and target repo. In ADO mode, include the ADO work item ID. Each phase has built-in quality gates that halt the pipeline on failure rather than producing garbage for downstream phases.
256
-
257
- See [.github/prompts/spell-full-cycle.prompt.md](../.github/prompts/spell-full-cycle.prompt.md) for the complete prompt.
258
-
259
- ---
260
-
261
- ## Assessment Flow (Large PRDs)
262
-
263
- For PRDs too large for a single Spell Loop cycle, insert `spell-scope` between planning (and optional enchantment) and solutioning:
264
-
265
- ```
266
- spell-plan → [spell-enchant] → spell-scope → [spell-architect → spell-implement → spell-test → spell-review → spell-ship]* per epic
267
- ```
268
-
269
- `spell-scope` reads the full PRD and produces an `execution-plan.md` containing:
270
-
271
- - **Epic splitting** — self-contained, sprint-sized work packages with dependency ordering
272
- - **Architecture decision candidates** — new ADRs needed before implementation
273
- - **Security flags** — threat model impact and required mitigations
274
- - **Agent assignments** — which agents handle each epic
275
- - **Dependency graph** — Mermaid diagram of execution order and parallelization opportunities
276
-
277
- Each epic then runs through its own Spell Loop cycle (architect → implement → test → review → ship).
278
-
279
- Before starting the next epic after a major output checkpoint (execution plan, architecture + stories, full test evidence, or ship recommendation), run `spell-commit-work` to preserve progress and checkpoint branch state.
280
-
281
- See [.github/prompts/spell-scope.prompt.md](../.github/prompts/spell-scope.prompt.md) for the complete prompt.
282
-
283
- ---
284
-
285
- ## Quick Flow (Small Changes)
286
-
287
- For bug fixes, small refactors, or single-file changes, skip Planning and Solutioning:
288
-
289
- ```
290
- spell-implement → spell-test → spell-review → spell-ship
291
- ```
292
-
293
- No PRD or architecture doc needed. The developer provides the intent directly to `spell-implement`.
294
-
295
- ---
296
-
297
- ## Interactive Tool Builds (Copilot / Claude in VS Code)
298
-
299
- When GitHub Copilot, Claude in VS Code, or any other interactive AI tool (not an autonomous agent-runtime agent) is used to write code, the **same quality gates apply** as for autonomous agent builds. Interactive tools are implementation executors — they occupy the same position in the Spell Loop as `spell-implement`.
300
-
301
- ### Rule: Interactive tools cannot self-validate
302
-
303
- A tool that writes code **must not** also run `spell-review` on that same code. This is the same constraint that prevents Lafayette from marking his own stories as passing. Specifically:
304
-
305
- - Copilot sessions count as implementation (`spell-implement` equivalent)
306
- - `spell-test` must be run to produce test evidence before review
307
- - `spell-review` must be run by a different agent or in a separate session with adversarial intent
308
- - "Looks good to me" within the same Copilot chat that wrote the code is **not** a spell-review
309
-
310
- ### Minimum gate for any Copilot-produced code
311
-
312
- ```
313
- Copilot implements → spell-test (run tests, check coverage) → spell-review (adversarial pass, min 3 findings) → spell-ship
314
- ```
315
-
316
- This applies regardless of change size. Even single-file bug fixes must pass `spell-review` before being pushed to `origin/main`.
317
-
318
- ### Why this rule exists
319
-
320
- A tool that both writes and validates its own work cannot be trusted to catch its own mistakes. In practice, when an interactive tool builds a codebase and also self-validates, defects slip through — for example, a roster of fabricated agents that never existed in `agent-policies.md`, or invented APIs that were never defined. A separate adversarial `spell-review` pass reliably catches these. The defects would ship if the gate were skipped.
321
-
322
- ---
323
-
324
- ## Agent Roster and Roles
325
-
326
- | Role | Agent | Notes |
327
- | --------------- | ------------------- | -------------------------------------------------- |
328
- | Product Manager | Kellar + Alexander | Kellar owns product; Alexander provides research |
329
- | Architect | Merlin | CTO / Architecture Lead |
330
- | Developer | Lafayette / Mercurio / Adelaide | Build team handles implementation |
331
- | QA Lead | Lince | QA Lead validates test evidence |
332
- | Scrum Master | Kellar | Product Operations Manager handles sprint tracking |
333
- | UX / Frontend | Adelaide | Frontend developer handles UX when needed |
334
- | Tech Writer | Any agent | No dedicated tech writer; any agent can document |
335
-
336
- ---
337
-
338
- ## Spell Reference
339
-
340
- ### Development Loop Spells
341
-
342
- | Spell | Invocation | Purpose |
343
- | ----------------- | ------------------ | ------------------------------------------------------------ | --- | ----------------- | ------------------ | ----------------------------------------------------------------------------- |
344
- | `spell-plan` | `@spell-plan` | Generate PRD from feature description | | `spell-enchant` | `@spell-enchant` | Enchant PRD quality — competitive research, UX/a11y/perf/security enhancement |
345
- | `spell-scope` | `@spell-scope` | Scope and split large PRDs into epics with execution plan | | `spell-architect` | `@spell-architect` | Architecture decisions + story breakdown |
346
- | `spell-implement` | `@spell-implement` | Autonomous loop: pick story → build → test → commit → repeat |
347
- | `spell-test` | `@spell-test` | Run tests, validate coverage, generate evidence |
348
- | `spell-review` | `@spell-review` | Adversarial code review |
349
- | `spell-ship` | `@spell-ship` | Pre-deploy checklist, merge approval |
350
-
351
- ### Specialist Spells
352
-
353
- | Spell | Invocation | Purpose |
354
- | ----------------------- | ------------------------ | ------------------------------------------ |
355
- | `spell-dotnet-expert` | `@spell-dotnet-expert` | Load .NET best practices for any dev agent |
356
- | `spell-security-review` | `@spell-security-review` | OWASP Top 10 + dependency audit |
357
- | `spell-product-review` | `@spell-product-review` | Build/Measure/Analyze/Decide cycle |
358
-
359
- ### Existing Operational Spells
360
-
361
- | Spell | Purpose |
362
- | -------------------------- | -------------------------------------------- |
363
- | `spell-open-session` | Rebuild context at session start |
364
- | `spell-close-session` | Journal, summarize, update TODO |
365
- | `spell-commit-work` | Conventional Commits with trailers |
366
- | `spell-check-drift` | Documentation audit for staleness |
367
- | `spell-bootstrap-business` | Scaffold new business docs |
368
- | `spell-explain-concept` | Bridge concepts to project context |
369
- | `spell-todo` | Manage TODO.md lifecycle |
370
- | `spell-generate-bot-icons` | Generate agent avatar assets |
371
- | `spell-bug` | Bug lifecycle: document → tracker/TODO → fix → verify |
372
- | `spell-suggest-feature` | Feature capture: user story → tracker/TODO → backlog |
373
-
374
- ---
375
-
376
- ## Open-Source Strategy
377
-
378
- The Spell Loop is a candidate for open-source release as a productized automation offering. Key differentiators:
379
-
380
- 1. **Multi-agent orchestration** — not just one AI tool, but a team of specialized agents
381
- 2. **Power-level governance** — agents have scoped autonomy per repo
382
- 3. **Git attribution** — every commit traces back to the agent that produced it
383
- 4. **Progressive context chain** — structured planning phases feed each successive phase with richer context
384
- 5. **Spell prompt packaging** — portable `.prompt.md` files that work across AI IDEs
1
+ ---
2
+ title: Development Methodology — The Spell Loop
3
+ audience: both
4
+ last_updated: YYYY-MM-DD
5
+ status: active
6
+ tags: [methodology, spell-loop, development, workflow]
7
+ ---
8
+
9
+ # Development Methodology — The Spell Loop
10
+
11
+ A structured development methodology combining progressive context phases and an autonomous implementation loop, delivered through the Arcane spell system. Designed for multi-agent infrastructure.
12
+
13
+ ## Executive Summary
14
+
15
+ - The Spell Loop is the standard development methodology for all projects that adopt it.
16
+ - It combines two proven patterns: the autonomous implementation loop and the spell system (operational workflows), with structured planning phases.
17
+ - Work flows through phases: Plan → [Enchant] → [Assess] → Architect → [Implement → Test → Review]\* → Ship.
18
+ - Optional enchantment phase uses Alexander (research) and Circe (marketing) to proactively enhance PRD quality.
19
+ - The implementation phase is an autonomous loop — agents iterate until all stories pass quality gates.
20
+
21
+ ---
22
+
23
+ ## The Spell Loop Flow
24
+
25
+ ```mermaid
26
+ flowchart TD
27
+ A[spell-plan] -->|PRD.md| AE{Enchant?}
28
+ AE -->|Yes| AF[spell-enchant]
29
+ AF -->|Enhanced PRD| AA{Large PRD?}
30
+ AE -->|No| AA{Large PRD?}
31
+ AA -->|Yes| AB[spell-scope]
32
+ AB -->|execution-plan.md| B[spell-architect]
33
+ AA -->|No| B[spell-architect]
34
+ B -->|architecture.md + stories.json| C[spell-implement]
35
+ C -->|code changes| D[spell-test]
36
+ D -->|test results| E{All tests pass?}
37
+ E -->|No| C
38
+ E -->|Yes| F[spell-review]
39
+ F -->|issues found| G{Critical issues?}
40
+ G -->|Yes| C
41
+ G -->|No| H[spell-ship]
42
+ H -->|merge + deploy| I[Done]
43
+
44
+ style A fill:#4a90d9,color:#fff
45
+ style AE fill:#d4a017,color:#fff
46
+ style AF fill:#d4a017,color:#fff
47
+ style AA fill:#4a90d9,color:#fff
48
+ style AB fill:#4a90d9,color:#fff
49
+ style B fill:#4a90d9,color:#fff
50
+ style C fill:#e67e22,color:#fff
51
+ style D fill:#27ae60,color:#fff
52
+ style F fill:#8e44ad,color:#fff
53
+ style H fill:#2c3e50,color:#fff
54
+ ```
55
+
56
+ ### Phase Overview
57
+
58
+ | Phase | Spell | Agent Owner | Input | Output |
59
+ | ------------------ | ----------------- | ------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
60
+ | **Planning** | `spell-plan` | Alexander (research) + Kellar (product) | Feature description or TODO item | `PRD.md` — requirements, acceptance criteria, constraints |
61
+ | **Enchantment** | `spell-enchant` | Alexander (research) + Circe (marketing) | PRD.md | Enhanced PRD — proactive quality improvements, competitive analysis, UX/a11y/perf/security gaps filled |
62
+ | **Assessment** | `spell-scope` | Merlin + Alexander + Lince | Large PRD | `execution-plan.md` — epics, dependency graph, ADR candidates, security flags, agent assignments |
63
+ | **Solutioning** | `spell-architect` | Merlin (architecture) | PRD.md (or single epic from execution plan) | `architecture.md` + `stories.json` — tech decisions, epic/story breakdown |
64
+ | **Implementation** | `spell-implement` | Lafayette / Mercurio / Adelaide (build team) | stories.json | Working code, committed per story |
65
+ | **Quality** | `spell-test` | Lince (QA) + dev agent | Code changes | Test results, coverage report, evidence |
66
+ | **Quality** | `spell-review` | Lince (QA) or Merlin (arch) | Code diff | Adversarial review findings |
67
+ | **Delivery** | `spell-ship` | Human (approval) + Prospero (infra) | Passing code + reviews | Merged PR, deployed artifact |
68
+
69
+ ---
70
+
71
+ ## Key Concepts
72
+
73
+ ### Work Tracking Modes
74
+
75
+ Arcane supports two work-tracking modes selected early (during `spell-open-session` or `spell-plan`):
76
+
77
+ - **`tracking_mode: internal`** — source of truth is repository artifacts (`PRD.md`, `execution-plan.md`, `stories.json`, `TODO.md`), with no external tracker dependency.
78
+ - **`tracking_mode: external`** — source of truth is still repository artifacts, but selected milestones/work items are mirrored to an external tracker.
79
+
80
+ For backward compatibility with existing Azure DevOps workflows, if tracking mode is not explicitly set and an ADO context is already present (work item ID, org, and project), default to:
81
+
82
+ ```yaml
83
+ tracking_mode: external
84
+ external_provider: ado
85
+ ```
86
+
87
+ Persist tracking configuration in PRD frontmatter (and in `.arcane.json` when available) so downstream spells do not lose context:
88
+
89
+ ```yaml
90
+ tracking:
91
+ tracking_mode: external # internal | external
92
+ external_provider: ado # ado | jira | other
93
+ ado:
94
+ org: "{ADO_ORG}"
95
+ project: "{ADO_PROJECT}"
96
+ process_template: "Agile"
97
+ ```
98
+
99
+ ### Process-Template-Aware ADO Hierarchy Rules
100
+
101
+ When `tracking_mode=external` and `external_provider=ado`, do not hardcode work item types. Resolve types from the project's process template and currently enabled types first:
102
+
103
+ ```bash
104
+ az devops project show \
105
+ --org https://dev.azure.com/{org} \
106
+ --project {project} \
107
+ --query "capabilities.processTemplate.templateName" \
108
+ --output tsv
109
+
110
+ az boards work-item-type list \
111
+ --org https://dev.azure.com/{org} \
112
+ --project {project} \
113
+ --output json \
114
+ --query "[].name"
115
+ ```
116
+
117
+ Use this fallback order against the discovered type list (baseline observed options: `Bug`, `Epic`, `Feature`, `Issue`, `Task`, `Test Case`, `User Story`):
118
+
119
+ | Logical level | Preferred type order |
120
+ | --- | --- |
121
+ | Epic-level | Epic → Feature → User Story → Issue |
122
+ | Feature-level | Feature → User Story → Issue |
123
+ | Story-level | User Story → Issue → Task |
124
+ | Task-level | Task → Issue |
125
+ | Defect-level | Bug → Issue → Task |
126
+
127
+ Child linkage rules:
128
+
129
+ 1. Preserve logical hierarchy order (Epic-level parent of Feature-level, Feature-level parent of Story-level, Story-level parent of Task/Bug-level).
130
+ 2. Attempt native ADO parent/child hierarchy links first.
131
+ 3. If the selected fallback type combination cannot be linked as parent/child in that process template, use `Related` links and prefix titles with logical level tags (for example: `[EPIC]`, `[FEATURE]`) to preserve intent.
132
+ 4. Never silently flatten hierarchy. Document fallback/link decisions in `execution-plan.md` notes.
133
+
134
+ ### External Provider TODOs
135
+
136
+ - **Jira (`external_provider=jira`)** — TODO: define issue-type mapping, parent-child/epic linkage strategy, and command examples.
137
+ - **Other providers (`external_provider=other`)** — TODO: define required metadata contract and fallback behavior before enabling automation.
138
+
139
+ ### Fresh Context Per Iteration
140
+
141
+ Each implementation iteration starts with clean context. The only memory between iterations is:
142
+
143
+ - **`stories.json`** — which stories are done (`passes: true/false`)
144
+ - **`progress.txt`** — append-only learnings from previous iterations
145
+ - **Git history** — commits from previous iterations
146
+
147
+ This prevents context poisoning — where an agent's failed approach poisons subsequent attempts.
148
+
149
+ ### Progressive Context Chain
150
+
151
+ Each phase produces artifacts that inform the next phase:
152
+
153
+ ```
154
+ Feature idea
155
+ → PRD.md (requirements, acceptance criteria)
156
+ → architecture.md (tech decisions, ADRs)
157
+ → stories.json (implementable work units)
158
+ → code (guided by architecture + story context)
159
+ → test results (validates requirements)
160
+ → review findings (validates architecture compliance)
161
+ ```
162
+
163
+ Without this chain, agents make conflicting decisions across stories (e.g., one uses REST, another uses GraphQL).
164
+
165
+ ### Adversarial Review
166
+
167
+ `spell-review` requires the reviewer to **find issues**. "Looks good" is not an acceptable review. The reviewer must:
168
+
169
+ 1. Find a minimum of 3 issues (or explain why fewer exist)
170
+ 2. Classify each as HIGH / MEDIUM / LOW severity
171
+ 3. Check for missing test coverage, architecture violations, security issues
172
+ 4. Defer unrelated findings to a backlog (don't derail the current change)
173
+
174
+ ### Append-Only Progress
175
+
176
+ `progress.txt` is never edited, only appended. Each iteration adds:
177
+
178
+ ```
179
+ ## Iteration N — [story-id] — [timestamp]
180
+ ### What was done
181
+ - [summary of changes]
182
+ ### What was learned
183
+ - [patterns discovered, gotchas, conventions]
184
+ ### What to watch for
185
+ - [warnings for future iterations]
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Story Format (stories.json)
191
+
192
+ The Arcane story schema for autonomous implementation:
193
+
194
+ ```json
195
+ {
196
+ "feature": "Feature Name",
197
+ "branchName": "lafayette/feat/feature-name",
198
+ "assignedAgent": "lafayette",
199
+ "trackingMode": "external",
200
+ "externalProvider": "ado",
201
+ "adoWorkItemId": 541,
202
+ "userStories": [
203
+ {
204
+ "id": "STORY-001",
205
+ "title": "Short description",
206
+ "description": "Detailed requirements",
207
+ "acceptanceCriteria": ["Criterion 1", "Criterion 2"],
208
+ "priority": 1,
209
+ "passes": false,
210
+ "assignedTo": "lafayette",
211
+ "testEvidence": null
212
+ }
213
+ ]
214
+ }
215
+ ```
216
+
217
+ ### Schema Validation
218
+
219
+ `spell-architect` must output stories.json using **exactly** this schema — all required fields must be present. Missing fields break `spell-implement`'s autonomous loop. Merlin must validate before outputting:
220
+
221
+ - `feature`, `branchName`, `assignedAgent`, `trackingMode` — top-level required
222
+ - `externalProvider` — required when `trackingMode=external`; optional otherwise
223
+ - `adoWorkItemId` — required only when `trackingMode=external` and `externalProvider=ado`
224
+ - Per story: `id`, `title`, `description`, `acceptanceCriteria`, `priority`, `passes: false`, `assignedTo`, `testEvidence: null`
225
+
226
+ If the output is missing required tracking fields, `passes`, `assignedTo`, `priority`, or `testEvidence`, it is malformed and must be regenerated.
227
+
228
+ ### Story Sizing
229
+
230
+ Each story must be small enough to complete in one context window:
231
+
232
+ **Right-sized:**
233
+
234
+ - Add a database column and migration
235
+ - Add a UI component to an existing page
236
+ - Implement a single API endpoint
237
+ - Add a filter dropdown to a list
238
+
239
+ **Too big (split these):**
240
+
241
+ - "Build the entire dashboard"
242
+ - "Add authentication"
243
+ - "Refactor the API layer"
244
+
245
+ ---
246
+
247
+ ## Full Cycle (Autonomous Pipeline)
248
+
249
+ For features that should run end-to-end with minimal human intervention, use `spell-full-cycle`:
250
+
251
+ ```
252
+ spell-full-cycle = spell-plan → [spell-enchant] → spell-architect → [spell-implement → spell-test → spell-review]* → spell-ship
253
+ ```
254
+
255
+ The entire pipeline runs autonomously with a single human gate at PR approval. Includes optional PRD enchantment between Plan and Architect (runs automatically if any quality dimension scores Bronze, or if `--enchant` is specified). Requires three inputs: feature description, tracking configuration (`tracking_mode` and optional `external_provider`), and target repo. In ADO mode, include the ADO work item ID. Each phase has built-in quality gates that halt the pipeline on failure rather than producing garbage for downstream phases.
256
+
257
+ See [.github/prompts/spell-full-cycle.prompt.md](../.github/prompts/spell-full-cycle.prompt.md) for the complete prompt.
258
+
259
+ ---
260
+
261
+ ## Assessment Flow (Large PRDs)
262
+
263
+ For PRDs too large for a single Spell Loop cycle, insert `spell-scope` between planning (and optional enchantment) and solutioning:
264
+
265
+ ```
266
+ spell-plan → [spell-enchant] → spell-scope → [spell-architect → spell-implement → spell-test → spell-review → spell-ship]* per epic
267
+ ```
268
+
269
+ `spell-scope` reads the full PRD and produces an `execution-plan.md` containing:
270
+
271
+ - **Epic splitting** — self-contained, sprint-sized work packages with dependency ordering
272
+ - **Architecture decision candidates** — new ADRs needed before implementation
273
+ - **Security flags** — threat model impact and required mitigations
274
+ - **Agent assignments** — which agents handle each epic
275
+ - **Dependency graph** — Mermaid diagram of execution order and parallelization opportunities
276
+
277
+ Each epic then runs through its own Spell Loop cycle (architect → implement → test → review → ship).
278
+
279
+ Before starting the next epic after a major output checkpoint (execution plan, architecture + stories, full test evidence, or ship recommendation), run `spell-commit-work` to preserve progress and checkpoint branch state.
280
+
281
+ See [.github/prompts/spell-scope.prompt.md](../.github/prompts/spell-scope.prompt.md) for the complete prompt.
282
+
283
+ ---
284
+
285
+ ## Quick Flow (Small Changes)
286
+
287
+ For bug fixes, small refactors, or single-file changes, skip Planning and Solutioning:
288
+
289
+ ```
290
+ spell-implement → spell-test → spell-review → spell-ship
291
+ ```
292
+
293
+ No PRD or architecture doc needed. The developer provides the intent directly to `spell-implement`.
294
+
295
+ ---
296
+
297
+ ## Interactive Tool Builds (Copilot / Claude in VS Code)
298
+
299
+ When GitHub Copilot, Claude in VS Code, or any other interactive AI tool (not an autonomous agent-runtime agent) is used to write code, the **same quality gates apply** as for autonomous agent builds. Interactive tools are implementation executors — they occupy the same position in the Spell Loop as `spell-implement`.
300
+
301
+ ### Rule: Interactive tools cannot self-validate
302
+
303
+ A tool that writes code **must not** also run `spell-review` on that same code. This is the same constraint that prevents Lafayette from marking his own stories as passing. Specifically:
304
+
305
+ - Copilot sessions count as implementation (`spell-implement` equivalent)
306
+ - `spell-test` must be run to produce test evidence before review
307
+ - `spell-review` must be run by a different agent or in a separate session with adversarial intent
308
+ - "Looks good to me" within the same Copilot chat that wrote the code is **not** a spell-review
309
+
310
+ ### Minimum gate for any Copilot-produced code
311
+
312
+ ```
313
+ Copilot implements → spell-test (run tests, check coverage) → spell-review (adversarial pass, min 3 findings) → spell-ship
314
+ ```
315
+
316
+ This applies regardless of change size. Even single-file bug fixes must pass `spell-review` before being pushed to `origin/main`.
317
+
318
+ ### Why this rule exists
319
+
320
+ A tool that both writes and validates its own work cannot be trusted to catch its own mistakes. In practice, when an interactive tool builds a codebase and also self-validates, defects slip through — for example, a roster of fabricated agents that never existed in `agent-policies.md`, or invented APIs that were never defined. A separate adversarial `spell-review` pass reliably catches these. The defects would ship if the gate were skipped.
321
+
322
+ ---
323
+
324
+ ## Agent Roster and Roles
325
+
326
+ | Role | Agent | Notes |
327
+ | --------------- | ------------------- | -------------------------------------------------- |
328
+ | Product Manager | Kellar + Alexander | Kellar owns product; Alexander provides research |
329
+ | Architect | Merlin | CTO / Architecture Lead |
330
+ | Developer | Lafayette / Mercurio / Adelaide | Build team handles implementation |
331
+ | QA Lead | Lince | QA Lead validates test evidence |
332
+ | Scrum Master | Kellar | Product Operations Manager handles sprint tracking |
333
+ | UX / Frontend | Adelaide | Frontend developer handles UX when needed |
334
+ | Tech Writer | Any agent | No dedicated tech writer; any agent can document |
335
+
336
+ ---
337
+
338
+ ## Spell Reference
339
+
340
+ ### Development Loop Spells
341
+
342
+ | Spell | Invocation | Purpose |
343
+ | ----------------- | ------------------ | ------------------------------------------------------------ | --- | ----------------- | ------------------ | ----------------------------------------------------------------------------- |
344
+ | `spell-plan` | `@spell-plan` | Generate PRD from feature description | | `spell-enchant` | `@spell-enchant` | Enchant PRD quality — competitive research, UX/a11y/perf/security enhancement |
345
+ | `spell-scope` | `@spell-scope` | Scope and split large PRDs into epics with execution plan | | `spell-architect` | `@spell-architect` | Architecture decisions + story breakdown |
346
+ | `spell-implement` | `@spell-implement` | Autonomous loop: pick story → build → test → commit → repeat |
347
+ | `spell-test` | `@spell-test` | Run tests, validate coverage, generate evidence |
348
+ | `spell-review` | `@spell-review` | Adversarial code review |
349
+ | `spell-ship` | `@spell-ship` | Pre-deploy checklist, merge approval |
350
+
351
+ ### Specialist Spells
352
+
353
+ | Spell | Invocation | Purpose |
354
+ | ----------------------- | ------------------------ | ------------------------------------------ |
355
+ | `spell-dotnet-expert` | `@spell-dotnet-expert` | Load .NET best practices for any dev agent |
356
+ | `spell-security-review` | `@spell-security-review` | OWASP Top 10 + dependency audit |
357
+ | `spell-product-review` | `@spell-product-review` | Build/Measure/Analyze/Decide cycle |
358
+
359
+ ### Existing Operational Spells
360
+
361
+ | Spell | Purpose |
362
+ | -------------------------- | -------------------------------------------- |
363
+ | `spell-open-session` | Rebuild context at session start |
364
+ | `spell-close-session` | Journal, summarize, update TODO |
365
+ | `spell-commit-work` | Conventional Commits with trailers |
366
+ | `spell-check-drift` | Documentation audit for staleness |
367
+ | `spell-bootstrap-business` | Scaffold new business docs |
368
+ | `spell-explain-concept` | Bridge concepts to project context |
369
+ | `spell-todo` | Manage TODO.md lifecycle |
370
+ | `spell-generate-bot-icons` | Generate agent avatar assets |
371
+ | `spell-bug` | Bug lifecycle: document → tracker/TODO → fix → verify |
372
+ | `spell-suggest-feature` | Feature capture: user story → tracker/TODO → backlog |
373
+
374
+ ---
375
+
376
+ ## Open-Source Strategy
377
+
378
+ The Spell Loop is a candidate for open-source release as a productized automation offering. Key differentiators:
379
+
380
+ 1. **Multi-agent orchestration** — not just one AI tool, but a team of specialized agents
381
+ 2. **Power-level governance** — agents have scoped autonomy per repo
382
+ 3. **Git attribution** — every commit traces back to the agent that produced it
383
+ 4. **Progressive context chain** — structured planning phases feed each successive phase with richer context
384
+ 5. **Spell prompt packaging** — portable `.prompt.md` files that work across AI IDEs