agileflow 2.90.7 → 2.92.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 (144) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -6
  3. package/lib/README.md +178 -0
  4. package/lib/codebase-indexer.js +818 -0
  5. package/lib/colors.js +190 -12
  6. package/lib/consent.js +232 -0
  7. package/lib/correlation.js +277 -0
  8. package/lib/error-codes.js +46 -0
  9. package/lib/errors.js +48 -6
  10. package/lib/file-cache.js +182 -0
  11. package/lib/format-error.js +156 -0
  12. package/lib/path-resolver.js +155 -7
  13. package/lib/paths.js +212 -20
  14. package/lib/placeholder-registry.js +205 -0
  15. package/lib/registry-di.js +358 -0
  16. package/lib/result-schema.js +363 -0
  17. package/lib/result.js +210 -0
  18. package/lib/session-registry.js +13 -0
  19. package/lib/session-state-machine.js +465 -0
  20. package/lib/validate-commands.js +308 -0
  21. package/lib/validate-names.js +3 -3
  22. package/lib/validate.js +116 -52
  23. package/package.json +4 -1
  24. package/scripts/af +34 -0
  25. package/scripts/agent-loop.js +63 -9
  26. package/scripts/agileflow-configure.js +2 -2
  27. package/scripts/agileflow-welcome.js +435 -23
  28. package/scripts/archive-completed-stories.sh +57 -11
  29. package/scripts/claude-tmux.sh +102 -0
  30. package/scripts/damage-control-bash.js +3 -70
  31. package/scripts/damage-control-edit.js +3 -20
  32. package/scripts/damage-control-write.js +3 -20
  33. package/scripts/dependency-check.js +310 -0
  34. package/scripts/get-env.js +11 -4
  35. package/scripts/lib/configure-detect.js +23 -1
  36. package/scripts/lib/configure-features.js +43 -2
  37. package/scripts/lib/context-formatter.js +771 -0
  38. package/scripts/lib/context-loader.js +699 -0
  39. package/scripts/lib/damage-control-utils.js +107 -0
  40. package/scripts/lib/json-utils.sh +162 -0
  41. package/scripts/lib/state-migrator.js +353 -0
  42. package/scripts/lib/story-state-machine.js +437 -0
  43. package/scripts/obtain-context.js +118 -1048
  44. package/scripts/pre-push-check.sh +46 -0
  45. package/scripts/precompact-context.sh +36 -11
  46. package/scripts/query-codebase.js +538 -0
  47. package/scripts/ralph-loop.js +5 -5
  48. package/scripts/session-manager.js +220 -42
  49. package/scripts/spawn-parallel.js +651 -0
  50. package/scripts/tui/blessed/data/watcher.js +180 -0
  51. package/scripts/tui/blessed/index.js +244 -0
  52. package/scripts/tui/blessed/panels/output.js +101 -0
  53. package/scripts/tui/blessed/panels/sessions.js +150 -0
  54. package/scripts/tui/blessed/panels/trace.js +97 -0
  55. package/scripts/tui/blessed/ui/help.js +77 -0
  56. package/scripts/tui/blessed/ui/screen.js +52 -0
  57. package/scripts/tui/blessed/ui/statusbar.js +47 -0
  58. package/scripts/tui/blessed/ui/tabbar.js +99 -0
  59. package/scripts/tui/index.js +38 -30
  60. package/scripts/validators/README.md +143 -0
  61. package/scripts/validators/component-validator.js +239 -0
  62. package/scripts/validators/json-schema-validator.js +186 -0
  63. package/scripts/validators/markdown-validator.js +152 -0
  64. package/scripts/validators/migration-validator.js +129 -0
  65. package/scripts/validators/security-validator.js +380 -0
  66. package/scripts/validators/story-format-validator.js +197 -0
  67. package/scripts/validators/test-result-validator.js +114 -0
  68. package/scripts/validators/workflow-validator.js +247 -0
  69. package/src/core/agents/accessibility.md +6 -0
  70. package/src/core/agents/adr-writer.md +6 -0
  71. package/src/core/agents/analytics.md +6 -0
  72. package/src/core/agents/api.md +6 -0
  73. package/src/core/agents/ci.md +6 -0
  74. package/src/core/agents/codebase-query.md +261 -0
  75. package/src/core/agents/compliance.md +6 -0
  76. package/src/core/agents/configuration-damage-control.md +6 -0
  77. package/src/core/agents/configuration-visual-e2e.md +6 -0
  78. package/src/core/agents/database.md +10 -0
  79. package/src/core/agents/datamigration.md +6 -0
  80. package/src/core/agents/design.md +6 -0
  81. package/src/core/agents/devops.md +6 -0
  82. package/src/core/agents/documentation.md +6 -0
  83. package/src/core/agents/epic-planner.md +6 -0
  84. package/src/core/agents/integrations.md +6 -0
  85. package/src/core/agents/mentor.md +6 -0
  86. package/src/core/agents/mobile.md +6 -0
  87. package/src/core/agents/monitoring.md +6 -0
  88. package/src/core/agents/multi-expert.md +6 -0
  89. package/src/core/agents/performance.md +6 -0
  90. package/src/core/agents/product.md +6 -0
  91. package/src/core/agents/qa.md +6 -0
  92. package/src/core/agents/readme-updater.md +6 -0
  93. package/src/core/agents/refactor.md +6 -0
  94. package/src/core/agents/research.md +6 -0
  95. package/src/core/agents/security.md +6 -0
  96. package/src/core/agents/testing.md +10 -0
  97. package/src/core/agents/ui.md +6 -0
  98. package/src/core/commands/adr.md +114 -0
  99. package/src/core/commands/agent.md +120 -0
  100. package/src/core/commands/assign.md +145 -0
  101. package/src/core/commands/audit.md +401 -0
  102. package/src/core/commands/babysit.md +32 -5
  103. package/src/core/commands/board.md +1 -0
  104. package/src/core/commands/changelog.md +118 -0
  105. package/src/core/commands/configure.md +42 -6
  106. package/src/core/commands/diagnose.md +114 -0
  107. package/src/core/commands/epic.md +205 -1
  108. package/src/core/commands/handoff.md +128 -0
  109. package/src/core/commands/help.md +76 -0
  110. package/src/core/commands/metrics.md +1 -0
  111. package/src/core/commands/pr.md +96 -0
  112. package/src/core/commands/research/analyze.md +1 -0
  113. package/src/core/commands/research/ask.md +2 -0
  114. package/src/core/commands/research/import.md +1 -0
  115. package/src/core/commands/research/list.md +2 -0
  116. package/src/core/commands/research/synthesize.md +584 -0
  117. package/src/core/commands/research/view.md +2 -0
  118. package/src/core/commands/roadmap/analyze.md +400 -0
  119. package/src/core/commands/session/new.md +113 -6
  120. package/src/core/commands/session/spawn.md +197 -0
  121. package/src/core/commands/sprint.md +22 -0
  122. package/src/core/commands/status.md +200 -1
  123. package/src/core/commands/story/list.md +9 -9
  124. package/src/core/commands/story/view.md +1 -0
  125. package/src/core/commands/story.md +143 -4
  126. package/src/core/experts/codebase-query/expertise.yaml +190 -0
  127. package/src/core/experts/codebase-query/question.md +73 -0
  128. package/src/core/experts/codebase-query/self-improve.md +105 -0
  129. package/src/core/templates/agileflow-metadata.json +55 -2
  130. package/src/core/templates/plan-template.md +125 -0
  131. package/src/core/templates/story-lifecycle.md +213 -0
  132. package/src/core/templates/story-template.md +4 -0
  133. package/src/core/templates/tdd-test-template.js +241 -0
  134. package/tools/cli/commands/setup.js +86 -0
  135. package/tools/cli/installers/core/installer.js +94 -0
  136. package/tools/cli/installers/ide/_base-ide.js +20 -11
  137. package/tools/cli/installers/ide/codex.js +29 -47
  138. package/tools/cli/lib/config-manager.js +17 -2
  139. package/tools/cli/lib/content-transformer.js +271 -0
  140. package/tools/cli/lib/error-handler.js +14 -22
  141. package/tools/cli/lib/ide-error-factory.js +421 -0
  142. package/tools/cli/lib/ide-health-monitor.js +364 -0
  143. package/tools/cli/lib/ide-registry.js +114 -1
  144. package/tools/cli/lib/ui.js +14 -25
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Create a user story with acceptance criteria
3
- argument-hint: EPIC=<EP-ID> STORY=<US-ID> TITLE=<text> OWNER=<id> [ESTIMATE=<pts>] [AC=<list>]
3
+ argument-hint: EPIC=<EP-ID> STORY=<US-ID> TITLE=<text> OWNER=<id> [ESTIMATE=<pts>] [AC=<list>] [TDD=true]
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
@@ -12,12 +12,17 @@ compact_context:
12
12
  - "MUST use AskUserQuestion for user confirmation (YES/NO/CANCEL format)"
