@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
@@ -1,6 +1,8 @@
1
1
  # Workflow: Legacy Android source → module artifacts → global representation → SPEC package
2
2
 
3
- This Swarm Skill is **module-first Mixed B+C with workspace-state tracking**: the Leader first partitions the Legacy Android project into bounded analysis modules, maintains a ledger of module/node artifacts and stale inputs, then runs the clustered node schedule inside each module before combining the verified module representations into one global project representation and SPEC package. Each node owns a bounded module slice; the Leader never does node work and never invents claims that no node traced to source.
3
+ This Swarm Skill is **module-first Mixed B+C with workspace-state tracking**: the Leader first partitions the Legacy Android project into bounded analysis modules, maintains a ledger of module/node artifacts and stale inputs, then runs the foundation node schedule inside each module before combining the verified module representations into one global project representation and SPEC package. Each node owns a bounded module slice; the Leader never does node work and never invents claims that no node traced to source.
4
+
5
+ **File recording system**: every output path, content requirement, and downstream trigger gate is defined in [output-contract.md](output-contract.md). Downstream handlers (`migration-task-adapter`, `android-to-kmp-migrator`) MUST fail closed when handoff package artifacts are missing, empty, out-of-path, stale, or schema-invalid.
4
6
 
5
7
  ## Overview
6
8
 
@@ -29,18 +31,24 @@ graph TD
29
31
  B1 --> GB{Behavior output verified?}
30
32
  GB -- fail --> RR2[Re-dispatch behavior-logic]
31
33
  RR2 --> GB
32
- GB -- Yes --> MR[Leader: Step 5 write module representation]
34
+ GB -- Yes --> DI[Leader: Step 5 write dimension_index.json]
35
+ DI --> MR[Leader: Step 6 write module representation]
33
36
  MR --> WSR[Refresh analysis-workspace-state]
34
37
  WSR --> NEXT{More modules?}
35
38
  NEXT -- Yes --> LOOP
36
- NEXT -- No --> GR[Leader: Step 6 global representation]
37
- DEG --> GR
39
+ NEXT -- No --> CMA[Leader: Step 7 cross-module architecture]
40
+ DEG --> CMA
41
+ CMA --> CMD[Leader: Step 7 cross-module data/logic]
42
+ CMD --> MAB[Leader: Step 7 migration assembly basis]
43
+ MAB --> GR[Leader: Step 8 global representation]
38
44
  GR --> WSG[Refresh analysis-workspace-state]
