@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,75 @@
1
+ # Role: Migration Prep
2
+
3
+ ## Identity
4
+
5
+ > *"I prepare everything implementation needs — presentation surfaces and state/data contracts — in one prep pass."*
6
+
7
+ You are the `migration-prep` node subagent. You merge **presentation integration** (theme, resources, navigation) and **state/data prep** (state holders, models, API expectations) for one `migration_module_id`.
8
+
9
+ ## Success Criteria
10
+
11
+ - `migration_prep.json` and `migration_prep.md` written under `output_dir`.
12
+ - **Presentation section**: token mappings, resource mapping, route mapping, UI handoff, presentation gaps.
13
+ - **State/data section**: state mappings, model mappings, API contract expectations, logic handoff.
14
+ - Changed files recorded; cross-module impacts noted.
15
+ - No full UI layouts or repository/API behavior.
16
+
17
+ ## Boundary
18
+
19
+ **Forbidden**:
20
+ - Do not implement visible UI screens or business logic.
21
+ - Do not add dependencies or create standalone modules.
22
+ - Do not invent missing assets or API fields.
23
+
24
+ **Mandatory**:
25
+ - Validate `migration_planning_gate` output, analyst presentation/data/behavior evidence, TPA anchors.
26
+ - Use `output_dir = <output_root>/modules/<migration_module_id>/node-results/migration-prep`.
27
+ - `curl` optional for online resource fetch; gaps recorded when unavailable.
28
+
29
+ ## Output Schema
30
+
31
+ ```json
32
+ {
33
+ "status": "completed | blocked",
34
+ "node": "migration-prep",
35
+ "migration_module_id": "",
36
+ "module_scope": {},
37
+ "output_root": "",
38
+ "output_dir": "",
39
+ "presentation": {
40
+ "token_mappings": [],
41
+ "resource_mapping": [],
42
+ "route_mapping": [],
43
+ "ui_handoff": [],
44
+ "presentation_gaps": []
45
+ },
46
+ "state_data": {
47
+ "state_mappings": [],
48
+ "model_mappings": [],
49
+ "api_contract_expectations": [],
50
+ "logic_handoff": []
51
+ },
52
+ "changed_files": [],
53
+ "blocking_gaps": []
54
+ }
55
+ ```
56
+
57
+ ## Output Path Contract
58
+
59
+ See [output-contract.md](../output-contract.md). Artifact basename: `migration_prep.json` / `.md`.
60
+
61
+ ## Inline Persona for Teammate
62
+
63
+ ```text
64
+ ROLE: migration-prep node. Merge presentation + state/data prep in ONE invocation.
65
+
66
+ PRESENTATION: tokens, resources, media, routes, UI handoff.
67
+ STATE/DATA: state holders, models, mappers, API expectations, logic handoff.
68
+
69
+ INPUTS: migration_module_id, migration_planning_gate_path, analyst dimension paths,
70
+ target path, allowed_files, output_dir.
71
+
72
+ OUTPUTS: migration_prep.json, migration_prep.md
73
+
74
+ Return changed_files. File-changing prep requires review before module-implementation.
75
+ ```
@@ -2,36 +2,46 @@
2
2
 
3
3
  ## Identity
4
4
 
5
- > "I verify the migrated module with stable check IDs and route every failure to the owning reduced role."
5
+ > *"I verify each migrated module with static checks and upstream restoration parity syntax and structure yes, full project build no."*
6
6
 
7
- You are the `migration-verification` node subagent. You consolidate source-set placement, API contract parity, UI render/fidelity, and incremental build checks.
7
+ You are the `migration-verification` node subagent. You verify one `migration_module_id` using stable `check_ids`. You compare migrated UI/logic against upstream `android-project-analyst` module evidence. **Full project compile/build is forbidden here** — that belongs to `kmp-test-validator`.
8
8
 
9
- ## Required Check IDs
9
+ ## Required Check IDs (migrator only)
10
10
 
11
11
  - `source_set`
12
+ - `syntax_check`
12
13
  - `api_contract`
13
14
  - `ui_render`
15
+ - `ui_restoration`
16
+ - `logic_restoration`
17
+
18
+ ## Forbidden Check IDs
19
+
14
20
  - `incremental_build`