13
13
  - "MUST create test stub in docs/07-testing/test-cases/<STORY>.md referencing AC"
14
14
  - "AC format: Given/When/Then bullets (user story format)"
15
+ - "TDD=true: Generate framework-specific test code BEFORE implementation"
16
+ - "TDD=true: Parse Given/When/Then into describe/it blocks (Jest) or test functions (pytest)"
17
+ - "TDD=true: All tests start as .skip or @pytest.mark.skip (pending)"
18
+ - "TDD=true: Add tdd_mode:true and test_file fields to status.json entry"
15
19
  state_fields:
16
20
  - story_id
17
21
  - epic_id
18
22
  - owner
19
23
  - estimate
20
24
  - ac_count
25
+ - tdd_mode
21
26
  ---
22
27
 
23
28
  # story-new
@@ -44,7 +49,7 @@ node .agileflow/scripts/obtain-context.js story
44
49
 
45
50
  ### 🚨 RULE #1: ALWAYS Create TodoWrite Task List FIRST
46
51
 
47
- Create a 6-step task list IMMEDIATELY:
52
+ Create a task list IMMEDIATELY (7 steps if TDD=true, 6 steps otherwise):
48
53
  ```xml
49
54
  <invoke name="TodoWrite">
50
55
  <parameter name="content">1. Parse inputs (EPIC, STORY, TITLE, OWNER, ESTIMATE, AC)
@@ -94,7 +99,45 @@ Test stub MUST reference AC:
94
99
  - Map each test to an AC bullet
95
100
  - Use BDD format (describe, test cases for each AC)
96
101
 
97
- ### 🚨 RULE #5: NEVER Use echo/cat > For JSON Operations
102
+ ### 🚨 RULE #5: TDD MODE (Smart Defaults)
103
+
104
+ **Smart TDD defaults based on OWNER:**
105
+ | Owner | Default | Rationale |
106
+ |-------|---------|-----------|
107
+ | AG-API, AG-UI, AG-DATABASE | TDD=true | Code-focused, tests critical |
108
+ | AG-TESTING, AG-SECURITY, AG-PERFORMANCE | TDD=true | Quality-focused |
109
+ | AG-DOCUMENTATION, AG-RESEARCH, AG-PRODUCT | TDD=false | Non-code work |
110
+ | AG-DEVOPS, AG-CI | TDD=false | Infrastructure, config |
111
+ | Other/Custom | TDD=false | Explicit opt-in |
112
+
113
+ **Override:** User can always specify `TDD=true` or `TDD=false` explicitly.
114
+
115
+ When TDD mode is active, generate framework-specific test code:
116
+
117
+ **Workflow:**
118
+ 1. Detect test framework from `environment.json` or `package.json`
119
+ 2. Parse AC into Given/When/Then structure
120
+ 3. Generate test file using `tdd-test-template.js`
121
+ 4. Create test in `__tests__/<STORY>.test.ts` (Jest) or `tests/test_<STORY>.py` (pytest)
122
+ 5. All tests start as `.skip` (pending)
123
+ 6. Add `tdd_mode: true` and `test_file` to status.json entry
124
+ 7. Add TDD badge to story file
125
+
126
+ **Test File Location:**
127
+ - Jest/Vitest: `__tests__/<STORY_ID>.test.ts`
128
+ - pytest: `tests/test_<STORY_ID>.py`
129
+ - Go: `<package>/<STORY_ID>_test.go`
130
+
131
+ **Status.json Entry (TDD mode):**
132
+ ```json
133
+ {
134
+ "tdd_mode": true,
135
+ "test_file": "__tests__/US-0042.test.ts",
136
+ "test_status": "not_run"
137
+ }
138
+ ```
139
+
140
+ ### 🚨 RULE #6: NEVER Use echo/cat > For JSON Operations
98
141
 
99
142
  **ALWAYS use**:
100
143
  - Edit tool for small changes
@@ -114,6 +157,7 @@ OWNER=<id> # Agent or person name (required)
114
157
  ESTIMATE=<time> # e.g., 0.5d, 2h (optional, default: 1d)
115
158
  AC=<bullets> # Given/When/Then format (optional)
116
159
  DEPENDENCIES=[<list>] # Dependent story IDs (optional)
160
+ TDD=true|false # TDD mode (smart default: true for code owners, false for docs/research)
117
161
  ```
