@code-migration/wow-migrator 0.1.2 → 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 (44) hide show
  1. package/package.json +1 -1
  2. package/skills/android-project-analyst/MIGRATION.md +14 -0
  3. package/skills/android-project-analyst/SKILL.md +20 -0
  4. package/skills/android-project-analyst/bind.md +2 -1
  5. package/skills/android-project-analyst/roles/analysis-workspace-state.md +7 -2
  6. package/skills/android-project-analyst/roles/behavior-logic.md +6 -3
  7. package/skills/android-project-analyst/roles/data-contract-flow.md +6 -3
  8. package/skills/android-project-analyst/roles/presentation-resource.md +8 -3
  9. package/skills/android-project-analyst/roles/project-architecture.md +6 -3
  10. package/skills/android-project-analyst/workflow.md +19 -16
  11. package/skills/android-to-kmp-migrator/MIGRATION.md +27 -2
  12. package/skills/android-to-kmp-migrator/SKILL.md +35 -4
  13. package/skills/android-to-kmp-migrator/bind.md +11 -5
  14. package/skills/android-to-kmp-migrator/dependencies.yaml +3 -3
  15. package/skills/android-to-kmp-migrator/roles/completion-report.md +9 -2
  16. package/skills/android-to-kmp-migrator/roles/dependency-platform-gate.md +7 -2
  17. package/skills/android-to-kmp-migrator/roles/logic-implementation.md +7 -2
  18. package/skills/android-to-kmp-migrator/roles/migration-analysis-planning.md +7 -2
  19. package/skills/android-to-kmp-migrator/roles/migration-verification.md +9 -3
  20. package/skills/android-to-kmp-migrator/roles/migration-workspace-state.md +199 -20
  21. package/skills/android-to-kmp-migrator/roles/module-node-review-fix.md +9 -2
  22. package/skills/android-to-kmp-migrator/roles/presentation-integration.md +7 -2
  23. package/skills/android-to-kmp-migrator/roles/state-data-prep.md +7 -2
  24. package/skills/android-to-kmp-migrator/roles/ui-implementation.md +7 -2
  25. package/skills/android-to-kmp-migrator/workflow.md +60 -20
  26. package/skills/kmp-test-validator/MIGRATION.md +26 -0
  27. package/skills/kmp-test-validator/SKILL.md +52 -1
  28. package/skills/kmp-test-validator/bind.md +21 -1
  29. package/skills/kmp-test-validator/roles/validation-intake-fidelity.md +7 -2
  30. package/skills/kmp-test-validator/roles/validation-plan-gate.md +9 -3
  31. package/skills/kmp-test-validator/roles/validation-remediation.md +7 -2
  32. package/skills/kmp-test-validator/roles/validation-report.md +7 -2
  33. package/skills/kmp-test-validator/roles/validation-test-runner.md +9 -3
  34. package/skills/kmp-test-validator/roles/validation-workspace-state.md +7 -2
  35. package/skills/kmp-test-validator/workflow.md +29 -9
  36. package/skills/migration-task-adapter/MIGRATION.md +16 -1
  37. package/skills/migration-task-adapter/SKILL.md +18 -0
  38. package/skills/migration-task-adapter/bind.md +4 -1
  39. package/skills/migration-task-adapter/dependencies.yaml +1 -1
  40. package/skills/migration-task-adapter/roles/task-reporter.md +7 -2
  41. package/skills/migration-task-adapter/roles/task-understanding-router.md +7 -2
  42. package/skills/migration-task-adapter/roles/workflow-orchestrator.md +7 -2
  43. package/skills/migration-task-adapter/roles/workspace-state-discipline-inspector.md +15 -6
  44. package/skills/migration-task-adapter/workflow.md +15 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-migration/wow-migrator",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Install KMP migration skills into Claude Code, Codex, Cursor, Gemini, OpenCode, OpenClaw, and JiuwenSwarm via npm install.",