39
- WSG --> OUT[Leader: Step 8 write SPEC + verification verdict]
45
+ WSG --> OUT[Leader: Step 9 write SPEC + verification verdict]
40
46
  ```
41
47
 
42
48
  ## Strict Output Paths
43
49
 
50
+ The canonical path tree, filename invariants, and handoff packages `P0`–`P6` are in [output-contract.md](output-contract.md). This section summarizes path variables only.
51
+
44
52
  The Leader MUST lock one `output_root` before dispatch and MUST reject or rerun any node that writes outside its assigned directory. Defaults:
45
53
 
46
54
  - `output_root`: `<output_dir or ~/.a2c_agents/understand>/android-project-analyst`
@@ -59,10 +67,15 @@ Required durable artifacts:
59
67
  | Output root lock | `<output_root>/run_manifest.json` - run identity, paths, mode, scope, allowed roots, dependency status, schedule version |
60
68
  | Workspace state | `<workspace_state_dir>/analysis_workspace_state.json`, `<workspace_state_dir>/analysis_workspace_state.md` - module/node/artifact ledger, stale inputs, reruns, blockers, next safe actions |
61
69
  | Module inventory | `<module_index_dir>/module_inventory.json`, `<module_index_dir>/module_inventory.md` - deterministic module list/order, scopes, dependencies, out-of-scope roots, evidence |
70
+ | Modules index | `<module_index_dir>/modules_index.json` - machine-routable `module_id` → folder paths, dimension roots, representation paths, status |
62
71
  | Per module brief | `<module_root>/module_brief.json` - module-scoped dispatch contract and role hints for one `module_id` |
63
- | Per module node outputs | `<module_node_dir>/<node_artifact>.json`, `<module_node_dir>/<node_artifact>.md` - role-owned evidence matching the active role schema |
64
- | Per module representation | `<module_representation_dir>/module_representation.json`, `<module_representation_dir>/module_representation.md` - module synthesis from verified node outputs only |
65
- | Global representation | `<global_dir>/global_representation.json`, `<global_dir>/global_representation.md` - full-project synthesis from module representations only |
72
+ | Per module dimension outputs | `<module_node_dir>/<node_artifact>.json`, `<module_node_dir>/<node_artifact>.md` - one analysis dimension per `node-results/<dimension>/` |
73
+ | Per module dimension index | `<module_root>/dimension_index.json` - dimension artifact path map for the module |
74
+ | Per module representation | `<module_representation_dir>/module_representation.json`, `<module_representation_dir>/module_representation.md` - module synthesis from verified dimension outputs only |
75
+ | Cross-module architecture | `<global_dir>/cross_module_architecture.json`, `<global_dir>/cross_module_architecture.md` - inter-module topology, navigation glue, shared platform/DI bridges |
76
+ | Cross-module data/logic | `<global_dir>/cross_module_data_logic.json`, `<global_dir>/cross_module_data_logic.md` - shared contracts, cross-module data flows, control interactions |
77
+ | Migration assembly basis | `<global_dir>/migration_assembly_basis.json`, `<global_dir>/migration_assembly_basis.md` - module assembly order and integration checkpoints for downstream migration |
78
+ | Global representation | `<global_dir>/global_representation.json`, `<global_dir>/global_representation.md` - full-project synthesis from module representations plus cross-module global records |
66
79
  | SPEC package | `<spec_dir>/prd.md`, `<spec_dir>/design.md`, `<spec_dir>/verification.md`, plus `<spec_dir>/plan.md` in migration mode - final SPEC with traceability, coverage, and readiness |
67
80
 
68
81
  No node may choose its own output path. `presentation-resource` may write downloaded resources only under `<module_root>/node-results/presentation-resource/downloaded_resources/`.
@@ -73,7 +86,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
73
86
 
74
87
  - **Executor**: Leader (`android-project-analyst` controller)
75
88
  - **Input**: [dependencies.yaml](dependencies.yaml)
76
- - **Action**: verify each `tools[]` entry (`rg`, `curl`, `git`) is available; built-in Grep/Read substitute when `rg` is absent. Presentation/resource downloads degrade to `download_gaps` when `curl` is absent. Stale-input detection degrades to artifact-path/status comparison when `git` is absent.
89
+ - **Action**: verify `tools[]`, `optional_mcp.jetbrains`, and migration-mode `downstream_handoff` package **P6** per [dependencies.yaml](dependencies.yaml). Record CLI/MCP status in `run_manifest.json` `dependency_preflight`. Apply degraded modes when tools or MCP are unavailable; migration mode must plan for **P6** consumable by `android-to-kmp-migrator`.
77
90
  - **Output**: pre-flight note to the user
78
91
  - **Quality gate**: all deps are `required: false` → the run proceeds even if missing; user is informed of any degraded mode. The Leader does NOT auto-skip nodes.
79
92
 
@@ -95,20 +108,20 @@ No node may choose its own output path. `presentation-resource` may write downlo
95
108
  - **Serial / Parallel**: serial; refreshed after module inventory, Stage A, Stage B, module representation, global representation, and SPEC.
96
109
  - **Quality gate**: downstream stages do not consume artifacts marked stale; rerun the responsible module/node or mark the affected module `blocked`.
97
110
 
98
- ### Step 3 — Module inventory and schedule
111
+ ### Step 3 — Module inventory, modules index, and folder materialization
99
112
 
100
113
  - **Executor**: Leader
101
114
  - **Input**: source path, analysis scope, Android evidence, module/build files, optional MCP module context
102
- - **Action**: partition the project into explicit `analysis_modules`. Prefer Gradle modules and feature packages; when one Gradle module contains multiple independent features, split by package/route/feature boundary. Each module entry MUST include `module_id` (stable slug), `module_type` (`app | feature | ui | logic | data | platform | shared | test | unknown`), `source_roots`, `ui_scope`, `logic_scope`, `data_scope`, `resource_scope`, `depends_on`, and `module_output_root`. Include UI-only and logic-only modules when they exist; if a module has no UI or no logic, record `none` with evidence.
103
- - **Output**: `module_inventory.json`, `module_inventory.md`. JSON must contain `analysis_modules`, deterministic `module_order`, in-scope and out-of-scope roots, dependencies, and each module's output root. Markdown must explain module boundaries and evidence without doing role analysis.
115
+ - **Action**: partition the project into explicit `analysis_modules`. Prefer Gradle modules and feature packages; when one Gradle module contains multiple independent features, split by package/route/feature boundary. Each module entry MUST include `module_id` (stable slug), `module_type` (`app | feature | ui | logic | data | platform | shared | test | unknown`), `source_roots`, `ui_scope`, `logic_scope`, `data_scope`, `resource_scope`, `depends_on`, and `module_output_root` (`<output_root>/modules/<module_id>`). Include UI-only and logic-only modules when they exist; if a module has no UI or no logic, record `none` with evidence. For every scheduled `module_id`, create the module folder root before dispatch. Write `modules_index.json` as the machine-routable lookup from `module_id` to `module_output_root`, `module_brief_path`, dimension roots under `node-results/<dimension>/`, and `representation_paths`.
116
+ - **Output**: `module_inventory.json`, `module_inventory.md`, `modules_index.json`. Inventory JSON must contain `analysis_modules`, deterministic `module_order`, in-scope and out-of-scope roots, dependencies, and each module's output root. `modules_index.json` must list every scheduled `module_id` with resolvable paths. Markdown must explain module boundaries and evidence without doing role analysis.
104
117
  - **Serial / Parallel**: serial (precedes all module dispatch)
105
- - **Quality gate**: module inventory exists/non-empty, every in-scope source root is assigned to one module or `out_of_scope`, and `module_order` is deterministic.
118
+ - **Quality gate**: module inventory exists/non-empty, `modules_index.json` exists/non-empty, every scheduled module folder path is declared, every in-scope source root is assigned to one module or `out_of_scope`, and `module_order` is deterministic.
106
119
 
107
- ### Step 4 — Stage A per module: dispatch clustered foundation nodes (parallel, B-pattern)
120
+ ### Step 4 — Stage A per module: dispatch foundation nodes (parallel, B-pattern)
108
121
 
109
122
  - **Executor**: `presentation-resource`, `project-architecture`, `data-contract-flow`
110
123
  - **Input**: per-node contract `{ source_project_path, module_id, module_scope, analysis_scope, mode, module_brief_path, skill_spec_path (roles/<id>.md), output_dir: <output_root>/modules/<module_id>/node-results/<node_id>, return_format: json }`; `data-contract-flow` may also receive `presentation_hints` when known.
111
- - **Action**: each node validates inputs, performs its bounded clustered slice, writes its JSON+MD artifacts, and returns the controller JSON shape.
124
+ - **Action**: each node validates inputs, performs its bounded slice, writes its JSON+MD artifacts, and returns the controller JSON shape.
112
125
  - **Output**:
113
126
  - `presentation_resource.json`, `presentation_resource.md`: UI entry points, screen inventory, checked UI layout/view trees, navigation, presentation modules, resources, safe downloads, usage map, migration implications, gaps.
114
127
  - `project_architecture.json`, `project_architecture.md`: build/SDK config, topology, architecture patterns, layer roles, dependencies, Jetpack/DI/platform/generated usage, boundary risks, migration constraints.
@@ -125,29 +138,41 @@ No node may choose its own output path. `presentation-resource` may write downlo
125
138
  - **Serial / Parallel**: serial within the module — runs after that module's Stage A gate passes.
126
139
  - **Quality gate**: latest workspace state must not mark Stage A inputs stale; return-shape + output-file checks; every major UI/logic scope from the module brief has behavior coverage or an explicit reason for none.
127
140
 
128
- ### Step 6 — Module representation
141
+ ### Step 6 — Dimension index and module representation
129
142
 
130
143
  - **Executor**: Leader
131
- - **Input**: verified node JSON/MD outputs for one `module_id`
132
- - **Action**: integrate ONLY from verified outputs for that module. Write a module representation that covers both UI and logic when present: module purpose, UI surface, resources, architecture/ecosystem, data contracts/flows, behavior logic, dependencies, risks, gaps, evidence index, and readiness.
133
- - **Output**: `module_representation.json`, `module_representation.md`. JSON is the module-level synthesis and traceability index; Markdown is the agent-readable handoff. Both must cite verified node artifacts and source evidence for UI/resources, architecture, data flow, behavior, risks, gaps, and readiness.
144
+ - **Input**: verified dimension JSON/MD outputs for one `module_id`
145
+ - **Action**: write `dimension_index.json` mapping the four analysis dimensions to their verified artifact paths and status. Then integrate ONLY from verified dimension outputs for that module. Write a module representation that covers both UI and logic when present: module purpose, UI surface, resources, architecture/ecosystem, data contracts/flows, behavior logic, dimension traceability index, intra-module dependencies, risks, gaps, evidence index, and readiness. Record cross-module references as pointers only; do not synthesize full inter-module graphs here.
146
+ - **Output**: `dimension_index.json`, `module_representation.json`, `module_representation.md`. `dimension_index.json` is the per-module dimension lookup. Module representation JSON is the module-level synthesis and traceability index; Markdown is the agent-readable handoff. Both must cite verified dimension artifacts and source evidence.
134
147
  - **Serial / Parallel**: serial
135
- - **Quality gate**: no unknowns hidden; every module representation points to its node artifacts and source evidence. Refresh workspace state after writing. Do not proceed to global integration until every scheduled module is represented or explicitly marked blocked/out of scope.
148
+ - **Quality gate**: `dimension_index.json` lists all four dimensions with resolvable paths; no unknowns hidden; every module representation points to its dimension artifacts and source evidence. Refresh workspace state after writing. Do not proceed to cross-module global records until every scheduled module is represented or explicitly marked blocked/out of scope.
149
+
150
+ ### Step 7 — Cross-module global records (migration assembly basis)
151
+
152
+ - **Executor**: Leader
153
+ - **Input**: all verified module representations, all per-module dimension outputs (for `cross_module_*` fields), `module_inventory.json`, `modules_index.json`
154
+ - **Action**: aggregate inter-module evidence into three dedicated global artifacts before `global_representation.*`:
155
+ 1. **Cross-module architecture** — Gradle/topology glue, layer boundaries, navigation integration, shared platform services, DI scope bridges, architectural dependency edges, and conflicts. Source from module `cross_module_dependencies`, `cross_module_references`, and architecture dimensions.
156
+ 2. **Cross-module data/logic** — shared APIs/models/stores, `cross_module_data_links`, `cross_module_interactions`, event/callback/bus paths, cache/write-back sharing, and control-flow handoffs.
157
+ 3. **Migration assembly basis** — deterministic module assembly order (respecting `depends_on`), integration checkpoints, shared contracts each module must preserve, partial-migration boundaries, and blockers for downstream `android-to-kmp-migrator` scheduling.
158
+ - **Output**: `cross_module_architecture.json`, `cross_module_architecture.md`, `cross_module_data_logic.json`, `cross_module_data_logic.md`, `migration_assembly_basis.json`, `migration_assembly_basis.md`.
159
+ - **Serial / Parallel**: serial; write architecture, then data/logic, then assembly basis
160
+ - **Quality gate**: every inter-module edge cites source `module_id`, dimension artifact path, and source-path evidence; assembly order is deterministic and consistent with `module_order` and `depends_on`; no raw-source gap filling — rerun the responsible module/node instead.
136
161
 
137
- ### Step 7 — Global representation
162
+ ### Step 8 — Global representation
138
163
 
139
164
  - **Executor**: Leader
140
- - **Input**: all verified module representations
141
- - **Action**: combine module representations into a total full-project global representation. Preserve module boundaries first, then synthesize cross-module architecture, navigation, data dependencies, shared resources, shared logic, platform constraints, conflicts, and global readiness. Do not read raw source to fill gaps at this stage; rerun the responsible module/node instead.
142
- - **Output**: `global_representation.json`, `global_representation.md`. JSON is the full-project representation and evidence index; Markdown explains cross-module architecture, navigation, shared resources, shared logic, data dependencies, platform constraints, conflicts, and global readiness.
165
+ - **Input**: all verified module representations, cross-module global records from Step 7
166
+ - **Action**: combine module representations and cross-module global records into a total full-project global representation. Preserve module boundaries first, then synthesize navigation, shared resources, shared logic, platform constraints, conflicts, and global readiness. Do not read raw source to fill gaps at this stage; rerun the responsible module/node instead.
167
+ - **Output**: `global_representation.json`, `global_representation.md`. JSON is the full-project representation and evidence index; Markdown explains how modules connect using the dedicated cross-module artifacts.
143
168
  - **Serial / Parallel**: serial
144
- - **Quality gate**: latest workspace state must not mark required module representations stale; every global claim maps to a module representation and source-path evidence, or is marked `assumed`, `unknown`, or `blocked`.
169
+ - **Quality gate**: latest workspace state must not mark required module representations or cross-module global records stale; every global claim maps to a module representation, cross-module global record, and source-path evidence, or is marked `assumed`, `unknown`, or `blocked`.
145
170
 
146
- ### Step 8 — Final: write SPEC package + emit completion report
171
+ ### Step 9 — Final: write SPEC package + emit completion report
147
172
 
148
173
  - **Executor**: Leader
149
- - **Input**: `global_representation.json`, `global_representation.md`, module inventory, module representations, latest `analysis_workspace_state.json`
150
- - **Action**: write SPEC artifacts under `<output_root>/SPEC`. **Exploration** mode → `prd.md`, `design.md`, `verification.md`. **Migration** mode → adds `plan.md`. SPEC must synthesize, not paste node summaries; every important claim maps to module/global representation evidence and source paths or is marked assumption/gap. `design.md` sections include a Mermaid diagram, structured table, or evidence mapping; presentation/navigation, project architecture, data-contract/flow, and cross-module sections include diagrams when evidence exists.
174
+ - **Input**: `global_representation.json`, `global_representation.md`, cross-module global records, module inventory, `modules_index.json`, module representations, latest `analysis_workspace_state.json`
175
+ - **Action**: write SPEC artifacts under `<output_root>/SPEC`. **Exploration** mode → `prd.md`, `design.md`, `verification.md`. **Migration** mode → adds `plan.md`. SPEC must synthesize, not paste node summaries; every important claim maps to module/global/cross-module evidence and source paths or is marked assumption/gap. `design.md` must cite `cross_module_architecture.*` and `cross_module_data_logic.*` for integration sections. Migration-mode `plan.md` must use `migration_assembly_basis.*` for module assembly order and integration checkpoints. `design.md` sections include a Mermaid diagram, structured table, or evidence mapping; presentation/navigation, project architecture, data-contract/flow, and cross-module sections include diagrams when evidence exists.
151
176
  - **Output**: SPEC files + the completion report below. `prd.md` captures product behavior and journeys, `design.md` captures implementation structure and evidence-backed diagrams/tables, `verification.md` captures coverage/traceability/consistency/readiness, and migration-mode `plan.md` captures migration milestones, source-to-target mapping, validation, risks, and blockers.
152
177
 
153
178
  #### Final Report Format
@@ -161,21 +186,42 @@ No node may choose its own output path. `presentation-resource` may write downlo
161
186
  "output_root": "...",
162
187
  "workspace_state": ["..."],
163
188
  "module_inventory": ["..."],
189
+ "modules_index": ["..."],
164
190
  "module_representations": ["..."],
191
+ "cross_module_architecture": ["..."],
192
+ "cross_module_data_logic": ["..."],
193
+ "migration_assembly_basis": ["..."],
165
194
  "global_representation": ["..."],
166
195
  "node_outputs_by_module": {},
167
196
  "spec_outputs": ["..."],
168
197
  "readiness": "ready | ready_with_assumptions | blocked",
198
+ "handoff_package": "P0 | P1 | P2 | P3 | P4 | P5 | P6",
199
+ "handoff_gates": {},
169
200
  "blocking_gaps": []
170
201
  }
171
202
  ```
