intentdna 1.7.5 → 1.8.1

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 (154) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/LICENSE +201 -0
  4. package/README.md +143 -194
  5. package/dist/assets/candidates.d.ts +124 -0
  6. package/dist/assets/candidates.js +1249 -0
  7. package/dist/assets/catalog.d.ts +101 -0
  8. package/dist/assets/catalog.js +311 -0
  9. package/dist/assets/evidence.d.ts +93 -0
  10. package/dist/assets/evidence.js +391 -0
  11. package/dist/assets/index.d.ts +4 -0
  12. package/dist/assets/index.js +4 -0
  13. package/dist/assets/metadata.d.ts +19 -0
  14. package/dist/assets/metadata.js +227 -0
  15. package/dist/cli/commands/assets.d.ts +65 -0
  16. package/dist/cli/commands/assets.js +2871 -0
  17. package/dist/cli/commands/auth.d.ts +322 -0
  18. package/dist/cli/commands/auth.js +1592 -0
  19. package/dist/cli/commands/cloud-auth-guidance.d.ts +2 -0
  20. package/dist/cli/commands/cloud-auth-guidance.js +4 -0
  21. package/dist/cli/commands/cloud.d.ts +1359 -0
  22. package/dist/cli/commands/cloud.js +8364 -0
  23. package/dist/cli/commands/evolve.js +18 -2
  24. package/dist/cli/commands/generate.js +25 -2
  25. package/dist/cli/commands/guard.d.ts +1 -1
  26. package/dist/cli/commands/guard.js +1 -1
  27. package/dist/cli/commands/guide.d.ts +15 -0
  28. package/dist/cli/commands/guide.js +1747 -0
  29. package/dist/cli/commands/init.d.ts +12 -0
  30. package/dist/cli/commands/init.js +95 -60
  31. package/dist/cli/commands/org.d.ts +16 -0
  32. package/dist/cli/commands/org.js +2393 -0
  33. package/dist/cli/commands/release.d.ts +59 -0
  34. package/dist/cli/commands/release.js +716 -0
  35. package/dist/cli/commands/report.d.ts +82 -0
  36. package/dist/cli/commands/report.js +1516 -0
  37. package/dist/cli/commands/run.d.ts +8 -1
  38. package/dist/cli/commands/run.js +129 -57
  39. package/dist/cli/commands/sync.d.ts +8 -1
  40. package/dist/cli/commands/sync.js +436 -141
  41. package/dist/cli/commands/templates.d.ts +64 -0
  42. package/dist/cli/commands/templates.js +2151 -1
  43. package/dist/cli/commands/workflow.d.ts +26 -0
  44. package/dist/cli/commands/workflow.js +3053 -0
  45. package/dist/cli/index.js +703 -36
  46. package/dist/compiler/cascade.js +4 -9
  47. package/dist/compiler/compile.js +1 -0
  48. package/dist/governance/evidence-capture-attribution.d.ts +12 -0
  49. package/dist/governance/evidence-capture-attribution.js +46 -0
  50. package/dist/governance/index.d.ts +2 -0
  51. package/dist/governance/index.js +1 -0
  52. package/dist/hooks/cli.d.ts +9 -0
  53. package/dist/hooks/cli.js +170 -411
  54. package/dist/hooks/enforce.d.ts +1 -0
  55. package/dist/hooks/protocol.d.ts +1 -1
  56. package/dist/hooks/protocol.js +1 -1
  57. package/dist/hooks/state.d.ts +41 -0
  58. package/dist/hooks/state.js +126 -2
  59. package/dist/index.d.ts +3 -0
  60. package/dist/index.js +3 -0
  61. package/dist/mcp/tools-state.js +2 -0
  62. package/dist/organization/index.d.ts +121 -0
  63. package/dist/organization/index.js +413 -0
  64. package/dist/runtime/claude-sync-target.d.ts +49 -0
  65. package/dist/runtime/claude-sync-target.js +280 -0
  66. package/dist/runtime/codex-adapter.d.ts +254 -0
  67. package/dist/runtime/codex-adapter.js +1204 -0
  68. package/dist/runtime/codex-sync-target.d.ts +33 -0
  69. package/dist/runtime/codex-sync-target.js +241 -0
  70. package/dist/runtime/index.d.ts +8 -0
  71. package/dist/runtime/index.js +4 -0
  72. package/dist/runtime/output-artifact-registry.d.ts +1 -1
  73. package/dist/runtime/output-artifact-registry.js +2 -0
  74. package/dist/runtime/settings-adapter.d.ts +1 -1
  75. package/dist/runtime/settings-adapter.js +1 -1
  76. package/dist/runtime/skill-adapter.d.ts +5 -1
  77. package/dist/runtime/skill-adapter.js +164 -39
  78. package/dist/runtime/sync-artifact-registry.d.ts +99 -0
  79. package/dist/runtime/sync-artifact-registry.js +194 -0
  80. package/dist/runtime/sync-target-plan.d.ts +45 -0
  81. package/dist/runtime/sync-target-plan.js +19 -0
  82. package/dist/runtime/verifier.d.ts +51 -0
  83. package/dist/runtime/verifier.js +462 -0
  84. package/dist/schema/controller-registry.d.ts +8 -1
  85. package/dist/schema/controller-registry.js +8 -0
  86. package/dist/schema/types.d.ts +35 -23
  87. package/dist/schema/types.js +10 -1
  88. package/dist/schema/validate.js +22 -22
  89. package/dist/schema/validators/controllers.js +38 -20
  90. package/dist/schema/workflow-authoring-contract.d.ts +29 -0
  91. package/dist/schema/workflow-authoring-contract.js +109 -0
  92. package/dist/schema/yaml-parser.js +18 -0
  93. package/dist/templates/api-backend.dna.yaml +19 -0
  94. package/dist/templates/brainstorming-first.dna.yaml +19 -0
  95. package/dist/templates/code-cleanup.dna.yaml +19 -0
  96. package/dist/templates/code-review-pipeline.dna.yaml +18 -0
  97. package/dist/templates/documentation-writer.dna.yaml +19 -0
  98. package/dist/templates/flutter-behavior-lock.dna.yaml +19 -0
  99. package/dist/templates/flutter-refactoring-rescue.dna.yaml +19 -0
  100. package/dist/templates/flutter-rewrite-diagnosis-review.dna.yaml +210 -0
  101. package/dist/templates/flutter-rewrite-fix-review-loop.dna.yaml +260 -0
  102. package/dist/templates/flutter-rewrite-new.dna.yaml +506 -0
  103. package/dist/templates/flutter-rewrite.dna.yaml +100 -4
  104. package/dist/templates/frontend-quality.dna.yaml +19 -0
  105. package/dist/templates/full-pipeline.dna.yaml +20 -0
  106. package/dist/templates/marketplace.d.ts +92 -0
  107. package/dist/templates/marketplace.js +502 -0
  108. package/dist/templates/metadata.d.ts +25 -0
  109. package/dist/templates/metadata.js +136 -3
  110. package/dist/templates/mobile-dev.dna.yaml +19 -0
  111. package/dist/templates/multi-agent-handoff-coordination.dna.yaml +156 -0
  112. package/dist/templates/multi-perspective-review.dna.yaml +19 -0
  113. package/dist/templates/persistent-executor.dna.yaml +19 -0
  114. package/dist/templates/qa-loop.dna.yaml +18 -0
  115. package/dist/templates/release-evidence-gate.dna.yaml +131 -0
  116. package/dist/templates/requirements-gate.dna.yaml +19 -0
  117. package/dist/templates/research-orchestration.dna.yaml +19 -0
  118. package/dist/templates/root-cause-analysis.dna.yaml +19 -0
  119. package/dist/templates/safe-refactoring.dna.yaml +321 -0
  120. package/dist/templates/secure-dev.dna.yaml +19 -0
  121. package/dist/templates/subagent-parallel.dna.yaml +19 -0
  122. package/dist/templates/systematic-debugging.dna.yaml +19 -0
  123. package/dist/templates/tdd-strict.dna.yaml +19 -0
  124. package/dist/templates/ui-visual-regression-qa.dna.yaml +133 -0
  125. package/dist/templates/workflow-author.dna.yaml +302 -0
  126. package/dist/templates/workflow-blocked-scope-triage.dna.yaml +242 -0
  127. package/dist/templates/workflow-completion-audit.dna.yaml +254 -0
  128. package/dist/templates/workflow-cross-boundary-resource-approval.dna.yaml +249 -0
  129. package/dist/templates/workflow-evidence-review.dna.yaml +198 -0
  130. package/dist/templates/workflow-module-inventory.dna.yaml +257 -0
  131. package/dist/templates/workflow-runtime-smoke-review.dna.yaml +252 -0
  132. package/dist/templates/workflow-verification-command-routing.dna.yaml +278 -0
  133. package/dist/workflow/authoring-packet.d.ts +67 -0
  134. package/dist/workflow/authoring-packet.js +218 -0
  135. package/dist/workflow/draft.d.ts +159 -0
  136. package/dist/workflow/draft.js +800 -0
  137. package/dist/workflow/index.d.ts +3 -0
  138. package/dist/workflow/index.js +3 -0
  139. package/dist/workflow/suggestion-review.d.ts +65 -0
  140. package/dist/workflow/suggestion-review.js +245 -0
  141. package/package.json +1 -1
  142. package/spec/README.md +15 -48
  143. package/spec/codex-adapter-contract.md +176 -0
  144. package/spec/sync-target-plan.md +158 -0
  145. package/spec/workflow-capability-ir.md +153 -0
  146. package/spec/agent-dispatch-fix.md +0 -116
  147. package/spec/control-plane-convergence-handoff-2026-04-24.md +0 -432
  148. package/spec/flutter-rewrite-template-optimization.md +0 -301
  149. package/spec/foundation-hardening.md +0 -178
  150. package/spec/hooks-infra-harness-hardening.md +0 -741
  151. package/spec/multi-config.md +0 -172
  152. package/spec/parallel-isolation.md +0 -268
  153. package/spec/template-version-namespace-fix.md +0 -653
  154. package/spec/workflow-pipeline.md +0 -101
