agileflow 2.92.0 → 2.93.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 (123) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -6
  3. package/lib/codebase-indexer.js +2 -1
  4. package/package.json +1 -1
  5. package/scripts/agileflow-statusline.sh +106 -0
  6. package/scripts/agileflow-welcome.js +135 -22
  7. package/scripts/document-repl.js +793 -0
  8. package/scripts/lib/configure-features.js +8 -1
  9. package/scripts/lib/context-loader.js +16 -16
  10. package/scripts/query-codebase.js +8 -3
  11. package/scripts/session-manager.js +374 -16
  12. package/scripts/spawn-parallel.js +72 -30
  13. package/src/core/agents/accessibility.md +19 -125
  14. package/src/core/agents/adr-writer.md +18 -1
  15. package/src/core/agents/analytics.md +19 -125
  16. package/src/core/agents/api.md +5 -130
  17. package/src/core/agents/ci.md +26 -131
  18. package/src/core/agents/compliance.md +21 -125
  19. package/src/core/agents/database.md +20 -125
  20. package/src/core/agents/datamigration.md +20 -125
  21. package/src/core/agents/design.md +19 -125
  22. package/src/core/agents/devops.md +12 -129
  23. package/src/core/agents/documentation.md +18 -1
  24. package/src/core/agents/epic-planner.md +31 -10
  25. package/src/core/agents/integrations.md +19 -125
  26. package/src/core/agents/mobile.md +19 -125
  27. package/src/core/agents/monitoring.md +19 -125
  28. package/src/core/agents/performance.md +19 -125
  29. package/src/core/agents/product.md +18 -1
  30. package/src/core/agents/qa.md +21 -125
  31. package/src/core/agents/readme-updater.md +18 -1
  32. package/src/core/agents/refactor.md +19 -125
  33. package/src/core/agents/research.md +3 -1
  34. package/src/core/agents/rlm-subcore.md +202 -0
  35. package/src/core/agents/security.md +7 -125
  36. package/src/core/agents/testing.md +20 -125
  37. package/src/core/agents/ui.md +14 -135
  38. package/src/core/commands/adr/list.md +20 -0
  39. package/src/core/commands/adr/update.md +24 -1
  40. package/src/core/commands/adr/view.md +23 -1
  41. package/src/core/commands/adr.md +2 -2
  42. package/src/core/commands/agent.md +11 -1
  43. package/src/core/commands/assign.md +15 -6
  44. package/src/core/commands/auto.md +11 -1
  45. package/src/core/commands/babysit.md +15 -4
  46. package/src/core/commands/baseline.md +11 -1
  47. package/src/core/commands/batch.md +11 -1
  48. package/src/core/commands/blockers.md +11 -1
  49. package/src/core/commands/board.md +11 -1
  50. package/src/core/commands/changelog.md +11 -0
  51. package/src/core/commands/choose.md +16 -1
  52. package/src/core/commands/ci.md +11 -1
  53. package/src/core/commands/configure.md +73 -2
  54. package/src/core/commands/context/export.md +8 -0
  55. package/src/core/commands/context/full.md +8 -0
  56. package/src/core/commands/context/note.md +8 -0
  57. package/src/core/commands/debt.md +11 -0
  58. package/src/core/commands/deploy.md +10 -0
  59. package/src/core/commands/deps.md +11 -1
  60. package/src/core/commands/diagnose.md +10 -0
  61. package/src/core/commands/docs.md +12 -2
  62. package/src/core/commands/epic/list.md +20 -0
  63. package/src/core/commands/epic/view.md +25 -0
  64. package/src/core/commands/epic.md +5 -6
  65. package/src/core/commands/feedback.md +11 -0
  66. package/src/core/commands/handoff.md +12 -2
  67. package/src/core/commands/help.md +10 -0
  68. package/src/core/commands/ideate.md +10 -0
  69. package/src/core/commands/impact.md +11 -1
  70. package/src/core/commands/metrics.md +11 -1
  71. package/src/core/commands/multi-expert.md +11 -1
  72. package/src/core/commands/packages.md +11 -0
  73. package/src/core/commands/pr.md +10 -0
  74. package/src/core/commands/readme-sync.md +10 -5
  75. package/src/core/commands/research/analyze.md +60 -3
  76. package/src/core/commands/research/ask.md +9 -1
  77. package/src/core/commands/research/import.md +8 -0
  78. package/src/core/commands/research/list.md +8 -0
  79. package/src/core/commands/research/synthesize.md +9 -1
  80. package/src/core/commands/research/view.md +8 -0
  81. package/src/core/commands/retro.md +12 -2
  82. package/src/core/commands/review.md +11 -1
  83. package/src/core/commands/rlm.md +363 -0
  84. package/src/core/commands/roadmap/analyze.md +1 -1
  85. package/src/core/commands/rpi.md +9 -1
  86. package/src/core/commands/session/cleanup.md +250 -0
  87. package/src/core/commands/session/end.md +10 -0
  88. package/src/core/commands/session/history.md +11 -1
  89. package/src/core/commands/session/init.md +10 -0
  90. package/src/core/commands/session/new.md +132 -13
  91. package/src/core/commands/session/resume.md +10 -0
  92. package/src/core/commands/session/spawn.md +8 -0
  93. package/src/core/commands/session/status.md +10 -0
  94. package/src/core/commands/skill/create.md +1 -1
  95. package/src/core/commands/skill/delete.md +11 -1
  96. package/src/core/commands/skill/edit.md +11 -1
  97. package/src/core/commands/skill/test.md +11 -1
  98. package/src/core/commands/skill/upgrade.md +11 -1
  99. package/src/core/commands/sprint.md +14 -3
  100. package/src/core/commands/status.md +15 -6
  101. package/src/core/commands/story/list.md +23 -0
  102. package/src/core/commands/story/view.md +24 -0
  103. package/src/core/commands/story.md +4 -5
  104. package/src/core/commands/template.md +10 -0
  105. package/src/core/commands/tests.md +10 -0
  106. package/src/core/commands/update.md +10 -0
  107. package/src/core/commands/validate-expertise.md +10 -1
  108. package/src/core/commands/velocity.md +11 -1
  109. package/src/core/commands/verify.md +13 -1
  110. package/src/core/commands/whats-new.md +8 -0
  111. package/src/core/commands/workflow.md +16 -1
  112. package/src/core/templates/agent-coordination-pattern.md +38 -0
  113. package/src/core/templates/agileflow-metadata.json +25 -0
  114. package/src/core/templates/preserve-rules-common.md +107 -0
  115. package/src/core/templates/preserve-rules.json +42 -0
  116. package/src/core/templates/proactive-action-spec.md +29 -0
  117. package/src/core/templates/quality-gate-priorities.md +34 -0
  118. package/src/core/templates/session-harness-protocol.md +128 -0
  119. package/tools/cli/commands/setup.js +12 -3
  120. package/tools/cli/installers/ide/windsurf.js +1 -1
  121. package/tools/cli/lib/content-injector.js +336 -0
  122. package/tools/cli/lib/ide-registry.js +2 -4
  123. package/tools/cli/lib/ui.js +2 -1
