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,743 @@
1
+ # ============================================================
2
+ # LAYER 1: FEATURE CATALOG
3
+ # What each capability is, when it triggers, what it touches
4
+ # ============================================================
5
+
6
+ domains:
7
+ - id: CTX
8
+ name: Context management
9
+ purpose: Build and maintain the agent's understanding of the project so every session starts informed
10
+ project_types: [universal]
11
+ - id: QRY
12
+ name: Query routing
13
+ purpose: Ensure the agent reads the right files and only the right files for each task
14
+ project_types: [universal]
15
+ - id: STT
16
+ name: State management
17
+ purpose: Preserve decisions, uncertainties, and position across sessions so nothing is lost
18
+ project_types: [universal]
19
+ - id: TSK
20
+ name: Task execution
21
+ purpose: Structure work into verifiable units so progress is measurable and auditable
22
+ project_types: [universal]
23
+ - id: HAI
24
+ name: Human-agent interaction
25
+ purpose: Give the human control over agent autonomy and keep both audiences served
26
+ project_types: [universal]
27
+ - id: TPL
28
+ name: Template and bootstrap
29
+ purpose: Get a new project from zero to working agent collaboration in minutes
30
+ project_types: [universal]
31
+ - id: EXP
32
+ name: Data exploration
33
+ purpose: Build structured understanding of user-submitted data and provide interactive access
34
+ project_types: [data]
35
+
36
+ - id: SCAN
37
+ name: Project discovery
38
+ purpose: Inventory, map, and assess existing projects so the agent builds understanding before contributing
39
+ project_types: [universal]
40
+
41
+ features:
42
+ # --- Context management ---
43
+ - id: CTX-01
44
+ name: initContext
45
+ domain: CTX
46
+ project_types: [universal]
47
+ description: Initialize the .context/ structure for a new or existing project
48
+ trigger: Project bootstrap (first session after template copy)
49
+ reads: [PROJECT.md, project directory structure]
50
+ writes: [.context/BASE.md]
51
+ options:
52
+ mode: [greenfield, brownfield]
53
+ dependencies: [TPL-01]
54
+ stage: on_demand
55
+ version: v1
56
+ type_variants:
57
+ code: Scan directory tree, map modules, technology stack, build system
58
+ data: Scan data sources, build data inventory, identify schemas
59
+ analytical: Discover chains, map components, identify pipeline stages
60
+ agent_directive: >
61
+ On first session, detect whether this is a new or existing project.
62
+ For greenfield: create BASE.md with empty project map ready to fill.
63
+ For brownfield: scan the project structure and populate the map
64
+ so future sessions understand the project immediately.
65
+
66
+ - id: CTX-02
67
+ name: refreshContext
68
+ domain: CTX
69
+ project_types: [universal]
70
+ description: Rescan the project and update .context/ files to match current reality
71
+ trigger: User requests context refresh; agent detects stale context; return after significant external changes
72
+ reads: [".context/*", "project directory structure", "recent git changes"]
73
+ writes: [".context/BASE.md", ".context/{affected specialists}", "entry point"]
74
+ options:
75
+ scope: [full, incremental]
76
+ dependencies: [CTX-05]
77
+ stage: on_demand
78
+ version: v1
79
+ type_variants:
80
+ code: Compare codebase map against directory structure, updated deps
81
+ data: Compare data map against data sources for new data, schema changes
82
+ analytical: Compare pipeline map against system state for new stages, changed rules
83
+ agent_directive: >
84
+ Projects evolve between sessions. Context files that don't match reality
85
+ cause the agent to make wrong assumptions. When triggered, compare
86
+ what .context/ says against what actually exists. Update the project
87
+ map, flag drift, and ensure future sessions start with accurate context.
88
+
89
+ - id: CTX-03
90
+ name: pairContext
91
+ domain: CTX
92
+ project_types: [universal]
93
+ description: Load the appropriate context pair (BASE + specialist) for a query type
94
+ trigger: Every query after cold start
95
+ reads: ["entry point scoping table", ".context/BASE.md", ".context/{matched specialist}"]
96
+ writes: []
97
+ dependencies: [QRY-02]
98
+ stage: scope
99
+ version: v1
100
+ type_variants:
101
+ code: "BASE + code specialist (API.md, DATABASE.md, TESTING.md, etc.)"
102
+ data: "BASE + data specialist (SCHEMA.md, DOCUMENTS.md, RELATIONSHIPS.md)"
103
+ analytical: "BASE + domain specialist (COMPOSITION.md, EVALUATION.md, EXECUTION.md, etc.)"
104
+ agent_directive: >
105
+ Never load all context files. Load BASE.md (always) plus exactly one
106
+ specialist matched to the query type. This keeps context focused and
107
+ prevents the agent from being overwhelmed with irrelevant information.
108
+
109
+ - id: CTX-04
110
+ name: growContext
111
+ domain: CTX
112
+ project_types: [universal]
113
+ description: Create a new specialist context file when a new domain area is identified
114
+ trigger: Agent recognizes recurring domain not covered by existing specialists; user explicitly requests
115
+ reads: [.context/BASE.md, entry point, relevant source files]
116
+ writes: [".context/{SPECIALIST}.md", ".context/BASE.md", "entry point"]
117
+ dependencies: [CTX-01]
118
+ stage: execute
119
+ version: v1
120
+ type_variants:
121
+ code: New code domain → new specialist (e.g., SECURITY.md when auth code grows)
122
+ data: New data dimension → new specialist or expanded existing
123
+ analytical: New pipeline stage → new specialist
124
+ agent_directive: >
125
+ As a project grows, new domain areas emerge that need their own context.
126
+ When you notice recurring questions about a domain not covered by existing
127
+ specialists, propose a new specialist file. This makes future sessions
128
+ in that domain more efficient.
129
+
130
+ - id: CTX-05
131
+ name: mapProject
132
+ domain: CTX
133
+ project_types: [universal]
134
+ description: Generate or update the project map section in BASE.md
135
+ trigger: CTX-01 bootstrap, CTX-02 refresh, cascade from project structure change
136
+ reads: [project directory structure, package files, key source files]
137
+ writes: [.context/BASE.md]
138
+ options:
139
+ mode: [codebase, data-sources, domain-chains]
140
+ depth: [shallow, deep]
141
+ dependencies: []
142
+ stage: execute
143
+ version: v1.1
144
+ type_variants:
145
+ codebase: Walk directory tree, record path/purpose/patterns/dependencies
146
+ data-sources: Scan data sources, record source/type/size/keys/dimensions
147
+ domain-chains: Trace input→transformation→output flows, record chains/components
148
+ agent_directive: >
149
+ The project map is the agent's working memory of the project structure.
150
+ For code: walk directories, record what each does and what patterns it uses.
151
+ For data: scan sources, record schemas, relationships, and dimensions.
152
+ For analytical systems: trace transformation chains and map components.
153
+ This map is what allows the agent to navigate without re-exploring every session.
154
+
155
+ - id: CTX-06
156
+ name: manageScale
157
+ domain: CTX
158
+ project_types: [universal]
159
+ description: Monitor file size, restructure into index + components when threshold exceeded, maintain navigation registry
160
+ trigger: After any file write that increases an intelligence layer file beyond 300 lines; after any file split, creation, deletion, or rename
161
+ reads: [affected file, .context/REGISTRY.md]
162
+ writes: [affected file (rewritten as index), new component subdirectory/files, .context/REGISTRY.md]
163
+ options:
164
+ threshold: [300]
165
+ grouping: [semantic, chronological]
166
+ dependencies: [QRY-03]
167
+ stage: execute
168
+ version: v1.2
169
+ type_variants:
170
+ all: >
171
+ Index keeps active/current content + navigation table linking to components.
172
+ Components are archived sections grouped by semantic boundary (phases, domains, time periods).
173
+ Subdirectory named after the file stem (e.g., SUMMARY.md -> summary/).
174
+ Navigation registry (.context/REGISTRY.md) tracks all files, topics, and structural changes.
175
+ agent_directive: >
176
+ After writing to an intelligence layer file, check its line count.
177
+ If it exceeds 300 lines, restructure: keep active content in the
178
+ original file (now an index with navigation table), move archived
179
+ sections to a subdirectory named after the file stem. Group archived
180
+ content by semantic boundaries. The index must remain self-sufficient
181
+ for current work — components hold history, not active state.
182
+ After ANY structural change (split, create, delete, rename), update
183
+ .context/REGISTRY.md: file tree (add/remove entries, update line counts),
184
+ topic index (add/redirect/remove entries), structural log (record what
185
+ happened and why). The registry is the agent's fast-lookup map — one
186
+ read gives the full picture of where content lives.
187
+
188
+ # --- Query routing ---
189
+ - id: QRY-01
190
+ name: coldStart
191
+ domain: QRY
192
+ project_types: [universal]
193
+ description: Two-file initialization protocol for every new session
194
+ trigger: Session start (always)
195
+ reads: [entry point, STATE.md]
196
+ writes: []
197
+ dependencies: []
198
+ stage: initialize
199
+ version: v1
200
+ agent_directive: >
201
+ Every session begins by reading exactly two files: the entry point
202
+ and STATE.md. This gives you scoping rules, cascade table, conventions,
203
+ current position, prior decisions, and open questions. Do not load
204
+ anything else until a query arrives.
205
+
206
+ - id: QRY-02
207
+ name: scopeQuery
208
+ domain: QRY
209
+ project_types: [universal]
210
+ description: Classify a human query and load the appropriate file set
211
+ trigger: Every human query after cold start
212
+ reads: [entry point scoping table]
213
+ writes: []
214
+ dependencies: [QRY-01]
215
+ stage: scope
216
+ version: v1
217
+ agent_directive: >
218
+ Match the user's query against the scoping table. Load the read-set.
219
+ Constrain writes to the write-set. If the query doesn't match any row
220
+ cleanly, ask the user to clarify before loading files. Tables are
221
+ your routing logic — follow them deterministically.
222
+
223
+ - id: QRY-03
224
+ name: cascadeUpdate
225
+ domain: QRY
226
+ project_types: [universal]
227
+ description: After a file change, propagate updates through the dependency chain
228
+ trigger: Any file change during execute or close stages
229
+ reads: [entry point cascade table]
230
+ writes: [dependent files per cascade rules]
231
+ dependencies: [QRY-02]
232
+ stage: execute
233
+ version: v1
234
+ agent_directive: >
235
+ After EVERY file change, check the cascade table. If the change matches
236
+ a trigger, update the dependent files in the same response. Deferred
237
+ cascades don't happen. Check for secondary cascades up to 2 levels deep.
238
+
239
+ # --- State management ---
240
+ - id: STT-01
241
+ name: recordDecision
242
+ domain: STT
243
+ project_types: [universal]
244
+ description: Capture decisions in STATE.md immediately when made
245
+ trigger: Agent makes or recognizes a decision during any stage
246
+ reads: [STATE.md]
247
+ writes: [STATE.md]
248
+ dependencies: []
249
+ stage: execute
250
+ version: v1
251
+ agent_directive: >
252
+ When you make a decision, write it to STATE.md in the SAME RESPONSE
253
+ as the work that produced it. Never defer. If deferred, it's lost.
254
+
255
+ - id: STT-02
256
+ name: flagUncertainty
257
+ domain: STT
258
+ project_types: [universal]
259
+ description: Track open questions as first-class artifacts in STATE.md
260
+ trigger: Agent encounters an ambiguity, unknown, or needs human input
261
+ reads: [STATE.md]
262
+ writes: [STATE.md]
263
+ dependencies: []
264
+ stage: plan
265
+ version: v1
266
+ agent_directive: >
267
+ When you're unsure, write it as an open question in STATE.md.
268
+ Do not guess silently. When resolved, strike through and add
269
+ resolution text — don't delete.
270
+
271
+ - id: STT-03
272
+ name: trackPosition
273
+ domain: STT
274
+ project_types: [universal]
275
+ description: Maintain the current phase and status in STATE.md
276
+ trigger: Phase transitions, task completion, session close
277
+ reads: [STATE.md]
278
+ writes: [STATE.md]
279
+ dependencies: [TSK-03]
280
+ stage: close
281
+ version: v1
282
+ agent_directive: >
283
+ STATE.md "Current position" must always reflect: what phase, what status
284
+ within it, what comes next, and what context is active.
285
+
286
+ # --- Task execution ---
287
+ - id: TSK-01
288
+ name: planTask
289
+ domain: TSK
290
+ project_types: [universal]
291
+ description: Create a structured PLAN.md with substeps and verification criteria
292
+ trigger: Start of a new task (plan stage)
293
+ reads: [REQUIREMENTS.md, ROADMAP.md, relevant .context/]
294
+ writes: [PLAN.md]
295
+ options:
296
+ detail: [minimal, standard, detailed]
297
+ dependencies: [HAI-01]
298
+ stage: plan
299
+ version: v1
300
+ agent_directive: >
301
+ Produce a plan with: objective, prerequisites, steps with read/produce
302
+ specs, and verification criteria. Plans are atomic — one task at a time.
303
+ Propose and wait for approval before executing.
304
+
305
+ - id: TSK-02
306
+ name: verifyTask
307
+ domain: TSK
308
+ project_types: [universal]
309
+ description: Check completed work against embedded verification criteria
310
+ trigger: Verify stage (after execution)
311
+ reads: [PLAN.md]
312
+ writes: [verification results in SUMMARY.md]
313
+ dependencies: [TSK-01]
314
+ stage: verify
315
+ version: v1
316
+ agent_directive: >
317
+ Read verification criteria from PLAN.md. Check each against completed
318
+ work. Report pass/fail with specific evidence.
319
+
320
+ - id: TSK-03
321
+ name: closeSession
322
+ domain: TSK
323
+ project_types: [universal]
324
+ description: Execute the close stage - SUMMARY, STATE, ROADMAP updates
325
+ trigger: Task or session completion
326
+ reads: [SUMMARY.md, STATE.md, ROADMAP.md]
327
+ writes: [SUMMARY.md, STATE.md, ROADMAP.md]
328
+ dependencies: [TSK-04, QRY-03]
329
+ stage: close
330
+ version: v1
331
+ agent_directive: >
332
+ Write SUMMARY.md entry. Update STATE.md position. Mark ROADMAP.md
333
+ if phase complete. Non-negotiable phase completion cascade.
334
+
335
+ - id: TSK-04
336
+ name: auditTrail
337
+ domain: TSK
338
+ project_types: [universal]
339
+ description: Maintain SUMMARY.md in the standard session entry format
340
+ trigger: TSK-03 closeSession
341
+ reads: [session work products, STATE.md]
342
+ writes: [SUMMARY.md]
343
+ dependencies: []
344
+ stage: close
345
+ version: v1
346
+ agent_directive: >
347
+ Each SUMMARY entry: date, plan, outcome, files created/updated,
348
+ decisions captured, next. The "Next" field bridges to the following session.
349
+
350
+ # --- Human-agent interaction ---
351
+ - id: HAI-01
352
+ name: checkpoint
353
+ domain: HAI
354
+ project_types: [universal]
355
+ description: Surface a plan proposal for human approval before execution
356
+ trigger: Plan stage (skipped at autonomous level)
357
+ reads: [proposed plan]
358
+ writes: []
359
+ dependencies: [HAI-02]
360
+ stage: plan
361
+ version: v1
362
+ agent_directive: >
363
+ Present your plan and WAIT for human approval. This is the PRIMARY
364
+ CHECKPOINT. A wrong plan executed perfectly is still failure.
365
+
366
+ - id: HAI-02
367
+ name: setInteractionLevel
368
+ domain: HAI
369
+ project_types: [universal]
370
+ description: Configure the checkpoint density for a session
371
+ trigger: Entry point mode setting read during cold start
372
+ reads: [entry point]
373
+ writes: []
374
+ options:
375
+ level: [autonomous, checkpoint, collaborative, supervised]
376
+ dependencies: [QRY-01]
377
+ stage: initialize
378
+ version: v1
379
+ agent_directive: >
380
+ Read the mode setting. It controls how often you pause. Default
381
+ is checkpoint. Respect the configured level.
382
+
383
+ - id: HAI-03
384
+ name: dualAudience
385
+ domain: HAI
386
+ project_types: [universal]
387
+ description: Maintain separation between agent-facing and human-facing files
388
+ trigger: Any file write during execute or close stages
389
+ reads: [entry point docs trigger mapping]
390
+ writes: [agent files, human files per trigger mapping]
391
+ dependencies: [HAI-04]
392
+ stage: execute
393
+ version: v1
394
+ agent_directive: >
395
+ Agent files (STATE.md, .context/) are for machine parsing.
396
+ Human files (docs/) use visual formats. Never mix audiences.
397
+
398
+ - id: HAI-04
399
+ name: docsTrigger
400
+ domain: HAI
401
+ project_types: [universal]
402
+ description: Update docs/ based on the trigger mapping in the entry point
403
+ trigger: Structural changes matching entry point docs maintenance table
404
+ reads: [entry point docs trigger table]
405
+ writes: [specific docs/ files per trigger]
406
+ dependencies: [HAI-03]
407
+ stage: close
408
+ version: v1
409
+ agent_directive: >
410
+ When structural changes match a trigger, update specified docs/ files.
411
+ Typo fixes and internal adjustments do NOT trigger docs updates.
412
+
413
+ - id: HAI-05
414
+ name: modelCapabilityCheck
415
+ domain: HAI
416
+ project_types: [universal]
417
+ description: Detect when the agent consistently fails methodology requirements due to model capability limitations
418
+ trigger: Agent detects repeated pattern failures (missed cascades, forgotten decisions, shallow context, incomplete discovery)
419
+ reads: [STATE.md, entry point, session history]
420
+ writes: [STATE.md (open question with capability warning)]
421
+ dependencies: []
422
+ stage: execute
423
+ version: v1
424
+ degradation_signals:
425
+ - pattern: Cascade misses — file changed but dependent files not updated in same response
426
+ threshold: 2+ misses in a session
427
+ recommendation: Switch to Sonnet or higher for this task type
428
+ - pattern: Decision recording failures — decisions made but not written to STATE.md
429
+ threshold: Any deferred decision recording
430
+ recommendation: Simpler model may not handle simultaneous work + recording
431
+ - pattern: Shallow context — .context/ files populated with generic content lacking project-specific detail
432
+ threshold: Context quality score < 3 (from protocol tools)
433
+ recommendation: Discovery tasks (WF-08) require Sonnet+; use Haiku only for greenfield/simple workflows
434
+ - pattern: Incomplete discovery — SCAN features produce shallow inventories missing architectural patterns
435
+ threshold: Brownfield scan misses >30% of project structure
436
+ recommendation: WF-08 requires Sonnet+ capability; Haiku cannot handle discovery
437
+ - pattern: Instruction loss — agent stops following entry point conventions mid-session
438
+ threshold: Conventions violated after being followed earlier in same session
439
+ recommendation: Entry point may exceed model's effective context window; switch to lite profile
440
+ agent_directive: >
441
+ Monitor your own methodology adherence. If you notice you are repeatedly
442
+ missing cascades, forgetting to update STATE.md, producing shallow context,
443
+ or losing track of entry point conventions, surface this to the user:
444
+ "I'm noticing degraded methodology adherence — this task may benefit from
445
+ a more capable model (Sonnet/Opus) or a lighter integration profile."
446
+ Record the observation as an open question in STATE.md.
447
+
448
+ - id: HAI-06
449
+ name: writeObligations
450
+ domain: HAI
451
+ project_types: [universal]
452
+ description: Enforce close-stage write obligations via PROTOCOL.yaml close_check
453
+ trigger: End of any file-modifying response
454
+ reads: [".context/PROTOCOL.yaml (close_check section)", "registry/doc-tokens.yaml (terminology consistency)"]
455
+ 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"]
456
+ dependencies: [HAI-04, QRY-03]
457
+ stage: close
458
+ version: v1.6
459
+ agent_directive: >
460
+ Before ending any response that modified files, read PROTOCOL.yaml close_check.
461
+ For each triggered item, update the target file now. A response that modifies
462
+ files but skips triggered obligations is incomplete. This is the final self-audit
463
+ before the response ends.
464
+
465
+ # --- Template and bootstrap ---
466
+ - id: TPL-01
467
+ name: bootstrap
468
+ domain: TPL
469
+ project_types: [universal]
470
+ description: Initialize a project from the template with guided content
471
+ trigger: First session on a new project
472
+ reads: [template files, "registry/feature-registry.yaml", "registry/doc-tokens.yaml"]
473
+ writes: [PROJECT.md, .context/BASE.md, STATE.md, "registry/doc-tokens.yaml"]
474
+ options:
475
+ template: [starter, full]
476
+ dependencies: [CTX-01, TPL-02]
477
+ stage: on_demand
478
+ version: v1.6
479
+ agent_directive: >
480
+ Read guided content. Help user fill PROJECT.md. Run initContext.
481
+ For brownfield: use segmented onboarding (5 segments driven by doc-tokens.yaml
482
+ categories). Populate doc-tokens.yaml with project identity, terminology,
483
+ and propagation targets during onboarding. Reference feature-registry.yaml
484
+ to determine applicable workflows and query types.
485
+
486
+ - id: TPL-02
487
+ name: detectRuntime
488
+ domain: TPL
489
+ project_types: [universal]
490
+ description: Determine which entry point file is active
491
+ trigger: Cold start (implicit)
492
+ reads: [loaded entry point file]
493
+ writes: []
494
+ dependencies: []
495
+ stage: initialize
496
+ version: v1
497
+ agent_directive: >
498
+ Templates ship all three variants. Runtime auto-loads the appropriate one.
499
+
500
+ - id: TPL-03
501
+ name: structureSelect
502
+ domain: TPL
503
+ project_types: [universal]
504
+ description: Choose template tier based on project complexity
505
+ trigger: TPL-01 bootstrap or user upgrade request
506
+ reads: [PROJECT.md, user input]
507
+ writes: [additional template files if upgrading]
508
+ options:
509
+ tier: [starter, full]
510
+ dependencies: [TPL-01]
511
+ stage: on_demand
512
+ version: v1
513
+ agent_directive: >
514
+ Starter for most projects. Full when project has multiple phases
515
+ or needs dual-audience separation. Offer upgrade path.
516
+
517
+ # --- Data exploration ---
518
+ - id: EXP-01
519
+ name: ingestData
520
+ domain: EXP
521
+ project_types: [data]
522
+ description: Scan submitted data sources, classify by type, sample content, measure scale, detect quality signals
523
+ trigger: User submits new data source (CSV, database, repo, document set)
524
+ reads: [data source, .context/BASE.md]
525
+ writes: [.context/BASE.md (data inventory), specialist stubs]
526
+ options:
527
+ source_type: [structured, repository, documents, mixed]
528
+ dependencies: [CTX-01]
529
+ stage: on_demand
530
+ version: v1.1
531
+ agent_directive: >
532
+ When data is submitted, scan for structure (columns, types, file names,
533
+ directory layout). Sample content. Measure scale (row counts, file counts).
534
+ Detect quality signals (null rates, duplicates, encoding). Present
535
+ findings to user. Do NOT try to understand everything — map the surface
536
+ first, deep understanding comes in the Map stage.
537
+
538
+ - id: EXP-02
539
+ name: buildReferences
540
+ domain: EXP
541
+ project_types: [data]
542
+ description: Transform raw data mapping into structured reference artifacts
543
+ trigger: After EXP-01 ingest and CTX-05 mapping, or user requests reference building
544
+ reads: [.context/BASE.md, relevant specialist, data sources]
545
+ writes: [specialist context files (entity registries, topic taxonomies, dimension indices, metric catalogs)]
546
+ dependencies: [EXP-01, CTX-05]
547
+ stage: execute
548
+ version: v1.1
549
+ agent_directive: >
550
+ Build navigable reference artifacts from the data map. Entity registries,
551
+ topic taxonomies, queryable dimension indices, derived metric catalogs.
552
+ References are the bridge between raw data and interactive exploration.
553
+ Each reference entry must be addressable, cross-linked, and source-attributed.
554
+
555
+ - id: EXP-03
556
+ name: exploreCommand
557
+ domain: EXP
558
+ project_types: [data]
559
+ description: Recognize and execute named exploration patterns consistently
560
+ trigger: User query matching an exploration command pattern
561
+ reads: [.context/BASE.md, relevant specialist per command type]
562
+ writes: [STATE.md (exploration path)]
563
+ options:
564
+ commands: [explore, schema, search, relate, quality, timeline, dimensions, gaps, summary]
565
+ dependencies: [QRY-02, CTX-03]
566
+ stage: execute
567
+ version: v1.1
568
+ agent_directive: >
569
+ Recognize named exploration patterns in user queries. Each command
570
+ maps to a specific specialist and action. Most exploration queries
571
+ are read-only — they don't produce file changes. Progressively reveal
572
+ available commands as the user explores.
573
+
574
+ - id: EXP-04
575
+ name: manageAbstraction
576
+ domain: EXP
577
+ project_types: [data]
578
+ description: Navigate the abstraction ladder, deciding when to access raw data vs references
579
+ trigger: Any data query during exploration
580
+ reads: [.context/BASE.md, relevant specialist]
581
+ writes: []
582
+ dependencies: [EXP-03]
583
+ stage: execute
584
+ version: v1.1
585
+ agent_directive: >
586
+ Work at Level 2-3 (summaries and references) by default. Drop to
587
+ Level 0-1 (raw data, schema) only for specific queries that require
588
+ actual data values. Context files contain understanding, not data.
589
+ If a recurring query needs Level 0 access, propose adding the result
590
+ as a derived metric or reference in the specialist.
591
+
592
+ # --- Project discovery ---
593
+ - id: SCAN-01
594
+ name: codebaseInventory
595
+ domain: SCAN
596
+ project_types: [universal]
597
+ description: Walk the project structure and build a complete inventory of directories, files, modules, and their purposes
598
+ trigger: Discovery stage entry (brownfield bootstrap, methodology first applied to existing project, major re-assessment)
599
+ reads: [project directory structure, package files, entry points, key source files, "registry/doc-tokens.yaml"]
600
+ writes: [.context/BASE.md (project map), "registry/doc-tokens.yaml (project identity, terminology)"]
601
+ options:
602
+ depth: [shallow, deep]
603
+ dependencies: [CTX-05]
604
+ stage: on_demand
605
+ version: v1.4
606
+ type_variants:
607
+ code: Walk directory tree, identify modules, map build system, record technology stack
608
+ data: Scan data directories, inventory data files, identify schema sources
609
+ analytical: Trace pipeline components, inventory chain stages, map orchestration config
610
+ agent_directive: >
611
+ Walk the entire project directory structure. For each significant directory
612
+ and file, record: path, purpose (inferred from names, contents, conventions),
613
+ key patterns, and dependencies. The inventory is the foundation — you cannot
614
+ contribute effectively to code you haven't mapped. Output goes into the
615
+ project map section of BASE.md.
616
+
617
+ - id: SCAN-02
618
+ name: dependencyMapping
619
+ domain: SCAN
620
+ project_types: [universal]
621
+ description: Map all internal and external dependencies — packages, modules, services, data flows
622
+ trigger: SCAN-01 inventory (cascade), explicit dependency analysis request
623
+ reads: [package manifests, import statements, configuration files, .context/BASE.md]
624
+ writes: [.context/BASE.md (dependencies section)]
625
+ dependencies: [SCAN-01]
626
+ stage: on_demand
627
+ version: v1.4
628
+ type_variants:
629
+ code: Parse package.json/Cargo.toml/requirements.txt, trace import graphs, map service dependencies
630
+ data: Map data source connections, trace ETL flows, identify schema dependencies
631
+ analytical: Map chain dependencies, trace data flows between pipeline stages
632
+ agent_directive: >
633
+ After the inventory, map how pieces connect. Parse package manifests for
634
+ external dependencies. Trace imports for internal module dependencies.
635
+ Identify service-to-service connections. Record version constraints.
636
+ This map tells you what breaks when something changes — essential for
637
+ cascade accuracy and safe modifications.
638
+
639
+ - id: SCAN-03
640
+ name: patternExtraction
641
+ domain: SCAN
642
+ project_types: [universal]
643
+ description: Identify recurring code patterns, conventions, and architectural decisions in the existing project
644
+ trigger: SCAN-01 inventory (cascade), explicit pattern analysis request, Evolution stage refactoring
645
+ reads: [source files (sampled), .context/BASE.md, existing .context/ specialists]
646
+ writes: [.context/ specialists (proposed), STATE.md (architectural decisions discovered)]
647
+ dependencies: [SCAN-01]
648
+ stage: on_demand
649
+ version: v1.4
650
+ type_variants:
651
+ code: Identify naming conventions, error handling patterns, test patterns, API design patterns
652
+ data: Identify data modeling patterns, query patterns, transformation conventions
653
+ analytical: Identify composition patterns, evaluation approaches, orchestration conventions
654
+ agent_directive: >
655
+ Sample key files across the project. Identify recurring patterns:
656
+ naming conventions, error handling, testing approach, architectural patterns,
657
+ design decisions embedded in the code. Each pattern is a convention the agent
658
+ must follow in future work. Patterns become specialist file candidates.
659
+ Record discovered architectural decisions in STATE.md — these are decisions
660
+ that were already made, just not documented.
661
+
662
+ - id: SCAN-04
663
+ name: debtAssessment
664
+ domain: SCAN
665
+ project_types: [universal]
666
+ description: Identify technical debt, inconsistencies, security concerns, and improvement opportunities
667
+ trigger: Explicit assessment request, Discovery stage completion, Evolution stage periodic review
668
+ reads: [.context/BASE.md, .context/ specialists, source files (targeted)]
669
+ writes: [STATE.md (open questions for debt items), PLAN.md (remediation priorities if requested)]
670
+ dependencies: [SCAN-01, SCAN-03]
671
+ stage: on_demand
672
+ version: v1.4
673
+ type_variants:
674
+ code: Outdated dependencies, missing tests, inconsistent patterns, security vulnerabilities, dead code
675
+ data: Stale data, missing validation, undocumented schemas, quality gaps
676
+ analytical: Outdated evaluation criteria, untested chains, missing documentation
677
+ agent_directive: >
678
+ Based on the inventory and patterns, identify areas of concern:
679
+ outdated dependencies, missing tests, inconsistent conventions, security
680
+ issues, dead code, documentation gaps. Each finding becomes an open
681
+ question in STATE.md with severity assessment. Do NOT attempt to fix
682
+ everything — assess and prioritize. The human decides what to address.
683
+
684
+ - id: SCAN-05
685
+ name: docDependencyGraph
686
+ domain: SCAN
687
+ project_types: [universal]
688
+ description: Build and maintain document dependency graph in doc-tokens.yaml during brownfield onboarding and close
689
+ trigger: Brownfield Segment 2 (Architecture scan), wwa close (growth tracking), wwa init (default seeding)
690
+ reads: [registry/doc-tokens.yaml, .context/DOCS-MAP.md, docs/ directory]
691
+ writes: [registry/doc-tokens.yaml (doc_graph section)]
692
+ dependencies: [SCAN-01, SCAN-02]
693
+ stage: on_demand
694
+ version: v1.6
695
+ type_variants:
696
+ code: API docs, database schemas, architecture docs dependency chains
697
+ data: Schema docs, data catalog, pipeline documentation dependency chains
698
+ analytical: Evaluation criteria, prompt templates, domain knowledge dependency chains
699
+ agent_directive: >
700
+ During brownfield onboarding Segment 2, scan the docs/ directory and build a
701
+ dependency graph. Create nodes for each document file, identify cross-references
702
+ (markdown links, .context/ references), and create typed edges (reads_from,
703
+ cascades_to). Write the graph to doc-tokens.yaml doc_graph section. During
704
+ close, detect new files and add them as nodes with category: unknown.
705
+
706
+ - id: SCAN-06
707
+ name: docReviewGenerate
708
+ domain: SCAN
709
+ project_types: [universal]
710
+ description: Generate internal document registry (docs/internal/doc-registry.yaml + .md) from dependency graph
711
+ trigger: Explicit wwa doc-review command, post-onboarding review
712
+ reads: [registry/doc-tokens.yaml (doc_graph, project_names), .context/DOCS-MAP.md]
713
+ writes: [docs/internal/doc-registry.yaml, docs/internal/doc-registry.md]
714
+ dependencies: [SCAN-05]
715
+ stage: on_demand
716
+ version: v1.6
717
+ agent_directive: >
718
+ Synthesize the document dependency graph, project terminology, and docs inventory
719
+ into a structured registry at docs/internal/. The YAML file provides machine-readable
720
+ data (dependency graph, terminology, health metrics). The markdown file provides
721
+ human-readable views (dependency tree, glossary, health dashboard, cross-reference
722
+ index). This registry can be included in case studies and management reports via
723
+ the --internal-registry flag on casestudy and close commands.
724
+
725
+ - id: SCAN-07
726
+ name: boundariesConfig
727
+ domain: SCAN
728
+ project_types: [universal]
729
+ description: Configurable project boundaries via PROTOCOL.yaml — path resolution, visibility, scan rules, distribution
730
+ trigger: Brownfield onboarding with non-standard paths, self-hosting projects, custom distribution rules
731
+ reads: [.context/PROTOCOL.yaml (boundaries section)]
732
+ writes: [.context/PROTOCOL.yaml (boundaries section)]
733
+ dependencies: [SCAN-01]
734
+ stage: on_demand
735
+ version: v1.6
736
+ agent_directive: >
737
+ When a project stores registries at non-standard paths (e.g. docs/internal/ instead
738
+ of .context/), uncomment and configure the boundaries section in PROTOCOL.yaml.
739
+ The boundaries section controls: registry paths (tokens, docs_map, output), visibility
740
+ classification (internal vs release folders), scan rules (include/exclude), and
741
+ distribution rules (git/npm include/exclude). All CLI tools read boundaries to resolve
742
+ paths. Projects without a boundaries section get default behavior (backward compatible).
743
+