@@ -5,6 +5,25 @@
5
5
  version: "0.1.0"
6
6
  id: template_documentation_writer
7
7
  name: Documentation Writer
8
+ purpose: Write technical documentation from code evidence with audience-aware structure and explicit accuracy constraints.
9
+ maturity: draft
10
+ fit:
11
+ - API docs, user guides, internal technical docs, or migration notes grounded in code.
12
+ - Documentation tasks where accuracy and scannable structure matter.
13
+ not_for:
14
+ - Inventing behavior not present in code or verified references.
15
+ - Publishing docs without human or maintainer review.
16
+ inputs:
17
+ - documentation request
18
+ - source code or API references
19
+ - target audience and format
20
+ outputs:
21
+ - structured documentation draft
22
+ - code-grounded accuracy notes
23
+ - review-ready doc artifact
24
+ lineage:
25
+ source: built-in technical documentation writer template
26
+ reference: src/templates/documentation-writer.dna.yaml
8
27
  type: project
9
28
  namespace: doc
10
29
 
@@ -6,6 +6,25 @@
6
6
  version: "0.1.0"
7
7
  id: template_flutter_behavior_lock
8
8
  name: Flutter Behavior Lock
9
+ purpose: Capture source behavior as docs and tests before risky Flutter rewrite, refactor, diagnosis, or fix work starts.
10
+ maturity: reviewed
11
+ fit:
12
+ - Flutter module rewrites where v1 behavior must be preserved before implementation.
13
+ - Migration work that needs source-backed behavior documents and baseline tests per module.
14
+ not_for:
15
+ - Editing app source during discovery.
16
+ - Feature redesigns or behavior changes mixed into migration evidence.
17
+ inputs:
18
+ - v1 source module path
19
+ - v2 test and behavior-document destination
20
+ - target module name or route
21
+ outputs:
22
+ - behavior document
23
+ - baseline unit or integration tests
24
+ - optional device smoke evidence
25
+ lineage:
26
+ source: Flutter rewrite dogfood behavior-lock workflow
27
+ reference: /Users/samuel/lawark/lwk_flutter_v2-rewrite/docs/behavior
9
28
  type: project