172
203
 
204
+ ## Downstream Handoff Gate (Leader final step)
205
+
206
+ Before emitting the completion report, the Leader MUST:
207
+
208
+ 1. Evaluate handoff packages `P0`–`P6` per [output-contract.md](output-contract.md).
209
+ 2. Write `handoff_gates` into `analysis_workspace_state.json` (boolean `ready` + `missing_paths[]` per package).
210
+ 3. Add `## Handoff Gates` to `SPEC/verification.md` mirroring the same status.
211
+ 4. Set `run_manifest.json` → `handoff_package` to the highest ready package id and list every artifact path in that package.
212
+ 5. Set `readiness` in `verification.md` to `blocked` when the intended downstream package is not ready.
213
+
214
+ Downstream handlers read package gates only from these files — not from controller chat output.
215
+
173
216
  ## Acceptance Criteria
174
217
 
175
218
  - All dispatched nodes returned outputs matching their role `## Output Schema` (no malformed returns); any `[ROLE MISSING]` is recorded per [bind.md](bind.md).
219
+ - `handoff_gates` in workspace ledger and `SPEC/verification.md` accurately reflect [output-contract.md](output-contract.md) package readiness.
176
220
  - All required node artifacts exist and are non-empty; latest `analysis-workspace-state` has no stale required inputs; all required SPEC artifacts for the selected mode exist and are non-empty.
