@code-migration/wow-migrator 0.1.3 → 0.1.4

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 (59) hide show
  1. package/package.json +1 -1
  2. package/skills/android-project-analyst/SKILL.md +69 -46
  3. package/skills/android-project-analyst/bind.md +10 -5
  4. package/skills/android-project-analyst/dependencies.yaml +66 -10
  5. package/skills/android-project-analyst/output-contract.md +357 -0
  6. package/skills/android-project-analyst/roles/analysis-workspace-state.md +25 -8
  7. package/skills/android-project-analyst/roles/behavior-logic.md +6 -2
  8. package/skills/android-project-analyst/roles/data-contract-flow.md +5 -1
  9. package/skills/android-project-analyst/roles/presentation-resource.md +5 -1
  10. package/skills/android-project-analyst/roles/project-architecture.md +5 -1
  11. package/skills/android-project-analyst/workflow.md +75 -29
  12. package/skills/android-to-kmp-migrator/SKILL.md +62 -142
  13. package/skills/android-to-kmp-migrator/bind.md +29 -67
  14. package/skills/android-to-kmp-migrator/dependencies.yaml +72 -11
  15. package/skills/android-to-kmp-migrator/output-contract.md +318 -0
  16. package/skills/android-to-kmp-migrator/roles/completion-report.md +3 -1
  17. package/skills/android-to-kmp-migrator/roles/global-migration-phase.md +87 -0
  18. package/skills/android-to-kmp-migrator/roles/migration-planning-gate.md +75 -0
  19. package/skills/android-to-kmp-migrator/roles/migration-prep.md +75 -0
  20. package/skills/android-to-kmp-migrator/roles/migration-verification.md +44 -26
  21. package/skills/android-to-kmp-migrator/roles/migration-workspace-state.md +16 -8
  22. package/skills/android-to-kmp-migrator/roles/module-implementation.md +82 -0
  23. package/skills/android-to-kmp-migrator/roles/target-project-assistant.md +104 -0
  24. package/skills/android-to-kmp-migrator/workflow.md +85 -224
  25. package/skills/kmp-test-validator/SKILL.md +52 -85
  26. package/skills/kmp-test-validator/bind.md +30 -56
  27. package/skills/kmp-test-validator/dependencies.yaml +101 -9
  28. package/skills/kmp-test-validator/output-contract.md +166 -0
  29. package/skills/kmp-test-validator/roles/validation-business-testing.md +83 -0
  30. package/skills/kmp-test-validator/roles/validation-code-gate.md +116 -0
  31. package/skills/kmp-test-validator/roles/validation-fidelity-gate.md +118 -0
  32. package/skills/kmp-test-validator/roles/validation-report.md +23 -14
  33. package/skills/kmp-test-validator/roles/validation-workspace-state.md +5 -2
  34. package/skills/kmp-test-validator/workflow.md +60 -115
  35. package/skills/migration-task-adapter/SKILL.md +65 -92
  36. package/skills/migration-task-adapter/bind.md +25 -92
  37. package/skills/migration-task-adapter/dependencies.yaml +21 -10
  38. package/skills/migration-task-adapter/roles/adapter-report.md +71 -0
  39. package/skills/migration-task-adapter/roles/adapter-workspace-state.md +71 -0
  40. package/skills/migration-task-adapter/roles/task-route-orchestrator.md +103 -0
  41. package/skills/migration-task-adapter/workflow.md +71 -143
  42. package/skills/android-project-analyst/MIGRATION.md +0 -67
  43. package/skills/android-to-kmp-migrator/MIGRATION.md +0 -129
  44. package/skills/android-to-kmp-migrator/roles/dependency-platform-gate.md +0 -68
  45. package/skills/android-to-kmp-migrator/roles/logic-implementation.md +0 -71
  46. package/skills/android-to-kmp-migrator/roles/migration-analysis-planning.md +0 -70
  47. package/skills/android-to-kmp-migrator/roles/presentation-integration.md +0 -70
  48. package/skills/android-to-kmp-migrator/roles/state-data-prep.md +0 -68
  49. package/skills/android-to-kmp-migrator/roles/ui-implementation.md +0 -69
  50. package/skills/kmp-test-validator/MIGRATION.md +0 -84
  51. package/skills/kmp-test-validator/roles/validation-intake-fidelity.md +0 -72
  52. package/skills/kmp-test-validator/roles/validation-plan-gate.md +0 -72
  53. package/skills/kmp-test-validator/roles/validation-remediation.md +0 -117
  54. package/skills/kmp-test-validator/roles/validation-test-runner.md +0 -67
  55. package/skills/migration-task-adapter/MIGRATION.md +0 -49
  56. package/skills/migration-task-adapter/roles/task-reporter.md +0 -134
  57. package/skills/migration-task-adapter/roles/task-understanding-router.md +0 -139
  58. package/skills/migration-task-adapter/roles/workflow-orchestrator.md +0 -145
  59. package/skills/migration-task-adapter/roles/workspace-state-discipline-inspector.md +0 -198