118
162
 
119
163
  **Output Files Created**:
@@ -121,6 +165,7 @@ DEPENDENCIES=[<list>] # Dependent story IDs (optional)
121
165
  |------|---------|----------|
122
166
  | docs/06-stories/EP-<ID>/US-<ID>-<slug>.md | Story with AC | story-template.md |
123
167
  | docs/07-testing/test-cases/US-<ID>.md | Test stub | BDD format |
168
+ | __tests__/US-<ID>.test.ts | TDD test code (if TDD=true) | tdd-test-template.js |
124
169
  | docs/09-agents/status.json | Story entry | jq merge |
125
170
  | docs/09-agents/bus/log.jsonl | Assign event | JSONL line |
126
171
 
@@ -202,8 +247,9 @@ DEPENDENCIES=[<list>] # Dependent story IDs (optional)
202
247
  - ALWAYS create test stub referencing AC
203
248
  - ALWAYS preview before confirming (prevents mistakes)
204
249
  - ALWAYS validate JSON after merge (prevents corruption)
205
- - Use TodoWrite for step tracking (6 steps)
250
+ - Use TodoWrite for step tracking (6 steps, or 7 if TDD=true)
206
251
  - Files: story file, test file, status.json, bus/log.jsonl
252
+ - **TDD=true**: Also create framework-specific test code in `__tests__/` with pending tests
207
253
 
