@code-migration/wow-migrator 0.1.2 → 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 (60) hide show
  1. package/package.json +1 -1
  2. package/skills/android-project-analyst/SKILL.md +71 -28
  3. package/skills/android-project-analyst/bind.md +12 -6
  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 +30 -8
  7. package/skills/android-project-analyst/roles/behavior-logic.md +12 -5
  8. package/skills/android-project-analyst/roles/data-contract-flow.md +11 -4
  9. package/skills/android-project-analyst/roles/presentation-resource.md +13 -4
  10. package/skills/android-project-analyst/roles/project-architecture.md +11 -4
  11. package/skills/android-project-analyst/workflow.md +88 -39
  12. package/skills/android-to-kmp-migrator/SKILL.md +62 -111
  13. package/skills/android-to-kmp-migrator/bind.md +29 -61
  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 +11 -2
  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 +47 -23
  21. package/skills/android-to-kmp-migrator/roles/migration-workspace-state.md +207 -20
  22. package/skills/android-to-kmp-migrator/roles/module-implementation.md +82 -0
  23. package/skills/android-to-kmp-migrator/roles/module-node-review-fix.md +9 -2
  24. package/skills/android-to-kmp-migrator/roles/target-project-assistant.md +104 -0
  25. package/skills/android-to-kmp-migrator/workflow.md +71 -170
  26. package/skills/kmp-test-validator/SKILL.md +63 -45
  27. package/skills/kmp-test-validator/bind.md +30 -36
  28. package/skills/kmp-test-validator/dependencies.yaml +101 -9
  29. package/skills/kmp-test-validator/output-contract.md +166 -0
  30. package/skills/kmp-test-validator/roles/validation-business-testing.md +83 -0
  31. package/skills/kmp-test-validator/roles/validation-code-gate.md +116 -0
  32. package/skills/kmp-test-validator/roles/validation-fidelity-gate.md +118 -0
  33. package/skills/kmp-test-validator/roles/validation-report.md +30 -16
  34. package/skills/kmp-test-validator/roles/validation-workspace-state.md +12 -4
  35. package/skills/kmp-test-validator/workflow.md +62 -97
  36. package/skills/migration-task-adapter/SKILL.md +67 -76
  37. package/skills/migration-task-adapter/bind.md +25 -89
  38. package/skills/migration-task-adapter/dependencies.yaml +21 -10
  39. package/skills/migration-task-adapter/roles/adapter-report.md +71 -0
  40. package/skills/migration-task-adapter/roles/adapter-workspace-state.md +71 -0
  41. package/skills/migration-task-adapter/roles/task-route-orchestrator.md +103 -0
  42. package/skills/migration-task-adapter/workflow.md +71 -143
  43. package/skills/android-project-analyst/MIGRATION.md +0 -53
  44. package/skills/android-to-kmp-migrator/MIGRATION.md +0 -104
  45. package/skills/android-to-kmp-migrator/roles/dependency-platform-gate.md +0 -63
  46. package/skills/android-to-kmp-migrator/roles/logic-implementation.md +0 -66
  47. package/skills/android-to-kmp-migrator/roles/migration-analysis-planning.md +0 -65
  48. package/skills/android-to-kmp-migrator/roles/presentation-integration.md +0 -65
  49. package/skills/android-to-kmp-migrator/roles/state-data-prep.md +0 -63
  50. package/skills/android-to-kmp-migrator/roles/ui-implementation.md +0 -64
  51. package/skills/kmp-test-validator/MIGRATION.md +0 -58
  52. package/skills/kmp-test-validator/roles/validation-intake-fidelity.md +0 -67
  53. package/skills/kmp-test-validator/roles/validation-plan-gate.md +0 -66
  54. package/skills/kmp-test-validator/roles/validation-remediation.md +0 -112
  55. package/skills/kmp-test-validator/roles/validation-test-runner.md +0 -61
  56. package/skills/migration-task-adapter/MIGRATION.md +0 -34
  57. package/skills/migration-task-adapter/roles/task-reporter.md +0 -129
  58. package/skills/migration-task-adapter/roles/task-understanding-router.md +0 -134
  59. package/skills/migration-task-adapter/roles/workflow-orchestrator.md +0 -140
  60. package/skills/migration-task-adapter/roles/workspace-state-discipline-inspector.md +0 -189