@@ -0,0 +1,357 @@
1
+ # Output Contract: File Recording System And Downstream Trigger Gates
2
+
3
+ This document is the **canonical path and content contract** for `android-project-analyst`. Downstream handlers (`migration-task-adapter`, `android-to-kmp-migrator`, `kmp-test-validator`, and human/agent orchestrators) **MUST treat missing, empty, out-of-path, stale, or schema-invalid artifacts as hard blockers** — they do not infer, reconstruct, or proceed from chat summaries.
4
+
5
+ The Leader and every node MUST read this file before writing artifacts. `SKILL.md` and `workflow.md` reference this contract; when they diverge, **this file wins on paths, filenames, and trigger gates**.
6
+
7
+ ## Output Root Layout
8
+
9
+ Lock one `output_root` before any dispatch:
10
+
11
+ ```text
12
+ output_root = <output_dir or ~/.a2c_agents/understand>/android-project-analyst
13
+
14
+ <output_root>/
15
+ ├── run_manifest.json # run identity + handoff package pointer
16
+ ├── workspace-state/
17
+ │ ├── analysis_workspace_state.json # machine ledger (freshness + inventory)
18
+ │ └── analysis_workspace_state.md
19
+ ├── module-index/
20
+ │ ├── module_inventory.json # authoritative module schedule
21
+ │ ├── module_inventory.md
22
+ │ └── modules_index.json # machine lookup: module_id → paths
23
+ ├── modules/
24
+ │ └── <module_id>/
25
+ │ ├── module_brief.json # dispatch contract for this module
26
+ │ ├── dimension_index.json # dimension → artifact path map
27
+ │ ├── node-results/
28
+ │ │ ├── presentation-resource/
29
+ │ │ │ ├── presentation_resource.json
30
+ │ │ │ ├── presentation_resource.md
31
+ │ │ │ └── downloaded_resources/ # optional; presentation-resource only
32
+ │ │ ├── project-architecture/
33
+ │ │ │ ├── project_architecture.json
34
+ │ │ │ └── project_architecture.md
35
+ │ │ ├── data-contract-flow/
36
+ │ │ │ ├── data_contract_flow.json
37
+ │ │ │ └── data_contract_flow.md
38
+ │ │ └── behavior-logic/
39
+ │ │ ├── behavior_logic.json
40
+ │ │ └── behavior_logic.md
41
+ │ └── representation/
42
+ │ ├── module_representation.json
43
+ │ └── module_representation.md
44
+ ├── global/
45
+ │ ├── cross_module_architecture.json
46
+ │ ├── cross_module_architecture.md
47
+ │ ├── cross_module_data_logic.json
48
+ │ ├── cross_module_data_logic.md
49
+ │ ├── migration_assembly_basis.json
50
+ │ ├── migration_assembly_basis.md
51
+ │ ├── global_representation.json
52
+ │ └── global_representation.md
53
+ └── SPEC/
54
+ ├── prd.md
55
+ ├── design.md
56
+ ├── verification.md
57
+ └── plan.md # migration mode only
58
+ ```
59
+
60
+ ### Path Variables (stable across runs)
61
+
62
+ | Variable | Resolved path |
63
+ |---|---|
64
+ | `output_root` | `<output_dir or ~/.a2c_agents/understand>/android-project-analyst` |
65
+ | `workspace_state_dir` | `<output_root>/workspace-state` |
66
+ | `module_index_dir` | `<output_root>/module-index` |
67
+ | `module_root` | `<output_root>/modules/<module_id>` |
68
+ | `dimension_dir` | `<module_root>/node-results/<dimension>` |
69
+ | `module_representation_dir` | `<module_root>/representation` |
70
+ | `global_dir` | `<output_root>/global` |
71
+ | `spec_dir` | `<output_root>/SPEC` |
72
+
73
+ ### Filename Invariants (downstream parsers depend on these)
74
+
75
+ - JSON primary artifacts use **snake_case** basenames matching the dimension or record type (`presentation_resource.json`, not `presentation-resource.json`).
76
+ - Dimension folder names use **kebab-case** node ids (`node-results/presentation-resource/`).
77
+ - `module_id` folder names use the **same slug** as in `module_inventory.json` and `modules_index.json`.
78
+ - No artifact outside `<output_root>/` is valid for gates below.
79
+
80
+ ---
81
+
82
+ ## Write Order (Leader Schedule)
83
+
84
+ Artifacts MUST be produced in this order. Skipping a layer invalidates downstream trigger gates.
85
+
86
+ | Step | Gate id | Required artifacts before next step |
87
+ |---|---|---|
88
+ | 0 | `G0` | `run_manifest.json` |
89
+ | 1 | `G1` | `workspace-state/analysis_workspace_state.*` (initialized) |
90
+ | 2 | `G2` | `module-index/module_inventory.*`, `module-index/modules_index.json` |
91
+ | 3 | `G3` | per `module_id`: `module_brief.json` |
92
+ | 4 | `G4` | per `module_id`: all three Stage A dimension JSON+MD pairs |
93
+ | 5 | `G5` | per `module_id`: `behavior-logic` dimension JSON+MD pair |
94
+ | 6 | `G6` | per `module_id`: `dimension_index.json`, `representation/module_representation.*` |
95
+ | 7 | `G7` | `global/cross_module_architecture.*`, `global/cross_module_data_logic.*`, `global/migration_assembly_basis.*` |
96
+ | 8 | `G8` | `global/global_representation.*` |
97
+ | 9 | `G9` | `SPEC/prd.md`, `SPEC/design.md`, `SPEC/verification.md`, migration-only `SPEC/plan.md` |
98
+
99
+ ---
100
+
101
+ ## Artifact Registry: Path, Owner, Content, Trigger Role
102
+
103
+ ### Run identity
104
+
105
+ | Path | Owner | Required JSON / content keys | Downstream trigger role |
106
+ |---|---|---|---|
107
+ | `run_manifest.json` | Leader | `source_project_path`, `mode`, `analysis_scope`, `output_root`, `schedule_version`, `handoff_package`, `allowed_path_roots`, `dependency_preflight`, `timestamp`; migration mode adds `target_project_path` | **All handlers** — resolves `output_root` and declares which gate package this run claims |
108
+
109
+ `handoff_package` MUST list absolute paths to the gate entry artifacts the run claims ready (see Handoff Packages below).
110
+
111
+ ### Workspace ledger
112
+
113
+ | Path | Owner | Required content | Downstream trigger role |
114
+ |---|---|---|---|
115
+ | `workspace-state/analysis_workspace_state.json` | `analysis-workspace-state` | `module_status`, `node_status`, `artifact_inventory`, `stale_upstream_inputs`, `rerun_history`, `blocking_gaps`, `next_actions`, `handoff_gates` | **All handlers** — refuse consumption when `stale_upstream_inputs` marks a required artifact stale or `handoff_gates.*.ready` is false |
116
+
117
+ ### Module index layer
118
+
119
+ | Path | Owner | Required content | Downstream trigger role |
120
+ |---|---|---|---|
121
+ | `module-index/module_inventory.json` | Leader | `analysis_modules[]`, `module_order[]`, `out_of_scope[]`, per-module `module_id`, `module_type`, `source_roots`, `ui_scope`, `logic_scope`, `data_scope`, `resource_scope`, `depends_on`, `module_output_root` | **Module scheduling** — authoritative partition; migrator maps `module_id` → source scope |
122
+ | `module-index/module_inventory.md` | Leader | Boundary evidence and scope notes (no dimension analysis) | Agent-readable scope confirmation |
123
+ | `module-index/modules_index.json` | Leader | `schema_version`, `output_root`, `modules[]` with per-entry `module_id`, `status`, `module_output_root`, `module_brief_path`, `dimension_roots`, `representation_paths`, `depends_on` | **Primary routing index** — downstream handlers resolve module folders only through this file |
124
+
125
+ #### `modules_index.json` minimum schema
126
+
127
+ ```json
128
+ {
129
+ "schema_version": "1.0",
130
+ "output_root": "",
131
+ "module_order": [],
132
+ "modules": [
133
+ {
134
+ "module_id": "",
135
+ "status": "scheduled | completed | blocked | out_of_scope",
136
+ "module_output_root": "",
137
+ "module_brief_path": "",
138
+ "dimension_roots": {
139
+ "presentation-resource": "",
140
+ "project-architecture": "",
141
+ "data-contract-flow": "",
142
+ "behavior-logic": ""
143
+ },
144
+ "representation_paths": {
145
+ "dimension_index": "",
146
+ "module_representation_json": "",
147
+ "module_representation_md": ""
148
+ },
149
+ "depends_on": []
150
+ }
151
+ ]
152
+ }
153
+ ```
154
+
155
+ ### Per-module dispatch and dimensions
156
+
157
+ | Path | Owner | Required content | Downstream trigger role |
158
+ |---|---|---|---|
159
+ | `modules/<module_id>/module_brief.json` | Leader | `module_id`, `module_type`, `source_roots`, scopes, `depends_on`, `output_root`, `dimension_output_dirs`, role hints | **Node dispatch** — nodes refuse work without this contract |
160
+ | `modules/<module_id>/node-results/presentation-resource/presentation_resource.json` | `presentation-resource` | `module_id`, `screen_inventory`, `navigation_edges`, `cross_module_references[]`, `resource_usage_map`, `evidence_paths` | UI understanding, resource migration, navigation handoff |
161
+ | `modules/<module_id>/node-results/project-architecture/project_architecture.json` | `project-architecture` | `module_id`, `module_topology`, `detected_patterns`, `layer_roles`, `cross_module_dependencies[]`, `migration_constraints`, `evidence_paths` | Architecture migration, dependency/platform gate |
162
+ | `modules/<module_id>/node-results/data-contract-flow/data_contract_flow.json` | `data-contract-flow` | `module_id`, API/model contracts, `end_to_end_flows`, `cross_module_data_links[]`, `evidence_paths` | Data/API migration, repository mapping |
163
+ | `modules/<module_id>/node-results/behavior-logic/behavior_logic.json` | `behavior-logic` | `module_id`, `screen_logic`, `control_flows`, `cross_module_interactions[]`, upstream alignment refs | Behavior/test planning, control-flow migration |
164
+ | `modules/<module_id>/dimension_index.json` | Leader | `module_id`, `dimensions{}` with four entries, each with `node_id`, `output_dir`, `json_path`, `md_path`, `status` | **Per-module completeness gate** — handlers verify all four dimensions before consuming representation |
165
+ | `modules/<module_id>/representation/module_representation.json` | Leader | `module_id`, `dimension_traceability[]`, synthesized slices per dimension, `intra_module_gaps`, `readiness` | **Module-level handoff** — migrator loads this for a scoped `module_id` |
166
+
167
+ #### `dimension_index.json` minimum schema
168
+
169
+ ```json
170
+ {
171
+ "module_id": "",
172
+ "schema_version": "1.0",
173
+ "dimensions": {
174
+ "presentation-resource": {
175
+ "node_id": "presentation-resource",
176
+ "output_dir": "",
177
+ "json_path": "",
178
+ "md_path": "",
179
+ "status": "completed | blocked | missing",
180
+ "evidence_count": 0
181
+ },
182
+ "project-architecture": { },
183
+ "data-contract-flow": { },
184
+ "behavior-logic": { }
185
+ },
186
+ "representation_ready": false
187
+ }
188
+ ```
189
+
190
+ Each dimension entry MUST have resolvable `json_path` and `md_path` before `representation_ready` is true.
191
+
192
+ ### Cross-module global records (migration assembly basis)
193
+
194
+ | Path | Owner | Required content | Downstream trigger role |
195
+ |---|---|---|---|
196
+ | `global/cross_module_architecture.json` | Leader | `architectural_edges[]` (`from_module_id`, `to_module_id`, `edge_type`, `evidence_paths`), `navigation_glue`, `shared_platform_services`, `di_bridges`, `conflicts[]` | **Inter-module architecture gate** — required before global representation and migrator topology planning |
197
+ | `global/cross_module_data_logic.json` | Leader | `shared_contracts[]`, `data_flow_edges[]`, `control_flow_edges[]`, `event_bus_links[]`, `evidence_paths` | **Inter-module data/logic gate** — required for API/state handoff across modules |
198
+ | `global/migration_assembly_basis.json` | Leader | `assembly_order[]`, `integration_checkpoints[]`, `shared_contracts_to_preserve[]`, `partial_migration_boundaries[]`, `blockers[]`, `evidence_paths` | **Primary migrator scheduling trigger** — `android-to-kmp-migrator` uses this to order `migration_module_id` work |
199
+
200
+ #### `migration_assembly_basis.json` minimum schema
201
+
202
+ ```json
203
+ {
204
+ "schema_version": "1.0",
205
+ "output_root": "",
206
+ "assembly_order": ["module_id_1", "module_id_2"],
207
+ "integration_checkpoints": [
208
+ {
209
+ "checkpoint_id": "",
210
+ "after_module_id": "",
211
+ "required_artifacts": [],
212
+ "shared_contracts": [],
213
+ "verification_focus": []
214
+ }
215
+ ],
216
+ "shared_contracts_to_preserve": [],
217
+ "partial_migration_boundaries": [],
218
+ "blockers": [],
219
+ "evidence_paths": []
220
+ }
221
+ ```
222
+
223
+ ### Global synthesis and SPEC
224
+
225
+ | Path | Owner | Required content | Downstream trigger role |
226
+ |---|---|---|---|
227
+ | `global/global_representation.json` | Leader | `module_summaries[]`, refs to cross-module global records, `global_readiness`, `evidence_index` | **Full-project handoff** — exploration overview and migrator context |
228
+ | `SPEC/prd.md` | Leader | Product scope, journeys, entities, rules (evidence-backed) | Exploration + migration product baseline |
229
+ | `SPEC/design.md` | Leader | Architecture, modules, integration view citing cross-module global records | Exploration + migration design baseline |
230
+ | `SPEC/verification.md` | Leader | Coverage matrix, traceability, `readiness` verdict (`ready \| ready_with_assumptions \| blocked`), `handoff_gates` status | **Universal readiness gate** — downstream workflows read verdict before dispatch |
231
+ | `SPEC/plan.md` | Leader (migration only) | Assembly order from `migration_assembly_basis.*`, milestones, source-to-target mapping | **Migration plan gate** — required for `android-to-kmp-migrator` |
232
+
233
+ ---
234
+
235
+ ## Handoff Packages (Downstream Trigger Conditions)
236
+
237
+ Downstream handlers MUST NOT start unless the declared package gate passes. A gate passes only when **every listed path exists, is non-empty, matches schema/content rules above, and is not marked stale** in `analysis_workspace_state.json`.
238
+
239
+ ### Package `P0` — Run identity
240
+
241
+ **Trigger for**: any downstream read of this analysis run.
242
+
243
+ | Required paths |
244
+ |---|
245
+ | `run_manifest.json` |
246
+ | `workspace-state/analysis_workspace_state.json` |
247
+
248
+ **Fail closed when**: `output_root` mismatch, manifest missing, or ledger reports `blocking_gaps` without explicit `ready_with_assumptions` override in `SPEC/verification.md`.
249
+
250
+ ### Package `P1` — Module index routing
251
+
252
+ **Trigger for**: per-module analyst rerun, adapter scoped dispatch, migrator module lookup.
253
+
254
+ | Required paths |
255
+ |---|
256
+ | `module-index/module_inventory.json` |
257
+ | `module-index/modules_index.json` |
258
+
259
+ **Fail closed when**: `modules_index.json` cannot resolve a requested `module_id`, or `module_order` is empty for in-scope work.
260
+
261
+ ### Package `P2` — Module dimension completeness
262
+
263
+ **Trigger for**: module representation consumption, focused UI/logic/architecture handoff from `migration-task-adapter`.
264
+
265
+ | Required paths (per `module_id`) |
266
+ |---|
267
+ | `modules/<module_id>/module_brief.json` |
268
+ | `modules/<module_id>/dimension_index.json` (all four dimensions `status: completed`) |
269
+ | all four dimension JSON+MD pairs under `node-results/<dimension>/` |
270
+
271
+ **Fail closed when**: any dimension is `missing`, `blocked`, or paths in `dimension_index.json` do not resolve.
272
+
273
+ ### Package `P3` — Module representation handoff
274
+
275
+ **Trigger for**: `android-to-kmp-migrator` per-module planning scoped to one legacy `module_id`.
276
+
277
+ | Required paths (per `module_id`) |
278
+ |---|
279
+ | Package `P2` artifacts |
280
+ | `modules/<module_id>/representation/module_representation.json` |
281
+ | `modules/<module_id>/representation/module_representation.md` |
282
+
283
+ **Fail closed when**: representation references dimension paths that fail Package `P2`.
284
+
285
+ ### Package `P4` — Cross-module assembly basis
286
+
287
+ **Trigger for**: `android-to-kmp-migrator` whole-project or multi-module scheduling.
288
+
289
+ | Required paths |
290
+ |---|
291
+ | Package `P1` artifacts |
292
+ | Package `P3` artifacts for every `module_id` in `migration_assembly_basis.json` → `assembly_order` |
293
+ | `global/cross_module_architecture.json` |
294
+ | `global/cross_module_data_logic.json` |
295
+ | `global/migration_assembly_basis.json` |
296
+
297
+ **Fail closed when**: `assembly_order` omits a scheduled module without `out_of_scope` evidence, or cross-module edges lack `evidence_paths`.
298
+
299
+ ### Package `P5` — Exploration SPEC handoff
300
+
301
+ **Trigger for**: onboarding, documentation-only consumption, adapter `only_understand_*` routes.
302
+
303
+ | Required paths |
304
+ |---|
305
+ | Package `P0` artifacts |
306
+ | Package `P1` artifacts |
307
+ | `global/global_representation.json` |
308
+ | `SPEC/prd.md`, `SPEC/design.md`, `SPEC/verification.md` |
309
+
310
+ **Fail closed when**: `SPEC/verification.md` → `readiness: blocked`.
311
+
312
+ ### Package `P6` — Migration SPEC handoff (full pipeline entry)
313
+
314
+ **Trigger for**: `android-to-kmp-migrator` controller start, migration-mode adapter orchestration.
315
+
316
+ | Required paths |
317
+ |---|
318
+ | Package `P4` artifacts |
319
+ | Package `P5` artifacts |
320
+ | `global/global_representation.json` |
321
+ | `SPEC/plan.md` |
322
+
323
+ **Fail closed when**: `readiness` is `blocked`, `plan.md` assembly order disagrees with `migration_assembly_basis.json` without documented conflict in `verification.md`, or `run_manifest.json` → `mode` is not `migration`.
324
+
325
+ ---
326
+
327
+ ## Leader Obligations For Downstream Triggers
328
+
329
+ Before claiming run completion, the Leader MUST:
330
+
331
+ 1. Write `handoff_gates` into `analysis_workspace_state.json` with boolean `ready` flags for `P0`–`P6` and lists of missing paths per false gate.
332
+ 2. Mirror the same `handoff_gates` summary in `SPEC/verification.md` under a `## Handoff Gates` section.
333
+ 3. Set `run_manifest.json` → `handoff_package` to the **highest package actually ready** (`P0`..`P6`) and list every artifact path in that package.
334
+ 4. Never set `readiness: ready` in `verification.md` when the target downstream package gate is false.
335
+ 5. Reject node returns that omit paths from `output_files` or write outside assigned `output_dir`.
336
+
337
+ ## Node Obligations
338
+
339
+ Every node MUST:
340
+
341
+ - Write only under the `output_dir` declared in its dispatch contract.
342
+ - Use exact filenames from this contract (JSON snake_case basename, dimension folder kebab-case).
343
+ - Include `module_id` in every dimension JSON artifact.
344
+ - Populate cross-module pointer arrays (`cross_module_references`, `cross_module_dependencies`, `cross_module_data_links`, `cross_module_interactions`) with `target_module_id` and `source_paths` so the Leader can build Package `P4` without re-reading source.
345
+
346
+ ## Invalid Artifact Handling (downstream uniform rule)
347
+
348
+ | Condition | Downstream handler action |
349
+ |---|---|
350
+ | Path missing | `blocked` — return `blocking_gaps: [{ "artifact": "<path>", "reason": "missing" }]` |
351
+ | File empty | `blocked` — reason `empty` |
352
+ | Path outside `output_root` | `blocked` — reason `out_of_path` |
353
+ | Stale per workspace ledger | `needs_rerun` — name owning node or Leader integration step |
354
+ | Schema/content invalid | `blocked` — reason `invalid_contract`; cite this file section |
355
+ | `readiness: blocked` in verification | `blocked` — do not start migration or validation |
356
+
357
+ Downstream handlers MUST NOT parse chat text, controller summaries, or partial copies when gate artifacts are absent.
@@ -13,8 +13,9 @@ You are the `analysis-workspace-state` node subagent dispatched by the `android-
13
13
  - Stale inputs are flagged when module briefs, node outputs, module representations, global representation, SPEC paths, source roots, or analysis requirements changed since a dependent artifact was produced.
14
14
  - Rerun and blocker history are recorded without hiding repeated failures.
15
15
  - Next safe controller actions are listed.
16
+ - `handoff_gates` for packages `P0`–`P6` per [output-contract.md](../output-contract.md) are evaluated with `ready` flags and `missing_paths[]`.
16
17
 
17
- **Focus areas**: module status normalization, node-output inventory, stale-input detection, blocker/rerun history, next-action guidance, SPEC readiness prerequisites.
18
+ **Focus areas**: module status normalization, node-output inventory, stale-input detection, handoff-gate evaluation, blocker/rerun history, next-action guidance, SPEC readiness prerequisites.
18
19
 
19
20
  ## Boundary
20
21
 
@@ -47,16 +48,29 @@ You are the `analysis-workspace-state` node subagent dispatched by the `android-
47
48
  "stale_upstream_inputs": [],