5
5
  "keywords": [
6
6
  "android",
@@ -51,3 +51,17 @@ The third pass adds `analysis-workspace-state`, following the ledger pattern use
51
51
  | Function/duty analysis and old-to-new map | `ROLE_CLUSTERING.md` |
52
52
  | Per-role identity, boundary, schema, and teammate persona | `roles/<clustered-role>.md` |
53
53
  | SPEC output contract + MCP context | `SKILL.md` body |
54
+
55
+ ## Output Contract Refinement
56
+
57
+ The active skill docs now distinguish output file names from output content responsibilities. `SKILL.md` and `workflow.md` define the full artifact schedule and content matrix, while each role file states the exact JSON/Markdown filenames and the evidence each artifact must contain.
58
+
59
+ This refinement keeps role ownership explicit:
60
+
61
+ - `analysis-workspace-state.*` records ledger state only.
62
+ - `presentation_resource.*` records screens, checked UI trees, navigation, presentation modules, and resources.
63
+ - `project_architecture.*` records build/module topology, architecture patterns, dependencies, platform services, and migration constraints.
64
+ - `data_contract_flow.*` records APIs, models, data sources, mappings, streams, and end-to-end data flows.
65
+ - `behavior_logic.*` records user actions, lifecycle behavior, state holders, rules, side effects, state machines, and upstream alignment.
66
+
67
+ The Leader must reject artifacts that have the correct filename but contain another role's work or prose-only summaries without machine-routable evidence.
@@ -112,6 +112,26 @@ The Leader MUST write artifacts in this order and MUST NOT skip directly from ra
112
112
 
113
113
  Any artifact written outside these paths is invalid for downstream gates.
114
114
 
115
+ ## Output Artifact Content Matrix
116
+
117
+ The controller verifies both the filename and the role-aligned content before any downstream stage consumes an artifact.
118
+
119
+ | Stage / owner | Output file(s) | Required content |
120
+ |---|---|---|
121
+ | Output root lock / Leader | `run_manifest.json` | Source project path, target project path when provided, mode, analysis scope, output root, allowed path roots, schedule version, dependency-preflight status, timestamp. |
122
+ | Workspace ledger / `analysis-workspace-state` | `analysis_workspace_state.json`, `analysis_workspace_state.md` | Module status, node output inventory, artifact inventory, stale upstream inputs, rerun history, blockers, next safe actions, SPEC readiness prerequisites. No UI/architecture/data/behavior analysis. |
123
+ | Module inventory / Leader | `module_inventory.json`, `module_inventory.md` | Deterministic `analysis_modules`, `module_order`, module ids/types, source roots, UI/logic/data/resource scopes, dependencies, out-of-scope roots, module output roots, inventory evidence. |
124
+ | Module brief / Leader | `module_brief.json` | One module's dispatch contract: `module_id`, module type, bounded source roots, UI/logic/data/resource scopes, dependencies, known entry points, output root, upstream assumptions, role-specific hints. |
125
+ | Presentation/resources / `presentation-resource` | `presentation_resource.json`, `presentation_resource.md`, optional `downloaded_resources/` manifest entries | Entry points, screen inventory, checked UI layout/view trees, presentation modules, navigation edges, shared UI components, local/online/downloaded resources, resource usage map, migration implications, download gaps, assumptions, source evidence. |
126
+ | Project architecture / `project-architecture` | `project_architecture.json`, `project_architecture.md` | Build/SDK configuration, module topology, architecture patterns with confidence, layer roles, dependency ecosystem, Jetpack/DI/persistence/background/platform/generated usage, boundary violations, migration constraints, cross-module dependencies, evidence. |
127
+ | Data contracts/flow / `data-contract-flow` | `data_contract_flow.json`, `data_contract_flow.md` | Network stack, APIs, request/response/model contracts, data sources, model mappings, repository flows, reactive streams, transformations, end-to-end data flows, dynamic/unknown APIs, loading/error/empty behavior, cross-module data links, diagrams when supported. |
128
+ | Behavior/control / `behavior-logic` | `behavior_logic.json`, `behavior_logic.md` | Screen logic, state holders, initialization and lifecycle flows, user-action flows, business rules, data-contract links, control flows, cross-module interactions, state machines, upstream alignment, diagrams when supported. |
129
+ | Module representation / Leader | `module_representation.json`, `module_representation.md` | Synthesized module view from verified node outputs only: module purpose, UI/resources, architecture, data contracts/flows, behavior logic, cross-role traceability, risks, gaps, evidence index, readiness for global integration. |
130
+ | Global representation / Leader | `global_representation.json`, `global_representation.md` | Full-project synthesis from module representations only: cross-module architecture, navigation, shared resources, shared logic, data dependencies, platform constraints, conflicts, global evidence index, readiness. |
131
+ | SPEC / Leader | `prd.md`, `design.md`, `verification.md`, migration-only `plan.md` | Final agent-readable SPEC synthesized from global/module representations: product behavior, system design, migration/refactor plan when needed, traceability, coverage, consistency checks, readiness verdict, blockers. |
132
+
133
+ JSON artifacts are the machine-routable source of truth. Markdown artifacts are agent-readable handoffs that preserve paths, evidence, diagrams/tables when useful, gaps, assumptions, and next-node context. Node Markdown must not become prose-only summaries.
134
+
115
135
  ## Optional Android Studio MCP Context
116
136
 
117
137
  When the `jetbrains` MCP server is available, the controller may pass indexed Android Studio context into the shared brief: project modules/dependencies/VCS roots (`get_project_modules`, `get_project_dependencies`, `get_repositories`), file/symbol discovery (`find_files_by_glob`, `search_in_files_by_regex`, `get_symbol_info`), and diagnostics (`get_file_problems`). Always pass `projectPath: <source_project_path>`. Treat MCP output as supporting evidence — major claims still need source paths and confidence labels; record any MCP gap in `verification.md`.
@@ -22,6 +22,7 @@ Team-level rules — distinct from each role's own `## Boundary`.
22
22
  - **Clustered slices, dispatch-time fixed (B-pattern, Stage A)**: each foundation node works ONLY on its assigned clustered slice. Slices are fixed at dispatch and are not renegotiated between nodes; nodes do not see each other's working state during Stage A.
23
23
  - **Gated handoff, no upstream mutation (C-pattern, Stage B)**: `behavior-logic` references upstream node outputs (by path) and enriches only where behavior analysis requires; it MUST NOT rebuild or overwrite an upstream node's catalog. If upstream data is missing/stale, it returns `needs_rerun`/`blocked` rather than reconstructing it.
24
24
  - **Mandatory contract enforcement**: every node is dispatched with a complete module-scoped contract (`source_project_path`, `module_id`, `module_scope`, `module_brief_path`, required upstream artifacts, `analysis_scope`, `skill_spec_path`, exact `output_dir`). The Leader rejects any return that lacks required JSON/MD artifacts, omits produced files from `output_files`, writes outside the assigned path, or claims `completed`/`ready_*` without proven output storage.
25
+ - **Role-output content discipline**: required artifacts must contain the content owned by their role, not just the correct filename. For example, `presentation_resource.*` must contain screens/resources/navigation/UI-tree evidence, `project_architecture.*` must contain topology/build/dependency/platform evidence, `data_contract_flow.*` must contain APIs/data-source/model/flow evidence, and `behavior_logic.*` must contain action/lifecycle/rule/control-flow evidence. If content belongs to another role, rerun or route rather than accepting it.
25
26
  - **Conflict handling**: when nodes disagree on a fact affecting architecture, data flow, resources, ecosystem constraints, behavior, or migration, the Leader surfaces it verbatim as `Needs confirmation` in `verification.md`. The Leader does NOT silently pick a winner or average findings.
26
27
  - **No source modification**: no node and not the Leader may edit the analyzed Android project. `presentation-resource` writes downloads only under `<output_dir>/node-results/presentation-resource/downloaded_resources/` and never stores secrets/cookies/tokens.
27
28
  - **Agent-only artifacts**: node outputs and SPEC files are structured for downstream agents/controllers, not human presentation; any user-facing summary is produced only after durable artifacts exist.
@@ -33,7 +34,7 @@ Team-level rules — distinct from each role's own `## Boundary`.
33
34
  | Failure mode | Response |
34
35
  |---|---|
35
36
  | Node timeout | Retry once with the same contract. On 2nd timeout, mark the node's slice `[ROLE MISSING — node timed out]` in `verification.md` and proceed with remaining outputs (downstream nodes that hard-require it return `blocked`). |
36
- | Malformed output (does not match role `## Output Schema`, 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]`. |
37
+ | Malformed output (does not match role `## Output Schema`, 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]`. |
37
38
  | Node returns `blocked` / `needs_rerun` (missing or stale upstream input) | Refresh `analysis-workspace-state`, resolve the named upstream gap first (re-run the upstream node), then re-dispatch this node. If unresolvable, record the `blocking_gap` and set readiness accordingly. |
38
39
  | Node attempts to rebuild another node's catalog | Reject the return as out-of-scope; re-dispatch with the role `## Boundary > Forbidden` restated. |
39
40
  | Node writes outside assigned path | Reject the return as invalid; re-dispatch with the exact assigned `output_dir`. Do not move or reuse out-of-path artifacts. |
@@ -53,6 +53,11 @@ You are the `analysis-workspace-state` node subagent dispatched by the `android-
53
53
 
54
54
  Shared controller return shape (all nodes): `status`, `node`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
55
55
 
56
+ ## Output Files And Contents
57
+
58
+ - `analysis_workspace_state.json`: machine-routable ledger of run mode, current controller step, module statuses, node output statuses, artifact inventory, stale upstream inputs, rerun history, blocking gaps, and next safe actions. It must not include UI, architecture, data-flow, or behavior analysis.
59
+ - `analysis_workspace_state.md`: agent-readable ledger handoff with module status table, node output inventory, artifact readiness table, stale-input table, rerun/blocker history, and next controller action. It must preserve exact artifact paths and owner nodes.
60
+
56
61
  ## Inline Persona for Teammate
57
62
 
58
63
  ```
@@ -102,8 +107,8 @@ HANDLER (how you process):
102
107
  5. Identify the next safe controller action.
103
108
 
104
109
  OUTPUTS (write under output_dir, exact names):
105
- - analysis_workspace_state.json (schema below)
106
- - analysis_workspace_state.md
110
+ - analysis_workspace_state.json (machine ledger: module/node/artifact status, stale inputs, reruns, blockers, next actions)
111
+ - analysis_workspace_state.md (agent-readable ledger: status tables, stale/rerun/blocker evidence, next safe action)
107
112
 
108
113
  analysis_workspace_state.json schema:
109
114
  { "status": "completed | blocked", "node": "analysis-workspace-state", "output_root": "",
@@ -87,7 +87,10 @@ You are the `behavior-logic` node subagent and behavior/control-flow owner dispa
87
87
  }
88
88
  ```
89
89
 
90
- The companion `behavior_logic.md` is an agent-readable handoff: screen-to-state-holder mapping, major user-action flows, lifecycle/initialization behavior, links to upstream data-contract/flow diagrams, project architecture/ecosystem effects on logic, business rules and error/loading/empty handling, cross-module interaction summary, state machines, unknowns, and assumptions.
90
+ ## Output Files And Contents
91
+
92
+ - `behavior_logic.json`: machine-routable behavior/control artifact containing screen logic, state holders, initialization flow, user-action flows, lifecycle behaviors, business rules, data-contract links, control flows, cross-module interactions, state machines, upstream alignment, assumptions, and evidence paths.
93
+ - `behavior_logic.md`: agent-readable behavior handoff containing screen-to-state-holder mapping, major user-action flows, lifecycle/initialization behavior, links to upstream data-contract/flow diagrams, project architecture/ecosystem effects on logic, business rules and error/loading/empty handling, cross-module interaction summary, state machines, unknowns, and assumptions.
91
94
 
92
95
  ## Inline Persona for Teammate
93
96
 
@@ -148,8 +151,8 @@ HANDLER (how you process):
148
151
  flowchart for complex logic).
149
152
 
150
153
  OUTPUTS (write under output_dir, exact names):
151
- - behavior_logic.json
152
- - behavior_logic.md
154
+ - behavior_logic.json (machine artifact: screen logic, actions, lifecycle, rules, data links, control/state flows, upstream alignment, evidence)
155
+ - behavior_logic.md (agent handoff: behavior tables, flow/state diagrams, upstream alignment, unknowns)
153
156
 
154
157
  RETURN TO CONTROLLER (exactly this shape, no preamble):
155
158
  {
@@ -88,7 +88,10 @@ You are the `data-contract-flow` node subagent and data contract/flow owner disp
88
88
  }
89
89
  ```
90
90
 
91
- The companion `data_contract_flow.md` is an agent-readable handoff: network stack overview, API endpoint table, consumer mapping table, local/generated/platform data-source inventory, model mapping notes, repository & mapper flow tables, reactive stream summary, end-to-end Mermaid flow diagrams (when evidence allows), loading/error/empty handling summary, dynamic or unknown API gaps, gaps, and assumptions.
91
+ ## Output Files And Contents
92
+
93
+ - `data_contract_flow.json`: machine-routable data contract/flow artifact containing network stack, API declarations, request/response/model contracts, local/generated/platform data sources, model mappings, repository flows, reactive streams, transformations, end-to-end flows, dynamic/unknown APIs, cross-module data links, gaps, assumptions, and evidence paths.
94
+ - `data_contract_flow.md`: agent-readable data handoff containing network stack overview, API endpoint table, consumer mapping table, local/generated/platform data-source inventory, model mapping notes, repository & mapper flow tables, reactive stream summary, end-to-end Mermaid flow diagrams when evidence allows, loading/error/empty handling summary, dynamic or unknown API gaps, gaps, and assumptions.
92
95
 
93
96
  ## Inline Persona for Teammate
94
97
 
@@ -152,8 +155,8 @@ HANDLER (how you process):
152
155
  unavailable, unclear consumers).
153
156
 
154
157
  OUTPUTS (write under output_dir, exact names):
155
- - data_contract_flow.json
156
- - data_contract_flow.md
158
+ - data_contract_flow.json (machine artifact: APIs, data sources, models, mappings, repository/reactive/end-to-end flows, gaps, evidence)
159
+ - data_contract_flow.md (agent handoff: endpoint/source/consumer tables, flow diagrams, loading/error/empty behavior, unknowns)
157
160
 
158
161
  RETURN TO CONTROLLER (exactly this shape, no preamble):
159
162
  {
@@ -130,7 +130,11 @@ You are the `presentation-resource` node subagent and presentation/resource owne
130
130
  }
131
131
  ```
132
132
 
133
- The companion `presentation_resource.md` is an agent-readable handoff: UI entry point overview, screen inventory table, checked UI layout/view trees by screen or section, Mermaid navigation graph (when evidence allows), presentation module decomposition, shared component summary, local resource inventory, online resource sources, downloaded resource manifest, resource→usage mapping table, production vs debug/test/sample classification, migration implications, download gaps, unknowns, and assumptions.
133
+ ## Output Files And Contents
134
+
135
+ - `presentation_resource.json`: machine-routable presentation/resource artifact containing UI entry points, screen inventory, checked UI layout/view trees, presentation modules, navigation edges, shared presentation components, local/online/downloaded resources, resource usage map, migration implications, cross-module references, download gaps, assumptions, and evidence paths.
136
+ - `presentation_resource.md`: agent-readable presentation handoff containing UI entry point overview, screen inventory table, checked UI layout/view trees by screen or section, Mermaid navigation graph when evidence allows, presentation module decomposition, shared component summary, local resource inventory, online resource sources, downloaded resource manifest, resource-to-usage mapping table, production vs debug/test/sample classification, migration implications, download gaps, unknowns, and assumptions.
137
+ - `downloaded_resources/`: optional auxiliary directory for safe concrete HTTP(S) resources downloaded for analysis. Every file must be represented in `downloaded_resources[]` with original URL, local path, content type, SHA-256, byte size, status, and reason when skipped/failed.
134
138
 
135
139
  ## Checked UI Layout / View Tree Format
136
140
 
@@ -280,8 +284,9 @@ ForegroundConstraintLayout @id/parent_layout [match_parent x wrap_content, padd
280
284
  └── src=ic_vector_more_new, tint=Graph_weak
281
285
 
282
286
  OUTPUTS (write under output_dir, exact names):
283
- - presentation_resource.json
284
- - presentation_resource.md
287
+ - presentation_resource.json (machine artifact: screens, checked UI trees, navigation, presentation modules, resources, usage map, downloads, gaps, evidence)
288
+ - presentation_resource.md (agent handoff: screen/resource tables, checked UI tree blocks, navigation graph, migration implications, unknowns)
289
+ - downloaded_resources/ (optional safe downloaded resource copies, only when concrete URLs are proven)
285
290
 
286
291
  RETURN TO CONTROLLER (exactly this shape, no preamble):
287
292
  {
@@ -97,7 +97,10 @@ You are the `project-architecture` node subagent and project architecture/ecosys
97
97
  }
98
98
  ```
99
99
 
100
- The companion `project_architecture.md` is an agent-readable handoff: build/SDK configuration, project topology overview, detected patterns + confidence, layer/role mapping, dependency + Jetpack inventory, DI setup, persistence/background/platform-service usage, generated tooling, dependency direction notes, legacy hybrid patterns/risks, migration constraints, and unknowns.
100
+ ## Output Files And Contents
101
+
102
+ - `project_architecture.json`: machine-routable architecture/ecosystem artifact containing build/SDK configuration, module topology, detected patterns with confidence, layer roles, dependency ecosystem, Jetpack usage, DI setup, platform services, boundary violations/hybrids, migration constraints, cross-module dependencies, assumptions, and evidence paths.
103
+ - `project_architecture.md`: agent-readable architecture handoff containing build/SDK configuration, project topology overview, detected patterns + confidence, layer/role mapping, dependency + Jetpack inventory, DI setup, persistence/background/platform-service usage, generated tooling, dependency direction notes, legacy hybrid patterns/risks, migration constraints, and unknowns.
101
104
 
102
105
  ## Inline Persona for Teammate
103
106
 
@@ -156,8 +159,8 @@ HANDLER (how you process):
156
159
  9. Identify legacy traits and migration/onboarding implications.
157
160
 
158
161
  OUTPUTS (write under output_dir, exact names):
159
- - project_architecture.json
160
- - project_architecture.md
162
+ - project_architecture.json (machine artifact: build config, topology, patterns, layers, dependencies, platform/generated constraints, evidence)
163
+ - project_architecture.md (agent handoff: architecture/ecosystem tables, risks, migration constraints, unknowns)
161
164
 
162
165
  RETURN TO CONTROLLER (exactly this shape, no preamble):