@@ -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,12 +48,30 @@ 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
+
70
+ ## Output Files And Contents
71
+
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.
74
+
56
75
  ## Inline Persona for Teammate
57
76
 
58
77
  ```
@@ -94,22 +113,25 @@ INPUTS YOU WILL RECEIVE:
94
113
 
95
114
  HANDLER (how you process):
96
115
  1. Normalize module status and node output status for every known analysis module.
97
- 2. Track artifact inventory for run manifest, module inventory, module briefs, node outputs,
98
- 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.
99
119
  3. Detect stale upstream inputs when source roots, module briefs, node outputs, representations, or
100
120
  SPEC inputs changed after dependent artifacts were produced.
101
121
  4. Record rerun and blocker history without hiding repeated failures.
102
- 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.
103
124
 
104
125
  OUTPUTS (write under output_dir, exact names):
105
- - analysis_workspace_state.json (schema below)
106
- - analysis_workspace_state.md
126
+ - analysis_workspace_state.json (machine ledger: module/node/artifact status, stale inputs, reruns, blockers, next actions)
127
+ - analysis_workspace_state.md (agent-readable ledger: status tables, stale/rerun/blocker evidence, next safe action)
107
128
 
108
129
  analysis_workspace_state.json schema:
109
130
  { "status": "completed | blocked", "node": "analysis-workspace-state", "output_root": "",
110
131
  "current_controller_step": "", "mode": "exploration | migration", "module_status": [],
111
132
  "node_status": [], "artifact_inventory": [], "stale_upstream_inputs": [], "rerun_history": [],
112
- "blocking_gaps": [], "next_actions": [] }
133
+ "blocking_gaps": [], "next_actions": [],
134
+ "handoff_gates": { "P0": { "ready": false, "missing_paths": [] }, "...": "P1-P6 same shape" } }
113
135
 
114
136
  RETURN TO CONTROLLER (shared shape, no preamble):
115
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,7 +87,14 @@ You are the `behavior-logic` node subagent and behavior/control-flow owner dispa
87
87
  }
88
88
  ```
89
89
 
90
- The companion `behavior_logic.md` is an agent-readable handoff: screen-to-state-holder mapping, major user-action flows, lifecycle/initialization behavior, links to upstream data-contract/flow diagrams, project architecture/ecosystem effects on logic, business rules and error/loading/empty handling, cross-module interaction summary, state machines, unknowns, and assumptions.
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
+
94
+ ## Output Files And Contents
95
+
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.
97
+ - `behavior_logic.md`: agent-readable behavior handoff containing screen-to-state-holder mapping, major user-action flows, lifecycle/initialization behavior, links to upstream data-contract/flow diagrams, project architecture/ecosystem effects on logic, business rules and error/loading/empty handling, cross-module interaction summary, state machines, unknowns, and assumptions.
91
98
 
92
99
  ## Inline Persona for Teammate
93
100
 
@@ -129,7 +136,7 @@ INPUTS YOU WILL RECEIVE:
129
136
  - output_dir (required, exact): {OUTPUT_ROOT}/modules/{MODULE_ID}/node-results/behavior-logic
130
137
 
131
138
  HANDLER (how you process):
132
- 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.
133
140
  2. Link presentation modules/screens to state holders (ViewModels/presenters/controllers/stores/
134
141
  reducers/interactors/loaders/state classes).