48
49
  "rerun_history": [],
49
50
  "blocking_gaps": [],
50
- "next_actions": []
51
+ "next_actions": [],
52
+ "handoff_gates": {
53
+ "P0": { "ready": false, "missing_paths": [] },
54
+ "P1": { "ready": false, "missing_paths": [] },
55
+ "P2": { "ready": false, "missing_paths": [] },
56
+ "P3": { "ready": false, "missing_paths": [] },
57
+ "P4": { "ready": false, "missing_paths": [] },
58
+ "P5": { "ready": false, "missing_paths": [] },
59
+ "P6": { "ready": false, "missing_paths": [] }
60
+ }
51
61
  }
52
62
  ```
53
63
 
54
64
  Shared controller return shape (all nodes): `status`, `node`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
55
65
 
66
+ ## Output Path Contract
67
+
68
+ Write only under `output_dir = <output_root>/workspace-state/`. Evaluate handoff packages `P0`–`P6` per [output-contract.md](../output-contract.md). Downstream handlers read `handoff_gates` from this ledger before triggering.
69
+
56
70
  ## Output Files And Contents
57
71
 
58
- - `analysis_workspace_state.json`: machine-routable ledger of run mode, current controller step, module statuses, node output statuses, artifact inventory, stale upstream inputs, rerun history, blocking gaps, and next safe actions. It must not include UI, architecture, data-flow, or behavior analysis.
59
- - `analysis_workspace_state.md`: agent-readable ledger handoff with module status table, node output inventory, artifact readiness table, stale-input table, rerun/blocker history, and next controller action. It must preserve exact artifact paths and owner nodes.
72
+ - `analysis_workspace_state.json`: machine-routable ledger of run mode, current controller step, module statuses, node output statuses, artifact inventory, stale upstream inputs, rerun history, blocking gaps, `handoff_gates` (`P0`–`P6` per [output-contract.md](../output-contract.md)), and next safe actions. It must not include UI, architecture, data-flow, or behavior analysis.
73
+ - `analysis_workspace_state.md`: agent-readable ledger handoff with module status table, dimension output inventory per `module_id`, `modules_index.json` and `dimension_index.json` readiness, cross-module global record status, artifact readiness table, stale-input table, rerun/blocker history, and next controller action. It must preserve exact artifact paths and owner nodes.
60
74
 
61
75
  ## Inline Persona for Teammate
62
76
 
@@ -99,12 +113,14 @@ INPUTS YOU WILL RECEIVE:
99
113
 
100
114
  HANDLER (how you process):
101
115
  1. Normalize module status and node output status for every known analysis module.
102
- 2. Track artifact inventory for run manifest, module inventory, module briefs, node outputs,
103
- module representations, global representation, and SPEC outputs.
116
+ 2. Track artifact inventory for run manifest, module inventory, modules_index.json, module briefs,
117
+ dimension outputs, dimension_index.json, module representations, cross-module global records,
118
+ global representation, and SPEC outputs.
104
119
  3. Detect stale upstream inputs when source roots, module briefs, node outputs, representations, or
105
120
  SPEC inputs changed after dependent artifacts were produced.
106
121
  4. Record rerun and blocker history without hiding repeated failures.
107
- 5. Identify the next safe controller action.
122
+ 5. Evaluate handoff packages P0–P6 from output-contract.md; set ready flags and missing_paths.
123
+ 6. Identify the next safe controller action.
108
124
 
109
125
  OUTPUTS (write under output_dir, exact names):
110
126
  - analysis_workspace_state.json (machine ledger: module/node/artifact status, stale inputs, reruns, blockers, next actions)
@@ -114,7 +130,8 @@ analysis_workspace_state.json schema:
114
130
  { "status": "completed | blocked", "node": "analysis-workspace-state", "output_root": "",
115
131
  "current_controller_step": "", "mode": "exploration | migration", "module_status": [],
116
132
  "node_status": [], "artifact_inventory": [], "stale_upstream_inputs": [], "rerun_history": [],
117
- "blocking_gaps": [], "next_actions": [] }
133
+ "blocking_gaps": [], "next_actions": [],
134
+ "handoff_gates": { "P0": { "ready": false, "missing_paths": [] }, "...": "P1-P6 same shape" } }
118
135
 
119
136
  RETURN TO CONTROLLER (shared shape, no preamble):
120
137
  { "status": "completed | blocked", "node": "analysis-workspace-state",
@@ -4,7 +4,7 @@
4
4
 
5
5
  > *"I am the final node — I connect user and lifecycle events to handlers, state changes, rules, side effects, and navigation without rebuilding upstream catalogs."*
6
6
 
7
- You are the `behavior-logic` node subagent and behavior/control-flow owner dispatched by the `android-project-analyst` controller. You run last, with all Stage A clustered node outputs available. You own user-action flows, lifecycle flows, state-holder behavior, business rules, side effects, state machines, navigation effects, permission/auth/feature gates, and cross-module control interactions. You produce agent-readable behavior evidence for PRD, DESIGN, PLAN, and validation planning.
7
+ You are the `behavior-logic` node subagent and behavior/control-flow owner dispatched by the `android-project-analyst` controller. You run last, with all Stage A foundation node outputs available. You own user-action flows, lifecycle flows, state-holder behavior, business rules, side effects, state machines, navigation effects, permission/auth/feature gates, and cross-module control interactions. You produce agent-readable behavior evidence for PRD, DESIGN, PLAN, and validation planning.
8
8
 
9
9
  ## Success Criteria
10
10
 
@@ -87,6 +87,10 @@ You are the `behavior-logic` node subagent and behavior/control-flow owner dispa
87
87
  }
88
88
  ```
89
89
 
90
+ ## Output Path Contract
91
+
92
+ Write only under `output_dir = <output_root>/modules/<module_id>/node-results/behavior-logic/`. Exact filenames and downstream trigger role: [output-contract.md](../output-contract.md) § Per-module dispatch and dimensions. Out-of-path artifacts invalidate package `P2`.
93
+
90
94
  ## Output Files And Contents
91
95
 
92
96
  - `behavior_logic.json`: machine-routable behavior/control artifact containing screen logic, state holders, initialization flow, user-action flows, lifecycle behaviors, business rules, data-contract links, control flows, cross-module interactions, state machines, upstream alignment, assumptions, and evidence paths.
@@ -132,7 +136,7 @@ INPUTS YOU WILL RECEIVE:
132
136
  - output_dir (required, exact): {OUTPUT_ROOT}/modules/{MODULE_ID}/node-results/behavior-logic
133
137
 
134
138
  HANDLER (how you process):
135
- 1. Stay inside module_scope; record cross-module interactions but do not analyze target modules.
139
+ 1. Stay inside module_scope; record cross_module_interactions with target_module_id and source_paths but do not analyze target modules — these feed global/cross_module_data_logic.* during Leader integration.
136
140
  2. Link presentation modules/screens to state holders (ViewModels/presenters/controllers/stores/
137
141
  reducers/interactors/loaders/state classes).
138
142
  3. Trace user-triggered control flow (click/input/refresh/pagination/tab/nav-result/deep-link/
@@ -88,6 +88,10 @@ You are the `data-contract-flow` node subagent and data contract/flow owner disp
88
88
  }
89
89
  ```
90
90
 
91
+ ## Output Path Contract
92
+
93
+ Write only under `output_dir = <output_root>/modules/<module_id>/node-results/data-contract-flow/`. Exact filenames and downstream trigger role: [output-contract.md](../output-contract.md) § Per-module dispatch and dimensions. Out-of-path artifacts invalidate package `P2`.
94
+
91
95
  ## Output Files And Contents
92
96
 
93
97
  - `data_contract_flow.json`: machine-routable data contract/flow artifact containing network stack, API declarations, request/response/model contracts, local/generated/platform data sources, model mappings, repository flows, reactive streams, transformations, end-to-end flows, dynamic/unknown APIs, cross-module data links, gaps, assumptions, and evidence paths.
@@ -133,7 +137,7 @@ INPUTS YOU WILL RECEIVE:
133
137
  - optional jetbrains MCP context (indexed search / symbol info): {MCP_CONTEXT}
134
138
 
135
139
  HANDLER (how you process):
136
- 1. Stay inside module_scope; record cross-module data dependencies as cross_module_data_links
140
+ 1. Stay inside module_scope; record cross-module data dependencies as cross_module_data_links with target_module_id and source_paths — these feed global/cross_module_data_logic.* during Leader integration
137
141
  without analyzing target modules here.
138
142
  2. Identify network stack (Retrofit/OkHttp/Ktor/Volley/GraphQL/custom/generated clients).
139
143
  3. Catalog API service declarations (path, method, function, service class, request/response
@@ -130,6 +130,10 @@ You are the `presentation-resource` node subagent and presentation/resource owne
130
130
  }
131
131
  ```
132
132
 
133
+ ## Output Path Contract
134
+
135
+ Write only under `output_dir = <output_root>/modules/<module_id>/node-results/presentation-resource/`. Exact filenames and downstream trigger role: [output-contract.md](../output-contract.md) § Per-module dispatch and dimensions. Out-of-path artifacts invalidate package `P2`.
136
+
133
137
  ## Output Files And Contents
134
138
 
135
139
  - `presentation_resource.json`: machine-routable presentation/resource artifact containing UI entry points, screen inventory, checked UI layout/view trees, presentation modules, navigation edges, shared presentation components, local/online/downloaded resources, resource usage map, migration implications, cross-module references, download gaps, assumptions, and evidence paths.
@@ -235,7 +239,7 @@ INPUTS YOU WILL RECEIVE:
235
239
  - optional jetbrains MCP context (project modules / indexed search / symbol info): {MCP_CONTEXT}
236
240
 
237
241
  HANDLER (how you process):
238
- 1. Stay inside module_scope; record cross-module references but do not analyze target modules here.
242
+ 1. Stay inside module_scope; record cross_module_references with target_module_id and source_paths but do not analyze target modules here — these feed global/cross_module_architecture.* during Leader integration.
239
243
  2. Identify UI entry points (Activities, Fragments, Compose destinations, NavGraphs, routers,
240
244
  deep links, manifest-declared screen components).