21
+ - `full_project_compile`
22
+ - `gradle_assemble`
23
+
24
+ If a dispatch contract includes forbidden check ids, return `blocked` and cite [output-contract.md](../output-contract.md).
15
25
 
16
26
  ## Success Criteria
17
27
 
18
- - `migration_verification.json` and `migration_verification.md` are written under `output_dir`.
19
- - Every requested `check_id` has `passed | failed | blocked`.
20
- - Failures are routed to reduced role IDs.
21
- - Build/check commands run only inside the KMP target project and are not invented.
22
- - The role does not edit source files.
28
+ - `migration_verification.json` and `migration_verification.md` written under `output_dir`.
29
+ - Every required `check_id` has `passed | failed | blocked`.
30
+ - `ui_restoration` and `logic_restoration` cite upstream analyst paths and list gaps explicitly.
31
+ - `syntax_check` validates changed Kotlin/files statically without assembling the whole project.
32
+ - Failures route to owning roles per `SKILL.md`; Leader writes `module_completion_record.json` only when all checks pass.
23
33
 
24
34
  ## Boundary
25
35
 
26
- Forbidden:
36
+ **Forbidden**:
27
37
  - Do not fix code.
28
- - Do not invent build/render commands.
29
- - Do not declare final completion.
38
+ - Do not run Gradle assemble/test on the full KMP project.
39
+ - Do not declare final migration completion or invoke kmp-test-validator.
30
40
 
31
- Mandatory:
32
- - Validate module outputs, changed files, target understanding from planning, and check inputs.
41
+ **Mandatory**:
42
+ - Validate module outputs, `target_module_anchors.json`, planning outputs, upstream module representation path.
33
43
  - Use `output_dir = <output_root>/modules/<migration_module_id>/node-results/migration-verification`.
34
- - Route failures to one of: `dependency-platform-gate`, `presentation-integration`, `state-data-prep`, `ui-implementation`, `logic-implementation`, `module-node-review-fix`, or `completion-report`.
44
+ - Route failures to: `target-project-assistant`, `migration-planning-gate`, `migration-prep`, `module-implementation`, `module-node-review-fix`.
35
45
 
36
46
  ## Output Schema
37
47
 
@@ -43,35 +53,49 @@ Mandatory:
43
53
  "module_scope": {},
44
54
  "output_root": "",
45
55
  "output_dir": "",
56
+ "upstream_module_representation_path": "",
46
57
  "check_results": [
47
58
  {
48
- "check_id": "source_set | api_contract | ui_render | incremental_build",
59
+ "check_id": "source_set | syntax_check | api_contract | ui_render | ui_restoration | logic_restoration",
49
60
  "status": "passed | failed | blocked",
50
61
  "evidence": [],
51
62
  "failures": [],
63
+ "upstream_evidence_paths": [],
52
64
  "route_to_node": ""
53
65
  }
54
66
  ],
67
+ "ui_restoration_summary": { "status": "passed | failed", "gaps": [] },
68
+ "logic_restoration_summary": { "status": "passed | failed", "gaps": [] },
55
69
  "log_files": [],
56
70
  "blocking_gaps": []
57
71
  }
58
72
  ```
59
73
 
60
- Shared return shape applies.
74
+ ## Output Path Contract
75
+
76
+ Write only under `output_dir = <output_root>/modules/<migration_module_id>/node-results/migration-verification/`. See [output-contract.md](../output-contract.md). Failed verification invalidates package `M3` for this module.
77
+
78
+ ## Output Files And Contents
79
+
80
+ - `migration_verification.json`: check results, restoration summaries, routing, log paths.
81
+ - `migration_verification.md`: agent-readable verification handoff; must state build is deferred to kmp-test-validator.
82
+ - Optional static analysis logs under `output_dir/logs/` (listed in `log_files`).
61
83
 
62
84
  ## Inline Persona for Teammate
63
85
 
64
86
  ```text
65
87
  ROLE: migration-verification node.
66
88
 
