agent-method 1.5.12

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 (108) hide show
  1. package/README.md +343 -0
  2. package/bin/wwa.js +115 -0
  3. package/docs/internal/cli-commands.yaml +259 -0
  4. package/docs/internal/doc-tokens.yaml +1103 -0
  5. package/docs/internal/feature-registry.yaml +1643 -0
  6. package/lib/boundaries.js +247 -0
  7. package/lib/cli/add.js +170 -0
  8. package/lib/cli/casestudy.js +1000 -0
  9. package/lib/cli/check.js +323 -0
  10. package/lib/cli/close.js +838 -0
  11. package/lib/cli/completion.js +735 -0
  12. package/lib/cli/deps.js +234 -0
  13. package/lib/cli/digest.js +73 -0
  14. package/lib/cli/doc-review.js +486 -0
  15. package/lib/cli/docs.js +315 -0
  16. package/lib/cli/helpers.js +198 -0
  17. package/lib/cli/implement.js +169 -0
  18. package/lib/cli/init.js +280 -0
  19. package/lib/cli/pipeline.js +206 -0
  20. package/lib/cli/plan.js +140 -0
  21. package/lib/cli/record.js +98 -0
  22. package/lib/cli/refine.js +202 -0
  23. package/lib/cli/report-helpers.js +113 -0
  24. package/lib/cli/review.js +76 -0
  25. package/lib/cli/routable.js +109 -0
  26. package/lib/cli/route.js +101 -0
  27. package/lib/cli/scan.js +133 -0
  28. package/lib/cli/serve.js +23 -0
  29. package/lib/cli/status.js +65 -0
  30. package/lib/cli/update-docs.js +574 -0
  31. package/lib/cli/upgrade.js +222 -0
  32. package/lib/cli/watch.js +32 -0
  33. package/lib/dependencies.js +196 -0
  34. package/lib/init.js +692 -0
  35. package/lib/mcp-server.js +612 -0
  36. package/lib/pipeline.js +907 -0
  37. package/lib/registry.js +132 -0
  38. package/lib/watcher.js +165 -0
  39. package/package.json +54 -0
  40. package/templates/README.md +363 -0
  41. package/templates/entry-points/.cursorrules +90 -0
  42. package/templates/entry-points/AGENT.md +90 -0
  43. package/templates/entry-points/CLAUDE.md +88 -0
  44. package/templates/extensions/MANIFEST.md +110 -0
  45. package/templates/extensions/analytical-system.md +96 -0
  46. package/templates/extensions/code-project.md +77 -0
  47. package/templates/extensions/data-exploration.md +117 -0
  48. package/templates/full/.context/BASE.md +101 -0
  49. package/templates/full/.context/COMPOSITION.md +47 -0
  50. package/templates/full/.context/INDEX.yaml +56 -0
  51. package/templates/full/.context/METHODOLOGY.md +246 -0
  52. package/templates/full/.context/PROTOCOL.yaml +169 -0
  53. package/templates/full/.context/REGISTRY.md +75 -0
  54. package/templates/full/.cursorrules +90 -0
  55. package/templates/full/AGENT.md +90 -0
  56. package/templates/full/CLAUDE.md +90 -0
  57. package/templates/full/Management/DIGEST.md +23 -0
  58. package/templates/full/Management/STATUS.md +46 -0
  59. package/templates/full/PLAN.md +67 -0
  60. package/templates/full/PROJECT-PROFILE.md +61 -0
  61. package/templates/full/PROJECT.md +80 -0
  62. package/templates/full/REQUIREMENTS.md +30 -0
  63. package/templates/full/ROADMAP.md +39 -0
  64. package/templates/full/Reviews/INDEX.md +41 -0
  65. package/templates/full/Reviews/backlog.md +52 -0
  66. package/templates/full/Reviews/plan.md +43 -0
  67. package/templates/full/Reviews/project.md +41 -0
  68. package/templates/full/Reviews/requirements.md +42 -0
  69. package/templates/full/Reviews/roadmap.md +41 -0
  70. package/templates/full/Reviews/state.md +56 -0
  71. package/templates/full/SESSION-LOG.md +102 -0
  72. package/templates/full/STATE.md +42 -0
  73. package/templates/full/SUMMARY.md +27 -0
  74. package/templates/full/agentWorkflows/INDEX.md +42 -0
  75. package/templates/full/agentWorkflows/observations.md +65 -0
  76. package/templates/full/agentWorkflows/patterns.md +68 -0
  77. package/templates/full/agentWorkflows/sessions.md +92 -0
  78. package/templates/full/intro/README.md +39 -0
  79. package/templates/full/registry/feature-registry.yaml +25 -0
  80. package/templates/full/registry/features/catalog.yaml +743 -0
  81. package/templates/full/registry/features/protocol.yaml +121 -0
  82. package/templates/full/registry/features/routing.yaml +358 -0
  83. package/templates/full/registry/features/workflows.yaml +404 -0
  84. package/templates/full/todos/backlog.md +19 -0
  85. package/templates/starter/.context/BASE.md +66 -0
  86. package/templates/starter/.context/INDEX.yaml +51 -0
  87. package/templates/starter/.context/METHODOLOGY.md +228 -0
  88. package/templates/starter/.context/PROTOCOL.yaml +165 -0
  89. package/templates/starter/.cursorrules +90 -0
  90. package/templates/starter/AGENT.md +90 -0
  91. package/templates/starter/CLAUDE.md +90 -0
  92. package/templates/starter/Management/DIGEST.md +23 -0
  93. package/templates/starter/Management/STATUS.md +46 -0
  94. package/templates/starter/PLAN.md +67 -0
  95. package/templates/starter/PROJECT-PROFILE.md +44 -0
  96. package/templates/starter/PROJECT.md +80 -0
  97. package/templates/starter/ROADMAP.md +39 -0
  98. package/templates/starter/Reviews/INDEX.md +75 -0
  99. package/templates/starter/SESSION-LOG.md +102 -0
  100. package/templates/starter/STATE.md +42 -0
  101. package/templates/starter/SUMMARY.md +27 -0
  102. package/templates/starter/agentWorkflows/INDEX.md +61 -0
  103. package/templates/starter/intro/README.md +37 -0
  104. package/templates/starter/registry/feature-registry.yaml +25 -0
  105. package/templates/starter/registry/features/catalog.yaml +743 -0
  106. package/templates/starter/registry/features/protocol.yaml +121 -0
  107. package/templates/starter/registry/features/routing.yaml +358 -0
  108. package/templates/starter/registry/features/workflows.yaml +404 -0
