@code-migration/wow-migrator 0.1.1 → 0.1.3

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 (78) hide show
  1. package/package.json +1 -1
  2. package/skills/android-project-analyst/MIGRATION.md +51 -21
  3. package/skills/android-project-analyst/SKILL.md +74 -44
  4. package/skills/android-project-analyst/bind.md +24 -15
  5. package/skills/android-project-analyst/dependencies.yaml +8 -4
  6. package/skills/android-project-analyst/roles/analysis-workspace-state.md +123 -0
  7. package/skills/android-project-analyst/roles/behavior-logic.md +166 -0
  8. package/skills/android-project-analyst/roles/data-contract-flow.md +170 -0
  9. package/skills/android-project-analyst/roles/presentation-resource.md +301 -0
  10. package/skills/android-project-analyst/roles/project-architecture.md +174 -0
  11. package/skills/android-project-analyst/workflow.md +123 -72
  12. package/skills/android-to-kmp-migrator/MIGRATION.md +87 -2
  13. package/skills/android-to-kmp-migrator/SKILL.md +126 -133
  14. package/skills/android-to-kmp-migrator/bind.md +43 -15
  15. package/skills/android-to-kmp-migrator/dependencies.yaml +3 -3
  16. package/skills/android-to-kmp-migrator/roles/completion-report.md +79 -0
  17. package/skills/android-to-kmp-migrator/roles/dependency-platform-gate.md +68 -0
  18. package/skills/android-to-kmp-migrator/roles/logic-implementation.md +71 -0
  19. package/skills/android-to-kmp-migrator/roles/migration-analysis-planning.md +70 -0
  20. package/skills/android-to-kmp-migrator/roles/migration-verification.md +83 -0
  21. package/skills/android-to-kmp-migrator/roles/migration-workspace-state.md +210 -19
  22. package/skills/android-to-kmp-migrator/roles/module-node-review-fix.md +81 -0
  23. package/skills/android-to-kmp-migrator/roles/presentation-integration.md +70 -0
  24. package/skills/android-to-kmp-migrator/roles/state-data-prep.md +68 -0
  25. package/skills/android-to-kmp-migrator/roles/ui-implementation.md +69 -0
  26. package/skills/android-to-kmp-migrator/workflow.md +215 -149
  27. package/skills/kmp-test-validator/MIGRATION.md +44 -3
  28. package/skills/kmp-test-validator/SKILL.md +93 -77
  29. package/skills/kmp-test-validator/bind.md +29 -9
  30. package/skills/kmp-test-validator/dependencies.yaml +3 -3
  31. package/skills/kmp-test-validator/roles/validation-intake-fidelity.md +72 -0
  32. package/skills/kmp-test-validator/roles/validation-plan-gate.md +72 -0
  33. package/skills/kmp-test-validator/roles/validation-remediation.md +14 -9
  34. package/skills/kmp-test-validator/roles/validation-report.md +15 -12
  35. package/skills/kmp-test-validator/roles/validation-test-runner.md +67 -0
  36. package/skills/kmp-test-validator/roles/validation-workspace-state.md +9 -4
  37. package/skills/kmp-test-validator/workflow.md +106 -118
  38. package/skills/migration-task-adapter/MIGRATION.md +49 -0
  39. package/skills/migration-task-adapter/SKILL.md +152 -0
  40. package/skills/migration-task-adapter/bind.md +116 -0
  41. package/skills/migration-task-adapter/dependencies.yaml +26 -0
  42. package/skills/migration-task-adapter/roles/task-reporter.md +134 -0
  43. package/skills/migration-task-adapter/roles/task-understanding-router.md +139 -0
  44. package/skills/migration-task-adapter/roles/workflow-orchestrator.md +145 -0
  45. package/skills/migration-task-adapter/roles/workspace-state-discipline-inspector.md +198 -0
  46. package/skills/migration-task-adapter/workflow.md +183 -0
  47. package/skills/android-project-analyst/roles/android-ecosystem.md +0 -141
  48. package/skills/android-project-analyst/roles/api-list.md +0 -136
  49. package/skills/android-project-analyst/roles/architecture-pattern.md +0 -131
  50. package/skills/android-project-analyst/roles/data-flow.md +0 -143
  51. package/skills/android-project-analyst/roles/logic-understand.md +0 -154
  52. package/skills/android-project-analyst/roles/resource-understand.md +0 -151
  53. package/skills/android-project-analyst/roles/ui-understand.md +0 -136
  54. package/skills/android-to-kmp-migrator/roles/api-contract-parity.md +0 -95
  55. package/skills/android-to-kmp-migrator/roles/dataflow-logic-implementation.md +0 -130
  56. package/skills/android-to-kmp-migrator/roles/dependency-resolution.md +0 -106
  57. package/skills/android-to-kmp-migrator/roles/incremental-build-check.md +0 -105
  58. package/skills/android-to-kmp-migrator/roles/legacy-spec-delta-review.md +0 -104
  59. package/skills/android-to-kmp-migrator/roles/migration-alignment.md +0 -119
  60. package/skills/android-to-kmp-migrator/roles/migration-report.md +0 -108
  61. package/skills/android-to-kmp-migrator/roles/module-node-migration-fix.md +0 -111
  62. package/skills/android-to-kmp-migrator/roles/module-node-migration-review.md +0 -108
  63. package/skills/android-to-kmp-migrator/roles/navigation-migration.md +0 -104
  64. package/skills/android-to-kmp-migrator/roles/platform-api-replacement.md +0 -104
  65. package/skills/android-to-kmp-migrator/roles/prd-completion-check.md +0 -124
  66. package/skills/android-to-kmp-migrator/roles/resource-migration.md +0 -109
  67. package/skills/android-to-kmp-migrator/roles/source-set-placement-guard.md +0 -95
  68. package/skills/android-to-kmp-migrator/roles/state-model-mapping.md +0 -109
  69. package/skills/android-to-kmp-migrator/roles/target-project-understand.md +0 -118
  70. package/skills/android-to-kmp-migrator/roles/theme-design-system-mapping.md +0 -101
  71. package/skills/android-to-kmp-migrator/roles/ui-mockup-implementation.md +0 -121
  72. package/skills/android-to-kmp-migrator/roles/ui-render-fidelity-check.md +0 -100
  73. package/skills/kmp-test-validator/roles/android-kmp-fidelity-audit.md +0 -102
  74. package/skills/kmp-test-validator/roles/build-preview-gate.md +0 -109
  75. package/skills/kmp-test-validator/roles/kmp-validation-plan.md +0 -108
  76. package/skills/kmp-test-validator/roles/test-case-decomposition.md +0 -103
  77. package/skills/kmp-test-validator/roles/test-execution.md +0 -104
  78. package/skills/kmp-test-validator/roles/validation-input-contract.md +0 -111
@@ -1,203 +1,196 @@
1
1
  ---
2
2
  name: android-to-kmp-migrator
3
3
  description: |
4
- 20-role pipeline Swarm Skill (C+B) that migrates Legacy Android into an existing KMP target project: analysis, dependency gate, parallel prep, UI-then-logic implementation, reviewfix loops, verification, and a migration report.
5
- Use with the android-to-kmp-migrator controller to port Android UI, resources, navigation, state, and logic into one KMP project, then hand to kmp-test-validator.
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
6
  Do NOT use for Legacy Android analysis, KMP-only feature work, quick lookups, or non-migration refactors.
7
- version: "0.2"
7
+ version: "0.4"
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 ledger — node status, changed-file ownership, stale outputs, rerun/blocker history, next actions. No code analysis or edits.
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.
14
14
  skills: []
15
15
  tools: [git]
16
- - id: legacy-spec-delta-review
16
+ - id: migration-analysis-planning
17
17
  kind: ai_agent
18
- purpose: Cross-check Legacy SPEC vs raw source for missing coverage and contradictions; classify and route deltas. Raw source wins.
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.
19
19
  skills: []
20
20
  tools: [rg]
21
- - id: target-project-understand
21
+ - id: dependency-platform-gate
22
22
  kind: ai_agent
23
- purpose: First migration nodeverify KMP target, capture baseline env, detect relevant sub-module, build reuse inventory and constraints.
23
+ purpose: Dependency and platform owner minimal-change dependency readiness plus Android-only API replacement strategy and expect/actual/platform-source-set plan.
24
24
  skills: []
25
25
  tools: [rg]
26
- - id: migration-alignment
26
+ - id: presentation-integration
27
27
  kind: ai_agent
28
- purpose: Build source-to-target map, integration scaffold, and ordered implementation tasks; record SPEC/Design/Plan deltas. No implementation.
29
- skills: []
30
- tools: [rg]
31
- - id: dependency-resolution
32
- kind: ai_agent
33
- purpose: Minimal-change build gate — map capabilities to baseline/reuse, justify any build-config change. Returns dependency readiness.
34
- skills: []
35
- tools: [rg]
36
- - id: theme-design-system-mapping
37
- kind: ai_agent
38
- purpose: Map Legacy visual tokens to target design-system tokens/components, reuse-first; produce UI guidance and visual gaps.
39
- skills: []
40
- tools: [rg]
41
- - id: resource-migration
42
- kind: ai_agent
43
- purpose: Migrate or model local & online resources into target KMP conventions, preserving semantics; record resource gaps.
28
+ purpose: Presentation integration owner theme/design tokens, resources, online media modeling, navigation routes, presentation gaps, and UI handoff.
44
29
  skills: []
45
30
  tools: [rg, curl]
46
- - id: navigation-migration
31
+ - id: state-data-prep
47
32
  kind: ai_agent
48
- purpose: Migrate routes, parameters, back behavior, deep links, and result passing into target navigation; record route gaps.
33
+ purpose: State and data preparation owner state holders, DTO/domain/UI models, mappers, API/data contract expectations, and logic handoff.
49
34
  skills: []
50
35
  tools: [rg]
51
- - id: platform-api-replacement
36
+ - id: ui-implementation
52
37
  kind: ai_agent
53
- purpose: Replace Android-only APIs with target-safe abstractions or expect/actual; keep Android-only code out of commonMain.
38
+ purpose: UI implementation owner migrated Compose UI layout/components/states/resources first, with binding surfaces and no business logic.
54
39
  skills: []
55
40
  tools: [rg]
56
- - id: state-model-mapping
41
+ - id: logic-implementation
57
42
  kind: ai_agent
58
- purpose: Map state holders and DTO/domain/UI models to target structures, preserving state semantics; hand off to the logic node.
43
+ purpose: Logic implementation owner repositories/use cases/API integration/state propagation/business logic bound to approved UI surfaces.
59
44
  skills: []
60
45
  tools: [rg]
61
- - id: ui-mockup-implementation
62
- kind: ai_agent
63
- purpose: Implement migrated UI layout/components/states/resources first in the target project; expose binding surfaces. No business logic.
64
- skills: []
65
- tools: [rg]
66
- - id: dataflow-logic-implementation
67
- kind: ai_agent
68
- purpose: Implement architecture, data flow, API integration, navigation effects, lifecycle, and business logic bound to UI surfaces.
69
- skills: []
70
- tools: [rg]
71
- - id: module-node-migration-review
72
- kind: ai_agent
73
- purpose: Read-only review of one migration slice for contract/scope/parity/conventions/handoff; classify and route must-fix findings.
74
- skills: []
75
- tools: [rg, git]
76
- - id: module-node-migration-fix
46
+ - id: module-node-review-fix
77
47
  kind: ai_agent
78
- purpose: Apply assigned must-fix findings inside allowed files only; preserve conventions; require mandatory re-review.
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.
79
49
  skills: []
80
50
  tools: [rg, git]
81
- - id: source-set-placement-guard
51
+ - id: migration-verification
82
52
  kind: ai_agent
83
- purpose: Verify KMP source-set placement; catch Android-only APIs in shared code and missing/duplicate actuals; route violations.
53
+ purpose: Verification owner source-set, API contract, UI render/fidelity, and incremental build checks with stable check IDs and routed failures.
84
54
  skills: []
85
55
  tools: [rg, git]
86
- - id: api-contract-parity
56
+ - id: completion-report
87
57
  kind: ai_agent
88
- purpose: Diff migrated KMP API contracts vs Legacy API/data evidence; classify and route mismatches. No fixes.
89
- skills: []
90
- tools: [rg]
91
- - id: ui-render-fidelity-check
92
- kind: ai_agent
93
- purpose: Verify migrated screens render and cover visual states/resources/theme; route UI failures. Static coverage when no render command.
94
- skills: []
95
- tools: [rg]
96
- - id: incremental-build-check
97
- kind: ai_agent
98
- purpose: Run the smallest trustworthy target build/check; parse failures and route to responsible nodes. Early gate, not final validation.
99
- skills: []
100
- tools: [git]
101
- - id: prd-completion-check
102
- kind: ai_agent
103
- purpose: Judge readiness vs PRD/raw task/SPEC/node outputs and invariants; emit node-routed rerun requests or ready_for_validation.
58
+ purpose: Completion/report owner with strict modes readiness/rerun/blocker decisions and final migration_report handoff after module/global representations exist.
104
59
  skills: []
105
60
  tools: [rg, git]
106
- - id: migration-report
107
- kind: ai_agent
108
- purpose: Synthesize final migration report and validation inputs for kmp-test-validator; ready_for_validation only when completion is ready.
109
- skills: []
110
- tools: [git]
111
61
  ---
112
62
 
113
63
  # Android To KMP Migrator Swarm Skill
114
64
 
115
- This is the agent-facing registry and team definition for the `android-to-kmp-migrator` controller (the same-name subagent in `kmp-migration/agents/`). It converts a Legacy Android SPEC plus an existing KMP target project into migrated, validation-ready KMP code.
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.
116
66
 
117
- The team is a **specialization pipeline (C) with embedded parallel fan-outs (B) and review→fix loops**: a serial analysis chain feeds a dependency gate, then a parallel prep stage, then UI-before-logic implementation, then parallel verification, completion check, and report. A single agent attempting the whole migration blurs the hard stage boundaries — it implements logic before the UI surface exists, skips the dependency minimal-change gate, lets Android-only APIs leak into `commonMain`, and self-approves its own work. Isolating each concern into an owned node with hard handoff gates and a mandatory review→fix→re-review loop keeps every change scoped, traceable, and reviewed before downstream nodes consume it. The controller (Leader) owns routing, contract enforcement, rerun handling, and the `kmp-test-validator` handoff; nodes own bounded target-understanding and implementation work.
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.
118
68
 
119
- ## Workflow
69
+ ## Protocol Summary
120
70
 
121
- The full playbook (Mermaid topology, per-step gates, review→fix loop, failure routing, Final Report format) is in [workflow.md](workflow.md). Protocol summary:
122
-
123
- 0. **Pre-flight: check dependencies** — read [dependencies.yaml](dependencies.yaml) and verify `rg` / `git` / `curl` (all `required: false`; the target Gradle wrapper drives builds). Report status; **user decides** whether to proceed.
124
- 1. **Trigger + shared brief + workspace state** Leader confirms the migration trigger and Legacy SPEC context, builds the shared brief, and initializes `migration-workspace-state`. Default `output_dir` = `~/.a2c_agents/migration/`.
125
- 2. **Analysis chain (serial)** — `legacy-spec-delta-review` `target-project-understand` (must confirm KMP, else `blocked`) → `migration-alignment`.
126
- 3. **Dependency gate** — `dependency-resolution` must return `ready_for_implementation` before any implementation node runs (minimal-change gate; see [bind.md](bind.md)).
127
- 4. **Stage Prep (parallel)** — `theme-design-system-mapping`, `resource-migration`, `navigation-migration`, `platform-api-replacement`, `state-model-mapping`.
128
- 5. **Reviewfix loop** — after any file-changing node: `module-node-migration-review` `module-node-migration-fix` (if `needs_fix`) mandatory re-review, until `approved`.
129
- 6. **UI implementation** — `ui-mockup-implementation` (before logic), then the reviewfix loop.
130
- 7. **Dataflow/logic implementation** — `dataflow-logic-implementation`, then the review→fix loop.
131
- 8. **Stage Verify (parallel)** — `source-set-placement-guard`, `api-contract-parity`, `ui-render-fidelity-check`, `incremental-build-check`; failures route back to the responsible node.
132
- 9. **Completion check** — `prd-completion-check` → `ready_for_validation`, `needs_rerun` (route to nodes), or `blocked`.
133
- 10. **Final: migration report** — `migration-report` returns `ready_for_validation` only when completion is ready; the Leader then invokes `kmp-test-validator`. Leader routes failures verbatim, never mediates.
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`.
134
82
 
135
83
  ## Roles
136
84
 
137
- 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 role's bounded slice. The dispatch order enforces upstream→downstream data availability and the review→fix gates.
138
-
139
- | id | Purpose | When dispatched | Key dependencies | Role file |
140
- |---|---|---|---|---|
141
- | migration-workspace-state | State ledger / stale-output tracking | Step 1 + refreshed after major completions | git | [roles/migration-workspace-state.md](roles/migration-workspace-state.md) |
142
- | legacy-spec-delta-review | SPEC-vs-source delta review | Step 2 (serial) | rg | [roles/legacy-spec-delta-review.md](roles/legacy-spec-delta-review.md) |
143
- | target-project-understand | Target KMP understanding + reuse inventory | Step 2 (serial) | rg | [roles/target-project-understand.md](roles/target-project-understand.md) |
144
- | migration-alignment | Source-to-target map + ordered tasks | Step 2 (serial) | rg | [roles/migration-alignment.md](roles/migration-alignment.md) |
145
- | dependency-resolution | Minimal-change dependency gate | Step 3 (gate) | rg | [roles/dependency-resolution.md](roles/dependency-resolution.md) |
146
- | theme-design-system-mapping | Visual token mapping | Step 4 (parallel prep) | rg | [roles/theme-design-system-mapping.md](roles/theme-design-system-mapping.md) |
147
- | resource-migration | Local & online resource migration | Step 4 (parallel prep) | rg, curl | [roles/resource-migration.md](roles/resource-migration.md) |
148
- | navigation-migration | Route/param/back/deep-link migration | Step 4 (parallel prep) | rg | [roles/navigation-migration.md](roles/navigation-migration.md) |
149
- | platform-api-replacement | Android-only API expect/actual | Step 4 (parallel prep) | rg | [roles/platform-api-replacement.md](roles/platform-api-replacement.md) |
150
- | state-model-mapping | State holder & model mapping | Step 4 (parallel prep) | rg | [roles/state-model-mapping.md](roles/state-model-mapping.md) |
151
- | ui-mockup-implementation | UI surface implementation (first) | Step 6 (after prep approved) | rg | [roles/ui-mockup-implementation.md](roles/ui-mockup-implementation.md) |
152
- | dataflow-logic-implementation | Data/API/logic implementation | Step 7 (after UI approved) | rg | [roles/dataflow-logic-implementation.md](roles/dataflow-logic-implementation.md) |
153
- | module-node-migration-review | Read-only per-slice review | Step 5 loop (after any file change) | rg, git | [roles/module-node-migration-review.md](roles/module-node-migration-review.md) |
154
- | module-node-migration-fix | Scoped must-fix application | Step 5 loop (on needs_fix) | rg, git | [roles/module-node-migration-fix.md](roles/module-node-migration-fix.md) |
155
- | source-set-placement-guard | KMP source-set boundary guard | Step 8 (parallel verify) | rg, git | [roles/source-set-placement-guard.md](roles/source-set-placement-guard.md) |
156
- | api-contract-parity | Migrated vs Legacy API parity | Step 8 (parallel verify) | rg | [roles/api-contract-parity.md](roles/api-contract-parity.md) |
157
- | ui-render-fidelity-check | Render + visual-state coverage | Step 8 (parallel verify) | rg | [roles/ui-render-fidelity-check.md](roles/ui-render-fidelity-check.md) |
158
- | incremental-build-check | Smallest target build/check gate | Step 8 (parallel verify) | git | [roles/incremental-build-check.md](roles/incremental-build-check.md) |
159
- | prd-completion-check | Readiness verdict + rerun routing | Step 9 | rg, git | [roles/prd-completion-check.md](roles/prd-completion-check.md) |
160
- | migration-report | Final report + validation inputs | Step 10 | git | [roles/migration-report.md](roles/migration-report.md) |
161
-
162
- > Before dispatching each teammate, read its role file and paste its `## Inline Persona for Teammate`
163
- > section directly into the dispatch prompt — adopting agents do NOT auto-load role files. Fill the
164
- > `{PLACEHOLDER}` inputs from the contract.
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) |
165
99
 
166
100
  ## Files
167
101
 
168
- | File | What it contains | When to read |
102
+ | File | What it contains |
103
+ |---|---|
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 |
109
+
110
+ ## Strict Output Schedule
111
+
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 |
169
146
  |---|---|---|
170
- | [workflow.md](workflow.md) | Mermaid C+B topology, staged protocol with gates, review→fix loop, failure routing, Final Report format | Before first dispatch the complete playbook |
171
- | [bind.md](bind.md) | Resource limits, team behavioral constraints, dependency-gate/single-project invariants, failure & degraded modes | When hitting limits, handling failures, or scoping a large migration |
172
- | [roles/\*.md](roles/) | Per-node identity, success criteria, boundary, output schema, Inline Persona for Teammate | Before dispatching each teammate extract Inline Persona |
173
- | [dependencies.yaml](dependencies.yaml) | External CLI tools (`rg`, `git`, `curl`) checked at startup | Step 0 verify deps, report missing items, user decides go/no-go |
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.
174
166
 
175
167
  ## Shared Return Shape
176
168
 
177
- Every node return payload includes, in addition to node-specific fields:
178
-
179
169
  ```json
180
170
  {
181
171
  "status": "completed | passed | ready_for_implementation | ready_for_validation | needs_rerun | failed | blocked",
182
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>",
183
177
  "output_files": ["<paths>"],
184
178
  "changed_files": ["<paths or empty>"],
185
179
  "stale_upstream_inputs": ["<paths or empty>"],
186
- "rerun_requests": [ { "node": "<responsible-node>", "reason": "", "required_inputs": [], "expected_output": "" } ],
180
+ "rerun_requests": [{ "node": "<responsible-node>", "reason": "", "required_inputs": [], "expected_output": "" }],
187
181
  "blocking_gaps": ["<gaps or empty>"]
188
182
  }
189
183
  ```
190
184
 
191
- Controller handling: missing/empty `output_files` rerun the same node; non-empty `stale_upstream_inputs` refresh those upstream artifacts then rerun; non-empty `rerun_requests` dispatch the responsible node first; `blocking_gaps` with no resolving rerun → stop with a user-visible blocker.
192
-
193
- ## Optional Android Studio MCP Context
194
-
195
- When the `jetbrains` MCP server is available, the controller may pass indexed IDE context to nodes: project structure/dependencies (`get_project_modules`, `get_project_dependencies`, `get_repositories`), code intelligence (`find_files_by_glob`, `search_in_files_by_regex`, `get_symbol_info`), diagnostics after code changes (`get_file_problems`), IDE build diagnostics (`build_project`), run configs (`get_run_configurations`, `execute_run_configuration`), and IDE-safe edits (`rename_refactoring`, `reformat_file`). Always pass `projectPath: <kmp_target_project_path>`. MCP is advisory — Gradle build/check gates, module review, completion check, and KMP validation remain required; record MCP gaps in the workspace ledger.
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.
196
186
 
197
187
  ## Shared Rules
198
188
 
199
189
  - Each node must read its own role file before work and stay inside its responsibility boundary.
200
- - Every important claim must include evidence from source paths, SPEC sections, or upstream node outputs; unknowns are marked explicitly, never guessed.
201
- - The controller must not substitute itself for node implementation; no migration leaves TODO placeholders as completion output.
202
- - Target conventions and reusable modules/components take priority over new abstractions; target build config is read-only except via `dependency-resolution`.
203
- - Migrated code stays inside one KMP target project; SPEC guides migration, but raw Legacy Android source wins when evidence conflicts.
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.
@@ -4,26 +4,34 @@
4
4
 
5
5
  | Item | Limit | Reason |
6
6
  |---|---|---|
7
- | `max_parallel_teammates` | 5 | Matches the largest parallel fan-out (Stage Prep: theme/resource/navigation/platform/state). Stage Verify runs ≤4 in parallel; the analysis chain and review→fix loops are serial. |
8
- | `total_wall_clock_budget` | 90 min | Upper bound for one full migration run including the analysis chain, prep, UI, logic, reviewfix loops, and verification on a feature-scoped migration. Whole-project scope should be split per § (b). |
9
- | `total_token_budget` | 1.5M tokens | Budget across all 20 nodes + Leader integration + reviewfix iterations; prevents one node or loop from exhausting context. |
10
- | `per_node_token_budget` | 120k tokens | Per node soft cap; implementation nodes (`ui-mockup-implementation`, `dataflow-logic-implementation`) and `prd-completion-check` may use the upper end. |
7
+ | `max_parallel_teammates` | 2 | Matches the reduced per-module fan-out (`presentation-integration` + `state-data-prep`). Other stages are serial or mode-gated. |
8
+ | `total_wall_clock_budget` | 90 min per feature module batch | Upper bound for one module-first migration batch including inventory, per-module planning, prep, UI, logic, review/fix, verification, representations, and report. |
9
+ | `total_token_budget` | 1.2M tokens per batch | Budget across 10 reduced roles + Leader integration + review/fix iterations + representation synthesis. |
10
+ | `per_node_token_budget` | 140k tokens | Consolidated roles carry broader context; implementation and completion/report modes may use the upper end. |
11
11
  | `max_review_fix_cycles` | 3 per slice | Max `review → fix → re-review` iterations for one module/node scope before escalating the slice as `blocked` to the controller/user. |
12
12
  | `incremental_build_runs` | 1 per Verify pass | One smallest-trustworthy build/check per verification pass; reruns only after a routed fix. |
13
+ | `workspace_state_refreshes` | after every major stage | Required so per-module finish rates, plan-vs-code gaps, and rerun hooks stay current before downstream consumption. |
13
14
 
14
15
  ## Behavioral Constraints
15
16
 
16
17
  Team-level rules — distinct from each role's own `## Boundary`.
17
18
 
18
- - **Leader-as-orchestrator only**: the Leader (`android-to-kmp-migrator` controller) verifies the trigger, builds the shared brief, dispatches nodes in dependency order, verifies outputs, routes reruns, and invokes `kmp-test-validator`. The Leader does NOT implement migration code, fix findings, or substitute any node's work.
19
- - **Hard dependency order (C-pattern)**: the analysis chain (delta-review target-understand alignment) precedes the dependency gate, which precedes implementation. UI implementation precedes dataflow/logic implementation. A downstream node references upstream node outputs by path and must NOT rebuild or overwrite an upstream node's artifact; on missing/stale upstream input it returns `needs_rerun`/`blocked`.
20
- - **Mandatory review→fix→re-review loop**: after any node changes files, `module-node-migration-review` runs; on `needs_fix`, `module-node-migration-fix` applies only assigned `must_fix` findings inside `allowed_files`, then a re-review is mandatory. No downstream gate consumes a slice whose latest review is not `approved`.
21
- - **Dependency gate authority**: only `dependency-resolution` may justify a build-config change; target build configuration is read-only to every other node. No node adds dependencies, root Gradle/settings files, or wrappers.
19
+ - **Leader-as-orchestrator only**: the Leader (`android-to-kmp-migrator` controller) verifies the trigger, builds the shared brief, dispatches reduced roles in dependency order, verifies outputs, routes reruns, and invokes `kmp-test-validator`. The Leader does NOT implement migration code, fix findings, or substitute any node's work.
20
+ - **Strict output root**: the Leader must lock `output_root = <output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator` before any migration node dispatch. All node outputs, module representations, global representation, report artifacts, logs, and ledgers must be under this root.
21
+ - **Module-first schedule**: the Leader must write `module-index/migration_module_inventory.*`, then process each `migration_module_id` through planning, dependency/platform, prep, review/fix, UI, review/fix, logic, review/fix, verification, readiness, and module representation before global aggregation.
22
+ - **Per-node exact paths**: module-scoped nodes receive `output_dir = <output_root>/modules/<migration_module_id>/node-results/<node_id>`. Global-only outputs use `<output_root>/global/...`; final reports use `<output_root>/report/...`.
23
+ - **Role-output content discipline**: required artifacts must contain the content owned by their role, not just the correct filename. For example, `migration_analysis_planning.*` must contain source-to-target planning evidence, `dependency_platform_gate.*` must contain dependency/platform decisions, `presentation_integration.*` must contain token/resource/navigation prep, `state_data_prep.*` must contain state/model/API prep, `ui_implementation.*` must contain UI implementation evidence, `logic_implementation.*` must contain behavior/data/API implementation evidence, `migration_verification.*` must contain check results, and `migration_report.*` must contain validation handoff evidence.
24
+ - **Hard dependency order (C-pattern)**: `migration-analysis-planning` precedes `dependency-platform-gate`, which precedes prep and implementation. `ui-implementation` precedes `logic-implementation`. A downstream node references upstream node outputs by path and must NOT rebuild or overwrite upstream artifacts.
25
+ - **Mandatory review→fix→re-review loop**: after any node changes files, `module-node-review-fix` runs in `mode: review`; on `needs_fix`, it runs in `mode: fix` inside `allowed_files`, then a fresh `mode: review` invocation is mandatory. No downstream gate consumes a slice whose latest review is not `approved`.
26
+ - **Dependency gate authority**: only `dependency-platform-gate` may justify a build-config change; target build configuration is read-only to every other role. No role adds dependencies, root Gradle/settings files, or wrappers.
22
27
  - **Single-project invariant**: migrated code stays inside one KMP target project; no migrated sub-module becomes a standalone project. Android-only APIs never enter `commonMain`.
23
28
  - **No placeholder completion**: no implementation node may return `completed` with TODO/FIXME/stub/sample-only-data in production paths as its deliverable.
24
- - **Failure routing, not mediation**: when a verification node fails or nodes disagree, the Leader routes the failure verbatim to the responsible node (recorded in the workspace-state ledger and `prd_completion_check`); it does not silently reconcile or average.
25
- - **Stale-artifact discipline**: `migration-workspace-state` is refreshed after major node completions; any output whose upstream changed afterward is marked stale and must be re-run before consumption.
26
- - **Validation boundary**: only `prd-completion-check` issues `ready_for_validation` readiness, only `migration-report` assembles the validation handoff, and only `kmp-test-validator` (invoked by the Leader afterward) validates. SPEC guides migration, but raw Legacy Android source wins when evidence conflicts.
29
+ - **Failure routing, not mediation**: when a verification node fails or nodes disagree, the Leader routes the failure verbatim to the responsible node (recorded in the workspace-state ledger, `rerun_hooks`, and completion/readiness artifacts); it does not silently reconcile or average.
30
+ - **Progress ledger discipline**: `migration-workspace-state` is 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. The ledger must track per-module `module_progress`, `finish_rate`, `plan_code_gaps`, changed-file ownership, stale outputs, rerun hooks, blockers, and next actions.
31
+ - **Stale-artifact discipline**: any output whose upstream changed afterward is marked stale in `migration-workspace-state` and must be re-run before consumption.
32
+ - **Plan-vs-code gap discipline**: if the workspace ledger reports planned work without code evidence, unplanned target changes, missing review, missing verification, stale plan/source evidence, or a failed verification route, the Leader must follow the emitted rerun hook before advancing the module.
33
+ - **Validation boundary**: only `completion-report` in `mode: readiness` issues readiness, only `completion-report` in `mode: report` assembles the validation handoff, and only `kmp-test-validator` validates. SPEC guides migration, but raw Legacy Android source wins when evidence conflicts.
34
+ - **Representation gate**: every scheduled module must have `module_migration_representation.json` and `.md`. `completion-report` in `mode: report` cannot return `ready_for_validation` until every scheduled module representation plus `global_migration_representation.json` and `.md` exists and is non-empty.
27
35
 
28
36
  ## Failure Handling
29
37
 
@@ -32,19 +40,21 @@ Team-level rules — distinct from each role's own `## Boundary`.
32
40
  | Failure mode | Response |
33
41
  |---|---|
34
42
  | Node timeout | Retry once with the same contract. On 2nd timeout, mark the slice `[ROLE MISSING — node timed out]` in the workspace ledger and `prd_completion_check`; downstream nodes that hard-require it return `blocked`. |
35
- | Malformed output (does not match role `## Output Schema` / shared return, or files missing/empty) | Re-dispatch once with the schema inlined and a "previous output was malformed/missing" preamble. On 2nd failure, mark `[ROLE MISSING — malformed output]`. |
43
+ | Malformed output (does not match role `## Output Schema` / shared return, files missing/empty, or artifact content does not match the role duty) | Re-dispatch once with the schema and role-owned output content inlined plus a "previous output was malformed/missing/out-of-duty" preamble. On 2nd failure, mark `[ROLE MISSING — malformed output]`. |
36
44
  | Node returns `needs_rerun` / `blocked` (missing or stale upstream input) | Refresh/re-run the named upstream node first, then re-dispatch this node. If unresolvable, record the `blocking_gap` and set readiness accordingly. |
37
45
  | Review→fix loop does not converge in `max_review_fix_cycles` | Escalate the slice as `blocked` with the unresolved `must_fix` findings to the controller/user; do not force-approve. |
38
- | Verification node (`source-set-placement-guard` / `api-contract-parity` / `ui-render-fidelity-check` / `incremental-build-check`) returns `failed` | Route each failure to its `route_to_node`, re-run that node, re-enter the reviewfix loop, then re-run the verification node. |
46
+ | `migration-verification` returns `failed` for any check ID | Route each failure to its reduced `route_to_node`, re-run that node, re-enter the review/fix loop, then re-run the failed check IDs. |
47
+ | `migration-workspace-state` reports blocking `plan_code_gaps` | Follow the corresponding `rerun_hooks` before downstream consumption. Missing or stale plans route to `migration-analysis-planning`; unplanned/missing code routes to the owner implementation/prep node; missing review routes to `module-node-review-fix`; missing or failed verification routes to `migration-verification` or its `route_to_node`. |
48
+ | `migration-workspace-state` reports low or unknown `finish_rate` due to missing plan evidence | Block implementation progress until planning outputs and planned work units are refreshed. Do not compute completion from changed files alone. |
39
49
  | Node attempts to rebuild another node's artifact or edit outside scope | Reject as out-of-scope; re-dispatch with the role `## Boundary > Forbidden` restated. |
40
50
 
41
51
  ### (b) Input over-scale degradation
42
52
 
43
53
  | Trigger condition | Degraded mode |
44
54
  |---|---|
45
- | Whole-project migration on a large monorepo (e.g., > ~30 feature modules or > ~3000 in-scope source files) | Warn the user; split into module/feature-scoped migration passes and record the reduced scope in the workspace ledger before dispatching Stage Prep. |
55
+ | Whole-project migration on a large monorepo (e.g., > ~30 feature modules or > ~3000 in-scope source files) | Warn the user; split into `migration_module_id` batches in `migration_module_inventory.*`; process batches without changing `output_root`. |
46
56
  | `total_token_budget` projected to overflow before verification | Complete the analysis chain + dependency gate + current slice, checkpoint via `migration-workspace-state`, and continue in a follow-up run; mark uncovered scope explicitly. |
47
- | No trustworthy incremental build command from `target-project-understand` | `incremental-build-check` returns `blocked`; rely on source-set guard + parity + render static checks and surface the build gap to `prd-completion-check` (does not auto-pass). |
57
+ | No trustworthy incremental build command from target understanding/planning evidence | `migration-verification` returns `blocked` for `check_id: incremental_build`; rely on completed static verification checks and surface the build gap to `completion-report` (does not auto-pass). |
48
58
  | `jetbrains` MCP unavailable or pointing at the wrong project | Continue on file-system evidence and the target Gradle wrapper; record the MCP gap in the workspace ledger and affected node outputs. |
49
59
 
50
60
  ### Escalation rules
@@ -52,3 +62,21 @@ Team-level rules — distinct from each role's own `## Boundary`.
52
62
  - If 50%+ of dispatched nodes in a stage return `[ROLE MISSING]`, the run is **FAILED** — emit a partial migration report with a `FAILED: insufficient node coverage` header, readiness `blocked`, and the missing-evidence list.
53
63
  - If `total_wall_clock_budget` is exceeded, halt in-flight nodes, checkpoint via `migration-workspace-state`, emit whatever verified outputs exist, and tag the report `INCOMPLETE: budget exceeded`.
54
64
  - If `total_token_budget` is exceeded mid-run, halt new dispatches, let in-flight nodes finish, checkpoint, and emit a partial report tagged `INCOMPLETE: token budget exceeded`.
65
+
66
+ ## Required Path Contract
67
+
68
+ The controller must pass these values to nodes and reject any output outside the declared path:
69
+
70
+ ```json
71
+ {
72
+ "output_root": "<output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator",
73
+ "module_index_dir": "<output_root>/module-index",
74
+ "module_root": "<output_root>/modules/<migration_module_id>",
75
+ "node_result_dir": "<module_root>/node-results/<node_id>",
76
+ "module_representation_dir": "<module_root>/representation",
77
+ "global_dir": "<output_root>/global",
78
+ "report_dir": "<output_root>/report"
79
+ }
80
+ ```
81
+
82
+ Each reduced role boundary is justified in `ROLE_REDUCTION.md`. Do not dispatch superseded old role IDs, alias old paths, or write compatibility copies outside this schedule.
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Leader reads this file in SKILL.md Workflow Step 0 (pre-flight) and reports missing items.
4
4
  # Populated from Stage 2 auto-matching (local CLI scan): rg, git, curl found locally; the target