208
254
  <!-- COMPACT_SUMMARY_END -->
209
255
 
@@ -324,3 +370,96 @@ After successfully creating the story, offer next steps:
324
370
  - `/agileflow:story-validate` - Validate story completeness
325
371
  - `/agileflow:status` - Update story status
326
372
  - `/agileflow:epic` - Create parent epic
373
+
374
+ ---
375
+
376
+ ## Expected Output
377
+
378
+ ### Successful Story Creation
379
+
380
+ ```
381
+ 📝 Creating Story: US-0042
382
+
383
+ Epic: EP-0010
384
+ Title: Login Form with Validation
385
+ Owner: AG-UI
386
+ Estimate: 2h
387
+ TDD Mode: true (smart default for AG-UI)
388
+
389
+ Files to create:
390
+ ───────────────────────────
391
+ 1. docs/06-stories/EP-0010/US-0042-login-form-validation.md
392
+ - Story file with 3 acceptance criteria
393
+
394
+ 2. docs/07-testing/test-cases/US-0042.md
395
+ - Test stub referencing AC
396
+
397
+ 3. __tests__/US-0042.test.ts (TDD mode)
398
+ - 3 pending test cases from AC
399
+
400
+ 4. docs/09-agents/status.json (merge)
401
+ + "US-0042": {
402
+ + "id": "US-0042",
403
+ + "epic": "EP-0010",
404
+ + "owner": "AG-UI",
405
+ + "status": "ready",
406
+ + "estimate": "2h",
407
+ + "tdd_mode": true,
408
+ + "test_file": "__tests__/US-0042.test.ts"
409
+ + }
410
+
411
+ 5. docs/09-agents/bus/log.jsonl (append)
412
+ + {"ts":"...","type":"assign","from":"SYSTEM","to":"AG-UI","story":"US-0042"}
413
+
414
+ [AskUserQuestion: "Create story US-0042: Login Form with Validation?"]
415
+
416
+ ✅ Story US-0042 created successfully!
417
+ ✅ Test stub created: docs/07-testing/test-cases/US-0042.md
418
+ ✅ TDD tests created: __tests__/US-0042.test.ts (3 pending)
419
+ ✅ Bus message sent: assign → AG-UI
420
+
421
+ [AskUserQuestion: "What would you like to do next?"]
422
+ ```
423
+
424
+ ### Story with Dependencies
425
+
426
+ ```
427
+ 📝 Creating Story: US-0043
428
+
429
+ Dependencies: US-0042 (Login Form)
430
+
431
+ ⚠️ Dependency Status:
432
+ • US-0042: ready (not yet done)
433
+
434
+ [AskUserQuestion: "Create story with pending dependency?"]
435
+ - Yes, create anyway (dependency will block)
436
+ - No, wait for US-0042
437
+
438
+ ✅ Story US-0043 created
439
+ ⚠️ Status set to 'blocked' (waiting on US-0042)
440
+ ```
441
+
442
+ ### Validation Error
443
+
444
+ ```
445
+ ❌ Invalid Input
446
+
447
+ Missing required parameters:
448
+ • EPIC - Parent epic ID (e.g., EP-0010)
449
+ • TITLE - Story title
450
+
451
+ Usage:
452
+ /agileflow:story EPIC=EP-0010 STORY=US-0042 TITLE="Login Form" OWNER=AG-UI
453
+ ```
454
+
455
+ ### TDD Mode Detection
456
+
457
+ ```
458
+ 📝 Story Creation
459
+
460
+ Owner: AG-DOCUMENTATION
461
+ TDD Mode: false (smart default - documentation work)
462
+
463
+ ℹ️ To enable TDD mode, add TDD=true to the command:
464
+ /agileflow:story ... TDD=true
465
+ ```
@@ -0,0 +1,190 @@
1
+ # Codebase Query Expert - Domain Knowledge
2
+ # This file is the agent's "mental model" of codebase querying
3
+ # AUTO-UPDATED by self-improve.md after completing work
4
+
5
+ domain: codebase-query
6
+ last_updated: 2026-01-19
7
+ version: 1.0
8
+
9
+ # Query interface components
10
+ files:
11
+ query_script:
12
+ - path: packages/cli/scripts/query-codebase.js
13
+ purpose: "CLI for codebase queries"
14
+ commands:
15
+ - "--build-index: Build/rebuild codebase index"
16
+ - "--query=<pattern>: Smart search (glob + tag + export)"
17
+ - "--content=<regex>: Search file content"
18
+ - "--tag=<tag>: Search by tag"
19
+ - "--export=<symbol>: Find export locations"
20
+ - "--deps=<file>: Show file dependencies"
21
+
22
+ indexer:
23
+ - path: packages/cli/lib/codebase-indexer.js
24
+ purpose: "Core indexing logic"
25
+ functions:
26
+ - "buildIndex(rootDir): Full index build"
27
+ - "updateIndex(rootDir): Incremental update"
28
+ - "getIndex(rootDir): Get cached or build"
29
+ - "queryFiles(index, pattern): Glob matching"
30
+ - "queryByTag(index, tag): Tag lookup"
31
+ - "queryByExport(index, symbol): Export search"
32
+ - "getDependencies(index, file): Import graph"
33
+
34
+ cache:
35
+ - path: .agileflow/cache/codebase-index.json
36
+ purpose: "Persistent index storage"
37
+ ttl: "60 seconds in-memory, persistent on disk"
38
+
39
+ # Query type mappings
40
+ query_types:
41
+ files:
42
+ flag: "--query"
43
+ description: "Smart search combining glob, tag, and export matching"
44
+ examples:
45
+ - input: "auth files"
46
+ translation: '--query="auth"'
47
+ - input: "api routes"
48
+ translation: '--query="src/api/**/*.ts"'
49
+ - input: "test files"
50
+ translation: '--query="**/*.test.{js,ts}"'
51
+
52
+ content:
53
+ flag: "--content"
54
+ description: "Grep-style regex content search"
55
+ examples:
56
+ - input: "files with validateToken"
57
+ translation: '--content="validateToken"'
58
+ - input: "error handling patterns"
59
+ translation: '--content="try.*catch|\.catch\\("'
60
+ - input: "React hooks usage"
61
+ translation: '--content="use(State|Effect|Ref|Context)"'
62
+
63
+ tag:
64
+ flag: "--tag"
65
+ description: "Search by auto-detected tag"
66
+ examples:
67
+ - input: "API endpoints"
68
+ translation: '--tag="api"'
69
+ - input: "UI components"
70
+ translation: '--tag="ui"'
71
+ - input: "database models"
72
+ translation: '--tag="database"'
73
+
74
+ export:
75
+ flag: "--export"
76
+ description: "Find files exporting a symbol"
77
+ examples:
78
+ - input: "where is login defined"
79
+ translation: '--export="login"'
80
+ - input: "UserService export"
81
+ translation: '--export="UserService"'
82
+
83
+ deps:
84
+ flag: "--deps"
85
+ description: "Show file dependencies"
86
+ examples:
87
+ - input: "what depends on auth.ts"
88
+ translation: '--deps="src/auth.ts"'
89
+ - input: "utils dependencies"
90
+ translation: '--deps="src/lib/utils.js"'
91
+
92
+ # Available tags (auto-detected from paths)
93
+ available_tags:
94
+ api:
95
+ patterns: ["/api/", "/routes/", "/endpoints/", "/controllers/"]
96
+ description: "API endpoints and routes"
97
+ ui:
98
+ patterns: ["/components/", "/ui/", "/views/", "/pages/"]
99
+ description: "UI components and views"
100
+ database:
101
+ patterns: ["/db/", "/database/", "/models/", "/schema/", "/migrations/"]
102
+ description: "Database models and migrations"
103
+ auth:
104
+ patterns: ["/auth/", "/login/", "/session/", "/jwt/", "/oauth/"]
105
+ description: "Authentication logic"
106
+ test:
107
+ patterns: ["/test/", "/tests/", "/__tests__/", "/spec/", "/specs/"]
108
+ description: "Test files"
109
+ config:
110
+ patterns: ["/config/", "/settings/", "/env/"]
111
+ description: "Configuration files"
112
+ lib:
113
+ patterns: ["/lib/", "/utils/", "/helpers/", "/shared/"]
114
+ description: "Utility libraries"
115
+ docs:
116
+ patterns: ["/docs/", "/documentation/"]
117
+ description: "Documentation files"
118
+ scripts:
119
+ patterns: ["/scripts/", "/bin/", "/tools/"]
120
+ description: "Build and utility scripts"
121
+ types:
122
+ patterns: ["/types/", "/typings/", "/interfaces/"]
123
+ description: "Type definitions"
124
+
125
+ # Natural language patterns
126
+ nl_patterns:
127
+ - pattern: "where is * defined"
128
+ query_type: export
129
+ extraction: "symbol from *"
130
+ - pattern: "what files use *"
131
+ query_type: export
132
+ extraction: "symbol from *"
133
+ - pattern: "* files"
134
+ query_type: query
135
+ extraction: "keyword from *"
136
+ - pattern: "files with *"
137
+ query_type: content
138
+ extraction: "regex from *"
139
+ - pattern: "* in the codebase"
140
+ query_type: query
141
+ extraction: "keyword from *"
142
+ - pattern: "dependencies of *"
143
+ query_type: deps
144
+ extraction: "file path from *"
145
+ - pattern: "what depends on *"
146
+ query_type: deps
147
+ extraction: "file path from *"
148
+
149
+ # Fallback strategies
150
+ fallbacks:
151
+ index_unavailable:
152
+ description: "When index cannot be built or is corrupted"
153
+ strategy:
154
+ - "Use Glob tool for file pattern matching"
155
+ - "Use Grep tool for content searching"
156
+ - "Combine results manually"
157
+
158
+ no_results:
159
+ description: "When query returns no matches"
160
+ strategy:
161
+ - "Try broader search terms"
162
+ - "Check for typos in symbol names"
163
+ - "Try content search instead of export search"
164
+ - "Suggest related tags"
165
+
166
+ # Conventions
167
+ conventions:
168
+ - "Always check index status before querying"
169
+ - "Translate natural language to structured queries"
170
+ - "Combine multiple query types for complex searches"
171
+ - "Respect token budget (default 15000 chars)"
172
+ - "Show file counts and truncation notices"
173
+ - "READ-ONLY: Never use Write/Edit tools"
174
+
175
+ # Learnings from codebase exploration
176
+ learnings:
177
+ - date: 2026-01-19
178
+ context: "Initial indexer implementation"
179
+ insight: "Index build takes ~6.5s for 1777 files, use incremental updates for speed"
180
+ source: "packages/cli/lib/codebase-indexer.js"
181
+
182
+ - date: 2026-01-19
183
+ context: "Tag detection"
184
+ insight: "9 auto-detected tags available: api, ui, database, auth, test, config, lib, docs, scripts"
185
+ source: "packages/cli/lib/codebase-indexer.js:TAG_PATTERNS"
186
+
187
+ - date: 2026-01-19
188
+ context: "Export tracking"
189
+ insight: "477 exports tracked across codebase, searchable via --export flag"
190
+ source: "query-codebase.js --build-index output"
@@ -0,0 +1,73 @@
1
+ ---
2
+ description: Ask questions about codebase-query - uses expertise for fast, accurate answers
3
+ argument-hint: <your question>
4
+ variables:
5
+ EXPERTISE_FILE: packages/cli/src/core/experts/codebase-query/expertise.yaml
6
+ ---
7
+
8
+ # Codebase Query Expert - Question
9
+
10
+ You are an expert on the codebase-query domain for this codebase. You maintain a mental model (expertise file) that helps you answer questions quickly and accurately.
11
+
12
+ ## CRITICAL: Expertise-First Workflow
13
+
14
+ **You MUST follow this workflow. Do not skip steps.**
15
+
16
+ ### Step 1: Load Your Expertise
17
+ Read your expertise file at `packages/cli/src/core/experts/codebase-query/expertise.yaml` FIRST, before doing anything else.
18
+
19
+ This file contains:
20
+ - Query types and their translations
21
+ - Available tags and patterns
22
+ - Natural language pattern mappings
23
+ - Fallback strategies
24
+ - Recent learnings from past queries
25
+
26
+ ### Step 2: Validate Against Actual Code
27
+ Your expertise is a mental model, NOT the source of truth. The code is always the source of truth.
28
+
29
+ For each relevant piece of expertise:
30
+ 1. Check if the query script still works as documented
31
+ 2. Verify your understanding matches current behavior
32
+ 3. Note any discrepancies (for self-improve later)
33
+
34
+ ### Step 3: Answer the Question
35
+ With your validated mental model:
36
+ 1. Answer based on your expertise + validation
37
+ 2. Be specific - include exact query commands
38
+ 3. If expertise was wrong, note it in your answer
39
+ 4. If you don't know, say so (don't guess)
40
+
41
+ ## Key Principles
42
+
43
+ - **Speed**: Use expertise to skip unnecessary testing
44
+ - **Accuracy**: Always validate against actual behavior
45
+ - **Honesty**: Acknowledge when expertise is stale
46
+ - **Learning**: Note discrepancies for self-improve
47
+
48
+ ## Common Questions
49
+
50
+ ### "How do I search for X?"
51
+ 1. Check `query_types` in expertise for matching type
52
+ 2. Check `nl_patterns` for natural language mapping
53
+ 3. Provide the exact command
54
+
55
+ ### "What tags are available?"
56
+ Reference `available_tags` in expertise, validate they exist in TAG_PATTERNS.
57
+
58
+ ### "Why did my query return no results?"
59
+ Check `fallbacks.no_results` for strategies, suggest alternatives.
60
+
61
+ ### "How does the index work?"
62
+ Reference `files.indexer` for implementation details.
63
+
64
+ ## Anti-Patterns to Avoid
65
+
66
+ - Reading expertise but ignoring it
67
+ - Testing queries before checking expertise
68
+ - Trusting expertise blindly without validation
69
+ - Giving vague answers when expertise has specifics
70
+
71
+ ## Question
72
+
73
+ {{argument}}
@@ -0,0 +1,105 @@
1
+ ---
2
+ description: Update codebase-query expertise after making changes
3
+ argument-hint: [optional context about what changed]
4
+ variables:
5
+ EXPERTISE_FILE: packages/cli/src/core/experts/codebase-query/expertise.yaml
6
+ ---
7
+
8
+ # Codebase Query Expert - Self-Improve
9
+
10
+ You are updating your mental model (expertise file) to reflect changes in the codebase. This keeps your expertise accurate and useful for future tasks.
11
+
12
+ ## CRITICAL: Self-Improve Workflow
13
+
14
+ ### Step 1: Read Current Expertise
15
+ Load your expertise file at `packages/cli/src/core/experts/codebase-query/expertise.yaml`.
16
+
17
+ Understand what you currently know about:
18
+ - Query types and translations
19
+ - Available tags
20
+ - Natural language patterns
21
+ - Fallback strategies
22
+
23
+ ### Step 2: Analyze What Changed
24
+
25
+ **If git diff available:**
26
+ ```bash
27
+ git diff HEAD~1 --name-only | grep -E "(codebase-indexer|query-codebase)"
28
+ ```
29
+
30
+ **If context provided:**
31
+ Use the argument/context to understand what changed.
32
+
33
+ **If neither:**
34
+ Compare expertise file against actual codebase state.
35
+
36
+ ### Step 3: Update Expertise
37
+
38
+ **Update `query_types` section if:**
39
+ - New query flags added
40
+ - Query behavior changed
41
+ - New examples discovered
42
+
43
+ **Update `available_tags` section if:**
44
+ - New tags added to TAG_PATTERNS
45
+ - Tag patterns changed
46
+ - Tag descriptions updated
47
+
48
+ **Update `nl_patterns` section if:**
49
+ - New natural language patterns discovered
50
+ - Better translations found
51
+ - User preferences learned
52
+
53
+ **Update `fallbacks` section if:**
54
+ - New fallback strategies needed
55
+ - Edge cases discovered
56
+ - Error handling improved
57
+
58
+ **ALWAYS add to `learnings` section:**
59
+ ```yaml
60
+ learnings:
61
+ - date: YYYY-MM-DD
62
+ context: "What prompted this update"
63
+ insight: "What you learned"
64
+ source: "Where you learned it"
65
+ ```
66
+
67
+ ### Step 4: Save Updated Expertise
68
+ Edit the expertise file with your updates.
69
+
70
+ ### Learning Signals
71
+
72
+ **High-confidence signals** (definitely add to learnings):
73
+ - User explicitly corrected a translation
74
+ - Query returned wrong results
75
+ - New query pattern worked well
76
+ - Index build revealed new patterns
77
+
78
+ **Medium-confidence signals** (consider adding):
79
+ - User rephrased query differently
80
+ - Multiple query types combined
81
+ - Fallback strategy used
82
+
83
+ **Low-confidence signals** (observe but don't add yet):
84
+ - Single-use query patterns
85
+ - Unusual file structures
86
+
87
+ ### Example Learning Entry
88
+
89
+ ```yaml
90
+ learnings:
91
+ - date: 2026-01-19
92
+ context: "User asked for 'authentication middleware'"
93
+ insight: "Combine --tag='auth' with --query='middleware' for auth middleware files"
94
+ source: "User query feedback"
95
+ ```
96
+
97
+ ## Output Format
98
+
99
+ After updating, confirm:
100
+ ```
101
+ Updated expertise.yaml:
102
+ - Added learning: [brief description]
103
+ - Updated [section]: [what changed]
104
+ - Version: [new version]
105
+ ```
@@ -1,8 +1,61 @@
1
1
  {
2
+ "schema_version": "2.0.0",
3
+ "config_schema_version": "2.92.0",
4
+ "active_profile": null,
2
5
  "agileflow": {
3
6
  "version": "2.28.0",
4
- "setupDate": "TIMESTAMP_PLACEHOLDER",
5
- "lastValidated": null,
7
+ "setup_date": "TIMESTAMP_PLACEHOLDER",
8
+ "last_validated": null,
9
+ "config_options": {
10
+ "claudeMdReinforcement": {
11
+ "available_since": "2.92.0",
12
+ "configured": false,
13
+ "enabled": false,
14
+ "description": "Add /babysit AskUserQuestion rules to CLAUDE.md"
15
+ },
16
+ "sessionStartHook": {
17
+ "available_since": "2.35.0",
18
+ "configured": false,
19
+ "enabled": false,
20
+ "description": "Welcome display with project status on session start"
21
+ },
22
+ "precompactHook": {
23
+ "available_since": "2.40.0",
24
+ "configured": false,
25
+ "enabled": false,
26
+ "description": "Context preservation when conversation compacts"
27
+ },
28
+ "damageControlHooks": {
29
+ "available_since": "2.50.0",
30
+ "configured": false,
31
+ "enabled": false,
32
+ "description": "Block destructive commands, protect sensitive paths"
33
+ },
34
+ "statusLine": {
35
+ "available_since": "2.35.0",
36
+ "configured": false,
37
+ "enabled": false,
38
+ "description": "Custom status bar showing story/epic info"
39
+ },
40
+ "autoArchival": {
41
+ "available_since": "2.35.0",
42
+ "configured": false,
43
+ "enabled": false,
44
+ "description": "Auto-archive completed stories older than threshold"
45
+ },
46
+ "autoUpdate": {
47
+ "available_since": "2.70.0",
48
+ "configured": false,
49
+ "enabled": false,
50
+ "description": "Automatically update AgileFlow on session start"
51
+ },
52
+ "ralphLoop": {
53
+ "available_since": "2.60.0",
54
+ "configured": false,
55
+ "enabled": false,
56
+ "description": "Autonomous story processing with test verification"
57
+ }
58
+ },
6
59
  "features": {
7
60
  "epics": true,
8
61
  "stories": true,