@@ -0,0 +1,1643 @@
1
+ # Feature Registry — Operational Specification
2
+ #
3
+ # This is NOT just a catalog. It is the agent's behavioral protocol
4
+ # AND the computable source of truth for routing automation.
5
+ # Four layers:
6
+ # 1. Feature catalog — WHAT each capability is
7
+ # 2. Guided workflows — HOW features compose into task patterns
8
+ # 3. Agent protocol — WHY the agent does what it does
9
+ # 4. Routing rules — HOW queries map to features automatically
10
+ #
11
+ # The entry point, scoping rules, and cascade table in any project
12
+ # are concrete implementations derived from this registry.
13
+ # Tools read this file to generate entry points, classify queries,
14
+ # and validate behavior.
15
+
16
+ version: v1.6
17
+
18
+ # ============================================================
19
+ # LAYER 1: FEATURE CATALOG
20
+ # What each capability is, when it triggers, what it touches
21
+ # ============================================================
22
+
23
+ domains:
24
+ - id: CTX
25
+ name: Context management
26
+ purpose: Build and maintain the agent's understanding of the project so every session starts informed
27
+ project_types: [universal]
28
+ - id: QRY
29
+ name: Query routing
30
+ purpose: Ensure the agent reads the right files and only the right files for each task
31
+ project_types: [universal]
32
+ - id: STT
33
+ name: State management
34
+ purpose: Preserve decisions, uncertainties, and position across sessions so nothing is lost
35
+ project_types: [universal]
36
+ - id: TSK
37
+ name: Task execution
38
+ purpose: Structure work into verifiable units so progress is measurable and auditable
39
+ project_types: [universal]
40
+ - id: HAI
41
+ name: Human-agent interaction
42
+ purpose: Give the human control over agent autonomy and keep both audiences served
43
+ project_types: [universal]
44
+ - id: TPL
45
+ name: Template and bootstrap
46
+ purpose: Get a new project from zero to working agent collaboration in minutes
47
+ project_types: [universal]
48
+ - id: EXP
49
+ name: Data exploration
50
+ purpose: Build structured understanding of user-submitted data and provide interactive access
51
+ project_types: [data]
52
+
53
+ - id: SCAN
54
+ name: Project discovery
55
+ purpose: Inventory, map, and assess existing projects so the agent builds understanding before contributing
56
+ project_types: [universal]
57
+
58
+ features:
59
+ # --- Context management ---
60
+ - id: CTX-01
61
+ name: initContext
62
+ domain: CTX
63
+ project_types: [universal]
64
+ description: Initialize the .context/ structure for a new or existing project
65
+ trigger: Project bootstrap (first session after template copy)
66
+ reads: [PROJECT.md, project directory structure]
67
+ writes: [.context/BASE.md]
68
+ options:
69
+ mode: [greenfield, brownfield]
70
+ dependencies: [TPL-01]
71
+ stage: on_demand
72
+ version: v1
73
+ type_variants:
74
+ code: Scan directory tree, map modules, technology stack, build system
75
+ data: Scan data sources, build data inventory, identify schemas
76
+ analytical: Discover chains, map components, identify pipeline stages
77
+ agent_directive: >
78
+ On first session, detect whether this is a new or existing project.
79
+ For greenfield: create BASE.md with empty project map ready to fill.
80
+ For brownfield: scan the project structure and populate the map
81
+ so future sessions understand the project immediately.
82
+
83
+ - id: CTX-02
84
+ name: refreshContext
85
+ domain: CTX
86
+ project_types: [universal]
87
+ description: Rescan the project and update .context/ files to match current reality
88
+ trigger: User requests context refresh; agent detects stale context; return after significant external changes
89
+ reads: [".context/*", "project directory structure", "recent git changes"]
90
+ writes: [".context/BASE.md", ".context/{affected specialists}", "entry point"]
91
+ options:
92
+ scope: [full, incremental]
93
+ dependencies: [CTX-05]
94
+ stage: on_demand
95
+ version: v1
96
+ type_variants:
97
+ code: Compare codebase map against directory structure, updated deps
98
+ data: Compare data map against data sources for new data, schema changes
99
+ analytical: Compare pipeline map against system state for new stages, changed rules
100
+ agent_directive: >
101
+ Projects evolve between sessions. Context files that don't match reality
102
+ cause the agent to make wrong assumptions. When triggered, compare
103
+ what .context/ says against what actually exists. Update the project
104
+ map, flag drift, and ensure future sessions start with accurate context.
105
+
106
+ - id: CTX-03
107
+ name: pairContext
108
+ domain: CTX
109
+ project_types: [universal]
110
+ description: Load the appropriate context pair (BASE + specialist) for a query type
111
+ trigger: Every query after cold start
112
+ reads: ["entry point scoping table", ".context/BASE.md", ".context/{matched specialist}"]
113
+ writes: []
114
+ dependencies: [QRY-02]
115
+ stage: scope
116
+ version: v1
117
+ type_variants:
118
+ code: "BASE + code specialist (API.md, DATABASE.md, TESTING.md, etc.)"
119
+ data: "BASE + data specialist (SCHEMA.md, DOCUMENTS.md, RELATIONSHIPS.md)"
120
+ analytical: "BASE + domain specialist (COMPOSITION.md, EVALUATION.md, EXECUTION.md, etc.)"
121
+ agent_directive: >
122
+ Never load all context files. Load BASE.md (always) plus exactly one
123
+ specialist matched to the query type. This keeps context focused and
124
+ prevents the agent from being overwhelmed with irrelevant information.
125
+
126
+ - id: CTX-04
127
+ name: growContext
128
+ domain: CTX
129
+ project_types: [universal]
130
+ description: Create a new specialist context file when a new domain area is identified
131
+ trigger: Agent recognizes recurring domain not covered by existing specialists; user explicitly requests
132
+ reads: [.context/BASE.md, entry point, relevant source files]
133
+ writes: [".context/{SPECIALIST}.md", ".context/BASE.md", "entry point"]
134
+ dependencies: [CTX-01]
135
+ stage: execute
136
+ version: v1
137
+ type_variants:
138
+ code: New code domain → new specialist (e.g., SECURITY.md when auth code grows)
139
+ data: New data dimension → new specialist or expanded existing
140
+ analytical: New pipeline stage → new specialist
141
+ agent_directive: >
142
+ As a project grows, new domain areas emerge that need their own context.
143
+ When you notice recurring questions about a domain not covered by existing
144
+ specialists, propose a new specialist file. This makes future sessions
145
+ in that domain more efficient.
146
+
147
+ - id: CTX-05
148
+ name: mapProject
149
+ domain: CTX
150
+ project_types: [universal]
151
+ description: Generate or update the project map section in BASE.md
152
+ trigger: CTX-01 bootstrap, CTX-02 refresh, cascade from project structure change
153
+ reads: [project directory structure, package files, key source files]
154
+ writes: [.context/BASE.md]
155
+ options:
156
+ mode: [codebase, data-sources, domain-chains]
157
+ depth: [shallow, deep]
158
+ dependencies: []
159
+ stage: execute
160
+ version: v1.1
161
+ type_variants:
162
+ codebase: Walk directory tree, record path/purpose/patterns/dependencies
163
+ data-sources: Scan data sources, record source/type/size/keys/dimensions
164
+ domain-chains: Trace input→transformation→output flows, record chains/components
165
+ agent_directive: >
166
+ The project map is the agent's working memory of the project structure.
167
+ For code: walk directories, record what each does and what patterns it uses.
168
+ For data: scan sources, record schemas, relationships, and dimensions.
169
+ For analytical systems: trace transformation chains and map components.
170
+ This map is what allows the agent to navigate without re-exploring every session.
171
+
172
+ - id: CTX-06
173
+ name: manageScale
174
+ domain: CTX
175
+ project_types: [universal]
176
+ description: Monitor file size, restructure into index + components when threshold exceeded, maintain navigation registry
177
+ trigger: After any file write that increases an intelligence layer file beyond 300 lines; after any file split, creation, deletion, or rename
178
+ reads: [affected file, .context/REGISTRY.md]
179
+ writes: [affected file (rewritten as index), new component subdirectory/files, .context/REGISTRY.md]
180
+ options:
181
+ threshold: [300]
182
+ grouping: [semantic, chronological]
183
+ dependencies: [QRY-03]
184
+ stage: execute
185
+ version: v1.2
186
+ type_variants:
187
+ all: >
188
+ Index keeps active/current content + navigation table linking to components.
189
+ Components are archived sections grouped by semantic boundary (phases, domains, time periods).
190
+ Subdirectory named after the file stem (e.g., SUMMARY.md -> summary/).
191
+ Navigation registry (.context/REGISTRY.md) tracks all files, topics, and structural changes.
192
+ agent_directive: >
193
+ After writing to an intelligence layer file, check its line count.
194
+ If it exceeds 300 lines, restructure: keep active content in the
195
+ original file (now an index with navigation table), move archived
196
+ sections to a subdirectory named after the file stem. Group archived
197
+ content by semantic boundaries. The index must remain self-sufficient
198
+ for current work — components hold history, not active state.
199
+ After ANY structural change (split, create, delete, rename), update
200
+ .context/REGISTRY.md: file tree (add/remove entries, update line counts),
201
+ topic index (add/redirect/remove entries), structural log (record what
202
+ happened and why). The registry is the agent's fast-lookup map — one
203
+ read gives the full picture of where content lives.
204
+
205
+ # --- Query routing ---
206
+ - id: QRY-01
207
+ name: coldStart
208
+ domain: QRY
209
+ project_types: [universal]
210
+ description: Two-file initialization protocol for every new session
211
+ trigger: Session start (always)
212
+ reads: [entry point, STATE.md]
213
+ writes: []
214
+ dependencies: []
215
+ stage: initialize
216
+ version: v1
217
+ agent_directive: >
218
+ Every session begins by reading exactly two files: the entry point
219
+ and STATE.md. This gives you scoping rules, cascade table, conventions,
220
+ current position, prior decisions, and open questions. Do not load
221
+ anything else until a query arrives.
222
+
223
+ - id: QRY-02
224
+ name: scopeQuery
225
+ domain: QRY
226
+ project_types: [universal]
227
+ description: Classify a human query and load the appropriate file set
228
+ trigger: Every human query after cold start
229
+ reads: [entry point scoping table]
230
+ writes: []
231
+ dependencies: [QRY-01]
232
+ stage: scope
233
+ version: v1
234
+ agent_directive: >
235
+ Match the user's query against the scoping table. Load the read-set.
236
+ Constrain writes to the write-set. If the query doesn't match any row
237
+ cleanly, ask the user to clarify before loading files. Tables are
238
+ your routing logic — follow them deterministically.
239
+
240
+ - id: QRY-03
241
+ name: cascadeUpdate
242
+ domain: QRY
243
+ project_types: [universal]
244
+ description: After a file change, propagate updates through the dependency chain
245
+ trigger: Any file change during execute or close stages
246
+ reads: [entry point cascade table]
247
+ writes: [dependent files per cascade rules]
248
+ dependencies: [QRY-02]
249
+ stage: execute
250
+ version: v1
251
+ agent_directive: >
252
+ After EVERY file change, check the cascade table. If the change matches
253
+ a trigger, update the dependent files in the same response. Deferred
254
+ cascades don't happen. Check for secondary cascades up to 2 levels deep.
255
+
256
+ # --- State management ---
257
+ - id: STT-01
258
+ name: recordDecision
259
+ domain: STT
260
+ project_types: [universal]
261
+ description: Capture decisions in STATE.md immediately when made
262
+ trigger: Agent makes or recognizes a decision during any stage
263
+ reads: [STATE.md]
264
+ writes: [STATE.md]
265
+ dependencies: []
266
+ stage: execute
267
+ version: v1
268
+ agent_directive: >
269
+ When you make a decision, write it to STATE.md in the SAME RESPONSE
270
+ as the work that produced it. Never defer. If deferred, it's lost.
271
+
272
+ - id: STT-02
273
+ name: flagUncertainty
274
+ domain: STT
275
+ project_types: [universal]
276
+ description: Track open questions as first-class artifacts in STATE.md
277
+ trigger: Agent encounters an ambiguity, unknown, or needs human input
278
+ reads: [STATE.md]
279
+ writes: [STATE.md]
280
+ dependencies: []
281
+ stage: plan
282
+ version: v1
283
+ agent_directive: >
284
+ When you're unsure, write it as an open question in STATE.md.
285
+ Do not guess silently. When resolved, strike through and add
286
+ resolution text — don't delete.
287
+
288
+ - id: STT-03
289
+ name: trackPosition
290
+ domain: STT
291
+ project_types: [universal]
292
+ description: Maintain the current phase and status in STATE.md
293
+ trigger: Phase transitions, task completion, session close
294
+ reads: [STATE.md]
295
+ writes: [STATE.md]
296
+ dependencies: [TSK-03]
297
+ stage: close
298
+ version: v1
299
+ agent_directive: >
300
+ STATE.md "Current position" must always reflect: what phase, what status
301
+ within it, what comes next, and what context is active.
302
+
303
+ # --- Task execution ---
304
+ - id: TSK-01
305
+ name: planTask
306
+ domain: TSK
307
+ project_types: [universal]
308
+ description: Create a structured PLAN.md with substeps and verification criteria
309
+ trigger: Start of a new task (plan stage)
310
+ reads: [REQUIREMENTS.md, ROADMAP.md, relevant .context/]
311
+ writes: [PLAN.md]
312
+ options:
313
+ detail: [minimal, standard, detailed]
314
+ dependencies: [HAI-01]
315
+ stage: plan
316
+ version: v1
317
+ agent_directive: >
318
+ Produce a plan with: objective, prerequisites, steps with read/produce
319
+ specs, and verification criteria. Plans are atomic — one task at a time.
320
+ Propose and wait for approval before executing.
321
+
322
+ - id: TSK-02
323
+ name: verifyTask
324
+ domain: TSK
325
+ project_types: [universal]
326
+ description: Check completed work against embedded verification criteria
327
+ trigger: Verify stage (after execution)
328
+ reads: [PLAN.md]
329
+ writes: [verification results in SUMMARY.md]
330
+ dependencies: [TSK-01]
331
+ stage: verify
332
+ version: v1
333
+ agent_directive: >
334
+ Read verification criteria from PLAN.md. Check each against completed
335
+ work. Report pass/fail with specific evidence.
336
+
337
+ - id: TSK-03
338
+ name: closeSession
339
+ domain: TSK
340
+ project_types: [universal]
341
+ description: Execute the close stage - SUMMARY, STATE, ROADMAP updates
342
+ trigger: Task or session completion
343
+ reads: [SUMMARY.md, STATE.md, ROADMAP.md]
344
+ writes: [SUMMARY.md, STATE.md, ROADMAP.md]
345
+ dependencies: [TSK-04, QRY-03]
346
+ stage: close
347
+ version: v1
348
+ agent_directive: >
349
+ Write SUMMARY.md entry. Update STATE.md position. Mark ROADMAP.md
350
+ if phase complete. Non-negotiable phase completion cascade.
351
+
352
+ - id: TSK-04
353
+ name: auditTrail
354
+ domain: TSK
355
+ project_types: [universal]
356
+ description: Maintain SUMMARY.md in the standard session entry format
357
+ trigger: TSK-03 closeSession
358
+ reads: [session work products, STATE.md]
359
+ writes: [SUMMARY.md]
360
+ dependencies: []
361
+ stage: close
362
+ version: v1
363
+ agent_directive: >
364
+ Each SUMMARY entry: date, plan, outcome, files created/updated,
365
+ decisions captured, next. The "Next" field bridges to the following session.
366
+
367
+ # --- Human-agent interaction ---
368
+ - id: HAI-01
369
+ name: checkpoint
370
+ domain: HAI
371
+ project_types: [universal]
372
+ description: Surface a plan proposal for human approval before execution
373
+ trigger: Plan stage (skipped at autonomous level)
374
+ reads: [proposed plan]
375
+ writes: []
376
+ dependencies: [HAI-02]
377
+ stage: plan
378
+ version: v1
379
+ agent_directive: >
380
+ Present your plan and WAIT for human approval. This is the PRIMARY
381
+ CHECKPOINT. A wrong plan executed perfectly is still failure.
382
+
383
+ - id: HAI-02
384
+ name: setInteractionLevel
385
+ domain: HAI
386
+ project_types: [universal]
387
+ description: Configure the checkpoint density for a session
388
+ trigger: Entry point mode setting read during cold start
389
+ reads: [entry point]
390
+ writes: []
391
+ options:
392
+ level: [autonomous, checkpoint, collaborative, supervised]
393
+ dependencies: [QRY-01]
394
+ stage: initialize
395
+ version: v1
396
+ agent_directive: >
397
+ Read the mode setting. It controls how often you pause. Default
398
+ is checkpoint. Respect the configured level.
399
+
400
+ - id: HAI-03
401
+ name: dualAudience
402
+ domain: HAI
403
+ project_types: [universal]
404
+ description: Maintain separation between agent-facing and human-facing files
405
+ trigger: Any file write during execute or close stages
406
+ reads: [entry point docs trigger mapping]
407
+ writes: [agent files, human files per trigger mapping]
408
+ dependencies: [HAI-04]
409
+ stage: execute
410
+ version: v1
411
+ agent_directive: >
412
+ Agent files (STATE.md, .context/) are for machine parsing.
413
+ Human files (docs/) use visual formats. Never mix audiences.
414
+
415
+ - id: HAI-04
416
+ name: docsTrigger
417
+ domain: HAI
418
+ project_types: [universal]
419
+ description: Update docs/ based on the trigger mapping in the entry point
420
+ trigger: Structural changes matching entry point docs maintenance table
421
+ reads: [entry point docs trigger table]
422
+ writes: [specific docs/ files per trigger]
423
+ dependencies: [HAI-03]
424
+ stage: close
425
+ version: v1
426
+ agent_directive: >
427
+ When structural changes match a trigger, update specified docs/ files.
428
+ Typo fixes and internal adjustments do NOT trigger docs updates.
429
+
430
+ - id: HAI-05
431
+ name: modelCapabilityCheck
432
+ domain: HAI
433
+ project_types: [universal]
434
+ description: Detect when the agent consistently fails methodology requirements due to model capability limitations
435
+ trigger: Agent detects repeated pattern failures (missed cascades, forgotten decisions, shallow context, incomplete discovery)
436
+ reads: [STATE.md, entry point, session history]
437
+ writes: [STATE.md (open question with capability warning)]
438
+ dependencies: []
439
+ stage: execute
440
+ version: v1
441
+ degradation_signals:
442
+ - pattern: Cascade misses — file changed but dependent files not updated in same response
443
+ threshold: 2+ misses in a session
444
+ recommendation: Switch to Sonnet or higher for this task type
445
+ - pattern: Decision recording failures — decisions made but not written to STATE.md
446
+ threshold: Any deferred decision recording
447
+ recommendation: Simpler model may not handle simultaneous work + recording
448
+ - pattern: Shallow context — .context/ files populated with generic content lacking project-specific detail
449
+ threshold: Context quality score < 3 (from protocol tools)
450
+ recommendation: Discovery tasks (WF-08) require Sonnet+; use Haiku only for greenfield/simple workflows
451
+ - pattern: Incomplete discovery — SCAN features produce shallow inventories missing architectural patterns
452
+ threshold: Brownfield scan misses >30% of project structure
453
+ recommendation: WF-08 requires Sonnet+ capability; Haiku cannot handle discovery
454
+ - pattern: Instruction loss — agent stops following entry point conventions mid-session
455
+ threshold: Conventions violated after being followed earlier in same session
456
+ recommendation: Entry point may exceed model's effective context window; switch to lite profile
457
+ agent_directive: >
458
+ Monitor your own methodology adherence. If you notice you are repeatedly
459
+ missing cascades, forgetting to update STATE.md, producing shallow context,
460
+ or losing track of entry point conventions, surface this to the user:
461
+ "I'm noticing degraded methodology adherence — this task may benefit from
462
+ a more capable model (Sonnet/Opus) or a lighter integration profile."
463
+ Record the observation as an open question in STATE.md.
464
+
465
+ - id: HAI-06
466
+ name: writeObligations
467
+ domain: HAI
468
+ project_types: [universal]
469
+ description: Enforce close-stage write obligations via PROTOCOL.yaml close_check
470
+ trigger: End of any file-modifying response
471
+ reads: [".context/PROTOCOL.yaml (close_check section)", "registry/doc-tokens.yaml (terminology consistency)"]
472
+ writes: [STATE.md, SUMMARY.md, ROADMAP.md, SESSION-LOG.md, "Management/DIGEST.md", "Management/STATUS.md", ".context/BASE.md", ".context/DOCS-MAP.md", "registry/doc-tokens.yaml"]
473
+ dependencies: [HAI-04, QRY-03]
474
+ stage: close
475
+ version: v1.6
476
+ agent_directive: >
477
+ Before ending any response that modified files, read PROTOCOL.yaml close_check.
478
+ For each triggered item, update the target file now. A response that modifies
479
+ files but skips triggered obligations is incomplete. This is the final self-audit
480
+ before the response ends.
481
+
482
+ # --- Template and bootstrap ---
483
+ - id: TPL-01
484
+ name: bootstrap
485
+ domain: TPL
486
+ project_types: [universal]
487
+ description: Initialize a project from the template with guided content
488
+ trigger: First session on a new project
489
+ reads: [template files, "registry/feature-registry.yaml", "registry/doc-tokens.yaml"]
490
+ writes: [PROJECT.md, .context/BASE.md, STATE.md, "registry/doc-tokens.yaml"]
491
+ options:
492
+ template: [starter, full]
493
+ dependencies: [CTX-01, TPL-02]
494
+ stage: on_demand
495
+ version: v1.6
496
+ agent_directive: >
497
+ Read guided content. Help user fill PROJECT.md. Run initContext.
498
+ For brownfield: use segmented onboarding (5 segments driven by doc-tokens.yaml
499
+ categories). Populate doc-tokens.yaml with project identity, terminology,
500
+ and propagation targets during onboarding. Reference feature-registry.yaml
501
+ to determine applicable workflows and query types.
502
+
503
+ - id: TPL-02
504
+ name: detectRuntime
505
+ domain: TPL
506
+ project_types: [universal]
507
+ description: Determine which entry point file is active
508
+ trigger: Cold start (implicit)
509
+ reads: [loaded entry point file]
510
+ writes: []
511
+ dependencies: []
512
+ stage: initialize
513
+ version: v1
514
+ agent_directive: >
515
+ Templates ship all three variants. Runtime auto-loads the appropriate one.
516
+
517
+ - id: TPL-03
518
+ name: structureSelect
519
+ domain: TPL
520
+ project_types: [universal]
521
+ description: Choose template tier based on project complexity
522
+ trigger: TPL-01 bootstrap or user upgrade request
523
+ reads: [PROJECT.md, user input]
524
+ writes: [additional template files if upgrading]
525
+ options:
526
+ tier: [starter, full]
527
+ dependencies: [TPL-01]
528
+ stage: on_demand
529
+ version: v1
530
+ agent_directive: >
531
+ Starter for most projects. Full when project has multiple phases
532
+ or needs dual-audience separation. Offer upgrade path.
533
+
534
+ # --- Data exploration ---
535
+ - id: EXP-01
536
+ name: ingestData
537
+ domain: EXP
538
+ project_types: [data]
539
+ description: Scan submitted data sources, classify by type, sample content, measure scale, detect quality signals
540
+ trigger: User submits new data source (CSV, database, repo, document set)
541
+ reads: [data source, .context/BASE.md]
542
+ writes: [.context/BASE.md (data inventory), specialist stubs]
543
+ options:
544
+ source_type: [structured, repository, documents, mixed]
545
+ dependencies: [CTX-01]
546
+ stage: on_demand
547
+ version: v1.1
548
+ agent_directive: >
549
+ When data is submitted, scan for structure (columns, types, file names,
550
+ directory layout). Sample content. Measure scale (row counts, file counts).
551
+ Detect quality signals (null rates, duplicates, encoding). Present
552
+ findings to user. Do NOT try to understand everything — map the surface
553
+ first, deep understanding comes in the Map stage.
554
+
555
+ - id: EXP-02
556
+ name: buildReferences
557
+ domain: EXP
558
+ project_types: [data]
559
+ description: Transform raw data mapping into structured reference artifacts
560
+ trigger: After EXP-01 ingest and CTX-05 mapping, or user requests reference building
561
+ reads: [.context/BASE.md, relevant specialist, data sources]
562
+ writes: [specialist context files (entity registries, topic taxonomies, dimension indices, metric catalogs)]
563
+ dependencies: [EXP-01, CTX-05]
564
+ stage: execute
565
+ version: v1.1
566
+ agent_directive: >
567
+ Build navigable reference artifacts from the data map. Entity registries,
568
+ topic taxonomies, queryable dimension indices, derived metric catalogs.
569
+ References are the bridge between raw data and interactive exploration.
570
+ Each reference entry must be addressable, cross-linked, and source-attributed.
571
+
572
+ - id: EXP-03
573
+ name: exploreCommand
574
+ domain: EXP
575
+ project_types: [data]
576
+ description: Recognize and execute named exploration patterns consistently
577
+ trigger: User query matching an exploration command pattern
578
+ reads: [.context/BASE.md, relevant specialist per command type]
579
+ writes: [STATE.md (exploration path)]
580
+ options:
581
+ commands: [explore, schema, search, relate, quality, timeline, dimensions, gaps, summary]
582
+ dependencies: [QRY-02, CTX-03]
583
+ stage: execute
584
+ version: v1.1
585
+ agent_directive: >
586
+ Recognize named exploration patterns in user queries. Each command
587
+ maps to a specific specialist and action. Most exploration queries
588
+ are read-only — they don't produce file changes. Progressively reveal
589
+ available commands as the user explores.
590
+
591
+ - id: EXP-04
592
+ name: manageAbstraction
593
+ domain: EXP
594
+ project_types: [data]
595
+ description: Navigate the abstraction ladder, deciding when to access raw data vs references
596
+ trigger: Any data query during exploration
597
+ reads: [.context/BASE.md, relevant specialist]
598
+ writes: []
599
+ dependencies: [EXP-03]
600
+ stage: execute
601
+ version: v1.1
602
+ agent_directive: >
603
+ Work at Level 2-3 (summaries and references) by default. Drop to
604
+ Level 0-1 (raw data, schema) only for specific queries that require
605
+ actual data values. Context files contain understanding, not data.
606
+ If a recurring query needs Level 0 access, propose adding the result
607
+ as a derived metric or reference in the specialist.
608
+
609
+ # --- Project discovery ---
610
+ - id: SCAN-01
611
+ name: codebaseInventory
612
+ domain: SCAN
613
+ project_types: [universal]
614
+ description: Walk the project structure and build a complete inventory of directories, files, modules, and their purposes
615
+ trigger: Discovery stage entry (brownfield bootstrap, methodology first applied to existing project, major re-assessment)
616
+ reads: [project directory structure, package files, entry points, key source files, "registry/doc-tokens.yaml"]
617
+ writes: [.context/BASE.md (project map), "registry/doc-tokens.yaml (project identity, terminology)"]
618
+ options:
619
+ depth: [shallow, deep]
620
+ dependencies: [CTX-05]
621
+ stage: on_demand
622
+ version: v1.4
623
+ type_variants:
624
+ code: Walk directory tree, identify modules, map build system, record technology stack
625
+ data: Scan data directories, inventory data files, identify schema sources
626
+ analytical: Trace pipeline components, inventory chain stages, map orchestration config
627
+ agent_directive: >
628
+ Walk the entire project directory structure. For each significant directory
629
+ and file, record: path, purpose (inferred from names, contents, conventions),
630
+ key patterns, and dependencies. The inventory is the foundation — you cannot
631
+ contribute effectively to code you haven't mapped. Output goes into the
632
+ project map section of BASE.md.
633
+
634
+ - id: SCAN-02
635
+ name: dependencyMapping
636
+ domain: SCAN
637
+ project_types: [universal]
638
+ description: Map all internal and external dependencies — packages, modules, services, data flows
639
+ trigger: SCAN-01 inventory (cascade), explicit dependency analysis request
640
+ reads: [package manifests, import statements, configuration files, .context/BASE.md]
641
+ writes: [.context/BASE.md (dependencies section)]
642
+ dependencies: [SCAN-01]
643
+ stage: on_demand
644
+ version: v1.4
645
+ type_variants:
646
+ code: Parse package.json/Cargo.toml/requirements.txt, trace import graphs, map service dependencies
647
+ data: Map data source connections, trace ETL flows, identify schema dependencies
648
+ analytical: Map chain dependencies, trace data flows between pipeline stages
649
+ agent_directive: >
650
+ After the inventory, map how pieces connect. Parse package manifests for
651
+ external dependencies. Trace imports for internal module dependencies.
652
+ Identify service-to-service connections. Record version constraints.
653
+ This map tells you what breaks when something changes — essential for
654
+ cascade accuracy and safe modifications.
655
+
656
+ - id: SCAN-03
657
+ name: patternExtraction
658
+ domain: SCAN
659
+ project_types: [universal]
660
+ description: Identify recurring code patterns, conventions, and architectural decisions in the existing project
661
+ trigger: SCAN-01 inventory (cascade), explicit pattern analysis request, Evolution stage refactoring
662
+ reads: [source files (sampled), .context/BASE.md, existing .context/ specialists]
663
+ writes: [.context/ specialists (proposed), STATE.md (architectural decisions discovered)]
664
+ dependencies: [SCAN-01]
665
+ stage: on_demand
666
+ version: v1.4
667
+ type_variants:
668
+ code: Identify naming conventions, error handling patterns, test patterns, API design patterns
669
+ data: Identify data modeling patterns, query patterns, transformation conventions
670
+ analytical: Identify composition patterns, evaluation approaches, orchestration conventions
671
+ agent_directive: >
672
+ Sample key files across the project. Identify recurring patterns:
673
+ naming conventions, error handling, testing approach, architectural patterns,
674
+ design decisions embedded in the code. Each pattern is a convention the agent
675
+ must follow in future work. Patterns become specialist file candidates.
676
+ Record discovered architectural decisions in STATE.md — these are decisions
677
+ that were already made, just not documented.
678
+
679
+ - id: SCAN-04
680
+ name: debtAssessment
681
+ domain: SCAN
682
+ project_types: [universal]
683
+ description: Identify technical debt, inconsistencies, security concerns, and improvement opportunities
684
+ trigger: Explicit assessment request, Discovery stage completion, Evolution stage periodic review
685
+ reads: [.context/BASE.md, .context/ specialists, source files (targeted)]
686
+ writes: [STATE.md (open questions for debt items), PLAN.md (remediation priorities if requested)]
687
+ dependencies: [SCAN-01, SCAN-03]
688
+ stage: on_demand
689
+ version: v1.4
690
+ type_variants:
691
+ code: Outdated dependencies, missing tests, inconsistent patterns, security vulnerabilities, dead code
692
+ data: Stale data, missing validation, undocumented schemas, quality gaps
693
+ analytical: Outdated evaluation criteria, untested chains, missing documentation
694
+ agent_directive: >
695
+ Based on the inventory and patterns, identify areas of concern:
696
+ outdated dependencies, missing tests, inconsistent conventions, security
697
+ issues, dead code, documentation gaps. Each finding becomes an open
698
+ question in STATE.md with severity assessment. Do NOT attempt to fix
699
+ everything — assess and prioritize. The human decides what to address.
700
+
701
+ - id: SCAN-05
702
+ name: docDependencyGraph
703
+ domain: SCAN
704
+ project_types: [universal]
705
+ description: Build and maintain document dependency graph in doc-tokens.yaml during brownfield onboarding and close
706
+ trigger: Brownfield Segment 2 (Architecture scan), wwa close (growth tracking), wwa init (default seeding)
707
+ reads: [registry/doc-tokens.yaml, .context/DOCS-MAP.md, docs/ directory]
708
+ writes: [registry/doc-tokens.yaml (doc_graph section)]
709
+ dependencies: [SCAN-01, SCAN-02]
710
+ stage: on_demand
711
+ version: v1.6
712
+ type_variants:
713
+ code: API docs, database schemas, architecture docs dependency chains
714
+ data: Schema docs, data catalog, pipeline documentation dependency chains
715
+ analytical: Evaluation criteria, prompt templates, domain knowledge dependency chains
716
+ agent_directive: >
717
+ During brownfield onboarding Segment 2, scan the docs/ directory and build a
718
+ dependency graph. Create nodes for each document file, identify cross-references
719
+ (markdown links, .context/ references), and create typed edges (reads_from,
720
+ cascades_to). Write the graph to doc-tokens.yaml doc_graph section. During
721
+ close, detect new files and add them as nodes with category: unknown.
722
+
723
+ - id: SCAN-06
724
+ name: docReviewGenerate
725
+ domain: SCAN
726
+ project_types: [universal]
727
+ description: Generate internal document registry (docs/internal/doc-registry.yaml + .md) from dependency graph
728
+ trigger: Explicit wwa doc-review command, post-onboarding review
729
+ reads: [registry/doc-tokens.yaml (doc_graph, project_names), .context/DOCS-MAP.md]
730
+ writes: [docs/internal/doc-registry.yaml, docs/internal/doc-registry.md]
731
+ dependencies: [SCAN-05]
732
+ stage: on_demand
733
+ version: v1.6
734
+ agent_directive: >
735
+ Synthesize the document dependency graph, project terminology, and docs inventory
736
+ into a structured registry at docs/internal/. The YAML file provides machine-readable
737
+ data (dependency graph, terminology, health metrics). The markdown file provides
738
+ human-readable views (dependency tree, glossary, health dashboard, cross-reference
739
+ index). This registry can be included in case studies and management reports via
740
+ the --internal-registry flag on casestudy and close commands.
741
+
742
+ - id: SCAN-07
743
+ name: boundariesConfig
744
+ domain: SCAN
745
+ project_types: [universal]
746
+ description: Configurable project boundaries via PROTOCOL.yaml — path resolution, visibility, scan rules, distribution
747
+ trigger: Brownfield onboarding with non-standard paths, self-hosting projects, custom distribution rules
748
+ reads: [.context/PROTOCOL.yaml (boundaries section)]
749
+ writes: [.context/PROTOCOL.yaml (boundaries section)]
750
+ dependencies: [SCAN-01]
751
+ stage: on_demand
752
+ version: v1.6
753
+ agent_directive: >
754
+ When a project stores registries at non-standard paths (e.g. docs/internal/ instead
755
+ of .context/), uncomment and configure the boundaries section in PROTOCOL.yaml.
756
+ The boundaries section controls: registry paths (tokens, docs_map, output), visibility
757
+ classification (internal vs release folders), scan rules (include/exclude), and
758
+ distribution rules (git/npm include/exclude). All CLI tools read boundaries to resolve
759
+ paths. Projects without a boundaries section get default behavior (backward compatible).
760
+
761
+ # ============================================================
762
+ # LAYER 2: GUIDED WORKFLOWS
763
+ # How features compose into reusable task patterns.
764
+ # ============================================================
765
+
766
+ workflows:
767
+ - id: WF-01
768
+ name: standard-task
769
+ project_types: [universal]
770
+ description: >
771
+ The default workflow for any task. Review current state, plan the work,
772
+ implement changes, update documentation and context, close with
773
+ management file updates. This is the backbone pattern.
774
+ steps:
775
+ - name: review
776
+ stage: scope
777
+ description: Read current state, understand context, identify what needs to change
778
+ features: [QRY-01, QRY-02, CTX-03]
779
+ agent_action: >
780
+ Load entry point + STATE.md (cold start). Classify the query.
781
+ Load the scoped context. Understand the current position and
782
+ what decisions have been made. Read relevant files.
783
+ - name: plan
784
+ stage: plan
785
+ description: Propose structured plan with verification criteria
786
+ features: [TSK-01, HAI-01, STT-02]
787
+ agent_action: >
788
+ Draft a plan with objectives, steps, read/produce specs, and
789
+ verification criteria. Surface any unknowns as open questions.
790
+ Present to human for approval. Wait before executing.
791
+ - name: implement
792
+ stage: execute
793
+ description: Execute plan, record decisions, cascade changes
794
+ features: [STT-01, QRY-03, CTX-05, HAI-03]
795
+ agent_action: >
796
+ Follow the plan step by step. After each file change, check
797
+ cascades and update dependent files. Record every decision in
798
+ STATE.md immediately. If the project structure changed, update
799
+ the map in BASE.md.
800
+ - name: document
801
+ stage: execute
802
+ description: Update context files and triggered docs
803
+ features: [CTX-04, CTX-05, HAI-04]
804
+ agent_action: >
805
+ If new domain areas were discovered, propose specialist context
806
+ files. Update BASE.md map if structure changed. Check docs
807
+ trigger table and update human-facing docs if structural changes.
808
+ - name: update
809
+ stage: close
810
+ description: Close session with audit trail and position update
811
+ features: [TSK-03, TSK-04, STT-03]
812
+ agent_action: >
813
+ Write SUMMARY.md entry. Update STATE.md position. Mark ROADMAP.md
814
+ if phase complete. The "Next" field bridges to the next session.
815
+
816
+ - id: WF-02
817
+ name: code-change
818
+ project_types: [code]
819
+ description: >
820
+ When the user asks to modify code. The agent doesn't just change files —
821
+ it maintains the project's understanding of itself.
822
+ steps:
823
+ - name: review
824
+ stage: scope
825
+ description: Understand what exists before changing it
826
+ features: [QRY-01, QRY-02, CTX-03]
827
+ agent_action: >
828
+ Load context for the relevant domain. Read the files that will
829
+ be affected. Read tests first. Understand dependencies.
830
+ - name: plan
831
+ stage: plan
832
+ description: Propose code changes with cascade impacts identified
833
+ features: [TSK-01, HAI-01]
834
+ agent_action: >
835
+ Plan the code change. Identify cascade triggers. List all files
836
+ affected (direct + cascade). Include context updates in the plan.
837
+ - name: implement
838
+ stage: execute
839
+ description: Make changes, cascade, update context
840
+ features: [STT-01, QRY-03, CTX-05]
841
+ agent_action: >
842
+ Make the code change. Immediately cascade to dependent files.
843
+ Update .context/BASE.md codebase map if structure changed.
844
+ Record the decision in STATE.md.
845
+ - name: context-sync
846
+ stage: execute
847
+ description: Ensure future sessions understand the change
848
+ features: [CTX-04, CTX-05, HAI-03]
849
+ agent_action: >
850
+ This is the key step. Update the codebase map so the next session
851
+ knows about the new code. If a new domain emerged, propose a
852
+ specialist. The agent is building understanding for its future self.
853
+ - name: update
854
+ stage: close
855
+ description: Record and close
856
+ features: [TSK-03, TSK-04, STT-03]
857
+ agent_action: Write audit trail. Update position. Bridge to next session.
858
+
859
+ - id: WF-03
860
+ name: context-refresh
861
+ project_types: [universal]
862
+ description: >
863
+ Resync the agent's understanding with the actual project state.
864
+ Used when the project has changed significantly between sessions.
865
+ steps:
866
+ - name: scan
867
+ stage: scope
868
+ description: Read current .context/ and compare against reality
869
+ features: [QRY-01, CTX-02]
870
+ agent_action: >
871
+ Load all .context/ files. Scan the actual project structure.
872
+ Identify drift: new items, removed items, renamed files,
873
+ updated dependencies.
874
+ - name: compare
875
+ stage: plan
876
+ description: Identify what's stale and what's missing
877
+ features: [CTX-05]
878
+ agent_action: >
879
+ Build a diff between what .context/ says and what exists.
880
+ Flag significant drift to the user.
881
+ - name: update-context
882
+ stage: execute
883
+ description: Rewrite context files to match reality
884
+ features: [CTX-05, CTX-04]
885
+ agent_action: >
886
+ Update BASE.md project map. Update affected specialist files.
887
+ If new domain areas are discovered, propose new specialists.
888
+ - name: cascade
889
+ stage: execute
890
+ description: Propagate context changes
891
+ features: [QRY-03]
892
+ agent_action: >
893
+ If scoping rules or cascade rules need updating,
894
+ update the entry point.
895
+ - name: record
896
+ stage: close
897
+ description: Log what changed and why
898
+ features: [STT-01, TSK-04]
899
+ agent_action: >
900
+ Record context changes in STATE.md. Write SUMMARY entry
901
+ documenting what drifted and what was corrected.
902
+
903
+ - id: WF-04
904
+ name: bootstrap
905
+ project_types: [universal]
906
+ description: >
907
+ First session on a new project. Get from zero to working agent
908
+ collaboration as fast as possible.
909
+ steps:
910
+ - name: detect
911
+ stage: initialize
912
+ description: Identify project type and runtime
913
+ features: [TPL-02, TPL-03]
914
+ agent_action: >
915
+ Determine which entry point was loaded. Detect whether this
916
+ is greenfield or brownfield. Choose template tier.
917
+ Infer project type from directory contents.
918
+ - name: initialize
919
+ stage: scope
920
+ description: Set up project context
921
+ features: [TPL-01, CTX-01]
922
+ agent_action: >
923
+ Help user fill in PROJECT.md. Create initial .context/BASE.md.
924
+ For brownfield, scan the project to populate the map.
925
+ - name: map
926
+ stage: execute
927
+ description: Build the project understanding
928
+ features: [CTX-05]
929
+ agent_action: >
930
+ Walk project structure. Record paths, purposes, patterns.
931
+ Map dependencies. This is the foundation for all future sessions.
932
+ - name: pair
933
+ stage: execute
934
+ description: Set up context pairing
935
+ features: [CTX-04]
936
+ agent_action: >
937
+ Identify domain areas. Suggest specialist context files.
938
+ Add scoping rules for each domain to the entry point.
939
+ - name: ready
940
+ stage: close
941
+ description: Confirm setup and orient
942
+ features: [STT-03, TSK-04]
943
+ agent_action: >
944
+ Set STATE.md to initial position. Write first SUMMARY entry.
945
+ The project is now ready for real work.
946
+
947
+ - id: WF-05
948
+ name: data-exploration
949
+ project_types: [data]
950
+ description: >
951
+ When the user submits data and wants to explore it. The agent builds
952
+ structured understanding and provides interactive access. Context IS
953
+ the primary artifact — not a maintenance side effect.
954
+ steps:
955
+ - name: ingest
956
+ stage: scope
957
+ description: First contact with the data — scan structure, classify, measure
958
+ features: [QRY-01, EXP-01, CTX-05]
959
+ agent_action: >
960
+ Scan data sources for structure (columns, types, files, layout).
961
+ Sample content. Measure scale. Detect quality signals.
962
+ Present initial findings to user. Build draft BASE.md data inventory.
963
+ - name: map
964
+ stage: plan
965
+ description: Build the data model — schemas, relationships, taxonomies
966
+ features: [CTX-05, EXP-01, HAI-01]
967
+ agent_action: >
968
+ Build field inventories, identify keys and join paths, map
969
+ derived metrics, note quality issues. For documents: build index,
970
+ identify entities, map cross-references. Present to user for
971
+ correction and approval.
972
+ - name: reference
973
+ stage: execute
974
+ description: Build navigable reference artifacts
975
+ features: [EXP-02, CTX-04, EXP-04]
976
+ agent_action: >
977
+ Transform raw mapping into structured references: entity registries,
978
+ topic taxonomies, dimension indices, metric catalogs. Each entry
979
+ must be addressable, cross-linked, and source-attributed.
980
+ - name: explore
981
+ stage: execute
982
+ description: Interactive querying — user asks, agent routes to data
983
+ features: [EXP-03, EXP-04, CTX-03]
984
+ agent_action: >
985
+ Classify user query against queryable dimensions. Load appropriate
986
+ specialist. Answer from references when possible, access raw data
987
+ only when needed. Propose new dimensions when queries reveal gaps.
988
+ - name: refine
989
+ stage: close
990
+ description: Evolve understanding based on exploration
991
+ features: [EXP-02, STT-01, TSK-04]
992
+ agent_action: >
993
+ Add new queryable dimensions discovered during exploration.
994
+ Update references. Record exploration insights in STATE.md.
995
+ Write SUMMARY entry bridging to next session.
996
+
997
+ - id: WF-06
998
+ name: analytical-system
999
+ project_types: [analytical]
1000
+ description: >
1001
+ When the user works on prompt composition, evaluation pipelines,
1002
+ context analysis, or ML chain orchestration. The agent maps
1003
+ analytical components, builds structured understanding, and
1004
+ supports iterative refinement of analytical artifacts.
1005
+ steps:
1006
+ - name: discover
1007
+ stage: scope
1008
+ description: Identify analytical components, chains, and pipeline stages
1009
+ features: [QRY-01, QRY-02, CTX-03]
1010
+ agent_action: >
1011
+ Load context for the analytical domain. Identify chains
1012
+ (input → transformation → output). Map pipeline stages.
1013
+ Understand what components exist and how they connect.
1014
+ - name: map-chains
1015
+ stage: plan
1016
+ description: Build the chain model and propose specialist structure
1017
+ features: [TSK-01, HAI-01, CTX-05]
1018
+ agent_action: >
1019
+ Document each chain with its stages, inputs, outputs, and
1020
+ evaluation criteria. Propose specialist context files for
1021
+ distinct knowledge domains. Present chain model for approval.
1022
+ - name: build-context
1023
+ stage: execute
1024
+ description: Create structured context for analytical components
1025
+ features: [CTX-04, CTX-05, STT-01]
1026
+ agent_action: >
1027
+ Build specialist files for each analytical domain (composition,
1028
+ evaluation, execution, domain knowledge). Record architectural
1029
+ decisions about chain structure in STATE.md.
1030
+ - name: compose
1031
+ stage: execute
1032
+ description: Build or modify analytical artifacts (prompts, pipelines, evaluations)
1033
+ features: [STT-01, QRY-03, HAI-03]
1034
+ agent_action: >
1035
+ Create or modify the analytical artifacts. Follow cascade rules
1036
+ for pipeline changes (upstream change → downstream specs update).
1037
+ Maintain dual-audience separation for documentation.
1038
+ - name: evaluate
1039
+ stage: verify
1040
+ description: Check analytical artifacts against evaluation criteria
1041
+ features: [TSK-02]
1042
+ agent_action: >
1043
+ Run evaluation criteria against completed work. For prompts:
1044
+ check against scoring rubrics. For pipelines: verify stage
1045
+ contracts. Report results with specific evidence.
1046
+ - name: refine
1047
+ stage: close
1048
+ description: Record findings and bridge to next iteration
1049
+ features: [TSK-03, TSK-04, STT-03]
1050
+ agent_action: >
1051
+ Write SUMMARY entry documenting what was built and evaluation
1052
+ results. Update STATE.md with refinement direction. The "Next"
1053
+ field should identify what to iterate on.
1054
+
1055
+ - id: WF-07
1056
+ name: specification-project
1057
+ project_types: [universal]
1058
+ description: >
1059
+ When the primary output is specifications, standards, or methodology
1060
+ documents rather than code or data artifacts. The agent helps
1061
+ structure, draft, review, and cross-reference specification content.
1062
+ steps:
1063
+ - name: research
1064
+ stage: scope
1065
+ description: Gather prior art, constraints, and requirements
1066
+ features: [QRY-01, QRY-02, CTX-03]
1067
+ agent_action: >
1068
+ Load relevant context. Read existing specs, research docs,
1069
+ and requirements. Identify what the spec needs to cover
1070
+ and what prior decisions constrain it.
1071
+ - name: outline
1072
+ stage: plan
1073
+ description: Propose spec structure with sections and cross-references
1074
+ features: [TSK-01, HAI-01, STT-02]
1075
+ agent_action: >
1076
+ Draft a spec outline with sections, cross-references to
1077
+ existing specs, and verification criteria. Surface any
1078
+ open questions about scope or approach. Wait for approval.
1079
+ - name: draft
1080
+ stage: execute
1081
+ description: Write spec content with traceability
1082
+ features: [STT-01, QRY-03, CTX-05, HAI-03]
1083
+ agent_action: >
1084
+ Write each spec section. Cross-reference related specs.
1085
+ Record design decisions in STATE.md immediately. Follow
1086
+ cascade rules when spec changes affect other documents.
1087
+ - name: cross-reference
1088
+ stage: execute
1089
+ description: Ensure consistency across related specifications
1090
+ features: [QRY-03, CTX-05]
1091
+ agent_action: >
1092
+ Check that this spec is consistent with all related specs.
1093
+ Update cross-references. Flag contradictions. Update
1094
+ context files if the spec changes the project's understanding.
1095
+ - name: review
1096
+ stage: verify
1097
+ description: Verify spec completeness and consistency
1098
+ features: [TSK-02]
1099
+ agent_action: >
1100
+ Check spec against outline criteria. Verify all sections
1101
+ are substantive. Confirm cross-references are valid.
1102
+ Report coverage gaps.
1103
+ - name: record
1104
+ stage: close
1105
+ description: Update management files and bridge to next spec
1106
+ features: [TSK-03, TSK-04, STT-03]
1107
+ agent_action: >
1108
+ Write SUMMARY entry. Update STATE.md position. If this
1109
+ spec enables other specs, note the dependency in "Next."
1110
+
1111
+ - id: WF-08
1112
+ name: discovery
1113
+ project_types: [universal]
1114
+ description: >
1115
+ When the methodology is applied to an existing project (brownfield) or
1116
+ when a major re-assessment is needed. The agent systematically builds
1117
+ understanding of the project before contributing to it. Discovery must
1118
+ complete before the agent can work effectively.
1119
+ steps:
1120
+ - name: inventory
1121
+ stage: scope
1122
+ description: Walk the project structure and build a complete file/module inventory
1123
+ features: [QRY-01, SCAN-01, CTX-05]
1124
+ agent_action: >
1125
+ Walk the entire project directory. Record every significant path,
1126
+ its purpose, and its key patterns. Build the project map in
1127
+ .context/BASE.md. This is the foundation — skip nothing.
1128
+ - name: map
1129
+ stage: plan
1130
+ description: Map dependencies, connections, and data flows between components
1131
+ features: [SCAN-02, HAI-01]
1132
+ agent_action: >
1133
+ Parse package manifests, trace imports, map service connections.
1134
+ Present the dependency map to the human for validation. Flag
1135
+ any surprising connections or circular dependencies.
1136
+ - name: extract
1137
+ stage: execute
1138
+ description: Identify patterns, conventions, and implicit architectural decisions
1139
+ features: [SCAN-03, STT-01, CTX-04]
1140
+ agent_action: >
1141
+ Sample key files. Identify naming conventions, error handling
1142
+ patterns, test approaches, design patterns. Record discovered
1143
+ architectural decisions in STATE.md. Propose specialist context
1144
+ files for distinct domains.
1145
+ - name: assess
1146
+ stage: verify
1147
+ description: Evaluate technical debt, risks, and improvement opportunities
1148
+ features: [SCAN-04, STT-02]
1149
+ agent_action: >
1150
+ Based on inventory and patterns, identify areas of concern:
1151
+ outdated deps, missing tests, inconsistencies, security issues.
1152
+ Write findings as open questions in STATE.md with severity.
1153
+ Present assessment to human — they decide priorities.
1154
+ - name: bootstrap
1155
+ stage: close
1156
+ description: Finalize context files, update entry point, record discovery session
1157
+ features: [CTX-01, TSK-03, TSK-04, STT-03]
1158
+ agent_action: >
1159
+ Finalize .context/BASE.md with complete project map. Write
1160
+ specialist context files approved during extract step. Update
1161
+ entry point scoping table with project-specific query types.
1162
+ Write SUMMARY entry. Update STATE.md position. Set lifecycle
1163
+ stage to Development (or Design if architecture needs work).
1164
+
1165
+ # ============================================================
1166
+ # LAYER 3: AGENT BEHAVIORAL PROTOCOL
1167
+ # ============================================================
1168
+
1169
+ protocol:
1170
+ purpose: >
1171
+ The agent's job is not just to complete tasks. It is to build and
1172
+ maintain a project intelligence layer that makes every future session
1173
+ more effective than the last. When you change something, you also update
1174
+ the project's understanding of itself. When you make a decision, you
1175
+ record it. When you encounter something new, you build context.
1176
+
1177
+ core_directives:
1178
+ - id: P-01
1179
+ name: Build understanding, not just output
1180
+ project_types: [universal]
1181
+ directive: >
1182
+ Every change is also a context change. When you add a module,
1183
+ update the project map. When you make an architecture decision,
1184
+ record it. When you discover a new domain, propose a specialist.
1185
+ The agent is always building the project's self-knowledge.
1186
+
1187
+ - id: P-02
1188
+ name: Maintain for your future self
1189
+ project_types: [universal]
1190
+ directive: >
1191
+ Every session starts cold. Write decisions, open questions,
1192
+ and context updates as if leaving notes for a colleague who
1193
+ will continue your work but has no memory of this session.
1194
+
1195
+ - id: P-03
1196
+ name: Cascade is not optional
1197
+ project_types: [universal]
1198
+ directive: >
1199
+ File changes ripple through dependencies. Check the cascade table
1200
+ after every change. Do it in the same response. Deferred cascades
1201
+ are skipped cascades.
1202
+
1203
+ - id: P-04
1204
+ name: Scope to avoid drowning
1205
+ project_types: [universal]
1206
+ directive: >
1207
+ Context windows are finite. Follow the scoping table. Load BASE.md
1208
+ + one specialist. If you need more, split the query.
1209
+
1210
+ - id: P-05
1211
+ name: Surface uncertainty, don't hide it
1212
+ project_types: [universal]
1213
+ directive: >
1214
+ Silent assumptions are the primary failure mode. When unsure,
1215
+ write an open question. When ambiguous, ask.
1216
+
1217
+ - id: P-06
1218
+ name: The human controls direction
1219
+ project_types: [universal]
1220
+ directive: >
1221
+ The agent proposes; the human decides. The plan checkpoint exists
1222
+ because the human's judgment about WHAT to build is more reliable
1223
+ than the agent's.
1224
+
1225
+ - id: P-07
1226
+ name: Keep files loadable
1227
+ project_types: [universal]
1228
+ directive: >
1229
+ Context that doesn't fit in the window can't help. Intelligence
1230
+ layer files that grow beyond 300 lines consume disproportionate
1231
+ tokens. When a file exceeds this threshold, restructure it into
1232
+ an index (active content + navigation) and component files
1233
+ (archived sections). The index stays small; components are loaded
1234
+ only when their specific content is needed.
1235
+
1236
+ - id: P-08
1237
+ name: Methodology is additive only
1238
+ project_types: [universal]
1239
+ directive: >
1240
+ The methodology NEVER modifies project source code, tests, or
1241
+ pre-existing documentation. It only creates and modifies its own
1242
+ files (STATE.md, .context/, PLAN.md, SUMMARY.md, etc.). In
1243
+ brownfield projects, existing files are NEVER deleted or
1244
+ overwritten — methodology content is appended to existing entry
1245
+ points and new files are created alongside existing ones.
1246
+
1247
+ - id: P-09
1248
+ name: Surface capability limitations
1249
+ project_types: [universal]
1250
+ directive: >
1251
+ Monitor your own methodology adherence during a session. If you
1252
+ notice repeated cascade misses, forgotten STATE.md updates,
1253
+ shallow context, or lost conventions, surface this to the user
1254
+ rather than silently degrading. Record the observation as an
1255
+ open question in STATE.md. Suggest switching to a more capable
1256
+ model or a lighter integration profile. Two rules followed
1257
+ consistently beat ten rules followed inconsistently.
1258
+
1259
+ - id: P-10
1260
+ name: Document proportionally
1261
+ project_types: [universal]
1262
+ directive: >
1263
+ Match documentation effort to task significance. Low-effort tasks
1264
+ (status checks, lookups, clarifications) need no STATE.md or
1265
+ SESSION-LOG updates beyond the cascade contract. Medium-effort tasks
1266
+ get targeted recording (decisions yes, session log optional).
1267
+ High-effort tasks get full recording including session metrics and
1268
+ refinement tracking. The agent self-assesses materiality and documents
1269
+ accordingly. Never record routine queries in STATE.md or SESSION-LOG.md.
1270
+
1271
+ workflow_selection: >
1272
+ When a query arrives, the agent selects the appropriate guided workflow:
1273
+ - First session / template just copied → WF-04 (bootstrap)
1274
+ - Brownfield project, first application of methodology → WF-08 (discovery)
1275
+ - Code modification request → WF-02 (code-change)
1276
+ - Data submitted or data question → WF-05 (data-exploration)
1277
+ - "Refresh context" or detected drift → WF-03 (context-refresh)
1278
+ - General task request → WF-01 (standard-task)
1279
+ - Analytical/prompt system task → WF-06 (analytical-system)
1280
+ - Spec writing or methodology design → WF-07 (specification-project)
1281
+ If no workflow matches, follow WF-01 as the default pattern.
1282
+ Project type is inferred from the entry point's scoping table content.
1283
+ Lifecycle stage (from PROJECT-PROFILE.md) further adjusts feature priorities —
1284
+ see docs/architecture/project-lifecycle.md for the activation table.
1285
+
1286
+ # ============================================================
1287
+ # LAYER 4: ROUTING RULES
1288
+ # Computable query classification and feature activation
1289
+ # ============================================================
1290
+
1291
+ query_patterns:
1292
+ # --- Universal patterns ---
1293
+ - query_type: planning
1294
+ match_rules:
1295
+ keywords: [plan, roadmap, phase, requirements, scope, prioritize]
1296
+ phrases: ["what should we", "next phase", "plan for"]
1297
+ workflow: WF-01
1298
+ project_types: [universal]
1299
+
1300
+ - query_type: context_refresh
1301
+ match_rules:
1302
+ keywords: [refresh, resync, update context, drift, stale]
1303
+ phrases: ["refresh context", "update .context", "resync"]
1304
+ workflow: WF-03
1305
+ project_types: [universal]
1306
+
1307
+ - query_type: phase_completion
1308
+ match_rules:
1309
+ keywords: [complete, finish, close, done, gate]
1310
+ phrases: ["phase complete", "mark done", "close session"]
1311
+ workflow: WF-01
1312
+ project_types: [universal]
1313
+
1314
+ - query_type: backlog
1315
+ match_rules:
1316
+ keywords: [backlog, idea, future, todo, later]
1317
+ phrases: ["add to backlog", "future work"]
1318
+ workflow: WF-01
1319
+ project_types: [universal]
1320
+
1321
+ # --- Code project patterns ---
1322
+ - query_type: code_change
1323
+ match_rules:
1324
+ keywords: [implement, code, build, fix, refactor, add feature, modify]
1325
+ phrases: ["add a", "change the", "fix the", "refactor", "implement"]
1326
+ workflow: WF-02
1327
+ project_types: [code]
1328
+
1329
+ - query_type: bug_fix
1330
+ match_rules:
1331
+ keywords: [bug, error, broken, failing, debug]
1332
+ phrases: ["fix the bug", "why is this", "not working"]
1333
+ workflow: WF-02
1334
+ project_types: [code]
1335
+
1336
+ - query_type: dependency_update
1337
+ match_rules:
1338
+ keywords: [dependency, package, upgrade, install, npm, pip]
1339
+ phrases: ["update package", "add dependency"]
1340
+ workflow: WF-02
1341
+ project_types: [code]
1342
+
1343
+ - query_type: database_work
1344
+ match_rules:
1345
+ keywords: [database, schema, migration, model, table, query, sql]
1346
+ phrases: ["add a table", "update schema", "run migration"]
1347
+ workflow: WF-02
1348
+ project_types: [code]
1349
+
1350
+ - query_type: api_work
1351
+ match_rules:
1352
+ keywords: [api, endpoint, route, controller, rest, graphql]
1353
+ phrases: ["add endpoint", "api route", "rest endpoint"]
1354
+ workflow: WF-02
1355
+ project_types: [code]
1356
+
1357
+ - query_type: deployment_work
1358
+ match_rules:
1359
+ keywords: [deploy, infrastructure, pipeline, ci, cd, environment, staging, production, devops]
1360
+ phrases: ["deploy to", "set up pipeline", "configure environment", "infrastructure change"]
1361
+ workflow: WF-02
1362
+ project_types: [code]
1363
+
1364
+ # --- Data exploration patterns ---
1365
+ - query_type: data_ingest
1366
+ match_rules:
1367
+ keywords: [ingest, import, load, submit, upload, dataset, csv]
1368
+ phrases: ["here is the data", "load this", "analyze this dataset"]
1369
+ workflow: WF-05
1370
+ project_types: [data]
1371
+
1372
+ - query_type: schema_query
1373
+ match_rules:
1374
+ keywords: [schema, columns, fields, types, structure, table]
1375
+ phrases: ["what columns", "show schema", "field types"]
1376
+ workflow: WF-05
1377
+ project_types: [data]
1378
+
1379
+ - query_type: explore_entity
1380
+ match_rules:
1381
+ keywords: [explore, entity, about, details, info]
1382
+ phrases: ["explore", "tell me about", "what do we know about"]
1383
+ workflow: WF-05
1384
+ project_types: [data]
1385
+
1386
+ - query_type: relationship_query
1387
+ match_rules:
1388
+ keywords: [relate, relationship, connect, join, link, between]
1389
+ phrases: ["how does X relate to", "connection between"]
1390
+ workflow: WF-05
1391
+ project_types: [data]
1392
+
1393
+ - query_type: quality_check
1394
+ match_rules:
1395
+ keywords: [quality, null, missing, duplicate, integrity]
1396
+ phrases: ["data quality", "check quality", "missing values"]
1397
+ workflow: WF-05
1398
+ project_types: [data]
1399
+
1400
+ - query_type: analytical_query
1401
+ match_rules:
1402
+ keywords: [trend, compare, analyze, distribution, aggregate, count]
1403
+ phrases: ["show me trends", "compare", "how many"]
1404
+ workflow: WF-05
1405
+ project_types: [data]
1406
+
1407
+ - query_type: document_search
1408
+ match_rules:
1409
+ keywords: [document, search, find, topic, reference, policy]
1410
+ phrases: ["search for", "find documents about", "what does the policy say"]
1411
+ workflow: WF-05
1412
+ project_types: [data]
1413
+
1414
+ - query_type: dimension_management
1415
+ match_rules:
1416
+ keywords: [dimension, add dimension, queryable, aspect]
1417
+ phrases: ["add dimension", "new queryable aspect", "list dimensions"]
1418
+ workflow: WF-05
1419
+ project_types: [data]
1420
+
1421
+ - query_type: add_reference
1422
+ match_rules:
1423
+ keywords: [reference, add reference, build reference, catalog, registry entry]
1424
+ phrases: ["add a reference", "build reference for", "new reference entry"]
1425
+ workflow: WF-05
1426
+ project_types: [data]
1427
+
1428
+ # --- Analytical system patterns ---
1429
+ - query_type: chain_work
1430
+ match_rules:
1431
+ keywords: [chain, pipeline, prompt, composition, orchestration, stage]
1432
+ phrases: ["build a chain", "compose prompts", "pipeline stage", "chain architecture"]
1433
+ workflow: WF-06
1434
+ project_types: [analytical]
1435
+
1436
+ - query_type: evaluation
1437
+ match_rules:
1438
+ keywords: [evaluate, score, rubric, criteria, benchmark, test prompt]
1439
+ phrases: ["evaluate this", "scoring rubric", "how well does", "benchmark against"]
1440
+ workflow: WF-06
1441
+ project_types: [analytical]
1442
+
1443
+ - query_type: composition
1444
+ match_rules:
1445
+ keywords: [compose, template, prompt template, context window, token]
1446
+ phrases: ["compose a prompt", "prompt template", "context strategy"]
1447
+ workflow: WF-06
1448
+ project_types: [analytical]
1449
+
1450
+ - query_type: domain_research
1451
+ match_rules:
1452
+ keywords: [research, domain, pattern, best practice, prior art]
1453
+ phrases: ["research patterns", "domain knowledge", "what works for"]
1454
+ workflow: WF-06
1455
+ project_types: [analytical]
1456
+
1457
+ # --- Discovery / brownfield patterns ---
1458
+ - query_type: project_discovery
1459
+ match_rules:
1460
+ keywords: [discover, inventory, map project, assess, scan codebase, understand, brownfield]
1461
+ phrases: ["what does this project do", "scan the codebase", "map the project", "understand the architecture"]
1462
+ workflow: WF-08
1463
+ project_types: [universal]
1464
+
1465
+ - query_type: dependency_analysis
1466
+ match_rules:
1467
+ keywords: [dependencies, imports, connections, coupling, what uses, used by]
1468
+ phrases: ["map dependencies", "what depends on", "trace imports", "dependency graph"]
1469
+ workflow: WF-08
1470
+ project_types: [universal]
1471
+
1472
+ - query_type: pattern_analysis
1473
+ match_rules:
1474
+ keywords: [patterns, conventions, architecture, how is this built, coding style]
1475
+ phrases: ["what patterns", "coding conventions", "architectural decisions", "how does this work"]
1476
+ workflow: WF-08
1477
+ project_types: [universal]
1478
+
1479
+ - query_type: debt_assessment
1480
+ match_rules:
1481
+ keywords: [debt, technical debt, outdated, risks, security audit, code quality]
1482
+ phrases: ["assess technical debt", "what needs fixing", "code quality", "security review"]
1483
+ workflow: WF-08
1484
+ project_types: [universal]
1485
+
1486
+ # --- Specification project patterns ---
1487
+ - query_type: spec_writing
1488
+ match_rules:
1489
+ keywords: [spec, specification, standard, define, formalize, document]
1490
+ phrases: ["write a spec", "define the standard", "formalize this", "specification for"]
1491
+ workflow: WF-07
1492
+ project_types: [universal]
1493
+
1494
+ - query_type: cross_reference
1495
+ match_rules:
1496
+ keywords: [cross-reference, consistency, align, reconcile, trace]
1497
+ phrases: ["cross-reference with", "check consistency", "align specs"]
1498
+ workflow: WF-07
1499
+ project_types: [universal]
1500
+
1501
+ routing:
1502
+ algorithm: >
1503
+ 1. CLASSIFY: Match query against entry point scoping table first (project-specific).
1504
+ If no match, check query_patterns (registry-level). Default: general_task → WF-01.
1505
+ 2. SELECT: Use workflow field from matched pattern. Check for bootstrap override
1506
+ (first session → WF-04).
1507
+ 3. RESOLVE: Get workflow steps. For current stage, collect features from step + activation map.
1508
+ 4. COMPUTE: Aggregate reads/writes from scoping table row + resolved features.
1509
+ 5. EXECUTE: Agent loads read set, performs work, writes to write set.
1510
+ 6. CASCADE: For each written file, walk cascade table + registry dependencies (max 2 levels).
1511
+
1512
+ project_type_detection: >
1513
+ Infer from entry point scoping table content and PROJECT-PROFILE.md:
1514
+ - Has PROJECT-PROFILE.md → read project types and lifecycle stage directly
1515
+ - Has "code change", "bug fix", "API work" rows → code project
1516
+ - Has "schema query", "explore", "data ingest" rows → data project
1517
+ - Has "chain work", "evaluation", "composition" rows → analytical project
1518
+ - Has "spec writing", "cross-reference" rows → specification project (uses WF-07)
1519
+ - Has "project discovery", "dependency analysis" rows → discovery active (uses WF-08)
1520
+ - Has rows from multiple types → mixed project (multiple workflows available)
1521
+ - Has neither → general project (WF-01 only)
1522
+ Lifecycle stage (from PROJECT-PROFILE.md) adjusts feature activation priorities
1523
+ but does not change project type detection.
1524
+
1525
+ priority_rules:
1526
+ - Scoping table (project-specific) takes priority over registry patterns
1527
+ - Entry point cascade table takes priority over registry dependencies
1528
+ - One specialist per query (never load multiple)
1529
+ - Write sets are constraints (agent should not write outside them)
1530
+ - Max cascade depth is 2 levels
1531
+ - Ambiguous classification → ask user (STT-02)
1532
+
1533
+ # ============================================================
1534
+ # ACTIVATION AND DEPENDENCY MAPS
1535
+ # ============================================================
1536
+
1537
+ activation:
1538
+ initialize: [QRY-01, HAI-02, TPL-02]
1539
+ scope: [QRY-02, CTX-03]
1540
+ plan: [TSK-01, HAI-01, STT-02]
1541
+ execute: [STT-01, QRY-03, CTX-04, CTX-05, CTX-06, HAI-03, HAI-05, EXP-02, EXP-03, EXP-04, SCAN-03]
1542
+ verify: [TSK-02, SCAN-04]
1543
+ close: [TSK-03, TSK-04, STT-03, HAI-04, HAI-06]
1544
+ on_demand: [CTX-01, CTX-02, TPL-01, TPL-03, EXP-01, SCAN-01, SCAN-02, SCAN-05, SCAN-06, SCAN-07]
1545
+
1546
+ dependencies:
1547
+ TPL-01: [CTX-01, TPL-02]
1548
+ CTX-01: [CTX-05]
1549
+ QRY-01: [QRY-02]
1550
+ QRY-02: [CTX-03]
1551
+ TSK-01: [HAI-01]
1552
+ HAI-02: [HAI-01]
1553
+ TSK-03: [TSK-04, QRY-03]
1554
+ STT-03: [TSK-03]
1555
+ HAI-03: [HAI-04]
1556
+ CTX-02: [CTX-05]
1557
+ CTX-06: [QRY-03]
1558
+ EXP-01: [CTX-05]
1559
+ EXP-02: [EXP-01, CTX-05]
1560
+ EXP-03: [QRY-02, CTX-03]
1561
+ EXP-04: [EXP-03]
1562
+ SCAN-01: [CTX-05]
1563
+ SCAN-02: [SCAN-01]
1564
+ SCAN-03: [SCAN-01]
1565
+ SCAN-04: [SCAN-01, SCAN-03]
1566
+ SCAN-05: [SCAN-01, SCAN-02]
1567
+ SCAN-06: [SCAN-05]
1568
+ SCAN-07: [SCAN-01]
1569
+
1570
+ versions:
1571
+ v1:
1572
+ features: 22
1573
+ workflows: 4
1574
+ protocol_directives: 6
1575
+ notes: Core methodology. File-driven, single-agent. Workflows compose features into task patterns.
1576
+ v1.1:
1577
+ features: 26
1578
+ workflows: 5
1579
+ protocol_directives: 6
1580
+ query_patterns: 19
1581
+ notes: >
1582
+ Adds EXP domain (4 features), WF-05 (data-exploration), project-type annotations,
1583
+ query patterns for automated routing, Layer 4 routing rules. CTX-05 generalized
1584
+ to mapProject. Backwards-compatible with v1.
1585
+ v1.2:
1586
+ features: 27
1587
+ workflows: 5
1588
+ protocol_directives: 7
1589
+ query_patterns: 19
1590
+ notes: >
1591
+ Adds CTX-06 manageScale (file size monitoring + index restructuring) and P-07
1592
+ Keep files loadable (context window efficiency). Backwards-compatible with v1.1.
1593
+ v1.3:
1594
+ features: 27
1595
+ workflows: 7
1596
+ protocol_directives: 7
1597
+ query_patterns: 25
1598
+ notes: >
1599
+ Adds WF-06 analytical-system, WF-07 specification-project. 6 new query patterns
1600
+ for analytical and specification work. Backwards-compatible with v1.2.
1601
+ v1.4:
1602
+ features: 31
1603
+ workflows: 8
1604
+ protocol_directives: 7
1605
+ query_patterns: 29
1606
+ notes: >
1607
+ Adds SCAN domain (4 features: SCAN-01 codebaseInventory, SCAN-02 dependencyMapping,
1608
+ SCAN-03 patternExtraction, SCAN-04 debtAssessment). Adds WF-08 discovery workflow
1609
+ for brownfield project entry. 4 new query patterns for discovery. Adds lifecycle
1610
+ stage awareness to routing. PROJECT-PROFILE.md as new intelligence layer file.
1611
+ Backwards-compatible with v1.3.
1612
+ v1.5:
1613
+ features: 32
1614
+ workflows: 8
1615
+ protocol_directives: 10
1616
+ query_patterns: 29
1617
+ notes: >
1618
+ Adds HAI-05 modelCapabilityCheck (degradation detection + user surfacing).
1619
+ Adds P-08 Methodology is additive only (safety invariant for brownfield).
1620
+ Adds P-09 Surface capability limitations (self-monitoring directive).
1621
+ Integration profiles (lite/standard/full) for controlling methodology surface area.
1622
+ .context/METHODOLOGY.md as overflow target for lighter profiles.
1623
+ Brownfield merge protocol (append-only, never delete). Model tier entry point setting.
1624
+ Backwards-compatible with v1.4.
1625
+ v1.6:
1626
+ features: 36
1627
+ workflows: 8
1628
+ protocol_directives: 10
1629
+ query_patterns: 29
1630
+ notes: >
1631
+ Adds HAI-06 writeObligations (close-stage enforcement via PROTOCOL.yaml close_check).
1632
+ YAML-centric agent protocol: entry points become thin boot loaders (~50 lines),
1633
+ all recurring rules move to .context/PROTOCOL.yaml (~120 lines YAML).
1634
+ Adds SCAN-05 docDependencyGraph (document dependency graph in doc-tokens.yaml),
1635
+ SCAN-06 docReviewGenerate (internal document registry generation),
1636
+ and SCAN-07 boundariesConfig (configurable path resolution via PROTOCOL.yaml boundaries).
1637
+ New CLI commands: deps, doc-review. New flags: --deps, --internal-registry.
1638
+ .context/INDEX.yaml as navigation manifest with live metrics.
1639
+ Template file counts: starter 20, full 34 (+PROTOCOL.yaml, +INDEX.yaml per tier).
1640
+ Backwards-compatible with v1.5.
1641
+ v2:
1642
+ adds: [multi-agent orchestration, automated gate verification, template generator CLI]
1643
+ notes: Extends v1.5. Backwards-compatible. New workflows for multi-agent patterns.