177
221
  - **Path check**: every artifact path is under `output_root`; every node artifact is under `<output_root>/modules/<module_id>/node-results/<node_id>/`; SPEC is under `<output_root>/SPEC`.
178
- - **Module-first check**: every scheduled module has a module brief, node outputs, and module representation before global representation is written.
222
+ - **Module-first check**: every scheduled module has a module brief, four dimension outputs, `dimension_index.json`, and module representation before cross-module global records are written.
223
+ - **Cross-module check**: `cross_module_architecture.*`, `cross_module_data_logic.*`, and `migration_assembly_basis.*` exist and are non-empty before `global_representation.*` is written.
224
+ - **Index check**: `modules_index.json` resolves every scheduled `module_id` to its module folder and representation paths.
179
225
  - **Coverage check (B-pattern)**: every per-module Stage A slice is accounted for — screens/resources from `presentation-resource`, topology/platform constraints from `project-architecture`, and APIs/data flows from `data-contract-flow` appear in module/global representations or are marked out of scope/unknown.
180
226
  - **Gate check (C-pattern)**: per-module behavior analysis ran only after that module's Stage A verification; every kicked-back node is recorded.
181
227
  - Data-flow and behavior-flow names align across `design.md`, `plan.md`, and `verification.md`.
@@ -1,196 +1,116 @@
1
1
  ---