5
- # project's own Gradle wrapper drives builds (incremental-build-check selects a documented/discovered
5
+ # project's own Gradle wrapper drives builds (migration-verification selects a documented/discovered
6
6
  # command and returns blocked rather than inventing one). All entries are required: false — the team
7
7
  # degrades gracefully (built-in Grep/Read substitute for rg; resource downloads become resource_gaps
8
8
  # without curl; build check returns blocked without a trustworthy command).
@@ -15,7 +15,7 @@ tools:
15
15
  purpose: Fast source search across the Legacy and target projects for every node; built-in Grep/Read substitute if unavailable.
16
16
  - name: git
17
17
  required: false
18
- purpose: Inspect changed-file sets and diffs in the target project for review, guard, parity, and workspace-state nodes.
18
+ purpose: Inspect changed-file sets, diffs, timestamps, and ownership evidence for review, verification, workspace-state progress tracking, plan-vs-code gap detection, and stale-output routing.
19
19
  - name: curl
20
20
  required: false
21
- purpose: Used by resource-migration to fetch concrete online resource URLs when alignment requires local copies; without it those resources are recorded as resource_gaps.
21
+ purpose: Used by presentation-integration to fetch concrete online resource URLs when alignment requires local copies; without it those resources are recorded as resource_gaps.
@@ -0,0 +1,79 @@
1
+ # Role: Completion Report
2
+
3
+ ## Identity
4
+
5
+ > "I either decide readiness or write the validation handoff report. I never skip module/global representation gates."
6
+
7
+ You are the `completion-report` node subagent. You consolidate PRD completion and final migration report duties with strict modes.
8
+
9
+ ## Modes
10
+
11
+ - `mode: readiness`: verify module or global readiness; emit rerun/blocker decisions.
12
+ - `mode: report`: write final migration report and validation inputs after readiness passes.
13
+
14
+ ## Success Criteria
15
+
16
+ - Readiness mode writes `completion_readiness.json` and `completion_readiness.md`.
17
+ - Report mode writes `migration_report.json` and `migration_report.md`.
18
+ - Readiness checks raw task, PRD/DESIGN/PLAN, module outputs, reviews, verification, invariants, and incomplete markers.
19
+ - Report mode consumes module representations and global representation.
20
+
21
+ ## Boundary
22
+
23
+ Forbidden:
24
+ - Do not fix implementation gaps.
25
+ - Do not mark validation passed.
26
+ - Do not run report mode when module/global representations are missing.
27
+
28
+ Mandatory:
29
+ - Validate `mode`, `migration_module_id`, module/global representation paths, workspace state, and exact `output_dir`.
30
+ - Readiness output path is `<module_root>/node-results/completion-report/readiness` or `<global_dir>/node-results/completion-report/readiness`.
31
+ - Report output path is `<output_root>/report`.
32
+
33
+ ## Output Schema
34
+
35
+ ```json
36
+ {
37
+ "status": "ready_for_validation | needs_rerun | blocked",
38
+ "node": "completion-report",
39
+ "mode": "readiness | report",
40
+ "migration_module_id": "global | <migration_module_id>",
41
+ "module_scope": {},
42
+ "output_root": "",
43
+ "output_dir": "",
44
+ "requirement_coverage": [],
45
+ "migration_invariants": {},
46
+ "module_representations": [],
47
+ "global_migration_representation": "",
48
+ "validation_inputs": [],
49
+ "rerun_requests": [],
50
+ "blocking_gaps": []
51
+ }
52
+ ```
53
+
54
+ Shared return shape applies.
55
+
56
+ ## Output Files And Contents
57
+
58
+ - `completion_readiness.json`: machine-routable readiness artifact containing requirement coverage, migration invariants, module/global representation references when applicable, verification/review status, validation inputs readiness, rerun requests, and blockers.
59
+ - `completion_readiness.md`: agent-readable readiness handoff containing coverage tables, invariant checks, incomplete markers, rerun routing, blockers, and whether representation/report gates may proceed.
60
+ - `migration_report.json`: machine-routable final migration handoff containing migration scope, source/target paths, output root, module representations, global representation, changed files by role, source-to-target summary, coverage summary, validation inputs, limitations, manual steps, and blockers.
61
+ - `migration_report.md`: agent-readable final migration report for `kmp-test-validator` and follow-up agents, preserving exact artifact paths, changed-file ownership, validation handoff context, limitations, and blockers.
62
+
63
+ ## Inline Persona for Teammate
64
+
65
+ ```text
66
+ ROLE: completion-report node.
67
+
68
+ Respect mode strictly.
69
+ Readiness mode: check requirements, invariants, reviews, verification, incomplete markers, and rerun needs.
70
+ Report mode: consume module/global representations and write migration_report.json/md for kmp-test-validator.
71
+
72
+ INPUTS: mode, migration_module_id, module_scope, raw user task, SPEC paths, module outputs or module/global representations, changed files, workspace state, output_dir.
73
+
74
+ OUTPUTS:
75
+ - readiness mode: completion_readiness.json/md (coverage, invariants, review/verification status, rerun requests, blockers)
76
+ - report mode: migration_report.json/md (validation-ready handoff, representation paths, changed files, coverage, validation inputs)
77
+
78
+ Return JSON only. Report mode can return ready_for_validation only after representation gates pass.
79
+ ```