135
142
  3. Trace user-triggered control flow (click/input/refresh/pagination/tab/nav-result/deep-link/
@@ -148,8 +155,8 @@ HANDLER (how you process):
148
155
  flowchart for complex logic).
149
156
 
150
157
  OUTPUTS (write under output_dir, exact names):
151
- - behavior_logic.json
152
- - behavior_logic.md
158
+ - behavior_logic.json (machine artifact: screen logic, actions, lifecycle, rules, data links, control/state flows, upstream alignment, evidence)
159
+ - behavior_logic.md (agent handoff: behavior tables, flow/state diagrams, upstream alignment, unknowns)
153
160
 
154
161
  RETURN TO CONTROLLER (exactly this shape, no preamble):
155
162
  {
@@ -88,7 +88,14 @@ You are the `data-contract-flow` node subagent and data contract/flow owner disp
88
88
  }
89
89
  ```
90
90
 
91
- The companion `data_contract_flow.md` is an agent-readable handoff: network stack overview, API endpoint table, consumer mapping table, local/generated/platform data-source inventory, model mapping notes, repository & mapper flow tables, reactive stream summary, end-to-end Mermaid flow diagrams (when evidence allows), loading/error/empty handling summary, dynamic or unknown API gaps, gaps, and assumptions.
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
+
95
+ ## Output Files And Contents
96
+
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.
98
+ - `data_contract_flow.md`: agent-readable data handoff containing network stack overview, API endpoint table, consumer mapping table, local/generated/platform data-source inventory, model mapping notes, repository & mapper flow tables, reactive stream summary, end-to-end Mermaid flow diagrams when evidence allows, loading/error/empty handling summary, dynamic or unknown API gaps, gaps, and assumptions.
92
99
 
93
100
  ## Inline Persona for Teammate
94
101
 
@@ -130,7 +137,7 @@ INPUTS YOU WILL RECEIVE:
130
137
  - optional jetbrains MCP context (indexed search / symbol info): {MCP_CONTEXT}
131
138
 
132
139
  HANDLER (how you process):
133
- 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
134
141
  without analyzing target modules here.
135
142
  2. Identify network stack (Retrofit/OkHttp/Ktor/Volley/GraphQL/custom/generated clients).
136
143
  3. Catalog API service declarations (path, method, function, service class, request/response
@@ -152,8 +159,8 @@ HANDLER (how you process):
152
159
  unavailable, unclear consumers).
153
160
 
154
161
  OUTPUTS (write under output_dir, exact names):
155
- - data_contract_flow.json
156
- - data_contract_flow.md
162
+ - data_contract_flow.json (machine artifact: APIs, data sources, models, mappings, repository/reactive/end-to-end flows, gaps, evidence)
163
+ - data_contract_flow.md (agent handoff: endpoint/source/consumer tables, flow diagrams, loading/error/empty behavior, unknowns)
157
164
 
158
165
  RETURN TO CONTROLLER (exactly this shape, no preamble):
159
166
  {
@@ -130,7 +130,15 @@ You are the `presentation-resource` node subagent and presentation/resource owne
130
130
  }
131
131
  ```
132
132
 
133
- The companion `presentation_resource.md` is an agent-readable handoff: UI entry point overview, screen inventory table, checked UI layout/view trees by screen or section, Mermaid navigation graph (when evidence allows), presentation module decomposition, shared component summary, local resource inventory, online resource sources, downloaded resource manifest, resource→usage mapping table, production vs debug/test/sample classification, migration implications, download gaps, unknowns, and assumptions.
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
+
137
+ ## Output Files And Contents
138
+
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.
140
+ - `presentation_resource.md`: agent-readable presentation handoff containing UI entry point overview, screen inventory table, checked UI layout/view trees by screen or section, Mermaid navigation graph when evidence allows, presentation module decomposition, shared component summary, local resource inventory, online resource sources, downloaded resource manifest, resource-to-usage mapping table, production vs debug/test/sample classification, migration implications, download gaps, unknowns, and assumptions.
141
+ - `downloaded_resources/`: optional auxiliary directory for safe concrete HTTP(S) resources downloaded for analysis. Every file must be represented in `downloaded_resources[]` with original URL, local path, content type, SHA-256, byte size, status, and reason when skipped/failed.
134
142
 