10
29
  namespace: fbl
11
30
 
@@ -6,6 +6,25 @@
6
6
  version: "0.1.0"
7
7
  id: template_flutter_refactoring_rescue
8
8
  name: Flutter Refactoring Rescue
9
+ purpose: Rescue an already migrated Flutter project by repairing one broken feature chain at a time using v1 as oracle.
10
+ maturity: reviewed
11
+ fit:
12
+ - Flutter migrations where framework movement is done but user-visible chains are broken.
13
+ - Small verified fixes that must preserve existing behavior.
14
+ not_for:
15
+ - First-pass migration planning.
16
+ - Broad redesign or multi-feature cleanup work.
17
+ inputs:
18
+ - broken feature chain
19
+ - v1 oracle behavior
20
+ - device or test verification output
21
+ outputs:
22
+ - scoped fix plan
23
+ - reviewable change evidence
24
+ - runtime verification summary
25
+ lineage:
26
+ source: dogfood extraction
27
+ reference: safe-refactoring plus verification-loop workflow shape
9
28
  type: project
10
29
  namespace: frr
11
30
 
@@ -0,0 +1,210 @@
1
+ # flutter-rewrite-diagnosis-review: reusable diagnosis + reviewer gate extracted from Flutter rewrite dogfood
2
+ # Source: flutter-rewrite diagnosis workflow and module-level progress evidence
3
+ # Purpose: make "classify before editing" a smaller workflow asset users can adopt without the full rewrite loop
4
+
5
+ version: "0.1.0"
6
+ id: template_flutter_rewrite_diagnosis_review
7
+ name: Flutter Rewrite Diagnosis Review
8
+ purpose: Classify risky Flutter rewrite failures from evidence and require independent diagnosis review before implementation starts.
9
+ maturity: reviewed
10
+ fit:
11
+ - Rewrite or migration slices where failures must be classified before editing.
12
+ - Teams that need evidence-only diagnosis and a reviewer verdict before handoff to fixing.
13
+ not_for:
14
+ - Writing implementation plans inside the diagnosis artifact.
15
+ - Self-approving diagnosis or skipping evidence review before code changes.
16
+ inputs:
17
+ - behavior documents
18
+ - failing tests or runtime evidence
19
+ - v1 and v2 implementation references
20
+ outputs:
21
+ - evidence-only diagnosis artifact
22
+ - independent review verdict
23
+ - manager-readable implementation route
24
+ lineage:
25
+ source: Flutter rewrite dogfood diagnosis workflow
26
+ reference: /Users/samuel/lawark/lwk_flutter_v2-rewrite/.dna/specs
27
+ type: project
28
+ namespace: frdr
29
+
30
+ cascade:
31
+ inherits: ["species:default"]
32
+ priority: 100
33
+
34
+ variables:
35
+ behavior_docs:
36
+ description: "Behavior evidence directory"
37
+ default: "docs/behavior"
38
+ diagnosis_path:
39
+ description: "Diagnosis artifact path"
40
+ default: ".dna/specs/diagnosis-$ARGUMENTS.md"
41
+ diagnosis_review_path:
42
+ description: "Diagnosis review verdict path"
43
+ default: ".dna/specs/diagnosis-$ARGUMENTS.review.json"
44
+
45
+ evidence:
46
+ - label: Flutter rewrite diagnosis workflow
47
+ kind: reference
48
+ path: /Users/samuel/lawark/lwk_flutter_v2-rewrite/.dna/specs
49
+ description: Dogfood diagnosis specs and review verdicts that gate implementation.
50
+ - label: Flutter rewrite progress evidence
51
+ kind: reference
52
+ path: /Users/samuel/lawark/lwk_flutter_v2-rewrite/.dna/fix-progress
53
+ description: Module-level progress JSON and test logs showing diagnosis/review as a repeated work pattern.
54
+
55
+ genes:
56
+ diagnosis_before_edit:
57
+ description: Risky rewrite work must classify failures and missing behavior before any implementation edit
58
+ codons:
59
+ - type: attract
60
+ target: evidence_first_diagnosis
61
+ - type: repel
62
+ target: edit_before_classification
63
+ - type: threshold
64
+ condition: "diagnosis_review_verdict == APPROVE"
65
+ action: block
66
+
67
+ evidence_only_diagnosis:
68
+ description: Diagnosis artifacts describe facts and classifications, not implementation orders or hidden fix plans
69
+ codons:
70
+ - type: attract
71
+ target: v1_reference
72
+ - type: attract
73
+ target: failing_test_reference
74
+ - type: repel
75
+ target: fix_prescription_in_diagnosis
76
+ - type: sense
77
+ signal: missing_evidence_path
78
+ response: request_reanalysis
79
+
80
+ reviewer_gate:
81
+ description: A separate reviewer must approve diagnosis quality before the workflow can hand off to fixing
82
+ codons:
83
+ - type: attract
84
+ target: independent_reviewer_verdict
85
+ - type: repel
86
+ target: self_approved_diagnosis
87
+ - type: threshold
88
+ condition: "diagnosis_review_written == true"
89
+ action: block
90
+
91
+ contexts: {}
92
+
93
+ roles:
94
+ diagnostician:
95
+ description: Reads behavior evidence, tests, v1/v2 code, and writes an evidence-only diagnosis artifact.
96
+ tool_permissions:
97
+ allow: [Read, Grep, Glob, Write]
98
+ deny: [Edit, Bash, NotebookEdit]
99
+ scope:
100
+ read: ["**/*", ".dna/**", "docs/**"]
101
+ write: [".dna/specs/**"]
102
+ instructions:
103
+ - Read the behavior document, failing tests, v1 implementation, and v2 current state before writing diagnosis.
104
+ - Classify each issue as BUG, UNIMPLEMENTED, INFRA, REMOVED, or TEST_BUG.
105
+ - Include concrete evidence paths and v1/v2 references for every classification.
106
+ - Do not include fix prescriptions, implementation order, call-site instructions, or notes for the implementer.
107
+ - Write only the diagnosis artifact; do not edit app code, tests, org profiles, templates, or runtime artifacts.
108
+
109
+ diagnosis_reviewer:
110
+ description: Reviews diagnosis quality and writes the durable approval or reanalysis verdict.
111
+ tool_permissions:
112
+ allow: [Read, Grep, Glob, Write]
113
+ deny: [Edit, Bash, NotebookEdit]
114
+ scope:
115
+ read: ["**/*", ".dna/**", "docs/**"]
116
+ write: [".dna/specs/*.review.json"]
117
+ instructions:
118
+ - Verify every failing, skipped, or hung test from the baseline is covered.
119
+ - Verify v1 references and evidence paths exist and support the classifications.
120
+ - Reject diagnosis that contains implementation instructions or unsupported claims.
121
+ - Write verdict JSON with verdict, artifact_reviewed, sections_to_fix, evidence_paths, confidence, summary, and updated_at.
122
+ - APPROVE permits later fixing; REQUEST_REANALYSIS blocks implementation and routes back to diagnosis.
123
+
124
+ manager_reviewer:
125
+ description: Turns the diagnosis/review state into a manager-readable next-action packet.
126
+ tool_permissions:
127
+ allow: [Read, Grep, Glob]
128
+ deny: [Edit, Write, Bash, NotebookEdit]
129
+ scope:
130
+ read: ["**/*", ".dna/**", "docs/**"]
131
+ write: []
132
+ instructions:
133
+ - Summarize whether implementation is allowed, blocked, or needs reanalysis.
134
+ - Name the exact diagnosis and review artifacts used as evidence.
135
+ - If review is missing or REQUEST_REANALYSIS, block fixing and provide the next command.
136
+ - Keep Obsidian/wiki as internal memory only; use machine artifacts as workflow evidence.
137
+
138
+ workflows:
139
+ diagnosis-review:
140
+ name: Diagnosis Review
141
+ description: Analyze module failures and require an independent diagnosis review before implementation starts.
142
+ steps:
143
+ - id: diagnose
144
+ role: diagnostician
145
+ description: Produce evidence-only diagnosis for the target module or risky rewrite slice.
146
+ prompt: |
147
+ Diagnose $ARGUMENTS before any implementation edit.
148
+ Read {{behavior_docs}}/$ARGUMENTS.md, failing test evidence, v1 implementation, and v2 current state.
149
+ Write {{diagnosis_path}} with classifications, evidence paths, v1/v2 references, and uncertainty.
150
+ Do not include fix prescriptions, implementation order, call-site instructions, or notes for the implementer.
151
+ handoff:
152
+ produces:
153
+ - type: file
154
+ path: "{{diagnosis_path}}"
155
+ description: Evidence-only diagnosis artifact.
156
+ - id: review-diagnosis
157
+ role: diagnosis_reviewer
158
+ depends_on: [diagnose]
159
+ description: Review diagnosis quality and write an approval or reanalysis verdict.
160
+ prompt: |
161
+ Review {{diagnosis_path}} for $ARGUMENTS.
162
+ Verify coverage, evidence paths, classification quality, and absence of fix prescriptions.
163
+ Write {{diagnosis_review_path}} with verdict APPROVE or REQUEST_REANALYSIS.
164
+ checkpoints:
165
+ - assert: diagnosis_review_verdict_present
166
+ command: "test -s \"{{diagnosis_review_path}}\""
167
+ message: "Diagnosis review verdict must exist before any implementation handoff."
168
+ action: block
169
+ handoff:
170
+ consumes:
171
+ - type: file
172
+ path: "{{diagnosis_path}}"
173
+ from: diagnose
174
+ description: Diagnosis artifact.
175
+ produces:
176
+ - type: file
177
+ path: "{{diagnosis_review_path}}"
178
+ description: Diagnosis review verdict.
179
+ - id: manager-route
180
+ role: manager_reviewer
181
+ depends_on: [review-diagnosis]
182
+ description: Produce manager-readable next action for implementation, reanalysis, or blocked scope.
183
+ prompt: |
184
+ Read {{diagnosis_path}} and {{diagnosis_review_path}}.
185
+ State whether fixing is allowed, blocked, or requires reanalysis.
186
+ Include evidence paths, confidence, and the next command.
187
+ handoff:
188
+ consumes:
189
+ - type: file
190
+ path: "{{diagnosis_review_path}}"
191
+ from: review-diagnosis
192
+ description: Diagnosis review verdict.
193
+ produces:
194
+ - type: summary
195
+ name: diagnosis_route
196
+ description: Manager-readable route to fix, reanalysis, or blocked state.
197
+
198
+ controllers:
199
+ diagnosis-review-gate:
200
+ name: Diagnosis Review Gate
201
+ description: "Run diagnosis, independent diagnosis review, and manager route before implementation starts."
202
+ kind: sequential
203
+ workflow: diagnosis-review
204
+ max_rounds: 1
205
+ progress_artifact_path: ".dna/diagnosis-review/$ARGUMENTS.json"
206
+ roles:
207
+ diagnostician: diagnostician
208
+ diagnosis_reviewer: diagnosis_reviewer
209
+ manager_reviewer: manager_reviewer
210
+ stop_format: configured_stop_report
@@ -0,0 +1,260 @@
1
+ # flutter-rewrite-fix-review-loop: diagnosis-backed fix, review, and verification loop
2
+ # Source: extracted from Flutter rewrite dogfood fix workflow
3
+ # Purpose: reuse the inner implementation/review/verify loop without adopting the full rewrite asset
4
+
5
+ version: "0.1.0"
6
+ id: template_flutter_rewrite_fix_review_loop
7
+ name: Flutter Rewrite Fix Review Loop
8
+ purpose: Run the smallest approved Flutter rewrite fix with independent review, fresh verification, and durable progress evidence.
9
+ maturity: reviewed
10
+ fit:
11
+ - Rewrite slices with an approved diagnosis and review verdict.
12
+ - Behavior-preserving fixes that need independent review before completion or rollout.
13
+ not_for:
14
+ - Starting implementation without approved diagnosis.
15
+ - Broad refactors, opportunistic improvements, or self-approved fixes.
16
+ inputs:
17
+ - approved diagnosis artifact
18
+ - diagnosis review verdict
19
+ - v1 behavior reference
20
+ - focused verification command
21
+ outputs:
22
+ - scoped fix diff summary
23
+ - independent fix review verdict
24
+ - verification and progress evidence
25
+ lineage:
26
+ source: Flutter rewrite dogfood fix-review-verify loop
27
+ reference: /Users/samuel/lawark/lwk_flutter_v2-rewrite/.dna/fix-progress
28
+ type: project
29
+ namespace: frfrl
30
+
31
+ cascade:
32
+ inherits: ["species:default"]
33
+ priority: 100
34
+
35
+ variables:
36
+ diagnosis_path:
37
+ description: "Approved diagnosis artifact path"
38
+ default: ".dna/specs/diagnosis-$ARGUMENTS.md"
39
+ diagnosis_review_path:
40
+ description: "Diagnosis review verdict path"
41
+ default: ".dna/specs/diagnosis-$ARGUMENTS.review.json"
42
+ progress_path:
43
+ description: "Module progress JSON path"
44
+ default: ".dna/fix-progress/$ARGUMENTS.json"
45
+ behavior_docs:
46
+ description: "Behavior evidence directory"
47
+ default: "docs/behavior"
48
+
49
+ evidence:
50
+ - label: Flutter rewrite fix-loop progress
51
+ kind: reference
52
+ path: /Users/samuel/lawark/lwk_flutter_v2-rewrite/.dna/fix-progress
53
+ description: Module-level progress JSON and test logs showing the diagnosis-backed fix/review/verify loop.
54
+ - label: Flutter rewrite diagnosis specs
55
+ kind: reference
56
+ path: /Users/samuel/lawark/lwk_flutter_v2-rewrite/.dna/specs
57
+ description: Approved diagnosis and review artifacts consumed before implementation starts.
58
+
59
+ genes:
60
+ approved_diagnosis_required:
61
+ description: Implementation can start only from an approved diagnosis and review verdict
62
+ codons:
63
+ - type: attract
64
+ target: reviewed_diagnosis
65
+ - type: repel
66
+ target: edit_without_diagnosis
67
+ - type: threshold
68
+ condition: "diagnosis_review_verdict == APPROVE"
69
+ action: block
70
+
71
+ behavior_equivalence:
72
+ description: Fixes preserve v1 behavior and prove equivalence with fresh evidence
73
+ codons:
74
+ - type: attract
75
+ target: v1_behavior_reference
76
+ - type: attract
77
+ target: logic_equivalence_check
78
+ - type: repel
79
+ target: opportunistic_improvement
80
+ - type: threshold
81
+ condition: "fresh_verification_evidence == true"
82
+ action: block
83
+
84
+ small_reversible_rounds:
85
+ description: Each fix round stays small, reviewable, and reversible
86
+ codons:
87
+ - type: attract
88
+ target: minimal_diff
89
+ - type: attract
90
+ target: after_change_verification
91
+ - type: repel
92
+ target: broad_refactor_batch
93
+ - type: threshold
94
+ condition: "files_changed_per_round <= 5"
95
+ action: escalate
96
+
97
+ contexts: {}
98
+
99
+ roles:
100
+ fixer:
101
+ description: Implements the smallest diagnosis-approved fix while preserving v1 behavior.
102
+ tool_permissions:
103
+ allow: [Read, Edit, Write, Grep, Glob, Bash]
104
+ deny: [NotebookEdit]
105
+ scope:
106
+ read: ["**/*", ".dna/**", "docs/**"]
107
+ write: ["lib/**", "v2/**", "test/**", ".dna/fix-progress/**"]
108
+ instructions:
109
+ - Read {{diagnosis_path}} and {{diagnosis_review_path}} before any Edit.
110
+ - Confirm the diagnosis review verdict is APPROVE before changing code.
111
+ - Read the relevant v1 source and behavior evidence before implementing.
112
+ - Fix only the approved breakpoint or missing implementation.
113
+ - Preserve behavior, including old edge cases and bugs, unless the approved diagnosis explicitly says otherwise.
114
+ - Keep the diff small and reversible; avoid unrelated cleanup, new abstractions, or broad refactors.
115
+ - Run focused verification after each meaningful change and record evidence.
116
+
117
+ fix_reviewer:
118
+ description: Reviews the fix against diagnosis, v1 behavior, and scope boundaries.
119
+ tool_permissions:
120
+ allow: [Read, Grep, Glob, Bash]
121
+ deny: [Edit, Write, NotebookEdit]
122
+ scope:
123
+ read: ["**/*", ".dna/**", "docs/**"]
124
+ write: []
125
+ instructions:
126
+ - Compare the diff to {{diagnosis_path}} and {{diagnosis_review_path}}.
127
+ - Verify every changed file is necessary for the approved diagnosis.
128
+ - Check for behavior drift, opportunistic improvement, unrelated refactor, or missing v1 reference.
129
+ - Reject the round if evidence is stale, missing, or too broad.
130
+ - "Produce a concise verdict: APPROVE, REQUEST_CHANGES, or BLOCKED."
131
+
132
+ verifier:
133
+ description: Runs focused verification and updates progress evidence for the module.
134
+ tool_permissions:
135
+ allow: [Read, Edit, Write, Grep, Glob, Bash]
136
+ deny: [NotebookEdit]
137
+ scope:
138
+ read: ["**/*", ".dna/**", "docs/**"]
139
+ write: [".dna/fix-progress/**"]
140
+ instructions:
141
+ - Run the smallest meaningful test/analyze/build command that proves the fix.
142
+ - Record command, result, evidence paths, remaining failures, and next focus in {{progress_path}}.
143
+ - If verification cannot run, record the blocker and required human/environment action.
144
+ - Do not claim completion without fresh evidence.
145
+
146
+ manager_reviewer:
147
+ description: Turns fix/review/verify results into a manager-readable route decision.
148
+ tool_permissions:
149
+ allow: [Read, Grep, Glob]
150
+ deny: [Edit, Write, Bash, NotebookEdit]
151
+ scope:
152
+ read: ["**/*", ".dna/**", "docs/**"]
153
+ write: []
154
+ instructions:
155
+ - Summarize whether the module is PASS, CONTINUE, REQUEST_CHANGES, or BLOCKED.
156
+ - Name the diagnosis, review verdict, test evidence, and progress artifact.
157
+ - If active work remains, route back to the fix loop or asset suggestions before sync/evolution.
158
+ - Keep Obsidian/wiki as internal memory only; use machine artifacts as workflow evidence.
159
+
160
+ workflows:
161
+ fix-review-loop:
162
+ name: Fix Review Loop
163
+ description: Implement from approved diagnosis, independently review behavior equivalence, verify, and record manager-readable progress.
164
+ steps:
165
+ - id: fix
166
+ role: fixer
167
+ description: Implement the smallest diagnosis-approved behavior-preserving fix.
168
+ prompt: |
169
+ Fix $ARGUMENTS using {{diagnosis_path}} and {{diagnosis_review_path}}.
170
+ Confirm the review verdict is APPROVE, read v1 behavior references, then make the smallest necessary code/test changes.
171
+ Preserve v1 behavior and avoid unrelated refactors.
172
+ checkpoints:
173
+ - assert: diagnosis_review_verdict_present
174
+ command: "test -s \"{{diagnosis_review_path}}\""
175
+ message: "Diagnosis review verdict must exist before fixing."
176
+ action: block
177
+ handoff:
178
+ consumes:
179
+ - type: file
180
+ path: "{{diagnosis_path}}"
181
+ description: Approved diagnosis artifact.
182
+ - type: file
183
+ path: "{{diagnosis_review_path}}"
184
+ description: Diagnosis review verdict.
185
+ produces:
186
+ - type: summary
187
+ name: fix_diff_summary
188
+ description: Changed files, target diagnosis item, and verification commands run.
189
+ - id: review-fix
190
+ role: fix_reviewer
191
+ depends_on: [fix]
192
+ description: Review the fix against approved diagnosis and v1 behavior.
193
+ prompt: |
194
+ Review the current diff for $ARGUMENTS.
195
+ Check scope, v1 behavior equivalence, diagnosis alignment, and evidence freshness.
196
+ Return APPROVE, REQUEST_CHANGES, or BLOCKED with reasons.
197
+ handoff:
198
+ consumes:
199
+ - type: summary
200
+ name: fix_diff_summary
201
+ from: fix
202
+ description: Fix round summary.
203
+ produces:
204
+ - type: summary
205
+ name: fix_review_verdict
206
+ description: Independent review verdict for the fix round.
207
+ - id: verify
208
+ role: verifier
209
+ depends_on: [review-fix]
210
+ description: Run focused verification and update progress evidence.
211
+ prompt: |
212
+ Run focused verification for $ARGUMENTS after review.
213
+ Update {{progress_path}} with verdict, commands, evidence paths, remaining failures, and next focus.
214
+ checkpoints:
215
+ - assert: progress_artifact_written
216
+ command: "test -s \"{{progress_path}}\""
217
+ message: "Progress JSON must be written before manager route."
218
+ action: block
219
+ handoff:
220
+ consumes:
221
+ - type: summary
222
+ name: fix_review_verdict
223
+ from: review-fix
224
+ description: Fix review verdict.
225
+ produces:
226
+ - type: file
227
+ path: "{{progress_path}}"
228
+ description: Updated module progress evidence.
229
+ - id: manager-route
230
+ role: manager_reviewer
231
+ depends_on: [verify]
232
+ description: Produce manager-readable next action from progress evidence.
233
+ prompt: |
234
+ Read {{progress_path}}, {{diagnosis_path}}, and {{diagnosis_review_path}}.
235
+ State PASS, CONTINUE, REQUEST_CHANGES, or BLOCKED; include evidence paths and next command.
236
+ handoff:
237
+ consumes:
238
+ - type: file
239
+ path: "{{progress_path}}"
240
+ from: verify
241
+ description: Module progress evidence.
242
+ produces:
243
+ - type: summary
244
+ name: fix_loop_route
245
+ description: Manager-readable next action for the module.
246
+
247
+ controllers:
248
+ fix-review-loop:
249
+ name: Fix Review Loop
250
+ description: "Run diagnosis-backed fix, independent review, verification, and manager route for one module or risky slice."
251
+ kind: sequential
252
+ workflow: fix-review-loop
253
+ max_rounds: 3
254
+ progress_artifact_path: ".dna/fix-progress/$ARGUMENTS.json"
255
+ roles:
256
+ fixer: fixer
257
+ fix_reviewer: fix_reviewer
258
+ verifier: verifier
259
+ manager_reviewer: manager_reviewer
260
+ stop_format: configured_stop_report