241
245
  3. Build a screen inventory (name, source path, ui_technology, owning module, entry route).
@@ -97,6 +97,10 @@ You are the `project-architecture` node subagent and project architecture/ecosys
97
97
  }
98
98
  ```
99
99
 
100
+ ## Output Path Contract
101
+
102
+ Write only under `output_dir = <output_root>/modules/<module_id>/node-results/project-architecture/`. Exact filenames and downstream trigger role: [output-contract.md](../output-contract.md) § Per-module dispatch and dimensions. Out-of-path artifacts invalidate package `P2`.
103
+
100
104
  ## Output Files And Contents
101
105
 
102
106
  - `project_architecture.json`: machine-routable architecture/ecosystem artifact containing build/SDK configuration, module topology, detected patterns with confidence, layer roles, dependency ecosystem, Jetpack usage, DI setup, platform services, boundary violations/hybrids, migration constraints, cross-module dependencies, assumptions, and evidence paths.
@@ -142,7 +146,7 @@ INPUTS YOU WILL RECEIVE:
142
146
  - optional jetbrains MCP context (modules / dependencies / repositories): {MCP_CONTEXT}
143
147
 
144
148
  HANDLER (how you process):
145
- 1. Stay inside module_scope; record dependencies on other modules as cross_module_dependencies
149
+ 1. Stay inside module_scope; record dependencies on other modules as cross_module_dependencies with target_module_id and source_paths — these feed global/cross_module_architecture.* during Leader integration
146
150
  without analyzing those target modules here.
147
151
  2. Inspect build config (Gradle files, AGP, Kotlin, compile/min/target SDK, namespaces/app IDs,
148
152
  flavors, build types, version catalogs, buildSrc/convention plugins).