@c0x12c/spartan-ai-toolkit 1.6.2 → 1.6.4

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.
@@ -10,7 +10,7 @@
10
10
  "name": "spartan-ai-toolkit",
11
11
  "description": "5 workflows, 56 commands, 12 rules, 22 skills, 7 agents — organized in 11 packs with dependencies",
12
12
  "source": "./toolkit",
13
- "version": "1.6.2"
13
+ "version": "1.6.4"
14
14
  }
15
15
  ]
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spartan-ai-toolkit",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Engineering discipline layer for Claude Code — 5 workflows, 56 commands, 12 rules, 22 skills, 7 agents organized in 11 packs",
5
5
  "author": {
6
6
  "name": "Khoa Tran",
package/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.2
1
+ 1.6.4
@@ -12,16 +12,24 @@ You are the **Build workflow leader** — the main way to go from requirement to
12
12
  You decide which steps to run, which skills to call, and when to move forward. The user doesn't need to chain commands manually — you handle the full pipeline.
13
13
 
14
14
  ```
15
- PIPELINE:
15
+ SINGLE FEATURE:
16
16
 
17
- Check Context → Spec → Design? → Plan → Implement → Review → Ship
18
- │ │ │ │ │ │
19
- .memory/ Gate 1 Design Gate 2 Gate 3 Gate 3.5 Gate 4
20
- .planning/ Gate (UI)
17
+ Context → Spec → Design? → Plan → Implement → Review Agent Fix → Ship
18
+ │ │ │ │ │ │
19
+ .memory/ Gate 1 Design Gate 2 Gate 3 Spawn agent Loop Gate 4
20
+ Gate fix until OK
21
+
22
+ EPIC (multi-feature — auto-detected):
23
+
24
+ Context → Epic detected → Per feature: Spec/Design/Plan → Implement → Review Agent → Fix → Ship
25
+ │ │ │ │ │ │ │
26
+ .planning/ read epic fill gaps if needed parallel by Spawn agent Loop one PR
27
+ epics/ dependency fix until OK
21
28
  ```
22
29
 
23
30
  **Fast path:** For small work (< 1 day, ≤ 4 tasks), you do spec + plan inline. No separate commands needed.
24
31
  **Full path:** For bigger work, you call `/spartan:spec`, `/spartan:design`, `/spartan:plan` as sub-steps.
32
+ **Epic path:** If the feature name matches an epic with 2+ specs ready, build all features together — one branch, one PR.
25
33
 
26
34
  ---
27
35
 
@@ -66,6 +74,9 @@ ls .planning/specs/*.md 2>/dev/null
66
74
  ls .planning/designs/*.md 2>/dev/null
67
75
  ls .planning/plans/*.md 2>/dev/null
68
76
 
77
+ # Check for epic
78
+ ls .planning/epics/*.md 2>/dev/null
79
+
69
80
  # Check for handoff from a previous session
70
81
  ls .handoff/*.md 2>/dev/null
71
82
  ```
@@ -79,6 +90,25 @@ ls .handoff/*.md 2>/dev/null
79
90
  **If spec/design/plan already exist** for this feature, skip those stages and jump ahead. Show what you found:
80
91
  > "Found: spec ✓, design ✓, plan ✓ — jumping to Implement."
81
92
 
93
+ ### Epic detection (auto — no questions)
94
+
95
+ **If an epic exists** that matches the feature name (or the user passed an epic name):
96
+
97
+ 1. Read the epic file at `.planning/epics/{name}.md`
98
+ 2. Find all features listed in the epic's Features table
99
+ 3. Check which features have specs ready (status = `spec` or `planned`)
100
+ 4. Check which features are already `done` or `skipped`
101
+
102
+ **If 2+ features have specs ready → switch to Epic mode:**
103
+ > "Found epic **{name}** with {N} features. {X} specs ready, {Y} already done. Building all ready features together — one branch, one PR."
104
+
105
+ Then jump to **Stage E: Epic Build** below.
106
+
107
+ **If only 1 feature has a spec** → build that one normally (single feature mode).
108
+
109
+ **If no features have specs yet** → tell the user to write specs first:
110
+ > "Epic exists but no specs are ready. Run `/spartan:spec {first-feature}` to start."
111
+
82
112
  ---
83
113
 
84
114
  ## Stage 1: Understand (Spec)
@@ -138,7 +168,7 @@ Then continue to the next stage automatically (don't tell the user to run a sepa
138
168
 
139
169
  ---
140
170
 
141
- ## Stage 1.5: Design (UI work only — auto-detected)
171
+ ## Stage 2: Design (UI work only — auto-detected)
142
172
 
143
173
  **Only runs if the feature has UI work.** Skip entirely for pure backend.
144
174
 
@@ -169,7 +199,7 @@ If user picks C → read the Figma reference and use it as the design source.
169
199
 
170
200
  ---
171
201
 
172
- ## Stage 2: Plan
202
+ ## Stage 3: Plan
173
203
 
174
204
  ### Check for saved plan
175
205
 
@@ -241,7 +271,7 @@ Write the first failing test for Task 1. Show it fails.
241
271
 
242
272
  ---
243
273
 
244
- ## Stage 3: Implement
274
+ ## Stage 4: Implement
245
275
 
246
276
  ### Auto-parallelize with Agent Teams
247
277
 
@@ -333,7 +363,7 @@ Call the right skills based on what you're doing:
333
363
 
334
364
  ### After all tasks — Verify Definition of Done
335
365
 
336
- **Before moving to Gate 3, verify ALL layers are complete:**
366
+ **Before moving to review, verify ALL layers are complete:**
337
367
 
338
368
  | Mode | Must be done before review |
339
369
  |------|---------------------------|
@@ -348,7 +378,7 @@ Call the right skills based on what you're doing:
348
378
  4. API client has methods for all new endpoints
349
379
  5. UI shows the data from the new endpoints
350
380
 
351
- **If any layer is incomplete**, go back and finish it. Do NOT proceed to Gate 3 with only backend done.
381
+ **If any layer is incomplete**, go back and finish it. Do NOT proceed to review with only backend done.
352
382
 
353
383
  Run the full test suite:
354
384
  ```bash
@@ -362,40 +392,93 @@ npm test && npm run build
362
392
  ./gradlew test && npm test && npm run build
363
393
  ```
364
394
 
365
- **GATE 3 — STOP and ask:**
366
- > "All [N] tasks done. [X] tests passing. Ready for review?"
367
- >
368
- > **Full-stack:** "Backend: [N] tasks done, tests passing. Frontend: [N] tasks done, build passing. Ready for review?"
369
- >
370
- > If 3+ tasks were completed: "I'll run a self-review now. For a deeper dual-agent review, say 'gate review'."
395
+ **GATE 3 — Implementation complete.**
396
+ > "All [N] tasks done. [X] tests passing. Starting review."
371
397
  >
372
- > **Auto mode on?** → Continue to Review immediately.
398
+ > **Auto mode on?** → Go straight to review.
373
399
 
374
400
  ---
375
401
 
376
- ## Stage 3.5: Review (auto-runs)
402
+ ## Stage 5: Review (agent-based — mandatory)
403
+
404
+ **This is NOT a self-review.** Spawn a separate review agent to get a fresh perspective. The reviewer finds issues, you fix them, repeat until clean.
405
+
406
+ ### Step 1: Spawn the review agent
407
+
408
+ Use the `Agent` tool to spawn a reviewer:
409
+
410
+ ```
411
+ Agent:
412
+ name: "reviewer"
413
+ subagent_type: "phase-reviewer" (or "general-purpose" if phase-reviewer not available)
414
+ prompt: |
415
+ You are reviewing code changes for the feature: {feature name}.
416
+
417
+ Review scope:
418
+ - Backend code: {list changed backend files}
419
+ - Frontend code: {list changed frontend files}
420
+ - Design doc: {path if exists, or "none"}
421
+
422
+ Run `git diff main...HEAD` to see all changes.
423
+
424
+ Review checklist:
425
+ **Code quality:** SOLID, clean code, no duplication, proper error handling
426
+ **Tests:** adequate coverage, edge cases, test quality
427
+ **Security:** auth, input validation, injection risks
428
+ **Stack conventions:** {backend: Kotlin/Micronaut rules | frontend: React/Next.js rules | both}
429
+ **Design compliance:** if a design doc exists, check that UI matches it
430
+
431
+ For each issue found, report:
432
+ - File and line
433
+ - What's wrong
434
+ - Severity: HIGH (must fix) / MEDIUM (should fix) / LOW (nice to have)
435
+ - Suggested fix
436
+
437
+ End with a verdict: **PASS** or **NEEDS CHANGES** (with the list of HIGH/MEDIUM issues).
438
+ ```
439
+
440
+ ### Step 2: Fix loop
441
+
442
+ When the reviewer reports back:
443
+
444
+ **If PASS** → continue to Ship.
445
+
446
+ **If NEEDS CHANGES:**
447
+
448
+ 1. Read the reviewer's findings
449
+ 2. Fix all HIGH issues. Fix MEDIUM issues if they make sense.
450
+ 3. Commit fixes:
451
+ ```
452
+ fix([scope]): [what review caught]
453
+ ```
454
+ 4. Run tests again to make sure fixes didn't break anything
455
+ 5. Spawn the review agent AGAIN with the updated diff — only the remaining/new changes need review
456
+ 6. Repeat until the reviewer says PASS
457
+
458
+ **Max 3 review rounds.** If still failing after 3 rounds, stop and ask the user:
459
+ > "Review found issues I can't fully fix. Here's what's left: [list]. Want to continue anyway or address these manually?"
377
460
 
378
- This stage runs automatically after implementation. You don't wait for the user to run a separate review command.
461
+ ### Step 3: Parallel review with Agent Teams
462
+
463
+ ```bash
464
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
465
+ ```
379
466
 
380
- ### Self-review
381
- - **Backend code** → use the approach from `/spartan:review`
382
- - **Frontend code** → use the approach from `/spartan:fe-review`
383
- - **Both** → review backend first, then frontend
467
+ **If Agent Teams is enabled**, always spawn parallel review agents for deeper coverage:
384
468
 
385
- Fix any issues found during review. Commit fixes separately:
386
469
  ```
387
- fix([scope]): [what review caught]
470
+ Agent 1: "quality-reviewer" code design, SOLID, conventions, stack rules
471
+ Agent 2: "test-reviewer" — test coverage, edge cases, test quality
472
+ Agent 3: "security-reviewer" (if auth/input/data code changed) — security checklist
388
473
  ```
389
474
 
390
- ### Dual-agent review (optional, on request)
391
- If the user says "gate review" or if the feature is large (5+ tasks), offer to spawn the gate-review approach:
392
- > "Want a dual-agent gate review? This spawns a reviewer agent for a second opinion."
475
+ All agents review at the same time. Combine their findings. All must PASS before moving to Ship. If any says NEEDS CHANGES → fix loop applies to the combined findings.
393
476
 
394
- If yes use the approach from `/spartan:gate-review` internally.
477
+ **If Agent Teams is NOT enabled**, use a single review agent (Step 1 above).
395
478
 
396
479
  ---
397
480
 
398
- ## Stage 4: Ship
481
+ ## Stage 6: Ship
399
482
 
400
483
  ### Create PR
401
484
  Run the approach from `/spartan:pr-ready`:
@@ -423,6 +506,84 @@ Update `.memory/index.md` if you saved anything.
423
506
 
424
507
  ---
425
508
 
509
+ ## Stage E: Epic Build (multi-feature mode)
510
+
511
+ **This replaces Stages 1–4 when epic mode is active.** It builds all ready features from the epic on one branch and creates one PR. Review and Ship still run normally after.
512
+
513
+ ### Step 1: Collect and fill gaps
514
+
515
+ Read the epic file. For each feature with status `spec`, `planned`, or `building`:
516
+
517
+ 1. Read its spec from `.planning/specs/`
518
+ 2. Read its design from `.planning/designs/` (if exists)
519
+ 3. Read its plan from `.planning/plans/` (if exists)
520
+
521
+ **Fill gaps for each feature that's missing something:**
522
+
523
+ | Missing | Action |
524
+ |---------|--------|
525
+ | Spec | Skip this feature — tell user to run `/spartan:spec {feature}` first |
526
+ | Design (and feature has UI work) | Ask user: create design now or skip? Same logic as Stage 2 |
527
+ | Plan | Generate a plan inline (fast path for small, full path for big) |
528
+
529
+ **Use Agent Teams to fill gaps in parallel** (if enabled): When 2+ features need plans or designs generated, spawn one agent per feature to do this work at the same time. Each agent runs the spec/design/plan logic for its feature independently.
530
+
531
+ ```bash
532
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
533
+ ```
534
+
535
+ If Agent Teams enabled and 2+ features need plans:
536
+ - Spawn one `general-purpose` agent per feature
537
+ - Each agent generates the design (if needed) and plan for its feature
538
+ - Collect results, save to `.planning/designs/` and `.planning/plans/`
539
+
540
+ ### Step 2: Sort by dependency and create branch
541
+
542
+ Read the epic's Features table. Sort features by dependency order:
543
+ - Features with no dependencies → can build first
544
+ - Features that depend on others → build after their dependencies are done
545
+
546
+ ```bash
547
+ git checkout -b feature/[epic-slug]
548
+ ```
549
+
550
+ ### Step 3: Implement in dependency order
551
+
552
+ Go through features in dependency order. **When 2+ features have no dependency between them, build them at the same time using Agent Teams** (if enabled). Otherwise build one by one.
553
+
554
+ ```bash
555
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
556
+ ```
557
+
558
+ **For each feature (or group of parallel features):**
559
+
560
+ 1. **If Agent Teams enabled and 2+ features can run at the same time:**
561
+ - Spawn one agent per feature with `isolation: "worktree"`
562
+ - Each agent gets: its spec, design doc (if exists), plan, TDD instructions, relevant rules
563
+ - **Design doc handoff is MANDATORY** — every frontend/UI agent must read the design doc first
564
+ - Wait for all parallel agents to finish
565
+ - Merge worktrees, run full test suite
566
+ - If tests fail → fix before moving on
567
+
568
+ 2. **If sequential (Agent Teams not enabled or only one feature ready):**
569
+ - Build each task with TDD: test → implement → refactor → commit
570
+ - Follow the same skill routing as Stage 4
571
+
572
+ 3. **After each feature completes:**
573
+ - Update epic Features table (status → `done`)
574
+ - Check: does this unblock the next features? If yes, start those next.
575
+
576
+ ### Step 4: After all features built
577
+
578
+ Run the full test suite. Then continue to **Stage 5: Review** — the review agent reviews ALL changes across all features. One review, one fix loop, one PR.
579
+
580
+ **GATE 3 (Epic):**
581
+ > "All {N} features built. {X} tests passing. Starting review."
582
+ >
583
+ > **Auto mode on?** → Go straight to review.
584
+
585
+ ---
586
+
426
587
  ## Resume: Picking Up Where You Left Off
427
588
 
428
589
  If a previous session was interrupted (context overflow, user stopped, etc.), this workflow can resume.
@@ -430,9 +591,9 @@ If a previous session was interrupted (context overflow, user stopped, etc.), th
430
591
  **How resume works:**
431
592
  1. Step 0.5 checks for `.handoff/` files and existing `.planning/` artifacts
432
593
  2. Determine which stage was completed last:
433
- - Has spec but no plan → resume at Stage 2 (Plan)
434
- - Has plan but no commits on feature branch → resume at Stage 3 (Implement)
435
- - Has commits but no PR → resume at Stage 4 (Ship)
594
+ - Has spec but no plan → resume at Stage 3 (Plan)
595
+ - Has plan but no commits on feature branch → resume at Stage 4 (Implement)
596
+ - Has commits but no PR → resume at Stage 5 (Review) or Stage 6 (Ship)
436
597
  3. Show the user: "Resuming from [stage]. Here's what was done: [summary]."
437
598
  4. Continue from that point.
438
599
 
@@ -448,11 +609,14 @@ If a previous session was interrupted (context overflow, user stopped, etc.), th
448
609
  - **Gates are mandatory.** Even small features go through all stages. The stages are fast for small work — that's fine.
449
610
  - **TDD by default.** Write the test first. Override only when test-first doesn't make sense for that specific task.
450
611
  - **One commit per task.** Don't batch. Each task = one commit with a clear message.
612
+ - **Review is always an agent.** Never self-review. Always spawn a separate review agent for a fresh perspective. Fix issues until the reviewer says PASS.
451
613
  - **Security check always runs.** Whether backend or frontend, security patterns get checked during review.
452
- - **Frontend checks for backend needs.** If a new page needs data that doesn't exist yet, say so at Stage 2 and add backend tasks first.
614
+ - **Frontend checks for backend needs.** If a new page needs data that doesn't exist yet, say so at Stage 3 and add backend tasks first.
453
615
  - **Don't over-plan.** If the whole thing is 1-2 files and 30 minutes of work, don't force it into this workflow. Just do it. This workflow is for features that need structure — at least 2-3 tasks.
454
616
  - **Save state for big work.** If 5+ tasks, save artifacts to `.planning/` so future sessions can resume.
455
617
  - **Full-stack = both layers done.** If the feature touches both backend and frontend, you MUST implement both before creating the PR. Backend-only completion is NOT "done" for a full-stack feature.
618
+ - **Epic = one branch, one PR.** When building from an epic, all features go on one branch and ship as one PR. Don't create separate PRs per feature. Parallelize independent features with Agent Teams when available.
619
+ - **Epic auto-detection.** If the user's feature name matches an epic in `.planning/epics/`, switch to epic mode automatically. Don't ask.
456
620
 
457
621
  ---
458
622
 
@@ -484,5 +648,5 @@ A feature is NOT done until every applicable item is checked:
484
648
 
485
649
  ### Always
486
650
  - [ ] Atomic commits (one per task)
487
- - [ ] Self-review passed (backend review + frontend review if applicable)
651
+ - [ ] Review agent passed (all HIGH/MEDIUM issues fixed)
488
652
  - [ ] PR created with summary and test plan
@@ -141,13 +141,22 @@ Then tell the user:
141
141
 
142
142
  > "Epic saved to `.planning/epics/{{ args[0] }}.md` with [N] features."
143
143
  >
144
- > **The workflow for each feature:**
144
+ > **Next steps:**
145
+ >
146
+ > 1. Write specs for each feature (can do multiple before building):
147
+ > ```
148
+ > /spartan:spec [feature-1]
149
+ > /spartan:spec [feature-2]
150
+ > /spartan:design [feature-2] ← if it has UI work
151
+ > /spartan:spec [feature-3]
145
152
  > ```
146
- > /spartan:spec [feature-name] ← write the spec, pass Gate 1
147
- > /spartan:design [feature-name] ← if it has UI work (optional)
148
- > /spartan:plan [feature-name] ← write the plan, pass Gate 2
149
- > /spartan:build [feature-name] ← build it, TDD, pass Gates 3-4
153
+ >
154
+ > 2. When specs are ready, build the whole epic at once:
150
155
  > ```
156
+ > /spartan:build {{ args[0] }} ← builds all ready features, one branch, one PR
157
+ > ```
158
+ >
159
+ > Build auto-detects the epic, plans all features together, parallelizes independent ones with Agent Teams, and ships one PR.
151
160
  >
152
161
  > **Start with:** `/spartan:spec [first-feature-name]`
153
162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c0x12c/spartan-ai-toolkit",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Engineering discipline layer for AI coding agents — commands, rules, skills, agents, and packs for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {