agileflow 2.92.1 → 2.94.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 (115) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/scripts/agileflow-statusline.sh +106 -0
  5. package/scripts/agileflow-welcome.js +54 -0
  6. package/scripts/document-repl.js +793 -0
  7. package/scripts/session-manager.js +230 -16
  8. package/scripts/spawn-parallel.js +53 -14
  9. package/src/core/agents/accessibility.md +19 -125
  10. package/src/core/agents/adr-writer.md +18 -1
  11. package/src/core/agents/analytics.md +19 -125
  12. package/src/core/agents/api.md +5 -130
  13. package/src/core/agents/ci.md +26 -131
  14. package/src/core/agents/compliance.md +21 -125
  15. package/src/core/agents/database.md +20 -125
  16. package/src/core/agents/datamigration.md +20 -125
  17. package/src/core/agents/design.md +19 -125
  18. package/src/core/agents/devops.md +12 -129
  19. package/src/core/agents/documentation.md +18 -1
  20. package/src/core/agents/epic-planner.md +31 -10
  21. package/src/core/agents/integrations.md +19 -125
  22. package/src/core/agents/mobile.md +19 -125
  23. package/src/core/agents/monitoring.md +19 -125
  24. package/src/core/agents/performance.md +19 -125
  25. package/src/core/agents/product.md +18 -1
  26. package/src/core/agents/qa.md +21 -125
  27. package/src/core/agents/readme-updater.md +18 -1
  28. package/src/core/agents/refactor.md +19 -125
  29. package/src/core/agents/research.md +3 -1
  30. package/src/core/agents/rlm-subcore.md +202 -0
  31. package/src/core/agents/security.md +7 -125
  32. package/src/core/agents/testing.md +20 -125
  33. package/src/core/agents/ui.md +14 -135
  34. package/src/core/commands/adr/list.md +20 -0
  35. package/src/core/commands/adr/update.md +24 -1
  36. package/src/core/commands/adr/view.md +23 -1
  37. package/src/core/commands/adr.md +2 -2
  38. package/src/core/commands/agent.md +11 -1
  39. package/src/core/commands/assign.md +15 -6
  40. package/src/core/commands/auto.md +11 -1
  41. package/src/core/commands/babysit.md +15 -4
  42. package/src/core/commands/baseline.md +11 -1
  43. package/src/core/commands/batch.md +11 -1
  44. package/src/core/commands/blockers.md +11 -1
  45. package/src/core/commands/board.md +11 -1
  46. package/src/core/commands/changelog.md +11 -0
  47. package/src/core/commands/choose.md +16 -1
  48. package/src/core/commands/ci.md +11 -1
  49. package/src/core/commands/configure.md +73 -2
  50. package/src/core/commands/context/export.md +8 -0
  51. package/src/core/commands/context/full.md +8 -0
  52. package/src/core/commands/context/note.md +8 -0
  53. package/src/core/commands/debt.md +11 -0
  54. package/src/core/commands/deploy.md +10 -0
  55. package/src/core/commands/deps.md +11 -1
  56. package/src/core/commands/diagnose.md +10 -0
  57. package/src/core/commands/docs.md +12 -2
  58. package/src/core/commands/epic/list.md +20 -0
  59. package/src/core/commands/epic/view.md +25 -0
  60. package/src/core/commands/epic.md +5 -6
  61. package/src/core/commands/feedback.md +11 -0
  62. package/src/core/commands/handoff.md +12 -2
  63. package/src/core/commands/help.md +10 -0
  64. package/src/core/commands/ideate.md +10 -0
  65. package/src/core/commands/impact.md +11 -1
  66. package/src/core/commands/metrics.md +11 -1
  67. package/src/core/commands/multi-expert.md +11 -1
  68. package/src/core/commands/packages.md +11 -0
  69. package/src/core/commands/pr.md +10 -0
  70. package/src/core/commands/readme-sync.md +10 -5
  71. package/src/core/commands/research/analyze.md +60 -3
  72. package/src/core/commands/research/ask.md +9 -1
  73. package/src/core/commands/research/import.md +8 -0
  74. package/src/core/commands/research/list.md +8 -0
  75. package/src/core/commands/research/synthesize.md +9 -1
  76. package/src/core/commands/research/view.md +8 -0
  77. package/src/core/commands/retro.md +12 -2
  78. package/src/core/commands/review.md +11 -1
  79. package/src/core/commands/rlm.md +363 -0
  80. package/src/core/commands/roadmap/analyze.md +1 -1
  81. package/src/core/commands/rpi.md +9 -1
  82. package/src/core/commands/session/cleanup.md +250 -0
  83. package/src/core/commands/session/end.md +10 -0
  84. package/src/core/commands/session/history.md +11 -1
  85. package/src/core/commands/session/init.md +10 -0
  86. package/src/core/commands/session/new.md +113 -13
  87. package/src/core/commands/session/resume.md +10 -0
  88. package/src/core/commands/session/spawn.md +8 -0
  89. package/src/core/commands/session/status.md +10 -0
  90. package/src/core/commands/skill/create.md +1 -1
  91. package/src/core/commands/skill/delete.md +11 -1
  92. package/src/core/commands/skill/edit.md +11 -1
  93. package/src/core/commands/skill/test.md +11 -1
  94. package/src/core/commands/skill/upgrade.md +11 -1
  95. package/src/core/commands/sprint.md +14 -3
  96. package/src/core/commands/status.md +15 -6
  97. package/src/core/commands/story/list.md +23 -0
  98. package/src/core/commands/story/view.md +24 -0
  99. package/src/core/commands/story.md +4 -5
  100. package/src/core/commands/template.md +10 -0
  101. package/src/core/commands/tests.md +10 -0
  102. package/src/core/commands/update.md +10 -0
  103. package/src/core/commands/validate-expertise.md +10 -1
  104. package/src/core/commands/velocity.md +11 -1
  105. package/src/core/commands/verify.md +13 -1
  106. package/src/core/commands/whats-new.md +8 -0
  107. package/src/core/commands/workflow.md +16 -1
  108. package/src/core/templates/agent-coordination-pattern.md +38 -0
  109. package/src/core/templates/agileflow-metadata.json +25 -0
  110. package/src/core/templates/preserve-rules-common.md +107 -0
  111. package/src/core/templates/preserve-rules.json +42 -0
  112. package/src/core/templates/proactive-action-spec.md +29 -0
  113. package/src/core/templates/quality-gate-priorities.md +34 -0
  114. package/src/core/templates/session-harness-protocol.md +128 -0
  115. package/tools/cli/lib/content-injector.js +338 -0
@@ -212,131 +212,8 @@ BOUNDARIES
212
212
  - Always prioritize user privacy and data protection
213
213
 
214
214
 
215
- SESSION HARNESS & VERIFICATION PROTOCOL (v2.25.0+)
215
+ <!-- {{SESSION_HARNESS}} -->
216
216
 
217
- **CRITICAL**: Session Harness System prevents agents from breaking functionality, claiming work is done when tests fail, or losing context between sessions.
218
-
219
- **PRE-IMPLEMENTATION VERIFICATION**
220
-
221
- Before starting work on ANY story:
222
-
223
- 1. **Check Session Harness**:
224
- - Look for `docs/00-meta/environment.json`
225
- - If exists → Session harness is active ✅
226
- - If missing → Suggest `/agileflow:session:init` to user
227
-
228
- 2. **Test Baseline Check**:
229
- - Read `test_status` from story in `docs/09-agents/status.json`
230
- - If `"passing"` → Proceed with implementation ✅
231
- - If `"failing"` → STOP. Cannot start new work with failing baseline ⚠️
232
- - If `"not_run"` → Run `/agileflow:verify` first to establish baseline
233
- - If `"skipped"` → Check why tests are skipped, document override decision
234
-
235
- 3. **Environment Verification** (if session harness active):
236
- - Run `/agileflow:session:resume` to verify environment and load context
237
- - Check for regressions (tests were passing, now failing)
238
- - If regression detected → Fix before proceeding with new story
239
-
240
- **DURING IMPLEMENTATION**
241
-
242
- 1. **Incremental Testing**:
243
- - Run tests frequently during development (not just at end)
244
- - Fix test failures immediately (don't accumulate debt)
245
- - Use `/agileflow:verify US-XXXX` to check specific story tests
246
-
247
- 2. **Real-time Status Updates**:
248
- - Update `test_status` in status.json as tests are written/fixed
249
- - Append bus messages when tests pass milestone checkpoints
250
-
251
- **POST-IMPLEMENTATION VERIFICATION**
252
-
253
- After completing ANY changes:
254
-
255
- 1. **Run Full Test Suite**:
256
- - Execute `/agileflow:verify US-XXXX` to run tests for the story
257
- - Check exit code (0 = success required for completion)
258
- - Review test output for warnings or flaky tests
259
-
260
- 2. **Update Test Status**:
261
- - `/agileflow:verify` automatically updates `test_status` in status.json
262
- - Verify the update was successful
263
- - Expected: `test_status: "passing"` with test results metadata
264
-
265
- 3. **Regression Check**:
266
- - Compare test results to baseline (initial test status)
267
- - If new failures introduced → Fix before marking complete
268
- - If test count decreased → Investigate deleted tests
269
-
270
- 4. **Story Completion Requirements**:
271
- - Story can ONLY be marked `"in-review"` if `test_status: "passing"` ✅
272
- - If tests failing → Story remains `"in-progress"` until fixed ⚠️
273
- - No exceptions unless documented override (see below)
274
-
275
- **OVERRIDE PROTOCOL** (Use with extreme caution)
276
-
277
- If tests are failing but you need to proceed:
278
-
279
- 1. **Document Override Decision**:
280
- - Append bus message with full explanation (include agent ID, story ID, reason, tracking issue)
281
-
282
- 2. **Update Story Dev Agent Record**:
283
- - Add note to "Issues Encountered" section explaining override
284
- - Link to tracking issue for the failing test
285
- - Document risk and mitigation plan
286
-
287
- 3. **Create Follow-up Story**:
288
- - If test failure is real but out of scope → Create new story
289
- - Link dependency in status.json
290
- - Notify user of the override and follow-up story
291
-
292
- **BASELINE MANAGEMENT**
293
-
294
- After completing major milestones (epic complete, sprint end):
295
-
296
- 1. **Establish Baseline**:
297
- - Suggest `/agileflow:baseline "Epic EP-XXXX complete"` to user
298
- - Requires: All tests passing, git working tree clean
299
- - Creates git tag + metadata for reset point
300
-
301
- 2. **Baseline Benefits**:
302
- - Known-good state to reset to if needed
303
- - Regression detection reference point
304
- - Deployment readiness checkpoint
305
- - Sprint/epic completion marker
306
-
307
- **INTEGRATION WITH WORKFLOW**
308
-
309
- The verification protocol integrates into the standard workflow:
310
-
311
- 1. **Before creating feature branch**: Run pre-implementation verification
312
- 2. **Before marking in-review**: Run post-implementation verification
313
- 3. **After merge**: Verify baseline is still passing
314
-
315
- **ERROR HANDLING**
316
-
317
- If `/agileflow:verify` fails:
318
- - Read error output carefully
319
- - Check if test command is configured in `docs/00-meta/environment.json`
320
- - Verify test dependencies are installed
321
- - If project has no tests → Suggest `/agileflow:session:init` to set up testing
322
- - If tests are misconfigured → Coordinate with AG-CI
323
-
324
- **SESSION RESUME PROTOCOL**
325
-
326
- When resuming work after context loss:
327
-
328
- 1. **Run Resume Command**: `/agileflow:session:resume` loads context automatically
329
- 2. **Check Session State**: Review `docs/09-agents/session-state.json`
330
- 3. **Verify Test Status**: Ensure no regressions occurred
331
- 4. **Load Previous Insights**: Check Dev Agent Record from previous stories
332
-
333
- **KEY PRINCIPLES**
334
-
335
- - **Tests are the contract**: Passing tests = feature works as specified
336
- - **Fail fast**: Catch regressions immediately, not at PR review
337
- - **Context preservation**: Session harness maintains progress across context windows
338
- - **Transparency**: Document all override decisions fully
339
- - **Accountability**: test_status field creates audit trail
340
217
 
341
218
  EVENT TRACKING
342
219
 
@@ -655,7 +532,9 @@ WORKFLOW
655
532
 
656
533
  11. Sync externally if enabled
657
534
 
658
- QUALITY CHECKLIST
535
+ <!-- {{QUALITY_GATE_PRIORITIES}} -->
536
+
537
+ QUALITY CHECKLIST (AG-ANALYTICS Specific)
659
538
 
660
539
  Before approval:
661
540
  - [ ] Event schema designed and documented
@@ -669,6 +548,21 @@ Before approval:
669
548
  - [ ] A/B testing framework ready
670
549
  - [ ] Documentation complete (event catalog, dashboards)
671
550
 
551
+ AGENT COORDINATION
552
+
553
+ **Coordinates with**:
554
+ - **AG-UI**: Analytics events in UI components (send event schema, receive tracking requirements)
555
+ - **AG-API**: Backend event tracking (coordinate event types, data formats)
556
+ - **AG-COMPLIANCE**: Privacy/GDPR requirements (receive consent requirements, send compliance status)
557
+
558
+ **Bus Messages** (append to `docs/09-agents/bus/log.jsonl`):
559
+ ```jsonl
560
+ {"ts":"<ISO>","from":"AG-ANALYTICS","type":"status","story":"<US-ID>","text":"Event tracking implemented for [feature]"}
561
+ {"ts":"<ISO>","from":"AG-ANALYTICS","type":"finding","story":"<US-ID>","text":"Finding: Missing consent check for tracking event [name]"}
562
+ ```
563
+
564
+ **On invocation**: Check bus for AG-UI/AG-API requests for analytics support.
565
+
672
566
  FIRST ACTION
673
567
 
674
568
  **CRITICAL: Load Expertise First (Agent Expert Protocol)**
@@ -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)**