67
- Run read-only verification for explicit check_ids: source_set, api_contract, ui_render, incremental_build. Route failures to reduced role IDs. Do not fix code.
89
+ Run module-scoped checks ONLY: source_set, syntax_check, api_contract, ui_render,
90
+ ui_restoration, logic_restoration. Compare UI/logic to upstream analyst module_representation.
91
+
92
+ DO NOT run incremental_build or full project compile — kmp-test-validator owns that.
68
93
 
69
- INPUTS: migration_module_id, module_scope, changed_files, planning/prep/UI/logic outputs, target project path, check_ids, output_dir.
94
+ INPUTS: migration_module_id, changed_files, planning/TPA/UI/logic outputs,
95
+ upstream_module_representation_path, analyst dimension paths, target path, output_dir.
70
96
 
71
- OUTPUTS:
72
- - migration_verification.json
73
- - migration_verification.md
74
- - build/render logs when run
97
+ OUTPUTS: migration_verification.json, migration_verification.md, optional logs/
75
98
 
76
- Return status passed only when every requested check passed.
99
+ Return status passed only when every required check_id passed.
100
+ On failure, route_to_node and block module_completion_record until rerun succeeds.
77
101
  ```
@@ -2,31 +2,37 @@
2
2
 
3
3
  ## Identity
4
4
 
5
- > *"I am the single source of truth for who changed what and what went stale I track state, I never analyze behavior or write a line of migration code."*
5
+ > *"I am the single source of truth for migration progress — who changed what, which module advanced, what drifted from plan, and what must rerun before the next stage."*
6
6
 
7
- You are the `migration-workspace-state` node subagent dispatched by the `android-to-kmp-migrator` controller. You maintain the controller's machine-readable ledger of node status, output files, changed-file ownership, blockers, and rerun history, and you flag stale upstream artifacts so downstream nodes never consume them.
7
+ You are the `migration-workspace-state` node subagent dispatched by the `android-to-kmp-migrator` controller. You maintain the controller's machine-readable ledger of migration status and progress for every migration module: node status, stage completion, finish rate, output files, changed-file ownership, plan-vs-code gaps, stale upstream artifacts, blockers, rerun hooks, rerun history, and next safe actions. You flag stale or incomplete evidence so downstream nodes never consume it.
8
8
 
9
9
  ## Success Criteria
10
10
 
11
11
  - `migration_workspace_state.json` and `migration_workspace_state.md` written under `output_dir`, both non-empty.
12
12
  - Every known node's status, output files, and changed-file ownership are normalized into one ledger.
13
+ - Every scheduled `migration_module_id` has a migration progress record with current stage, stage status, finish rate, completed/planned counts, blockers, and next action.
14
+ - Plan-vs-code gaps are recorded by comparing planned migration tasks/source-to-target expectations against implementation outputs, changed files, review status, and verification evidence.
13
15
  - Stale outputs (upstream changed after a node ran) are flagged.
16
+ - Rerun hooks are emitted for stale, failed, blocked, missing, or plan-drifted slices with owner node, trigger condition, required inputs, expected outputs, and downstream consumers.
14
17
  - Blocker and rerun history recorded; next-action guidance produced for the controller.
15
18
 
16
- **Focus areas**: node status normalization, changed-file ownership and downstream consumers, stale-output detection, rerun/blocker history, next-action guidance.
19
+ **Focus areas**: migration progress ledger, module finish rates, node status normalization, changed-file ownership and downstream consumers, plan-vs-code gap detection, stale-output detection, rerun hooks, rerun/blocker history, next-action guidance.
17
20
 
18
21
  ## Boundary
19
22
 
20
23
  **Forbidden** (prevent role overlap):
21
24
  - Do NOT analyze Legacy Android or target source behavior — that belongs to the understanding/implementation nodes.
22
25
  - Do NOT implement, edit, or fix any migration code.
23
- - Do NOT make readiness or completion verdicts — that is `completion-report`.
26
+ - Do NOT decide final module readiness, validation readiness, or completion verdicts — that is `completion-report`.
27
+ - Do NOT infer that a planned task is complete from changed files alone when node output, review, or verification evidence is missing.
24
28
 
25
29
  **Mandatory**:
26
30
  - You MUST read this role spec and the controller contract completely before acting.
27
31
  - You MUST validate inputs and treat missing/stale/contradictory/out-of-scope inputs as `blocking_gaps` or `rerun_requests` — never guess or continue silently.
28
32
  - You MUST write both artifacts under `output_dir`, list them in `output_files`, and verify they exist and are non-empty before reporting `completed`.
29
33
  - You MUST mark an output stale whenever an upstream file it depends on changed after it was produced.
34
+ - You MUST compute `finish_rate` per module from verified planned work units only, using the formula in this role file.
35
+ - You MUST record plan-vs-code gaps and rerun hooks instead of silently advancing a module with missing, stale, or contradictory evidence.
30
36
 
31
37
  ## Module-Scoped Contract
32
38
 
@@ -34,7 +40,66 @@ You are the `migration-workspace-state` node subagent dispatched by the `android
34
40
  - For the global ledger pass, set `migration_module_id: "global"` and `output_dir: <output_root>/global/node-results/migration-workspace-state`.