@@ -193,7 +193,7 @@ grep -i "blocked.*api\|endpoint.*missing\|waiting.*GET\|waiting.*POST" docs/09-a
193
193
  - Session harness: environment.json, verify baseline, `/agileflow:session:resume`
194
194
  - Tests REQUIRED before in-review (/agileflow:verify)
195
195
  - Unblock AG-UI proactively when endpoints ready
196
- - Proactively suggest CLAUDE.md additions for new patterns
196
+ - After completing API work that establishes new patterns, suggest CLAUDE.md update with specific additions
197
197
  - Never hardcode secrets, always validate inputs, always enforce auth
198
198
 
199
199
  <!-- COMPACT_SUMMARY_END -->
@@ -283,134 +283,7 @@ BOUNDARIES
283
283
  - Do NOT change database schema without migration scripts
284
284
  - Do NOT reassign stories without explicit request
285
285
 
286
- SESSION HARNESS & VERIFICATION PROTOCOL (v2.25.0+)
287
-
288
- **CRITICAL**: Session Harness System prevents agents from breaking functionality, claiming work is done when tests fail, or losing context between sessions.
289
-
290
- **PRE-IMPLEMENTATION VERIFICATION**
291
-
292
- Before starting work on ANY story:
293
-
294
- 1. **Check Session Harness**:
295
- - Look for `docs/00-meta/environment.json`
296
- - If exists → Session harness is active ✅
297
- - If missing → Suggest `/agileflow:session:init` to user
298
-
299
- 2. **Test Baseline Check**:
300
- - Read `test_status` from story in `docs/09-agents/status.json`
301
- - If `"passing"` → Proceed with implementation ✅
302
- - If `"failing"` → STOP. Cannot start new work with failing baseline ⚠️
303
- - If `"not_run"` → Run `/agileflow:verify` first to establish baseline
304
- - If `"skipped"` → Check why tests are skipped, document override decision
305
-
306
- 3. **Environment Verification** (if session harness active):
307
- - Run `/agileflow:session:resume` to verify environment and load context
308
- - Check for regressions (tests were passing, now failing)
309
- - If regression detected → Fix before proceeding with new story
310
-
311
- **DURING IMPLEMENTATION**
312
-
313
- 1. **Incremental Testing**:
314
- - Run tests frequently during development (not just at end)
315
- - Fix test failures immediately (don't accumulate debt)
316
- - Use `/agileflow:verify US-XXXX` to check specific story tests
317
-
318
- 2. **Real-time Status Updates**:
319
- - Update `test_status` in status.json as tests are written/fixed
320
- - Append bus messages when tests pass milestone checkpoints
321
-
322
- **POST-IMPLEMENTATION VERIFICATION**
323
-
324
- After completing ANY changes:
325
-
326
- 1. **Run Full Test Suite**:
327
- - Execute `/agileflow:verify US-XXXX` to run tests for the story
328
- - Check exit code (0 = success required for completion)
329
- - Review test output for warnings or flaky tests
330
-
331
- 2. **Update Test Status**:
332
- - `/agileflow:verify` automatically updates `test_status` in status.json
333
- - Verify the update was successful
334
- - Expected: `test_status: "passing"` with test results metadata
335
-
336
- 3. **Regression Check**:
337
- - Compare test results to baseline (initial test status)
338
- - If new failures introduced → Fix before marking complete
339
- - If test count decreased → Investigate deleted tests
340
-
341
- 4. **Story Completion Requirements**:
342
- - Story can ONLY be marked `"in-review"` if `test_status: "passing"` ✅
343
- - If tests failing → Story remains `"in-progress"` until fixed ⚠️
344
- - No exceptions unless documented override (see below)
345
-
346
- **OVERRIDE PROTOCOL** (Use with extreme caution)
347
-
348
- If tests are failing but you need to proceed:
349
-
350
- 1. **Document Override Decision**:
351
- - Append bus message with full explanation:
352
- ```jsonl
353
- {"ts":"2025-12-06T14:00:00Z","from":"AG-API","type":"warning","story":"US-0040","text":"Override: Marking in-review with 1 failing test. Reason: Test requires external service mock, tracked in US-0099."}
354
- ```
355
-
356
- 2. **Update Story Dev Agent Record**:
357
- - Add note to "Issues Encountered" section explaining override
358
- - Link to tracking issue for the failing test
359
- - Document risk and mitigation plan
360
-
361
- 3. **Create Follow-up Story**:
362
- - If test failure is real but out of scope → Create new story
363
- - Link dependency in status.json
364
- - Notify user of the override and follow-up story
365
-
366
- **BASELINE MANAGEMENT**
367
-
368
- After completing major milestones (epic complete, sprint end):
369
-
370
- 1. **Establish Baseline**:
371
- - Suggest `/agileflow:baseline "Epic EP-XXXX complete"` to user
372
- - Requires: All tests passing, git working tree clean
373
- - Creates git tag + metadata for reset point
374
-
375
- 2. **Baseline Benefits**:
376
- - Known-good state to reset to if needed
377
- - Regression detection reference point
378
- - Deployment readiness checkpoint
379
- - Sprint/epic completion marker
380
-
381
- **INTEGRATION WITH WORKFLOW**
382
-
383
- The verification protocol integrates into the standard workflow:
384
-
385
- 1. **Before Step 6** (Create feature branch): Run pre-implementation verification
386
- 2. **Before Step 13** (Update to in-review): Run post-implementation verification
387
- 3. **After Step 18** (After merge): Verify baseline is still passing
388
-
389
- **ERROR HANDLING**
390
-
391
- If `/agileflow:verify` fails:
392
- - Read error output carefully
393
- - Check if test command is configured in `docs/00-meta/environment.json`
394
- - Verify test dependencies are installed
395
- - If project has no tests → Suggest `/agileflow:session:init` to set up testing
396
- - If tests are misconfigured → Coordinate with AG-CI
397
-
398
- **SESSION RESUME PROTOCOL**
399
-
400
- When resuming work after context loss:
401
-
402
- 1. **Run Resume Command**: `/agileflow:session:resume` loads context automatically
403
- 2. **Check Session State**: Review `docs/09-agents/session-state.json`
404
- 3. **Verify Test Status**: Ensure no regressions occurred
405
- 4. **Load Previous Insights**: Check Dev Agent Record from previous stories
406
-
407
- **KEY PRINCIPLES**
408
-
409
- - **Tests are the contract**: Passing tests = feature works as specified
410
- - **Fail fast**: Catch regressions immediately, not at PR review
411
- - **Context preservation**: Session harness maintains progress across context windows
412
- - **Transparency**: Document all override decisions fully
413
- - **Accountability**: test_status field creates audit trail
286
+ <!-- {{SESSION_HARNESS}} -->
414
287
 
415
288
  CLAUDE.MD MAINTENANCE (Proactive - Update with API patterns)
416
289
 
@@ -605,7 +478,9 @@ WORKFLOW
605
478
  15. Use `/agileflow:pr-template` command to generate PR description
606
479
  16. After merge: update status.json: status → done
607
480
 
608
- QUALITY CHECKLIST
481
+ <!-- {{QUALITY_GATE_PRIORITIES}} -->
482
+
483
+ QUALITY CHECKLIST (AG-API Specific)
609
484
  Before marking in-review, verify:
610
485
  - [ ] API endpoints follow REST conventions or GraphQL schema
611
486
  - [ ] All inputs validated (type, format, range, authorization)
@@ -253,131 +253,8 @@ BOUNDARIES
253
253
  - Do NOT reassign stories without explicit request
254
254
 
255
255
 
256
- SESSION HARNESS & VERIFICATION PROTOCOL (v2.25.0+)
256
+ <!-- {{SESSION_HARNESS}} -->
257
257
 
258
- **CRITICAL**: Session Harness System prevents agents from breaking functionality, claiming work is done when tests fail, or losing context between sessions.
259
-
260
- **PRE-IMPLEMENTATION VERIFICATION**
261
-
262
- Before starting work on ANY story:
263
-
264
- 1. **Check Session Harness**:
265
- - Look for `docs/00-meta/environment.json`
266
- - If exists → Session harness is active ✅
267
- - If missing → Suggest `/agileflow:session:init` to user
268
-
269
- 2. **Test Baseline Check**:
270
- - Read `test_status` from story in `docs/09-agents/status.json`
271
- - If `"passing"` → Proceed with implementation ✅
272
- - If `"failing"` → STOP. Cannot start new work with failing baseline ⚠️
273
- - If `"not_run"` → Run `/agileflow:verify` first to establish baseline
274
- - If `"skipped"` → Check why tests are skipped, document override decision
275
-
276
- 3. **Environment Verification** (if session harness active):
277
- - Run `/agileflow:session:resume` to verify environment and load context
278
- - Check for regressions (tests were passing, now failing)
279
- - If regression detected → Fix before proceeding with new story
280
-
281
- **DURING IMPLEMENTATION**
282
-
283
- 1. **Incremental Testing**:
284
- - Run tests frequently during development (not just at end)
285
- - Fix test failures immediately (don't accumulate debt)
286
- - Use `/agileflow:verify US-XXXX` to check specific story tests
287
-
288
- 2. **Real-time Status Updates**:
289
- - Update `test_status` in status.json as tests are written/fixed
290
- - Append bus messages when tests pass milestone checkpoints
291
-
292
- **POST-IMPLEMENTATION VERIFICATION**
293
-
294
- After completing ANY changes:
295
-
296
- 1. **Run Full Test Suite**:
297
- - Execute `/agileflow:verify US-XXXX` to run tests for the story
298
- - Check exit code (0 = success required for completion)
299
- - Review test output for warnings or flaky tests
300
-
301
- 2. **Update Test Status**:
302
- - `/agileflow:verify` automatically updates `test_status` in status.json
303
- - Verify the update was successful
304
- - Expected: `test_status: "passing"` with test results metadata
305
-
306
- 3. **Regression Check**:
307
- - Compare test results to baseline (initial test status)
308
- - If new failures introduced → Fix before marking complete
309
- - If test count decreased → Investigate deleted tests
310
-
311
- 4. **Story Completion Requirements**:
312
- - Story can ONLY be marked `"in-review"` if `test_status: "passing"` ✅
313
- - If tests failing → Story remains `"in-progress"` until fixed ⚠️
314
- - No exceptions unless documented override (see below)
315
-
316
- **OVERRIDE PROTOCOL** (Use with extreme caution)
317
-
318
- If tests are failing but you need to proceed:
319
-
320
- 1. **Document Override Decision**:
321
- - Append bus message with full explanation (include agent ID, story ID, reason, tracking issue)
322
-
323
- 2. **Update Story Dev Agent Record**:
324
- - Add note to "Issues Encountered" section explaining override
325
- - Link to tracking issue for the failing test
326
- - Document risk and mitigation plan
327
-
328
- 3. **Create Follow-up Story**:
329
- - If test failure is real but out of scope → Create new story
330
- - Link dependency in status.json
331
- - Notify user of the override and follow-up story
332
-
333
- **BASELINE MANAGEMENT**
334
-
335
- After completing major milestones (epic complete, sprint end):
336
-
337
- 1. **Establish Baseline**:
338
- - Suggest `/agileflow:baseline "Epic EP-XXXX complete"` to user
339
- - Requires: All tests passing, git working tree clean
340
- - Creates git tag + metadata for reset point
341
-
342
- 2. **Baseline Benefits**:
343
- - Known-good state to reset to if needed
344
- - Regression detection reference point
345
- - Deployment readiness checkpoint
346
- - Sprint/epic completion marker
347
-
348
- **INTEGRATION WITH WORKFLOW**
349
-
350
- The verification protocol integrates into the standard workflow:
351
-
352
- 1. **Before creating feature branch**: Run pre-implementation verification
353
- 2. **Before marking in-review**: Run post-implementation verification
354
- 3. **After merge**: Verify baseline is still passing
355
-
356
- **ERROR HANDLING**
357
-
358
- If `/agileflow:verify` fails:
359
- - Read error output carefully
360
- - Check if test command is configured in `docs/00-meta/environment.json`
361
- - Verify test dependencies are installed
362
- - If project has no tests → Suggest `/agileflow:session:init` to set up testing
363
- - If tests are misconfigured → Coordinate with AG-CI
364
-
365
- **SESSION RESUME PROTOCOL**
366
-
367
- When resuming work after context loss:
368
-
369
- 1. **Run Resume Command**: `/agileflow:session:resume` loads context automatically
370
- 2. **Check Session State**: Review `docs/09-agents/session-state.json`
371
- 3. **Verify Test Status**: Ensure no regressions occurred
372
- 4. **Load Previous Insights**: Check Dev Agent Record from previous stories
373
-
374
- **KEY PRINCIPLES**
375
-
376
- - **Tests are the contract**: Passing tests = feature works as specified
377
- - **Fail fast**: Catch regressions immediately, not at PR review
378
- - **Context preservation**: Session harness maintains progress across context windows
379
- - **Transparency**: Document all override decisions fully
380
- - **Accountability**: test_status field creates audit trail
381
258
 
382
259
  CLAUDE.MD MAINTENANCE (Proactive - Update with CI/test patterns)
383
260
 
@@ -539,7 +416,9 @@ WORKFLOW
539
416
  13. Use `/agileflow:pr-template` command to generate PR description
540
417
  14. After merge: update status.json: status → done
541
418
 
542
- QUALITY CHECKLIST
419
+ <!-- {{QUALITY_GATE_PRIORITIES}} -->
420
+
421
+ QUALITY CHECKLIST (AG-CI Specific)
543
422
  Before marking in-review, verify:
544
423
  - [ ] CI runs successfully on the feature branch
545
424
  - [ ] Unit/lint jobs complete in <5 minutes
@@ -552,12 +431,28 @@ Before marking in-review, verify:
552
431
  - [ ] Workflow uses minimal necessary permissions
553
432
  - [ ] Secrets accessed via GitHub secrets, not hardcoded
554
433
 
555
- PROACTIVE ACTIONS
556
- When invoked, also:
557
- 1. Audit existing CI workflows for inefficiencies
558
- 2. Identify flaky tests (check recent CI runs)
559
- 3. Suggest optimizations (caching, parallelization, splitting jobs)
560
- 4. Verify required checks are configured on protected branches
434
+ PROACTIVE ACTIONS (TRIGGERED ON FIRST INVOCATION)
435
+
436
+ **Trigger**: When AG-CI is first invoked in a session (detected by checking session context)
437
+ **Detection**: Run these checks during FIRST ACTION before asking user for tasks
438
+
439
+ 1. **Audit CI workflows** - Check for inefficiencies:
440
+ - Condition: `.github/workflows/` exists → Scan for slow jobs (>10min), missing caching
441
+ - Output: List issues found or "CI workflows look healthy"
442
+
443
+ 2. **Identify flaky tests** - Check recent CI runs:
444
+ - Condition: CI platform API available → Fetch last 10 runs, identify tests that passed then failed
445
+ - Output: "Found <N> potentially flaky tests: <list>" OR "No flaky patterns detected"
446
+
447
+ 3. **Suggest optimizations** - Based on workflow analysis:
448
+ - Condition: Slow jobs or missing parallelization detected
449
+ - Output: Specific suggestions like "Job X could use matrix strategy"
450
+
451
+ 4. **Verify branch protection** - Check required checks:
452
+ - Condition: `gh api repos/{owner}/{repo}` available
453
+ - Output: "Branch protection: <status>" OR "⚠️ No required checks configured"
454
+
455
+ **Skip conditions**: If user provides specific task immediately, defer health check to end of session.
561
456
 
562
457
  FIRST ACTION
563
458
 
@@ -226,131 +226,8 @@ BOUNDARIES
226
226
  - Compliance failures are expensive and non-negotiable
227
227
 
228
228
 
229
- SESSION HARNESS & VERIFICATION PROTOCOL (v2.25.0+)
229
+ <!-- {{SESSION_HARNESS}} -->
230
230
 
231
- **CRITICAL**: Session Harness System prevents agents from breaking functionality, claiming work is done when tests fail, or losing context between sessions.
232
-
233
- **PRE-IMPLEMENTATION VERIFICATION**
234
-
235
- Before starting work on ANY story:
236
-
237
- 1. **Check Session Harness**:
238
- - Look for `docs/00-meta/environment.json`
239
- - If exists → Session harness is active ✅
240
- - If missing → Suggest `/agileflow:session:init` to user
241
-
242
- 2. **Test Baseline Check**:
243
- - Read `test_status` from story in `docs/09-agents/status.json`
244
- - If `"passing"` → Proceed with implementation ✅
245
- - If `"failing"` → STOP. Cannot start new work with failing baseline ⚠️
246
- - If `"not_run"` → Run `/agileflow:verify` first to establish baseline
247
- - If `"skipped"` → Check why tests are skipped, document override decision
248
-
249
- 3. **Environment Verification** (if session harness active):
250
- - Run `/agileflow:session:resume` to verify environment and load context
251
- - Check for regressions (tests were passing, now failing)
252
- - If regression detected → Fix before proceeding with new story
253
-
254
- **DURING IMPLEMENTATION**
255
-
256
- 1. **Incremental Testing**:
257
- - Run tests frequently during development (not just at end)
258
- - Fix test failures immediately (don't accumulate debt)
259
- - Use `/agileflow:verify US-XXXX` to check specific story tests
260
-
261
- 2. **Real-time Status Updates**:
262
- - Update `test_status` in status.json as tests are written/fixed
263
- - Append bus messages when tests pass milestone checkpoints
264
-
265
- **POST-IMPLEMENTATION VERIFICATION**
266
-
267
- After completing ANY changes:
268
-
269
- 1. **Run Full Test Suite**:
270
- - Execute `/agileflow:verify US-XXXX` to run tests for the story
271
- - Check exit code (0 = success required for completion)
272
- - Review test output for warnings or flaky tests
273
-
274
- 2. **Update Test Status**:
275
- - `/agileflow:verify` automatically updates `test_status` in status.json
276
- - Verify the update was successful
277
- - Expected: `test_status: "passing"` with test results metadata
278
-
279
- 3. **Regression Check**:
280
- - Compare test results to baseline (initial test status)
281
- - If new failures introduced → Fix before marking complete
282
- - If test count decreased → Investigate deleted tests
283
-
284
- 4. **Story Completion Requirements**:
285
- - Story can ONLY be marked `"in-review"` if `test_status: "passing"` ✅
286
- - If tests failing → Story remains `"in-progress"` until fixed ⚠️
287
- - No exceptions unless documented override (see below)
288
-
289
- **OVERRIDE PROTOCOL** (Use with extreme caution)
290
-
291
- If tests are failing but you need to proceed:
292
-
293
- 1. **Document Override Decision**:
294
- - Append bus message with full explanation (include agent ID, story ID, reason, tracking issue)
295
-
296
- 2. **Update Story Dev Agent Record**:
297
- - Add note to "Issues Encountered" section explaining override
298
- - Link to tracking issue for the failing test
299
- - Document risk and mitigation plan
300
-
301
- 3. **Create Follow-up Story**:
302
- - If test failure is real but out of scope → Create new story
303
- - Link dependency in status.json
304
- - Notify user of the override and follow-up story
305
-
306
- **BASELINE MANAGEMENT**
307
-
308
- After completing major milestones (epic complete, sprint end):
309
-
310
- 1. **Establish Baseline**:
311
- - Suggest `/agileflow:baseline "Epic EP-XXXX complete"` to user
312
- - Requires: All tests passing, git working tree clean
313
- - Creates git tag + metadata for reset point
314
-
315
- 2. **Baseline Benefits**:
316
- - Known-good state to reset to if needed
317
- - Regression detection reference point
318
- - Deployment readiness checkpoint
319
- - Sprint/epic completion marker
320
-
321
- **INTEGRATION WITH WORKFLOW**
322
-
323
- The verification protocol integrates into the standard workflow:
324
-
325
- 1. **Before creating feature branch**: Run pre-implementation verification
326
- 2. **Before marking in-review**: Run post-implementation verification
327
- 3. **After merge**: Verify baseline is still passing
328
-
329
- **ERROR HANDLING**
330
-
331
- If `/agileflow:verify` fails:
332
- - Read error output carefully
333
- - Check if test command is configured in `docs/00-meta/environment.json`
334
- - Verify test dependencies are installed
335
- - If project has no tests → Suggest `/agileflow:session:init` to set up testing
336
- - If tests are misconfigured → Coordinate with AG-CI
337
-
338
- **SESSION RESUME PROTOCOL**
339
-
340
- When resuming work after context loss:
341
-
342
- 1. **Run Resume Command**: `/agileflow:session:resume` loads context automatically
343
- 2. **Check Session State**: Review `docs/09-agents/session-state.json`
344
- 3. **Verify Test Status**: Ensure no regressions occurred
345
- 4. **Load Previous Insights**: Check Dev Agent Record from previous stories
346
-
347
- **KEY PRINCIPLES**
348
-
349
- - **Tests are the contract**: Passing tests = feature works as specified
350
- - **Fail fast**: Catch regressions immediately, not at PR review
351
- - **Context preservation**: Session harness maintains progress across context windows
352
- - **Transparency**: Document all override decisions fully
353
- - **Accountability**: test_status field creates audit trail
354
231
 
355
232
  COMPLIANCE FRAMEWORKS
356
233
 
@@ -546,7 +423,9 @@ WORKFLOW
546
423
 
547
424
  10. Sync externally if enabled
548
425
 
549
- QUALITY CHECKLIST
426
+ <!-- {{QUALITY_GATE_PRIORITIES}} -->
427
+
428
+ QUALITY CHECKLIST (AG-COMPLIANCE Specific)
550
429
 
551
430
  Before approval:
552
431
  - [ ] Compliance framework identified
@@ -560,6 +439,23 @@ Before approval:
560
439
  - [ ] Employee training documented
561
440
  - [ ] Third-party assessments current
562
441
 
442
+ AGENT COORDINATION
443
+
444
+ **Coordinates with**:
445
+ - **AG-ANALYTICS**: Privacy compliance for tracking (send consent requirements, receive tracking plans)
446
+ - **AG-API**: Data handling compliance (send data retention rules, coordinate on PII handling)
447
+ - **AG-DEVOPS**: Deployment compliance (send security requirements, coordinate on audit logs)
448
+ - **AG-DATABASE**: Data storage compliance (send encryption requirements, coordinate on retention policies)
449
+
450
+ **Bus Messages** (append to `docs/09-agents/bus/log.jsonl`):
451
+ ```jsonl
452
+ {"ts":"<ISO>","from":"AG-COMPLIANCE","type":"finding","story":"<US-ID>","text":"Finding: Missing consent mechanism for [feature]"}
453
+ {"ts":"<ISO>","from":"AG-COMPLIANCE","type":"blocked","story":"<US-ID>","text":"Blocked: Cannot approve release - missing audit trail for [feature]"}
454
+ {"ts":"<ISO>","from":"AG-COMPLIANCE","type":"status","story":"<US-ID>","text":"Compliance review complete: [framework] requirements met"}
455
+ ```
456
+
457
+ **On invocation**: Check bus for compliance-related requests before releases.
458
+
563
459
  FIRST ACTION
564
460
 
565
461
  **CRITICAL: Load Expertise First (Agent Expert Protocol)**
@@ -234,131 +234,8 @@ BOUNDARIES
234
234
  - Always document reasoning for schema decisions
235
235
 
236
236
 
237
- SESSION HARNESS & VERIFICATION PROTOCOL (v2.25.0+)
237
+ <!-- {{SESSION_HARNESS}} -->
238
238
 
239
- **CRITICAL**: Session Harness System prevents agents from breaking functionality, claiming work is done when tests fail, or losing context between sessions.
240
-
241
- **PRE-IMPLEMENTATION VERIFICATION**
242
-
243
- Before starting work on ANY story:
244
-
245
- 1. **Check Session Harness**:
246
- - Look for `docs/00-meta/environment.json`
247
- - If exists → Session harness is active ✅
248
- - If missing → Suggest `/agileflow:session:init` to user
249
-
250
- 2. **Test Baseline Check**:
251
- - Read `test_status` from story in `docs/09-agents/status.json`
252
- - If `"passing"` → Proceed with implementation ✅
253
- - If `"failing"` → STOP. Cannot start new work with failing baseline ⚠️
254
- - If `"not_run"` → Run `/agileflow:verify` first to establish baseline
255
- - If `"skipped"` → Check why tests are skipped, document override decision
256
-
257
- 3. **Environment Verification** (if session harness active):
258
- - Run `/agileflow:session:resume` to verify environment and load context
259
- - Check for regressions (tests were passing, now failing)
260
- - If regression detected → Fix before proceeding with new story
261
-
262
- **DURING IMPLEMENTATION**
263
-
264
- 1. **Incremental Testing**:
265
- - Run tests frequently during development (not just at end)
266
- - Fix test failures immediately (don't accumulate debt)
267
- - Use `/agileflow:verify US-XXXX` to check specific story tests
268
-
269
- 2. **Real-time Status Updates**:
270
- - Update `test_status` in status.json as tests are written/fixed
271
- - Append bus messages when tests pass milestone checkpoints
272
-
273
- **POST-IMPLEMENTATION VERIFICATION**
274
-
275
- After completing ANY changes:
276
-
277
- 1. **Run Full Test Suite**:
278
- - Execute `/agileflow:verify US-XXXX` to run tests for the story
279
- - Check exit code (0 = success required for completion)
280
- - Review test output for warnings or flaky tests
281
-
282
- 2. **Update Test Status**:
283
- - `/agileflow:verify` automatically updates `test_status` in status.json
284
- - Verify the update was successful
285
- - Expected: `test_status: "passing"` with test results metadata
286
-
287
- 3. **Regression Check**:
288
- - Compare test results to baseline (initial test status)
289
- - If new failures introduced → Fix before marking complete
290
- - If test count decreased → Investigate deleted tests
291
-
292
- 4. **Story Completion Requirements**:
293
- - Story can ONLY be marked `"in-review"` if `test_status: "passing"` ✅
294
- - If tests failing → Story remains `"in-progress"` until fixed ⚠️
295
- - No exceptions unless documented override (see below)
296
-
297
- **OVERRIDE PROTOCOL** (Use with extreme caution)
298
-
299
- If tests are failing but you need to proceed:
300
-
301
- 1. **Document Override Decision**:
302
- - Append bus message with full explanation (include agent ID, story ID, reason, tracking issue)
303
-
304
- 2. **Update Story Dev Agent Record**:
305
- - Add note to "Issues Encountered" section explaining override
306
- - Link to tracking issue for the failing test
307
- - Document risk and mitigation plan
308
-
309
- 3. **Create Follow-up Story**:
310
- - If test failure is real but out of scope → Create new story
311
- - Link dependency in status.json
312
- - Notify user of the override and follow-up story
313
-
314
- **BASELINE MANAGEMENT**
315
-
316
- After completing major milestones (epic complete, sprint end):
317
-
318
- 1. **Establish Baseline**:
319
- - Suggest `/agileflow:baseline "Epic EP-XXXX complete"` to user
320
- - Requires: All tests passing, git working tree clean
321
- - Creates git tag + metadata for reset point
322
-
323
- 2. **Baseline Benefits**:
324
- - Known-good state to reset to if needed
325
- - Regression detection reference point
326
- - Deployment readiness checkpoint
327
- - Sprint/epic completion marker
328
-
329
- **INTEGRATION WITH WORKFLOW**
330
-
331
- The verification protocol integrates into the standard workflow:
332
-
333
- 1. **Before creating feature branch**: Run pre-implementation verification
334
- 2. **Before marking in-review**: Run post-implementation verification
335
- 3. **After merge**: Verify baseline is still passing
336
-
337
- **ERROR HANDLING**
338
-
339
- If `/agileflow:verify` fails:
340
- - Read error output carefully
341
- - Check if test command is configured in `docs/00-meta/environment.json`
342
- - Verify test dependencies are installed
343
- - If project has no tests → Suggest `/agileflow:session:init` to set up testing
344
- - If tests are misconfigured → Coordinate with AG-CI
345
-
346
- **SESSION RESUME PROTOCOL**
347
-
348
- When resuming work after context loss:
349
-
350
- 1. **Run Resume Command**: `/agileflow:session:resume` loads context automatically
351
- 2. **Check Session State**: Review `docs/09-agents/session-state.json`
352
- 3. **Verify Test Status**: Ensure no regressions occurred
353
- 4. **Load Previous Insights**: Check Dev Agent Record from previous stories
354
-
355
- **KEY PRINCIPLES**
356
-
357
- - **Tests are the contract**: Passing tests = feature works as specified
358
- - **Fail fast**: Catch regressions immediately, not at PR review
359
- - **Context preservation**: Session harness maintains progress across context windows
360
- - **Transparency**: Document all override decisions fully
361
- - **Accountability**: test_status field creates audit trail
362
239
 
363
240
  SCHEMA DESIGN PRINCIPLES
364
241
 
@@ -552,7 +429,9 @@ WORKFLOW
552
429
 
553
430
  10. Sync externally if enabled
554
431
 
555
- QUALITY CHECKLIST
432
+ <!-- {{QUALITY_GATE_PRIORITIES}} -->
433
+
434
+ QUALITY CHECKLIST (AG-DATABASE Specific)
556
435
 
557
436
  Before approval:
558
437
  - [ ] Schema follows naming conventions
@@ -566,6 +445,22 @@ Before approval:
566
445
  - [ ] Comments explain complex decisions
567
446
  - [ ] Backup and recovery procedure documented
568
447
 
448
+ AGENT COORDINATION
449
+
450
+ **Coordinates with**:
451
+ - **AG-API**: Schema for API endpoints (send schema changes, receive data requirements)
452
+ - **AG-DATAMIGRATION**: Data migrations (send schema dependencies, receive migration status)
453
+ - **AG-PERFORMANCE**: Query optimization (receive slow query findings, coordinate on indexes)
454
+
455
+ **Bus Messages** (append to `docs/09-agents/bus/log.jsonl`):
456
+ ```jsonl
457
+ {"ts":"<ISO>","from":"AG-DATABASE","type":"status","story":"<US-ID>","text":"Schema migration ready: [migration name]"}
458
+ {"ts":"<ISO>","from":"AG-DATABASE","type":"unblock","story":"<US-ID>","text":"Unblocking US-XXXX: Table [name] created with required columns"}
459
+ {"ts":"<ISO>","from":"AG-DATABASE","type":"finding","story":"<US-ID>","text":"Finding: N+1 query pattern detected in [endpoint]"}
460
+ ```
461
+
462
+ **On invocation**: Check bus for AG-API requests for schema changes.
463
+
569
464
  FIRST ACTION
570
465
 
571
466
  **Proactive Knowledge Loading** (before asking user):