163
166
  {
@@ -56,14 +56,14 @@ Required durable artifacts:
56
56
 
57
57
  | Schedule point | Required artifacts |
58
58
  |---|---|
59
- | Output root lock | `<output_root>/run_manifest.json` |
60
- | Workspace state | `<workspace_state_dir>/analysis_workspace_state.json`, `<workspace_state_dir>/analysis_workspace_state.md` |
61
- | Module inventory | `<module_index_dir>/module_inventory.json`, `<module_index_dir>/module_inventory.md` |
62
- | Per module brief | `<module_root>/module_brief.json` |
63
- | Per module node outputs | `<module_node_dir>/<node_artifact>.json`, `<module_node_dir>/<node_artifact>.md` |
64
- | Per module representation | `<module_representation_dir>/module_representation.json`, `<module_representation_dir>/module_representation.md` |
65
- | Global representation | `<global_dir>/global_representation.json`, `<global_dir>/global_representation.md` |
66
- | SPEC package | `<spec_dir>/prd.md`, `<spec_dir>/design.md`, `<spec_dir>/verification.md`, plus `<spec_dir>/plan.md` in migration mode |
59
+ | Output root lock | `<output_root>/run_manifest.json` - run identity, paths, mode, scope, allowed roots, dependency status, schedule version |
60
+ | Workspace state | `<workspace_state_dir>/analysis_workspace_state.json`, `<workspace_state_dir>/analysis_workspace_state.md` - module/node/artifact ledger, stale inputs, reruns, blockers, next safe actions |
61
+ | Module inventory | `<module_index_dir>/module_inventory.json`, `<module_index_dir>/module_inventory.md` - deterministic module list/order, scopes, dependencies, out-of-scope roots, evidence |
62
+ | Per module brief | `<module_root>/module_brief.json` - module-scoped dispatch contract and role hints for one `module_id` |
63
+ | Per module node outputs | `<module_node_dir>/<node_artifact>.json`, `<module_node_dir>/<node_artifact>.md` - role-owned evidence matching the active role schema |
64
+ | Per module representation | `<module_representation_dir>/module_representation.json`, `<module_representation_dir>/module_representation.md` - module synthesis from verified node outputs only |
65
+ | Global representation | `<global_dir>/global_representation.json`, `<global_dir>/global_representation.md` - full-project synthesis from module representations only |
66
+ | SPEC package | `<spec_dir>/prd.md`, `<spec_dir>/design.md`, `<spec_dir>/verification.md`, plus `<spec_dir>/plan.md` in migration mode - final SPEC with traceability, coverage, and readiness |
67
67
 
68
68
  No node may choose its own output path. `presentation-resource` may write downloaded resources only under `<module_root>/node-results/presentation-resource/downloaded_resources/`.
69
69
 
@@ -82,7 +82,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
82
82
  - **Executor**: Leader
83
83
  - **Input**: `source_project_path`, optional `analysis_scope` / `mode` / `target_project_path` / `output_dir` / `language`, optional `jetbrains` MCP context
84
84
  - **Action**: verify the target is an Android project (`AndroidManifest.xml`, `settings.gradle(.kts)`, `build.gradle(.kts)`, or a `com.android.*` module) and that the request needs structured analysis, not a one-off lookup. Select `exploration` or `migration`. Lock `output_root`, `module_index_dir`, `global_dir`, and `spec_dir`. Write `run_manifest.json` with source path, mode, target path, scope, schedule version, allowed path roots, and timestamp.
85
- - **Output**: announced mode banner + `run_manifest.json`; default `output_root` = `~/.a2c_agents/understand/android-project-analyst`
85
+ - **Output**: announced mode banner + `run_manifest.json`; default `output_root` = `~/.a2c_agents/understand/android-project-analyst`. `run_manifest.json` must contain source/target paths, mode, analysis scope, output root, allowed path roots, dependency-preflight status, schedule version, and timestamp.
86
86
  - **Serial / Parallel**: serial (precedes all dispatch)
87
87
  - **Quality gate**: Android evidence present AND scope valid AND `run_manifest.json` exists/non-empty → proceed; otherwise STOP and explain the failed check. Migration mode without `target_project_path` → ask before producing `plan.md`.
88
88
 
@@ -91,7 +91,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
91
91
  - **Executor**: `analysis-workspace-state`
92
92
  - **Input**: output root, run manifest, current controller step, known module/node/artifact outputs, source change/timestamp evidence, rerun reports, blockers
93
93
  - **Action**: initialize and refresh the analysis ledger. Track module status, node output inventory, artifact inventory, stale upstream inputs, rerun history, blockers, and next safe controller actions.
94
- - **Output**: `analysis_workspace_state.json`, `analysis_workspace_state.md`
94
+ - **Output**: `analysis_workspace_state.json`, `analysis_workspace_state.md`. JSON is the machine ledger for module status, node output files, artifact inventory, stale upstream inputs, rerun history, blockers, and next actions. Markdown mirrors the ledger as an agent handoff with stale/rerun/blocker tables.
95
95
  - **Serial / Parallel**: serial; refreshed after module inventory, Stage A, Stage B, module representation, global representation, and SPEC.
96
96
  - **Quality gate**: downstream stages do not consume artifacts marked stale; rerun the responsible module/node or mark the affected module `blocked`.
97
97
 
@@ -100,7 +100,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
100
100
  - **Executor**: Leader
101
101
  - **Input**: source path, analysis scope, Android evidence, module/build files, optional MCP module context
102
102
  - **Action**: partition the project into explicit `analysis_modules`. Prefer Gradle modules and feature packages; when one Gradle module contains multiple independent features, split by package/route/feature boundary. Each module entry MUST include `module_id` (stable slug), `module_type` (`app | feature | ui | logic | data | platform | shared | test | unknown`), `source_roots`, `ui_scope`, `logic_scope`, `data_scope`, `resource_scope`, `depends_on`, and `module_output_root`. Include UI-only and logic-only modules when they exist; if a module has no UI or no logic, record `none` with evidence.
103
- - **Output**: `module_inventory.json`, `module_inventory.md`
103
+ - **Output**: `module_inventory.json`, `module_inventory.md`. JSON must contain `analysis_modules`, deterministic `module_order`, in-scope and out-of-scope roots, dependencies, and each module's output root. Markdown must explain module boundaries and evidence without doing role analysis.
104
104
  - **Serial / Parallel**: serial (precedes all module dispatch)
105
105
  - **Quality gate**: module inventory exists/non-empty, every in-scope source root is assigned to one module or `out_of_scope`, and `module_order` is deterministic.
106
106
 
@@ -109,7 +109,10 @@ No node may choose its own output path. `presentation-resource` may write downlo
109
109
  - **Executor**: `presentation-resource`, `project-architecture`, `data-contract-flow`
110
110
  - **Input**: per-node contract `{ source_project_path, module_id, module_scope, analysis_scope, mode, module_brief_path, skill_spec_path (roles/<id>.md), output_dir: <output_root>/modules/<module_id>/node-results/<node_id>, return_format: json }`; `data-contract-flow` may also receive `presentation_hints` when known.
111
111
  - **Action**: each node validates inputs, performs its bounded clustered slice, writes its JSON+MD artifacts, and returns the controller JSON shape.
112
- - **Output**: `presentation_resource.*`, `project_architecture.*`, `data_contract_flow.*`
112
+ - **Output**:
113
+ - `presentation_resource.json`, `presentation_resource.md`: UI entry points, screen inventory, checked UI layout/view trees, navigation, presentation modules, resources, safe downloads, usage map, migration implications, gaps.
114
+ - `project_architecture.json`, `project_architecture.md`: build/SDK config, topology, architecture patterns, layer roles, dependencies, Jetpack/DI/platform/generated usage, boundary risks, migration constraints.
115
+ - `data_contract_flow.json`, `data_contract_flow.md`: network/local data contracts, APIs, models, data sources, mappings, repository/reactive/end-to-end flows, loading/error/empty behavior, dynamic API gaps.
113
116
  - **Serial / Parallel**: parallel within one module — all three run together for the same `module_id`. Do not start the next module until the current module representation is written unless the user explicitly allows concurrent modules.
114
117
  - **Quality gate**: each return must be `status: "completed"` with `output_files` that exist and are non-empty. Refresh `analysis-workspace-state` after the group; on missing/empty/non-`completed`/stale output → re-dispatch that node with the same contract plus the failure reason (retry policy in [bind.md](bind.md) § Failure Handling). Do NOT synthesize around a failed node.
115
118
 
@@ -118,7 +121,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
118
121
  - **Executor**: `behavior-logic`
119
122
  - **Input**: required `module_id`, `module_scope`, `presentation_resource_path`, `project_architecture_path`, `data_contract_flow_path`, and latest `analysis_workspace_state_path`
120
123
  - **Action**: synthesize user-action / lifecycle / state-machine / business-rule behavior, referencing (not rebuilding) upstream catalogs.
121
- - **Output**: `behavior_logic.*`
124
+ - **Output**: `behavior_logic.json`, `behavior_logic.md`. JSON must contain screen logic, state holders, lifecycle/user-action/control flows, business rules, data-contract links, cross-module interactions, state machines, and upstream alignment. Markdown must provide an agent handoff with diagrams when evidence supports them.
122
125
  - **Serial / Parallel**: serial within the module — runs after that module's Stage A gate passes.
123
126
  - **Quality gate**: latest workspace state must not mark Stage A inputs stale; return-shape + output-file checks; every major UI/logic scope from the module brief has behavior coverage or an explicit reason for none.
124
127
 
@@ -127,7 +130,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
127
130
  - **Executor**: Leader
128
131
  - **Input**: verified node JSON/MD outputs for one `module_id`
129
132
  - **Action**: integrate ONLY from verified outputs for that module. Write a module representation that covers both UI and logic when present: module purpose, UI surface, resources, architecture/ecosystem, data contracts/flows, behavior logic, dependencies, risks, gaps, evidence index, and readiness.
130
- - **Output**: `module_representation.json`, `module_representation.md`
133
+ - **Output**: `module_representation.json`, `module_representation.md`. JSON is the module-level synthesis and traceability index; Markdown is the agent-readable handoff. Both must cite verified node artifacts and source evidence for UI/resources, architecture, data flow, behavior, risks, gaps, and readiness.
131
134
  - **Serial / Parallel**: serial
132
135
  - **Quality gate**: no unknowns hidden; every module representation points to its node artifacts and source evidence. Refresh workspace state after writing. Do not proceed to global integration until every scheduled module is represented or explicitly marked blocked/out of scope.
133
136
 
@@ -136,7 +139,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
136
139
  - **Executor**: Leader
137
140
  - **Input**: all verified module representations
138
141
  - **Action**: combine module representations into a total full-project global representation. Preserve module boundaries first, then synthesize cross-module architecture, navigation, data dependencies, shared resources, shared logic, platform constraints, conflicts, and global readiness. Do not read raw source to fill gaps at this stage; rerun the responsible module/node instead.
139
- - **Output**: `global_representation.json`, `global_representation.md`
142
+ - **Output**: `global_representation.json`, `global_representation.md`. JSON is the full-project representation and evidence index; Markdown explains cross-module architecture, navigation, shared resources, shared logic, data dependencies, platform constraints, conflicts, and global readiness.
140
143
  - **Serial / Parallel**: serial
141
144
  - **Quality gate**: latest workspace state must not mark required module representations stale; every global claim maps to a module representation and source-path evidence, or is marked `assumed`, `unknown`, or `blocked`.
142
145
 
@@ -145,7 +148,7 @@ No node may choose its own output path. `presentation-resource` may write downlo
145
148
  - **Executor**: Leader
146
149
  - **Input**: `global_representation.json`, `global_representation.md`, module inventory, module representations, latest `analysis_workspace_state.json`
147
150
  - **Action**: write SPEC artifacts under `<output_root>/SPEC`. **Exploration** mode → `prd.md`, `design.md`, `verification.md`. **Migration** mode → adds `plan.md`. SPEC must synthesize, not paste node summaries; every important claim maps to module/global representation evidence and source paths or is marked assumption/gap. `design.md` sections include a Mermaid diagram, structured table, or evidence mapping; presentation/navigation, project architecture, data-contract/flow, and cross-module sections include diagrams when evidence exists.
148
- - **Output**: SPEC files + the completion report below
151
+ - **Output**: SPEC files + the completion report below. `prd.md` captures product behavior and journeys, `design.md` captures implementation structure and evidence-backed diagrams/tables, `verification.md` captures coverage/traceability/consistency/readiness, and migration-mode `plan.md` captures migration milestones, source-to-target mapping, validation, risks, and blockers.
149
152
 
150
153
  #### Final Report Format
151
154
 
@@ -21,7 +21,7 @@ The registry separated controller from nodes and even encoded the staged dispatc
21
21
  - Review→fix loop after any file-changing node: `module-node-migration-review` ↔ `module-node-migration-fix`.
22
22
  - Parallel verify (B): `source-set-placement-guard`, `api-contract-parity`, `ui-render-fidelity-check`, `incremental-build-check`.
23
23
  - Completion + report: `prd-completion-check` → `migration-report` → `kmp-test-validator` handoff.
24
- - Cross-cutting: `migration-workspace-state` ledger refreshed after major completions.
24
+ - Cross-cutting: `migration-workspace-state` progress ledger refreshed after every major stage, tracking per-module finish rate, plan-vs-code gaps, stale outputs, and rerun hooks.
25
25
  - **Disjointness check: PASS.** Each node owns a distinct slice (state ledger vs SPEC delta vs target understanding vs alignment vs dependency gate vs theme vs resource vs navigation vs platform vs state/model vs UI vs logic vs review vs fix vs source-set guard vs API parity vs render vs build vs completion vs report). `module-node-migration-review` and `-fix` are intentionally complementary (read-only judge vs scoped editor) and gated as a loop, not overlapping.
26
26
 
27
27
  ## Content port map
@@ -65,7 +65,7 @@ The second refactor added a module-first migration schedule and strict output pa
65
65
  - Every module-scoped node now receives `migration_module_id`, `module_scope`, exact `output_dir`, and allowed target files/source sets when it may change files.
66
66
  - Review mode remains read-only. Fix mode consumes explicit findings, `allowed_files`, `owning_node`, and `migration_module_id`; re-review is a fresh read-only invocation.
67
67
  - Verification runs per module first. Global aggregation consumes module representations rather than loose node output lists.
68
- - `migration-report` may return `ready_for_validation` only when every scheduled module representation and the global representation exists and is non-empty.
68
+ - `completion-report` report mode may return `ready_for_validation` only when every scheduled module representation and the global representation exists and is non-empty.
69
69
 
70
70
  ### Path compatibility
71
71
 
@@ -102,3 +102,28 @@ The third refactor reduces active migrator role definitions from 20 to 10. The f
102
102
  - Verification is consolidated but still read-only for source changes and uses explicit check IDs.
103
103
  - Completion and report are consolidated but report mode is blocked until readiness mode and module/global representation gates pass.
104
104
  - Build-config changes remain owned only by `dependency-platform-gate`.
105
+
106
+ ## Workspace Progress Ledger Refinement
107
+
108
+ The `migration-workspace-state` role was refined from basic node/stale-output tracking into the controller's progress ledger. It now records per-module migration status, current stage, planned/completed work units, `finish_rate`, changed-file ownership, plan-vs-code gaps, stale outputs, rerun hooks, blocker history, and next safe action.
109
+
110
+ This preserves the role boundary: `migration-workspace-state` still does not analyze source behavior, implement code, fix code, or issue readiness verdicts. It only compares controller-visible plan artifacts, implementation outputs, review outputs, verification outputs, changed-file ownership, and freshness evidence so the Leader can rerun the correct owner before downstream consumption.
111
+
112
+ ## Output Contract Refinement
113
+
114
+ The active skill docs now distinguish output filenames from output content responsibilities. `SKILL.md` and `workflow.md` define the full artifact schedule and content matrix, while each role file states the exact JSON/Markdown filenames and the evidence each artifact must contain.
115
+
116
+ This keeps the reduced-role boundaries explicit:
117
+
118
+ - `migration_workspace_state.*` records progress ledger state only.
119
+ - `migration_analysis_planning.*` records SPEC/raw-source deltas, target evidence, source-to-target mapping, and ordered tasks.
120
+ - `dependency_platform_gate.*` records dependency, build, platform, and source-set decisions.
121
+ - `presentation_integration.*` records theme/token/resource/media/navigation prep and UI handoff.
122
+ - `state_data_prep.*` records state/model/API contract prep and logic handoff.
123
+ - `ui_implementation.*` records visible UI implementation evidence and binding surfaces.
124
+ - `logic_implementation.*` records behavior/data/API/state implementation evidence.
125
+ - `module_node_review.*` and `module_node_fix.*` record review/fix evidence by mode.
126
+ - `migration_verification.*` records stable check results and routed failures.
127
+ - `completion_readiness.*` and `migration_report.*` record readiness and validation handoff evidence.
128
+
129
+ The Leader must reject artifacts that have the correct filename but contain another role's work or prose-only summaries without machine-routable evidence.
@@ -10,7 +10,7 @@ disable-model-invocation: true
10
10
  roles:
11
11
  - id: migration-workspace-state
12
12
  kind: ai_agent
13
- purpose: State ledger owner — 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
16
  - id: migration-analysis-planning
@@ -71,7 +71,7 @@ The team is a **reduced specialization pipeline (C) with embedded parallel fan-o
71
71
  0. **Pre-flight** — verify optional dependencies from [dependencies.yaml](dependencies.yaml).
72
72
  1. **Trigger + output root** — lock `output_root = <output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator`; write `run_manifest.json`.
73
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/`.
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
75
  4. **Per-module planning** — run `migration-analysis-planning`.
76
76
  5. **Per-module dependency/platform gate** — run `dependency-platform-gate`.
77
77
  6. **Per-module prep fan-out** — run `presentation-integration` and `state-data-prep` when inputs allow.
@@ -86,7 +86,7 @@ Each node is dispatched as a subagent that must read its role file (`skill_spec_
86
86
 
87
87
  | id | Purpose | When dispatched | Role file |
88
88
  |---|---|---|---|
89
- | `migration-workspace-state` | Ledger and stale-output tracking | Global and module refreshes | [roles/migration-workspace-state.md](roles/migration-workspace-state.md) |
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
90
  | `migration-analysis-planning` | SPEC deltas, target understanding, alignment | Per-module first stage | [roles/migration-analysis-planning.md](roles/migration-analysis-planning.md) |
91
91
  | `dependency-platform-gate` | Dependency readiness and platform replacement | Before prep/implementation | [roles/dependency-platform-gate.md](roles/dependency-platform-gate.md) |
92
92
  | `presentation-integration` | Theme, resources, navigation | Prep fan-out before UI | [roles/presentation-integration.md](roles/presentation-integration.md) |
@@ -124,7 +124,11 @@ Required artifacts:
124
124
  - `<output_root>/run_manifest.json`
125
125
  - `<module_index_dir>/migration_module_inventory.json`
126
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`
127
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`
128
132
  - `<node_result_dir>/<node-specific>.json`
129
133
  - `<node_result_dir>/<node-specific>.md`
130
134
  - `<module_representation_dir>/module_migration_representation.json`
@@ -134,6 +138,32 @@ Required artifacts:
134
138
  - `<report_dir>/migration_report.json`
135
139
  - `<report_dir>/migration_report.md`
136
140
 
141
+ ## Output Artifact Content Matrix
142
+
143
+ The controller verifies both artifact names and role-aligned content before a downstream stage consumes any file.
144
+
145
+ | Stage / owner | Output file(s) | Required content |
146
+ |---|---|---|
147
+ | Output root lock / Leader | `run_manifest.json` | Migration trigger, Android/SPEC inputs, KMP target path, migration scope, output root, allowed roots, dependency-preflight status, schedule version, timestamp. |
148
+ | Module inventory / Leader | `migration_module_inventory.json`, `migration_module_inventory.md` | Deterministic migration module list/order, `migration_module_id`, module scope, UI/logic/data/resource scope, target placement hints, allowed target files/source sets, module output roots, blockers. |
149
+ | Module brief / Leader | `module_brief.json` | One module's dispatch contract: module id/scope, source/SPEC evidence paths, target hints, allowed files/source sets, expected node schedule, representation path, assumptions. |
150
+ | Workspace progress / `migration-workspace-state` | `migration_workspace_state.json`, `migration_workspace_state.md` | Per-module migration status, finish rates, stage status, node status, changed-file ownership, plan-vs-code gaps, stale outputs, rerun hooks, blocker/rerun history, next safe actions. |
151
+ | Planning / `migration-analysis-planning` | `migration_analysis_planning.json`, `migration_analysis_planning.md` | SPEC/raw-source deltas, target KMP understanding, reuse inventory, source-to-target map, resource project map, integration scaffold, ordered implementation tasks, blockers. |
152
+ | Dependency/platform / `dependency-platform-gate` | `dependency_platform_gate.json`, `dependency_platform_gate.md` | Required capability map, minimal-change dependency decisions, build-config changes, platform capability boundaries, expect/actual/source-set plan, changed files, implementation constraints, blockers. |
153
+ | Presentation prep / `presentation-integration` | `presentation_integration.json`, `presentation_integration.md` | Theme/design-token mapping, target component/resource reuse, local/online media modeling, route/navigation mapping, UI handoff, changed files, presentation gaps, blockers. |
154
+ | State/data prep / `state-data-prep` | `state_data_prep.json`, `state_data_prep.md` | State holder mapping, UI state/events/effects, DTO/domain/UI model mapping, mappers, API/data contract expectations, logic handoff, changed files, blockers. |
155
+ | UI implementation / `ui-implementation` | `ui_implementation.json`, `ui_implementation.md` | Migrated visible UI surface, changed UI/resource files, UI coverage, fidelity notes, binding surfaces, diagnostics, blockers. |
156
+ | Logic implementation / `logic-implementation` | `logic_implementation.json`, `logic_implementation.md` | Implemented behavior/data/API/state propagation, architecture alignment, platform boundaries, data flows, API integrations, logic coverage, changed files, diagnostics, blockers. |
157
+ | Review mode / `module-node-review-fix` | `module_node_review.json`, `module_node_review.md` | Read-only review of one owning node slice: reviewed files, contract/scope/parity/source-set/dependency findings, approval or `needs_fix`, blockers. |
158
+ | Fix mode / `module-node-review-fix` | `module_node_fix.json`, `module_node_fix.md` | Scoped fix report for explicit findings: fixed/unfixed findings, changed files, `requires_re_review: true`, blockers. |
159
+ | Verification / `migration-verification` | `migration_verification.json`, `migration_verification.md`, optional log files | `source_set`, `api_contract`, `ui_render`, and `incremental_build` check results, evidence, failures, routed owner nodes, command/log paths, blockers. |
160
+ | Readiness / `completion-report` | `completion_readiness.json`, `completion_readiness.md` | Requirement coverage, migration invariants, review/verification completion, rerun requests, blockers, readiness for representation/report gates. |
161
+ | Module representation / Leader | `module_migration_representation.json`, `module_migration_representation.md` | Module synthesis from verified node outputs only: source-to-target mapping, changed files by role, UI/state/data/logic/platform coverage, verification evidence, gaps, readiness. |
162
+ | Global representation / Leader | `global_migration_representation.json`, `global_migration_representation.md` | Cross-module migration synthesis from module representations only: global target changes, shared files/ownership, coverage, unresolved blockers, validation handoff prerequisites. |
163
+ | Final report / `completion-report` | `migration_report.json`, `migration_report.md` | Validation-ready migration handoff: source/target paths, scope, module/global representation paths, changed files by role, source-to-target summary, coverage summary, validation inputs, limitations, manual steps, blockers. |
164
+
165
+ JSON artifacts are the machine-routable source of truth. Markdown artifacts are agent-readable handoffs that preserve exact paths, evidence, commands/logs where applicable, changed-file ownership, rerun context, blockers, and next-node routing. Node Markdown must not be a prose-only completion summary.
166
+
137
167
  ## Shared Return Shape
138
168
 
139
169
  ```json
@@ -152,12 +182,13 @@ Required artifacts:
152
182
  }
153
183
  ```
154
184
 
155
- Controller handling: missing/empty `output_files` -> rerun the same node; non-empty `stale_upstream_inputs` -> refresh upstream artifacts then rerun; non-empty `rerun_requests` -> dispatch the responsible node first; unresolved `blocking_gaps` -> stop with a user-visible blocker.
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.
156
186
 
157
187
  ## Shared Rules
158
188
 
159
189
  - Each node must read its own role file before work and stay inside its responsibility boundary.
160
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.
161
192
  - Every important claim must include evidence from source paths, SPEC sections, upstream node outputs, or module/global representations.
162
193
  - The controller must not substitute itself for node implementation.
163
194
  - Target conventions and reusable modules/components take priority over new abstractions.
@@ -10,6 +10,7 @@
10
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
 
@@ -19,15 +20,18 @@ Team-level rules — distinct from each role's own `## Boundary`.
19
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.
20
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.
21
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.
22
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.
23
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`.
24
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.
25
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`.
26
28
  - **No placeholder completion**: no implementation node may return `completed` with TODO/FIXME/stub/sample-only-data in production paths as its deliverable.
27
- - **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.
28
- - **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.
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.
29
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.
30
- - **Representation gate**: every scheduled module must have `module_migration_representation.json` and `.md`. `migration-report` cannot return `ready_for_validation` until every scheduled module representation plus `global_migration_representation.json` and `.md` exists and is non-empty.
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.
31
35
 
32
36
  ## Failure Handling
33
37
 
@@ -36,10 +40,12 @@ Team-level rules — distinct from each role's own `## Boundary`.
36
40
  | Failure mode | Response |
37
41
  |---|---|
38
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`. |
39
- | 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]`. |
40
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. |
41
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. |
42
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. |
43
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. |
44
50
 
45
51
  ### (b) Input over-scale degradation
@@ -48,7 +54,7 @@ Team-level rules — distinct from each role's own `## Boundary`.
48
54
  |---|---|
49
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`. |
50
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. |
51
- | 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). |
52
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. |
53
59
 
54
60
  ### Escalation rules
@@ -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.
@@ -53,6 +53,13 @@ Mandatory:
53
53
 
54
54
  Shared return shape applies.
55
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
+
56
63
  ## Inline Persona for Teammate
57
64
 
58
65
  ```text
@@ -65,8 +72,8 @@ Report mode: consume module/global representations and write migration_report.js
65
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.
66
73
 
67
74
  OUTPUTS:
68
- - readiness mode: completion_readiness.json/md
69
- - report mode: migration_report.json/md
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)
70
77
 