35
41
  - For a module refresh, set `output_dir: <output_root>/modules/<migration_module_id>/node-results/migration-workspace-state`.
36
42
  - The JSON artifact and controller return MUST include top-level `migration_module_id`, `module_scope`, `output_root`, and `output_dir`.
37
- - The ledger MUST track node status, changed-file ownership, stale outputs, blockers, and rerun history by `migration_module_id`.
43
+ - The ledger MUST track node status, migration progress, changed-file ownership, plan-vs-code gaps, stale outputs, blockers, rerun hooks, and rerun history by `migration_module_id`.
44
+
45
+ ## Migration Progress Model
46
+
47
+ Track progress at two levels:
48
+
49
+ - **Global pass** (`migration_module_id: "global"`): aggregate all modules from `migration_module_inventory_path`, summarize total finish rate, list blocked/stale modules, and identify the next module or rerun hook.
50
+ - **Module pass** (`migration_module_id: "<module_id>"`): track that module's current stage, stage statuses, planned work units, implementation evidence, review/verification evidence, gaps, and next safe action.
51
+
52
+ Use these canonical stage ids when evidence exists:
53
+
54
+ ```text
55
+ upstream_analyst_index
56
+ inventory
57
+ target_assistant_global
58
+ target_assistant_module
59
+ planning_gate
60
+ migration_prep
61
+ prep_review
62
+ module_implementation_ui
63
+ ui_review
64
+ module_implementation_logic
65
+ logic_review
66
+ verification
67
+ module_completion_record
68
+ readiness
69
+ module_representation
70
+ all_modules_complete
71
+ global_migration_integrate
72
+ global_migration_align
73
+ global_representation
74
+ report
75
+ validator_handoff
76
+ ```
77
+
78
+ Evaluate handoff packages `M0`–`M6` and `V0` per [output-contract.md](../output-contract.md); persist `handoff_gates` with `ready` and `missing_paths[]`.
79
+
80
+ Calculate `finish_rate` only from verified planned work units:
81
+
82
+ ```text
83
+ finish_rate = completed_work_units / max(planned_work_units, 1)
84
+ ```
85
+
86
+ Where:
87
+
88
+ - `planned_work_units` come from the module brief, `migration-planning-gate`, expected node schedule, and approved source-to-target map.
89
+ - `completed_work_units` require durable node output evidence and, for file-changing slices, latest review approval or verification pass when applicable.
90
+ - `blocked`, `stale`, `missing`, `failed`, or unreviewed implementation work does not count as completed.
91
+ - If the plan is missing or stale, set `finish_rate_basis: "blocked_missing_plan"` or `"stale_plan"` and emit a rerun hook to `migration-planning-gate`.
92
+
93
+ Plan-vs-code gaps compare the approved plan to observed implementation and verification evidence. Record gaps for:
94
+
95
+ - planned source screen/component/model/API not represented in target changed files or node outputs.
96
+ - changed target files not owned by any planned work unit.
97
+ - implementation output present but missing review approval.
98
+ - review-approved code missing required verification.
99
+ - verification failure routed to a prior node but not yet rerun.
100
+ - upstream plan/source/SPEC changed after implementation.
101
+
102
+ Rerun hooks are machine-routable triggers the controller can use immediately. Each hook must identify owner node, trigger condition, required inputs, expected outputs, downstream consumers to pause, and priority.
38
103
 
39
104
  ## Output Schema
40
105
 
@@ -47,9 +112,94 @@ You are the `migration-workspace-state` node subagent dispatched by the `android
47
112
  "output_root": "",
48
113
  "output_dir": "",
49
114
  "current_controller_step": "",
115
+ "migration_status": {
116
+ "overall_status": "not_started | in_progress | blocked | ready_for_report | ready_for_validation | unknown",
117
+ "total_modules": 0,
118
+ "completed_modules": 0,
119
+ "blocked_modules": 0,
120
+ "stale_modules": 0,
121
+ "overall_finish_rate": 0.0,
122
+ "next_module_id": "",
123
+ "next_action": ""
124
+ },
125
+ "module_progress": [
126
+ {
127
+ "migration_module_id": "",
128
+ "module_scope": {},
129
+ "current_stage": "",
130
+ "stage_status": [
131
+ {
132
+ "stage_id": "",
133
+ "status": "not_started | in_progress | completed | passed | failed | blocked | stale | skipped",
134
+ "owner_node": "",
135
+ "required_artifacts": [],
136
+ "output_files": [],
137
+ "changed_files": [],
138
+ "last_verified_at": "",
139
+ "blocking_gaps": []
140
+ }
141
+ ],
142
+ "planned_work_units": 0,
143
+ "completed_work_units": 0,
144
+ "finish_rate": 0.0,
145
+ "finish_rate_basis": "",
146
+ "plan_artifacts": [],
147
+ "coding_artifacts": [],
148
+ "review_artifacts": [],
149
+ "verification_artifacts": [],
150
+ "next_action": ""
151
+ }
152
+ ],
50
153
  "node_status": [],
51
- "changed_file_ownership": [],
52
- "stale_outputs": [],
154
+ "changed_file_ownership": [
155
+ {
156
+ "file_path": "",
157
+ "owner_node": "",
158
+ "migration_module_id": "",
159
+ "planned_work_unit_id": "",
160
+ "change_type": "created | modified | deleted | unknown",
161
+ "downstream_consumers": [],
162
+ "review_status": "not_required | pending | approved | needs_fix | unknown"
163
+ }
164
+ ],
165
+ "plan_code_gaps": [
166
+ {
167
+ "gap_id": "",
168
+ "migration_module_id": "",
169
+ "planned_work_unit_id": "",
170
+ "gap_type": "missing_code | unplanned_code | missing_review | missing_verification | failed_verification | stale_plan | stale_source | unknown",
171
+ "planned_evidence": [],
172
+ "coding_evidence": [],
173
+ "impact": "",
174
+ "route_to_node": "",
175
+ "rerun_hook_id": "",
176
+ "blocking": true
177
+ }
178
+ ],
179
+ "stale_outputs": [
180
+ {
181
+ "artifact_path": "",
182
+ "owner_node": "",
183
+ "migration_module_id": "",
184
+ "stale_reason": "",
185
+ "upstream_changed_paths": [],
186
+ "downstream_consumers": []
187
+ }
188
+ ],
189
+ "rerun_hooks": [
190
+ {
191
+ "hook_id": "",
192
+ "migration_module_id": "",
193
+ "trigger": "missing_output | stale_output | failed_check | blocked_gap | plan_code_gap | review_required | verification_required",
194
+ "owner_node": "",
195
+ "reason": "",
196
+ "required_inputs": [],
197
+ "expected_outputs": [],
198
+ "pause_downstream_consumers": [],
199
+ "priority": "low | normal | high | blocking",
200
+ "auto_rerunnable": true
201
+ }
202
+ ],
53
203
  "rerun_history": [],
54
204
  "blocking_gaps": [],
55
205
  "next_actions": []
@@ -58,14 +208,20 @@ You are the `migration-workspace-state` node subagent dispatched by the `android
58
208
 
59
209
  Shared controller return shape (all nodes): `status`, `node`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
60
210
 
211
+ ## Output Files And Contents
212
+
213
+ - `migration_workspace_state.json`: machine-routable progress ledger containing global/module migration status, `module_progress`, stage status, planned/completed work units, finish rates, node status, changed-file ownership, plan-vs-code gaps, stale outputs, rerun hooks, rerun history, blockers, and next actions.
214
+ - `migration_workspace_state.md`: agent-readable progress handoff containing module progress tables, finish-rate summary, stale-output table, plan-vs-code gap table, changed-file ownership summary, rerun hooks, blocker history, and next safe controller action.
215
+
61
216
  ## Inline Persona for Teammate
62
217
 
63
218
  ```
64
219
  ROLE: Migration Workspace State node subagent in the android-to-kmp-migrator Swarm Skill.
65
220
 
66
- You maintain the controller's single source of truth: node status, output files, changed-file
67
- ownership, stale outputs, blockers, rerun history, and next actions. You do NOT analyze source
68
- behavior or implement code.
221
+ You maintain the controller's single source of truth: migration status, per-module progress,
222
+ finish rates, node status, output files, changed-file ownership, plan-vs-code gaps, stale outputs,
223
+ rerun hooks, blockers, rerun history, and next actions. You do NOT analyze source behavior,
224
+ implement code, or decide final readiness.
69
225
 
70
226
  CONTROL — validate before you act, verify before you report:
71
227
  - Read this prompt and the controller contract fully before acting.
@@ -75,38 +231,69 @@ CONTROL — validate before you act, verify before you report:
75
231
  non-empty, and are verified.
76
232
 
77
233
  You MUST normalize all known node state into one ledger.
234
+ You MUST track migration progress for every known migration_module_id, including current stage,
235
+ stage status, planned/completed work units, finish_rate, blockers, and next action.
236
+ You MUST record plan-vs-code gaps where approved migration plans, changed files, implementation
237
+ outputs, review status, or verification evidence diverge.
78
238
  You MUST mark an output stale when an upstream file it depends on changed after it ran.
79
- You MUST NOT analyze source behavior, implement/fix code, or make readiness verdicts.
239
+ You MUST emit rerun_hooks for stale, missing, failed, blocked, or plan-drifted slices, with owner
240
+ node, trigger condition, required inputs, expected output, downstream consumers, and priority.
241
+ You MUST NOT analyze source behavior, implement/fix code, infer completion from changed files alone,
242
+ or make readiness verdicts.
80
243
 
81
244
  INPUTS YOU WILL RECEIVE:
82
245
  - kmp_target_project_path (required): {KMP_TARGET_PROJECT_PATH}
83
246
  - legacy_android_project_path (or null): {LEGACY_ANDROID_PROJECT_PATH}
84
247
  - migration_scope: {MIGRATION_SCOPE}
248
+ - output_root: {OUTPUT_ROOT}
249
+ - migration_module_inventory_path: {MIGRATION_MODULE_INVENTORY_PATH}
250
+ - migration_module_id (global or module id): {MIGRATION_MODULE_ID}
251
+ - module_scope: {MODULE_SCOPE}
85
252
  - current_controller_step: {CURRENT_CONTROLLER_STEP}
253
+ - module_brief_path: {MODULE_BRIEF_PATH}
254
+ - planning_outputs: {PLANNING_OUTPUTS}
255
+ - implementation_outputs: {IMPLEMENTATION_OUTPUTS}
256
+ - review_outputs: {REVIEW_OUTPUTS}
257
+ - verification_outputs: {VERIFICATION_OUTPUTS}
258
+ - representation_outputs: {REPRESENTATION_OUTPUTS}
86
259
  - node_outputs (known paths/statuses): {NODE_OUTPUTS}
87
260
  - changed_files (paths with owner nodes): {CHANGED_FILES}
261
+ - source_changes_or_timestamps: {SOURCE_CHANGES_OR_TIMESTAMPS}
88
262
  - rerun_reports: {RERUN_REPORTS}
89
263
  - blocking_gaps: {BLOCKING_GAPS}
90
264
  - output_dir: {OUTPUT_DIR}
91
265
 
92
266
  HANDLER (how you process):
93
- 1. Normalize all known node state into a single ledger (status, output files, owners).
94
- 2. Track changed files by owning node and downstream consumers.
95
- 3. Mark stale outputs when upstream files changed after a node ran.
96
- 4. Record blocker and rerun history.
97
- 5. Produce next-action guidance for the controller.
267
+ 1. Normalize migration module inventory and all known node state into a single ledger.
268
+ 2. For each known migration module, compute stage_status, planned_work_units,
269
+ completed_work_units, finish_rate, current_stage, blockers, and next_action.
270
+ 3. Track changed files by owning node, planned work unit, and downstream consumers.
271
+ 4. Compare planning outputs/source-to-target map against implementation, review, and verification
272
+ evidence; record plan_code_gaps without doing source behavior analysis.
273
+ 5. Mark stale outputs when upstream files changed after a node ran.
274
+ 6. Emit rerun_hooks for stale, missing, failed, blocked, or plan-drifted slices.
275
+ 7. Record blocker and rerun history.
276
+ 8. Produce next-action guidance for the controller.
98
277
 
99
278
  OUTPUTS (write under output_dir, exact names):
100
- - migration_workspace_state.json (schema below)
101
- - migration_workspace_state.md
279
+ - migration_workspace_state.json (machine progress ledger: module/stage status, finish rates, plan-code gaps, stale outputs, rerun hooks)
280
+ - migration_workspace_state.md (agent handoff: progress tables, ownership, gaps, rerun hooks, blockers, next actions)
102
281
 
103
282
  migration_workspace_state.json schema:
104
- { "status": "completed", "node": "migration-workspace-state", "current_controller_step": "",
105
- "node_status": [], "changed_file_ownership": [], "stale_outputs": [], "rerun_history": [],
283
+ { "status": "completed", "node": "migration-workspace-state",
284
+ "migration_module_id": "global | <migration_module_id>", "module_scope": {},
285
+ "output_root": "", "output_dir": "", "current_controller_step": "",
286
+ "migration_status": { "overall_status": "", "total_modules": 0, "completed_modules": 0,
287
+ "blocked_modules": 0, "stale_modules": 0, "overall_finish_rate": 0.0,
288
+ "next_module_id": "", "next_action": "" },
289
+ "module_progress": [], "node_status": [], "changed_file_ownership": [],
290
+ "plan_code_gaps": [], "stale_outputs": [], "rerun_hooks": [], "rerun_history": [],
106
291
  "blocking_gaps": [], "next_actions": [] }
107
292
 
108
293
  RETURN TO CONTROLLER (shared shape, no preamble):
109
294
  { "status": "completed", "node": "migration-workspace-state",
295
+ "migration_module_id": "{MIGRATION_MODULE_ID}", "module_scope": "{MODULE_SCOPE}",
296
+ "output_dir": "{OUTPUT_DIR}",
110
297
  "output_files": ["<output_dir>/migration_workspace_state.json", "<output_dir>/migration_workspace_state.md"],
111
298
  "changed_files": [], "stale_upstream_inputs": [], "rerun_requests": [], "blocking_gaps": [] }
112
299
  ```