135
143
  ## Checked UI Layout / View Tree Format
136
144
 
@@ -231,7 +239,7 @@ INPUTS YOU WILL RECEIVE:
231
239
  - optional jetbrains MCP context (project modules / indexed search / symbol info): {MCP_CONTEXT}
232
240
 
233
241
  HANDLER (how you process):
234
- 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.
235
243
  2. Identify UI entry points (Activities, Fragments, Compose destinations, NavGraphs, routers,
236
244
  deep links, manifest-declared screen components).
237
245
  3. Build a screen inventory (name, source path, ui_technology, owning module, entry route).
@@ -280,8 +288,9 @@ ForegroundConstraintLayout @id/parent_layout [match_parent x wrap_content, padd
280
288
  └── src=ic_vector_more_new, tint=Graph_weak
281
289
 
282
290
  OUTPUTS (write under output_dir, exact names):
283
- - presentation_resource.json
284
- - presentation_resource.md
291
+ - presentation_resource.json (machine artifact: screens, checked UI trees, navigation, presentation modules, resources, usage map, downloads, gaps, evidence)
292
+ - presentation_resource.md (agent handoff: screen/resource tables, checked UI tree blocks, navigation graph, migration implications, unknowns)
293
+ - downloaded_resources/ (optional safe downloaded resource copies, only when concrete URLs are proven)
285
294
 
286
295
  RETURN TO CONTROLLER (exactly this shape, no preamble):
287
296
  {
@@ -97,7 +97,14 @@ You are the `project-architecture` node subagent and project architecture/ecosys
97
97
  }
98
98
  ```
99
99
 
100
- The companion `project_architecture.md` is an agent-readable handoff: build/SDK configuration, project topology overview, detected patterns + confidence, layer/role mapping, dependency + Jetpack inventory, DI setup, persistence/background/platform-service usage, generated tooling, dependency direction notes, legacy hybrid patterns/risks, migration constraints, and unknowns.
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
+
104
+ ## Output Files And Contents
105
+
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.
107
+ - `project_architecture.md`: agent-readable architecture handoff containing build/SDK configuration, project topology overview, detected patterns + confidence, layer/role mapping, dependency + Jetpack inventory, DI setup, persistence/background/platform-service usage, generated tooling, dependency direction notes, legacy hybrid patterns/risks, migration constraints, and unknowns.
101
108
 
102
109
  ## Inline Persona for Teammate
103
110
 
@@ -139,7 +146,7 @@ INPUTS YOU WILL RECEIVE:
139
146
  - optional jetbrains MCP context (modules / dependencies / repositories): {MCP_CONTEXT}
140
147
 
141
148
  HANDLER (how you process):
142
- 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
143
150
  without analyzing those target modules here.
144
151
  2. Inspect build config (Gradle files, AGP, Kotlin, compile/min/target SDK, namespaces/app IDs,
145
152
  flavors, build types, version catalogs, buildSrc/convention plugins).
@@ -156,8 +163,8 @@ HANDLER (how you process):
156
163
  9. Identify legacy traits and migration/onboarding implications.
157
164
 
158
165
  OUTPUTS (write under output_dir, exact names):
159
- - project_architecture.json
160
- - project_architecture.md
166
+ - project_architecture.json (machine artifact: build config, topology, patterns, layers, dependencies, platform/generated constraints, evidence)
167
+ - project_architecture.md (agent handoff: architecture/ecosystem tables, risks, migration constraints, unknowns)
161
168
 
162
169
  RETURN TO CONTROLLER (exactly this shape, no preamble):
163
170
  {