71
78
  Return JSON only. Report mode can return ready_for_validation only after representation gates pass.
72
79
  ```
@@ -46,6 +46,11 @@ Mandatory:
46
46
 
47
47
  Shared return shape applies.
48
48
 
49
+ ## Output Files And Contents
50
+
51
+ - `dependency_platform_gate.json`: machine-routable gate artifact containing capability map, minimal-change dependency decisions, build-config changes, platform capabilities, Android-only API replacement strategy, expect/actual/source-set placement, changed files, implementation constraints, and blockers.
52
+ - `dependency_platform_gate.md`: agent-readable gate handoff containing dependency/platform decisions, build-change rationale, source-set/platform-boundary notes, changed-file summary, downstream constraints, and blockers.
53
+
49
54
  ## Inline Persona for Teammate
50
55
 
51
56
  ```text
@@ -56,8 +61,8 @@ You protect the target build and common source sets. Map module capabilities to
56
61
  INPUTS: migration_module_id, module_scope, migration_analysis_planning_path, target paths, allowed_files, allowed_source_sets, output_root, output_dir.
57
62
 
58
63
  OUTPUTS:
59
- - dependency_platform_gate.json
60
- - dependency_platform_gate.md
64
+ - dependency_platform_gate.json (machine gate: capabilities, dependency/build decisions, platform boundaries, changed files, constraints)
65
+ - dependency_platform_gate.md (agent handoff: rationale, source-set/platform notes, downstream constraints, blockers)
61
66
 
62
67
  Return status ready_for_implementation or blocked. Include changed_files and blockers.
63
68
  ```