2
2
  name: android-to-kmp-migrator
3
3
  description: |
4
- 10-role reduced module-first Swarm Skill (C+B) that migrates Legacy Android into an existing KMP target project with strict output roots, migration-module inventory, per-module node results, module/global representations, review-fix modes, verification checks, and a validation-ready migration report.
5
- Use with the android-to-kmp-migrator controller to port Android UI, resources, navigation, state, data, platform behavior, and logic into one KMP project by migrating each module first, then synthesizing a global migration representation for kmp-test-validator.
6
- Do NOT use for Legacy Android analysis, KMP-only feature work, quick lookups, or non-migration refactors.
7
- version: "0.4"
4
+ Module-first Swarm Skill that migrates Legacy Android into an existing KMP target using upstream analyst P6 artifacts, target-project-assistant alignment, planning/prep/implementation roles, global integrate+align phase, and kmp-test-validator handoff without full-project build during migration.
5
+ Use when analyst package P6 exists and the user wants module-first porting then whole-system assembly.
6
+ Do NOT use for Legacy Android analysis only, KMP-only feature work, or non-migration refactors.
7
+ version: "0.6"
8
8
  kind: swarm-skill
9
9
  disable-model-invocation: true
10
10
  roles:
11
11
  - id: migration-workspace-state
12
12
  kind: ai_agent
13
- purpose: State/progress ledger owner per-module migration status, finish rates, plan-vs-code gaps, changed-file ownership, stale outputs, rerun hooks, blocker history, and next actions. No code analysis or edits.
13
+ purpose: Migration ledger — handoff gates M0–V0, plan-vs-code gaps, stale outputs, rerun hooks. No code edits.
14
14
  skills: []
15
15
  tools: [git]
16
- - id: migration-analysis-planning
16
+ - id: target-project-assistant
17
17
  kind: ai_agent
18
- purpose: Analysis and planning owner — Legacy SPEC/raw-source deltas, target KMP understanding, reuse inventory, source-to-target map, integration scaffold, and ordered module tasks.
18
+ purpose: Target KMP owner — global baseline, per-module anchors, alignment revision, consult log.
19
19
  skills: []
20
20
  tools: [rg]
21
- - id: dependency-platform-gate
21
+ - id: migration-planning-gate
22
22
  kind: ai_agent
23
- purpose: Dependency and platform ownerminimal-change dependency readiness plus Android-only API replacement strategy and expect/actual/platform-source-set plan.
23
+ purpose: Planning and dependency/platform gateSPEC deltas, source-to-target map, capability map, ready_for_implementation.
24
24
  skills: []
25
25
  tools: [rg]
26
- - id: presentation-integration
26
+ - id: migration-prep
27
27
  kind: ai_agent
28
- purpose: Presentation integration ownertheme/design tokens, resources, online media modeling, navigation routes, presentation gaps, and UI handoff.
28
+ purpose: Presentation and state/data prep — tokens, resources, routes, state/models/API expectations.
29
29
  skills: []
30
30
  tools: [rg, curl]
31
- - id: state-data-prep
31
+ - id: module-implementation
32
32
  kind: ai_agent
33
- purpose: State and data preparation ownerstate holders, DTO/domain/UI models, mappers, API/data contract expectations, and logic handoff.
34
- skills: []
35
- tools: [rg]
36
- - id: ui-implementation
37
- kind: ai_agent
38
- purpose: UI implementation owner — migrated Compose UI layout/components/states/resources first, with binding surfaces and no business logic.
39
- skills: []
40
- tools: [rg]
41
- - id: logic-implementation
42
- kind: ai_agent
43
- purpose: Logic implementation owner — repositories/use cases/API integration/state propagation/business logic bound to approved UI surfaces.
33
+ purpose: UI and logic implementation by mode ui first, then logic after UI approval.
44
34
  skills: []
45
35
  tools: [rg]
46
36
  - id: module-node-review-fix
47
37
  kind: ai_agent
48
- purpose: Review/fix owner with strict modes — read-only review or scoped fix for one module/node slice; fresh re-review required after every fix.
38
+ purpose: Review or scoped fix by mode; fresh re-review after every fix.
49
39
  skills: []
50
40
  tools: [rg, git]
51
41
  - id: migration-verification
52
42
  kind: ai_agent
53
- purpose: Verification owner source-set, API contract, UI render/fidelity, and incremental build checks with stable check IDs and routed failures.
43
+ purpose: Module static checks + UI/logic restoration vs analyst no full project build.
54
44
  skills: []
55
45
  tools: [rg, git]
46
+ - id: global-migration-phase
47
+ kind: ai_agent
48
+ purpose: Global integrate (cross-module wiring) then align (analyst vs target comparison) by mode.
49
+ skills: []
50
+ tools: [rg]
56
51
  - id: completion-report
57
52
  kind: ai_agent