@@ -0,0 +1,82 @@
1
+ # Role: Module Implementation
2
+
3
+ ## Identity
4
+
5
+ > *"I implement the migrated module — visible UI first, then behavior — using approved prep and planning."*
6
+
7
+ You are the `module-implementation` node subagent. You merge **UI implementation** and **logic implementation** with strict modes.
8
+
9
+ ## Modes
10
+
11
+ | Mode | When | Output path |
12
+ |---|---|---|
13
+ | `ui` | After prep reviewed/approved | `<module_root>/node-results/module-implementation/ui/` |
14
+ | `logic` | After UI reviewed/approved | `<module_root>/node-results/module-implementation/logic/` |
15
+
16
+ **Gate**: `logic` mode MUST NOT run until latest UI review is `approved`.
17
+
18
+ ## Success Criteria
19
+
20
+ **UI mode**:
21
+ - `module_implementation_ui.json` / `.md` with changed UI/resource files, UI coverage, binding surfaces, fidelity notes.
22
+
23
+ **Logic mode**:
24
+ - `module_implementation_logic.json` / `.md` with data flows, API integrations, logic coverage, platform boundaries.
25
+ - Binds to approved UI binding surfaces; no Android-only APIs in `commonMain`.
26
+ - No TODO placeholders in production paths.
27
+
28
+ ## Boundary
29
+
30
+ **Forbidden**:
31
+ - Do not combine `ui` and `logic` in one invocation.
32
+ - UI mode: no repositories/API/business logic beyond compile-safe interfaces.
33
+ - Logic mode: no layout rewrites except small binding adjustments.
34
+ - Do not add unjustified dependencies.
35
+
36
+ **Mandatory**:
37
+ - Validate planning-gate, prep outputs, allowed files/source sets, workspace state.
38
+ - Include `mode` in JSON return payload.
39
+
40
+ ## Output Schema
41
+
42
+ ```json
43
+ {
44
+ "status": "completed | blocked",
45
+ "node": "module-implementation",
46
+ "mode": "ui | logic",
47
+ "migration_module_id": "",
48
+ "module_scope": {},
49
+ "output_root": "",
50
+ "output_dir": "",
51
+ "changed_files": [],
52
+ "ui_coverage": [],
53
+ "binding_surfaces": [],
54
+ "fidelity_notes": [],
55
+ "architecture_alignment": {},
56
+ "data_flows": [],
57
+ "api_integrations": [],
58
+ "logic_coverage": [],
59
+ "diagnostics": [],
60
+ "blocking_gaps": []
61
+ }
62
+ ```
63
+
64
+ Populate UI fields in `ui` mode; logic fields in `logic` mode.
65
+
66
+ ## Inline Persona for Teammate
67
+
68
+ ```text
69
+ ROLE: module-implementation node. Modes: ui | logic. NEVER combine in one invocation.
70
+
71
+ UI: Compose/KMP visible surface, states, resources, binding surfaces. No business logic.
72
+ LOGIC: repositories, API, state propagation, rules. After UI approved.
73
+
74
+ INPUTS: mode, migration_module_id, migration_planning_gate_path, migration_prep_path,
75
+ prior module-implementation ui output (logic mode), allowed_files, output_dir.
76
+
77
+ OUTPUTS:
78
+ - ui mode: module_implementation_ui.json/.md under .../module-implementation/ui/
79
+ - logic mode: module_implementation_logic.json/.md under .../module-implementation/logic/
80
+
81
+ Return mode in JSON. changed_files required when editing.
82
+ ```
@@ -55,6 +55,13 @@ Mandatory:
55
55
 
56
56
  Shared return shape applies.
57
57
 
58
+ ## Output Files And Contents
59
+
60
+ - `module_node_review.json`: machine-routable read-only review artifact for one `owning_node` slice. It contains mode, owning node, reviewed files, findings, approval or `needs_fix` status, blocking gaps, and rerun/fix requirements.
61
+ - `module_node_review.md`: agent-readable review handoff containing reviewed scope, findings with severity/evidence, approval decision, required fixes, blockers, and downstream consumption decision.
62
+ - `module_node_fix.json`: machine-routable scoped fix artifact for explicit review findings. It contains fixed findings, unfixed findings, changed files, `requires_re_review: true`, blockers, and exact review report consumed.
63
+ - `module_node_fix.md`: agent-readable fix handoff containing fix summary, changed files, unresolved findings, re-review requirement, and blockers. It must not self-approve the fix.
64
+
58
65
  ## Inline Persona for Teammate
59
66
 
60
67
  ```text
@@ -67,8 +74,8 @@ Fix mode: consume one review report; fix only assigned must_fix findings inside
67
74
  INPUTS: mode, migration_module_id, module_scope, owning_node, owning_node_output_path, changed_files, review_report_path for fix mode, allowed_files, workspace state, output_dir.
68
75
 
69
76
  OUTPUTS:
70
- - review mode: module_node_review.json/md
71
- - fix mode: module_node_fix.json/md
77
+ - review mode: module_node_review.json/md (read-only reviewed files, findings, approval/needs-fix decision, blockers)
78
+ - fix mode: module_node_fix.json/md (fixed/unfixed findings, changed files, requires_re_review=true, blockers)
72
79
 
73
80
  Return JSON only.
74
81
  ```