58
- purpose: Completion/report owner with strict modes readiness/rerun/blocker decisions and final migration_report handoff after module/global representations exist.
53
+ purpose: Readiness and migration_report modes; validation handoff to kmp-test-validator.
59
54
  skills: []
60
55
  tools: [rg, git]
61
56
  ---
62
57
 
63
58
  # Android To KMP Migrator Swarm Skill
64
59
 
65
- This is the agent-facing registry and team definition for the `android-to-kmp-migrator` controller. It converts a completed Legacy Android SPEC plus an existing KMP target project into migrated, validation-ready KMP code through a module-first schedule.
60
+ Module-first migrator for Legacy Android KMP target assembly.
66
61
 
67
- The team is a **reduced specialization pipeline (C) with embedded parallel fan-outs (B)**. Role overlap has been collapsed into 10 role definitions; safety is preserved through explicit dispatch modes and strict path contracts. See [ROLE_REDUCTION.md](ROLE_REDUCTION.md) for the old-to-new mapping and merge rationale.
62
+ **Canonical contract**: [output-contract.md](output-contract.md)
68
63
 
69
64
  ## Protocol Summary
70
65
 
71
- 0. **Pre-flight**verify optional dependencies from [dependencies.yaml](dependencies.yaml).
72
- 1. **Trigger + output root** — lock `output_root = <output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator`; write `run_manifest.json`.
73
- 2. **Migration module inventory** write `module-index/migration_module_inventory.json` and `.md`; write each module's `module_brief.json`.
74
- 3. **Workspace state** — initialize and refresh `migration-workspace-state` under `<output_root>/global/node-results/migration-workspace-state/` and module-scoped workspace-state dirs. It records per-module migration progress, finish rate, plan-vs-code gaps, stale outputs, rerun hooks, and next safe actions.
75
- 4. **Per-module planning** — run `migration-analysis-planning`.
76
- 5. **Per-module dependency/platform gate** run `dependency-platform-gate`.
77
- 6. **Per-module prep fan-out** — run `presentation-integration` and `state-data-prep` when inputs allow.
78
- 7. **Review/fix loop** run `module-node-review-fix` in `review` mode; if needed, run `fix` mode; then run a fresh `review`.
79
- 8. **UI then logic** — run `ui-implementation`, review/fix, then `logic-implementation`, review/fix.
80
- 9. **Verification** — run `migration-verification` with required `check_ids`: `source_set`, `api_contract`, `ui_render`, `incremental_build`.
81
- 10. **Completion/report** — run `completion-report` in `readiness` mode, write module/global representations, then run `completion-report` in `report` mode and hand off to `kmp-test-validator`.
66
+ 0. Pre-flight — [dependencies.yaml](dependencies.yaml): `rg` / `git` / `curl`, optional `jetbrains` MCP (`optional_mcp`), upstream analyst **P6** (`upstream_inputs`); record `dependency_preflight` in `run_manifest.json`.
67
+ 1. Verify analyst **P6**; `run_manifest.json`, `upstream_analyst_index.json`.
68
+ 2. Migration inventory + `modules_migration_index.json`.
69
+ 3. Workspace state init.
70
+ 4. TPA `global_baseline`.
71
+ 5. **Per module** (assembly_order): TPA `module_anchors` → **planning-gate** **prep** → review/fix → **implementation `ui`** → review/fix → **implementation `logic`** → review/fix → verification → completion record → readiness → module representation.
72
+ 6. **Global phase `integrate`** **`align`** + alignment report.
73
+ 7. Global representation + completion-report `report` mode.
74
+ 8. **kmp-test-validator** when **V0** ready.
82
75
 
83
76
  ## Roles
84
77
 
85
- Each node is dispatched as a subagent that must read its role file (`skill_spec_path`), paste its `## Inline Persona for Teammate` into the dispatch prompt, and execute only that bounded slice.
86
-
87
- | id | Purpose | When dispatched | Role file |
88
- |---|---|---|---|
89
- | `migration-workspace-state` | Migration progress ledger, finish rates, plan-vs-code gaps, stale outputs, and rerun hooks | Global and module refreshes after every major stage | [roles/migration-workspace-state.md](roles/migration-workspace-state.md) |
90
- | `migration-analysis-planning` | SPEC deltas, target understanding, alignment | Per-module first stage | [roles/migration-analysis-planning.md](roles/migration-analysis-planning.md) |
91
- | `dependency-platform-gate` | Dependency readiness and platform replacement | Before prep/implementation | [roles/dependency-platform-gate.md](roles/dependency-platform-gate.md) |
92
- | `presentation-integration` | Theme, resources, navigation | Prep fan-out before UI | [roles/presentation-integration.md](roles/presentation-integration.md) |
93
- | `state-data-prep` | State/model/API contract prep | Prep fan-out before logic | [roles/state-data-prep.md](roles/state-data-prep.md) |
94
- | `ui-implementation` | UI-first migrated surface | After prep approval | [roles/ui-implementation.md](roles/ui-implementation.md) |
95
- | `logic-implementation` | Data/API/business logic | After UI approval | [roles/logic-implementation.md](roles/logic-implementation.md) |
96
- | `module-node-review-fix` | Read-only review or scoped fix by mode | After file-changing slices | [roles/module-node-review-fix.md](roles/module-node-review-fix.md) |
97
- | `migration-verification` | Source-set/API/UI/build checks | After implementation approval | [roles/migration-verification.md](roles/migration-verification.md) |
98
- | `completion-report` | Readiness and final report by mode | Module/global completion | [roles/completion-report.md](roles/completion-report.md) |
78
+ | id | Modes | Role file |
79
+ |---|---|---|
80
+ | `migration-workspace-state` | | [roles/migration-workspace-state.md](roles/migration-workspace-state.md) |
81
+ | `target-project-assistant` | `global_baseline`, `module_anchors`, `consult` | [roles/target-project-assistant.md](roles/target-project-assistant.md) |
82
+ | `migration-planning-gate` | | [roles/migration-planning-gate.md](roles/migration-planning-gate.md) |
83
+ | `migration-prep` | | [roles/migration-prep.md](roles/migration-prep.md) |
84
+ | `module-implementation` | `ui`, `logic` | [roles/module-implementation.md](roles/module-implementation.md) |
85
+ | `module-node-review-fix` | `review`, `fix` | [roles/module-node-review-fix.md](roles/module-node-review-fix.md) |
86
+ | `migration-verification` | | [roles/migration-verification.md](roles/migration-verification.md) |
87
+ | `global-migration-phase` | `integrate`, `align` | [roles/global-migration-phase.md](roles/global-migration-phase.md) |
88
+ | `completion-report` | `readiness`, `report` | [roles/completion-report.md](roles/completion-report.md) |
99
89
 
100
90
  ## Files
101
91
 
102
- | File | What it contains |
92
+ | File | Contents |
103
93
  |---|---|
104
- | [ROLE_REDUCTION.md](ROLE_REDUCTION.md) | Reduced role analysis, old-to-new map, dispatch order, mode boundaries |
105
- | [workflow.md](workflow.md) | Mermaid topology, staged protocol, gates, final report format |
106
- | [bind.md](bind.md) | Resource limits, behavioral constraints, failure handling, path contract |
107
- | [roles/](roles/) | Active reduced role specs |
108
- | [dependencies.yaml](dependencies.yaml) | Optional CLI tools checked at startup |
94
+ | [output-contract.md](output-contract.md) | Paths, upstream P6, packages M0–V0 |
95
+ | [workflow.md](workflow.md) | Topology, steps, gates |
96
+ | [bind.md](bind.md) | Limits, constraints, failures |
97
+ | [dependencies.yaml](dependencies.yaml) | CLI + optional MCP per role |
98
+ | [roles/](roles/) | Role specs |
109
99
 
110
- ## Strict Output Schedule
100
+ ## Handoff Gates
111
101
 
112
- ```text
113
- output_root = <output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator
114
- module_index_dir = <output_root>/module-index
115
- module_root = <output_root>/modules/<migration_module_id>
116
- node_result_dir = <module_root>/node-results/<node_id>
117
- module_representation_dir = <module_root>/representation
118
- global_dir = <output_root>/global
119
- report_dir = <output_root>/report
120
- ```
121
-
122
- Required artifacts:
123
-
124
- - `<output_root>/run_manifest.json`
125
- - `<module_index_dir>/migration_module_inventory.json`
126
- - `<module_index_dir>/migration_module_inventory.md`
127
- - `<global_dir>/node-results/migration-workspace-state/migration_workspace_state.json`
128
- - `<global_dir>/node-results/migration-workspace-state/migration_workspace_state.md`
129
- - `<module_root>/module_brief.json`
130
- - `<module_root>/node-results/migration-workspace-state/migration_workspace_state.json`
131
- - `<module_root>/node-results/migration-workspace-state/migration_workspace_state.md`
132
- - `<node_result_dir>/<node-specific>.json`
133
- - `<node_result_dir>/<node-specific>.md`
134
- - `<module_representation_dir>/module_migration_representation.json`
135
- - `<module_representation_dir>/module_migration_representation.md`
136
- - `<global_dir>/global_migration_representation.json`
137
- - `<global_dir>/global_migration_representation.md`
138
- - `<report_dir>/migration_report.json`
139
- - `<report_dir>/migration_report.md`
140
-
141
- ## Output Artifact Content Matrix
142
-
143
- The controller verifies both artifact names and role-aligned content before a downstream stage consumes any file.
144
-
145
- | Stage / owner | Output file(s) | Required content |
146
- |---|---|---|
147
- | Output root lock / Leader | `run_manifest.json` | Migration trigger, Android/SPEC inputs, KMP target path, migration scope, output root, allowed roots, dependency-preflight status, schedule version, timestamp. |
148
- | Module inventory / Leader | `migration_module_inventory.json`, `migration_module_inventory.md` | Deterministic migration module list/order, `migration_module_id`, module scope, UI/logic/data/resource scope, target placement hints, allowed target files/source sets, module output roots, blockers. |
149
- | Module brief / Leader | `module_brief.json` | One module's dispatch contract: module id/scope, source/SPEC evidence paths, target hints, allowed files/source sets, expected node schedule, representation path, assumptions. |
150
- | Workspace progress / `migration-workspace-state` | `migration_workspace_state.json`, `migration_workspace_state.md` | Per-module migration status, finish rates, stage status, node status, changed-file ownership, plan-vs-code gaps, stale outputs, rerun hooks, blocker/rerun history, next safe actions. |
151
- | Planning / `migration-analysis-planning` | `migration_analysis_planning.json`, `migration_analysis_planning.md` | SPEC/raw-source deltas, target KMP understanding, reuse inventory, source-to-target map, resource project map, integration scaffold, ordered implementation tasks, blockers. |
152
- | Dependency/platform / `dependency-platform-gate` | `dependency_platform_gate.json`, `dependency_platform_gate.md` | Required capability map, minimal-change dependency decisions, build-config changes, platform capability boundaries, expect/actual/source-set plan, changed files, implementation constraints, blockers. |
153
- | Presentation prep / `presentation-integration` | `presentation_integration.json`, `presentation_integration.md` | Theme/design-token mapping, target component/resource reuse, local/online media modeling, route/navigation mapping, UI handoff, changed files, presentation gaps, blockers. |
154
- | State/data prep / `state-data-prep` | `state_data_prep.json`, `state_data_prep.md` | State holder mapping, UI state/events/effects, DTO/domain/UI model mapping, mappers, API/data contract expectations, logic handoff, changed files, blockers. |
155
- | UI implementation / `ui-implementation` | `ui_implementation.json`, `ui_implementation.md` | Migrated visible UI surface, changed UI/resource files, UI coverage, fidelity notes, binding surfaces, diagnostics, blockers. |
156
- | Logic implementation / `logic-implementation` | `logic_implementation.json`, `logic_implementation.md` | Implemented behavior/data/API/state propagation, architecture alignment, platform boundaries, data flows, API integrations, logic coverage, changed files, diagnostics, blockers. |
157
- | Review mode / `module-node-review-fix` | `module_node_review.json`, `module_node_review.md` | Read-only review of one owning node slice: reviewed files, contract/scope/parity/source-set/dependency findings, approval or `needs_fix`, blockers. |
158
- | Fix mode / `module-node-review-fix` | `module_node_fix.json`, `module_node_fix.md` | Scoped fix report for explicit findings: fixed/unfixed findings, changed files, `requires_re_review: true`, blockers. |
159
- | Verification / `migration-verification` | `migration_verification.json`, `migration_verification.md`, optional log files | `source_set`, `api_contract`, `ui_render`, and `incremental_build` check results, evidence, failures, routed owner nodes, command/log paths, blockers. |
160
- | Readiness / `completion-report` | `completion_readiness.json`, `completion_readiness.md` | Requirement coverage, migration invariants, review/verification completion, rerun requests, blockers, readiness for representation/report gates. |
161
- | Module representation / Leader | `module_migration_representation.json`, `module_migration_representation.md` | Module synthesis from verified node outputs only: source-to-target mapping, changed files by role, UI/state/data/logic/platform coverage, verification evidence, gaps, readiness. |
162
- | Global representation / Leader | `global_migration_representation.json`, `global_migration_representation.md` | Cross-module migration synthesis from module representations only: global target changes, shared files/ownership, coverage, unresolved blockers, validation handoff prerequisites. |
163
- | Final report / `completion-report` | `migration_report.json`, `migration_report.md` | Validation-ready migration handoff: source/target paths, scope, module/global representation paths, changed files by role, source-to-target summary, coverage summary, validation inputs, limitations, manual steps, blockers. |
164
-
165
- JSON artifacts are the machine-routable source of truth. Markdown artifacts are agent-readable handoffs that preserve exact paths, evidence, commands/logs where applicable, changed-file ownership, rerun context, blockers, and next-node routing. Node Markdown must not be a prose-only completion summary.
166
-
167
- ## Shared Return Shape
168
-
169
- ```json
170
- {
171
- "status": "completed | passed | ready_for_implementation | ready_for_validation | needs_rerun | failed | blocked",
172
- "node": "<node-name>",
173
- "mode": "<mode when role has modes>",
174
- "migration_module_id": "<module id or global>",
175
- "module_scope": "<module/screen/feature/resource/API scope or global>",
176
- "output_dir": "<exact node_result_dir>",
177
- "output_files": ["<paths>"],
178
- "changed_files": ["<paths or empty>"],
179
- "stale_upstream_inputs": ["<paths or empty>"],
180
- "rerun_requests": [{ "node": "<responsible-node>", "reason": "", "required_inputs": [], "expected_output": "" }],
181
- "blocking_gaps": ["<gaps or empty>"]
182
- }
183
- ```
184
-
185
- Controller handling: missing/empty `output_files` -> rerun the same node; non-empty `stale_upstream_inputs` -> refresh upstream artifacts then rerun; non-empty `rerun_requests` or `migration-workspace-state.rerun_hooks` -> dispatch the responsible node first; unresolved `blocking_gaps` -> stop with a user-visible blocker. Downstream stages may consume a module only when the latest workspace-state progress record does not mark its required stage stale, blocked, failed, or missing review/verification.
102
+ | Package | Unlocks |
103
+ |---|---|
104
+ | `M2` | Target alignment (TPA) |
105
+ | `M3` | Per-module complete |
106
+ | `M4` | All modules migrated |
107
+ | `M5` | Global integrate |
108
+ | `M6` | Global align passed |
109
+ | `V0` | kmp-test-validator |
186
110
 
187
111
  ## Shared Rules
188
112
 
189
- - Each node must read its own role file before work and stay inside its responsibility boundary.
190
- - Consolidated roles must respect `mode`; do not combine review and fix in one invocation.
191
- - `migration-workspace-state` must be refreshed after inventory, planning, dependency/platform, prep fan-out, every review/fix loop, UI implementation, logic implementation, verification, readiness, module representation, global representation, and report. Its `module_progress`, `plan_code_gaps`, and `rerun_hooks` are routing inputs, not optional summaries.
192
- - Every important claim must include evidence from source paths, SPEC sections, upstream node outputs, or module/global representations.
193
- - The controller must not substitute itself for node implementation.
194
- - Target conventions and reusable modules/components take priority over new abstractions.
195
- - Target build config is read-only except through `dependency-platform-gate`.
196
- - Migrated code stays inside one KMP target project; raw Legacy Android source wins when SPEC conflicts.
113
+ - Analyst **P6** required; TPA owns all target Q&A.
114
+ - Mode boundaries non-negotiable: `ui`/`logic`, `integrate`/`align`, `review`/`fix`.
115
+ - No full project build in migrator.
116
+ - JSON artifacts are machine-routable source of truth.