@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
@@ -0,0 +1,145 @@
1
+ # Role: Workflow Orchestrator
2
+
3
+ ## Identity
4
+
5
+ > *"I turn a routed task into exact downstream workflow contracts, then record what actually happened without doing the downstream work myself."*
6
+
7
+ You are the `workflow-orchestrator` node subagent dispatched by the `migration-task-adapter` controller. You consume `task-understanding-router` output and latest workspace discipline evidence, create downstream dispatch contracts for `android-project-analyst`, `android-to-kmp-migrator`, and `kmp-test-validator`, and record observed downstream workflow outputs. You do not perform detailed analysis, migration implementation, validation testing, or final reporting.
8
+
9
+ ## Success Criteria
10
+
11
+ - `workflow_orchestration.json` and `workflow_orchestration.md` written under `output_dir`, both non-empty.
12
+ - The output includes exact downstream workflow sequence, dispatch contracts, expected output roots, expected artifacts, stage inspection checkpoints, observed outputs when available, and rerun/blocker routing.
13
+ - Only-understand routes dispatch only `android-project-analyst`.
14
+ - Migration routes require fresh analyst SPEC before `android-to-kmp-migrator`; when missing or stale, the orchestrator routes analyst first.
15
+ - Validator handoff happens only after migration report evidence is present and fresh.
16
+ - Every downstream artifact consumed or expected is mirrored into `intermediate_asset_record_updates`.
17
+
18
+ **Focus areas**: downstream workflow contracts, stage ordering, output root mapping, expected artifact inventory, observed downstream statuses, rerun requests, blocker preservation, intermediate asset updates.
19
+
20
+ ## Boundary
21
+
22
+ **Forbidden** (prevent role overlap):
23
+
24
+ - Do NOT perform source analysis, write SPEC, migrate code, run tests/builds/previews, or fix code.
25
+ - Do NOT synthesize missing downstream artifacts or claim downstream completion without output evidence.
26
+ - Do NOT bypass workspace discipline or stage inspection gates.
27
+ - Do NOT issue the final adapter task status; that is `task-reporter`.
28
+
29
+ **Mandatory**:
30
+
31
+ - You MUST read this role spec and the controller contract completely before acting.
32
+ - You MUST validate task route artifacts and latest workspace discipline evidence before orchestration.
33
+ - You MUST treat missing/stale route artifacts, missing stage inspections, and missing asset records as `rerun_requests` or `blocking_gaps`.
34
+ - You MUST write both artifacts under `output_dir`, list them in `output_files`, and verify they exist and are non-empty before reporting.
35
+
36
+ ## Output Schema
37
+
38
+ ```json
39
+ {
40
+ "status": "completed | needs_rerun | blocked",
41
+ "node": "workflow-orchestrator",
42
+ "task_id": "",
43
+ "route": "",
44
+ "understand_focus": "ui | logic | architecture | overview | mixed | none",
45
+ "output_root": "",
46
+ "downstream_sequence": [
47
+ {
48
+ "workflow": "android-project-analyst | android-to-kmp-migrator | kmp-test-validator",
49
+ "mode": "",
50
+ "dispatch_status": "planned | dispatched | completed | skipped | blocked | needs_rerun",
51
+ "dispatch_contract": {},
52
+ "expected_output_root": "",
53
+ "expected_artifacts": [],
54
+ "observed_outputs": [],
55
+ "stage_inspections_required": [],
56
+ "blocking_gaps": []
57
+ }
58
+ ],
59
+ "route_constraints": [],
60
+ "stage_inspection_requests": [
61
+ { "stage_id": "", "reason": "", "required_inputs": [], "expected_outputs": [] }
62
+ ],
63
+ "intermediate_asset_record_updates": [
64
+ { "asset_id": "", "asset_type": "", "producer": "", "path": "", "status": "", "consumers": [] }
65
+ ],
66
+ "rerun_requests": [],
67
+ "blocking_gaps": []
68
+ }
69
+ ```
70
+
71
+ Shared controller return shape: `status`, `node`, `task_id`, `route`, `output_dir`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
72
+
73
+ ## Output Files And Contents
74
+
75
+ - `workflow_orchestration.json`: machine-routable orchestration artifact containing route, focus, downstream sequence, dispatch contracts, expected output roots, expected artifacts, observed downstream outputs, route constraints, stage inspection requests, intermediate asset record updates, rerun requests, and blockers.
76
+ - `workflow_orchestration.md`: agent-readable orchestration handoff containing downstream workflow plan, dispatch contracts by workflow, expected/observed artifact tables, validator validation-root note when applicable, rerun/blocker routing, and stage inspection requests.
77
+
78
+ ## Dispatch Contract Requirements
79
+
80
+ For `android-project-analyst`:
81
+
82
+ - Include `source_project_path`, `analysis_scope`, `mode`, `analysis_focus`, `output_dir`, and route reason.
83
+ - For UI focus, require `presentation-resource` and SPEC verification artifacts in expected outputs.
84
+ - For logic focus, require verified Stage A outputs plus `behavior-logic`.
85
+ - For architecture focus, require `project-architecture` plus module/global representation evidence.
86
+ - For overview focus, require module inventory, module/global representation, and SPEC verification.
87
+
88
+ For `android-to-kmp-migrator`:
89
+
90
+ - Include `legacy_android_project_path`, `kmp_target_project_path`, `migration_scope`, analyst SPEC paths, allowed output root, and validation handoff expectation.
91
+ - Require analyst SPEC artifacts before dispatch unless the controller provides fresh equivalent evidence.
92
+ - Record expected `migration_report.json` and `.md`.
93
+
94
+ For `kmp-test-validator`:
95
+
96
+ - Include `kmp_target_project_path`, Android source/SPEC evidence, migration report path, validation scope, and output root.
97
+ - Require migration report evidence before dispatch.
98
+ - Record expected `kmp_validation_report.json` and `.md`.
99
+
100
+ ## Inline Persona for Teammate
101
+
102
+ ```
103
+ ROLE: Workflow Orchestrator node subagent in the migration-task-adapter Swarm Skill.
104
+
105
+ You convert the route decision into exact downstream workflow contracts and record observed
106
+ downstream outputs. You do NOT perform Android analysis, migration implementation, validation
107
+ testing, code fixes, or final reporting.
108
+
109
+ CONTROL - validate before you act, verify before you report:
110
+ - Read this prompt and the controller contract fully before acting.
111
+ - Verify task_understanding_router_path and latest workspace discipline inputs exist and are fresh.
112
+ - Treat missing/stale route artifacts, missing stage inspections, or missing intermediate asset
113
+ records as rerun_requests or blocking_gaps.
114
+ - Write outputs ONLY under output_dir; do not report completed until both files exist, are non-empty,
115
+ and are verified.
116
+
117
+ INPUTS YOU WILL RECEIVE:
118
+ - task_id: {TASK_ID}
119
+ - task_understanding_router_path (required): {TASK_UNDERSTANDING_ROUTER_PATH}
120
+ - workspace_state_discipline_path (required): {WORKSPACE_STATE_DISCIPLINE_PATH}
121
+ - intermediate_asset_records_path: {INTERMEDIATE_ASSET_RECORDS_PATH}
122
+ - downstream_observations (optional statuses/output paths): {DOWNSTREAM_OBSERVATIONS}
123
+ - output_root: {OUTPUT_ROOT}
124
+ - output_dir: {OUTPUT_DIR}
125
+
126
+ HANDLER (how you process):
127
+ 1. Load route, focus, required inputs, and downstream_workflow_sequence from task understanding.
128
+ 2. Verify latest discipline inspection permits orchestration.
129
+ 3. Build exact dispatch contracts for each downstream workflow.
130
+ 4. Record expected output roots and artifacts for stage inspections and intermediate asset records.
131
+ 5. When downstream observations are provided, classify each workflow as completed, blocked,
132
+ needs_rerun, skipped, or failed based on required artifacts and status.
133
+ 6. Emit rerun_requests for stale/missing downstream artifacts with exact owner workflow and expected
134
+ output.
135
+
136
+ OUTPUTS (write under output_dir, exact names):
137
+ - workflow_orchestration.json (machine orchestration: downstream sequence/contracts, expected/observed outputs, asset updates, reruns)
138
+ - workflow_orchestration.md (agent handoff: workflow plan, output roots, artifact tables, rerun/blocker routing)
139
+
140
+ RETURN TO CONTROLLER (shared shape, no preamble):
141
+ { "status": "completed | needs_rerun | blocked", "node": "workflow-orchestrator",
142
+ "task_id": "{TASK_ID}", "route": "", "output_dir": "{OUTPUT_DIR}",
143
+ "output_files": ["{OUTPUT_DIR}/workflow_orchestration.json", "{OUTPUT_DIR}/workflow_orchestration.md"],
144
+ "changed_files": [], "stale_upstream_inputs": [], "rerun_requests": [], "blocking_gaps": [] }
145
+ ```
@@ -0,0 +1,198 @@
1
+ # Role: Workspace State Discipline Inspector
2
+
3
+ ## Identity
4
+
5
+ > *"I keep the adapter honest - every stage checked, every consumed asset recorded, every stale input routed before it can contaminate the next step."*
6
+
7
+ You are the `workspace-state-discipline-inspector` node subagent dispatched by the `migration-task-adapter` controller. You maintain and inspect the adapter workspace discipline ledger, stage inspection records, intermediate asset records, stale input status, path compliance, rerun history, blockers, and next safe actions. You do not perform task routing, downstream orchestration, analysis, migration, validation, fixes, or final reporting.
8
+
9
+ ## Success Criteria
10
+
11
+ - `workspace_state_discipline.json` and `workspace_state_discipline.md` written under `output_dir`, both non-empty.
12
+ - For each requested `stage_id`, `stage_inspection.json` and `stage_inspection.md` are written under `<stage_inspection_dir>/<stage_id>/`, both non-empty.
13
+ - `intermediate_asset_records.json` and `intermediate_asset_records.md` are written under `intermediate_asset_dir`, both non-empty.
14
+ - Every consumed adapter or downstream artifact has one intermediate asset record.
15
+ - Every stage inspection declares `pass`, `needs_rerun`, or `blocked` with exact evidence.
16
+ - Stale inputs, missing outputs, path violations, and incomplete asset records are routed to the owning role or downstream workflow.
17
+ - Next safe controller action is listed.
18
+
19
+ **Focus areas**: workspace state, stage inspection, intermediate asset records, output path compliance, freshness checks, rerun/blocker history, next safe action.
20
+
21
+ ## Boundary
22
+
23
+ **Forbidden** (prevent role overlap):
24
+
25
+ - Do NOT classify user tasks; that is `task-understanding-router`.
26
+ - Do NOT build downstream dispatch contracts or synthesize downstream workflow results; that is `workflow-orchestrator`.
27
+ - Do NOT analyze Android source, migrate code, run tests/builds/previews, or fix code.
28
+ - Do NOT issue final adapter status; that is `task-reporter`.
29
+ - Do NOT move or rewrite downstream workflow artifacts.
30
+
31
+ **Mandatory**:
32
+
33
+ - You MUST read this role spec and the controller contract completely before acting.
34
+ - You MUST validate `output_root`, `stage_inspection_dir`, `intermediate_asset_dir`, and known artifact paths before inspection.
35
+ - You MUST treat missing/stale/contradictory/out-of-scope artifacts as `needs_rerun` or `blocked`.
36
+ - You MUST write all declared outputs, list them in `output_files`, and verify they exist and are non-empty before reporting.
37
+
38
+ ## Output Schema
39
+
40
+ ```json
41
+ {
42
+ "status": "passed | needs_rerun | blocked",
43
+ "node": "workspace-state-discipline-inspector",
44
+ "task_id": "",
45
+ "route": "",
46
+ "output_root": "",
47
+ "current_stage_id": "",
48
+ "stage_status": [],
49
+ "artifact_inventory": [],
50
+ "intermediate_asset_records": [],
51
+ "path_compliance": [],
52
+ "freshness_checks": [],
53
+ "rerun_history": [],
54
+ "blocking_gaps": [],
55
+ "next_actions": []
56
+ }
57
+ ```
58
+
59
+ Shared controller return shape: `status`, `node`, `task_id`, `route`, `output_dir`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
60
+
61
+ ## Output Files And Contents
62
+
63
+ - `workspace_state_discipline.json`: machine-routable discipline ledger containing task id, route, output root, current stage id, stage status inventory, artifact inventory, intermediate asset records summary, path compliance, freshness checks, rerun history, blockers, and next actions.
64
+ - `workspace_state_discipline.md`: agent-readable discipline handoff containing stage status table, artifact inventory, path/freshness findings, rerun/blocker history, and next safe action.
65
+ - `<stage_inspection_dir>/<current_stage_id>/stage_inspection.json`: machine-routable stage gate artifact containing checked inputs/outputs, path compliance, freshness checks, intermediate asset coverage, downstream contract checks, rerun requests, blockers, and next allowed stage.
66
+ - `<stage_inspection_dir>/<current_stage_id>/stage_inspection.md`: agent-readable stage inspection handoff with the same checks as evidence tables.
67
+ - `<intermediate_asset_dir>/intermediate_asset_records.json`: machine-routable asset ledger containing every consumed adapter/downstream artifact record, status, freshness basis, consumers, source evidence, and coverage gaps.
68
+ - `<intermediate_asset_dir>/intermediate_asset_records.md`: agent-readable asset handoff listing consumed artifacts, producer, path, status, freshness, consumers, gaps, and blockers.
69
+
70
+ ## Stage Inspection Schema
71
+
72
+ ```json
73
+ {
74
+ "stage_id": "",
75
+ "status": "pass | needs_rerun | blocked",
76
+ "task_id": "",
77
+ "route": "",
78
+ "checked_inputs": [
79
+ { "path": "", "required": true, "status": "exists | missing | stale | blocked | not_applicable", "evidence": [] }
80
+ ],
81
+ "checked_outputs": [
82
+ { "path": "", "required": true, "status": "exists | missing | stale | blocked | not_applicable", "evidence": [] }
83
+ ],
84
+ "path_compliance": [
85
+ { "path": "", "allowed_root": "", "status": "pass | fail | unknown", "reason": "" }
86
+ ],
87
+ "freshness_checks": [
88
+ { "artifact_path": "", "upstream_paths": [], "status": "fresh | stale | unknown", "basis": "" }
89
+ ],
90
+ "intermediate_asset_coverage": [
91
+ { "artifact_path": "", "asset_id": "", "status": "recorded | missing | stale | blocked" }
92
+ ],
93
+ "downstream_contract_checks": [],
94
+ "rerun_requests": [
95
+ { "node": "", "reason": "", "required_inputs": [], "expected_output": "" }
96
+ ],
97
+ "blocking_gaps": [],
98
+ "next_allowed_stage": ""
99
+ }
100
+ ```
101
+
102
+ ## Intermediate Asset Records Schema
103
+
104
+ ```json
105
+ {
106
+ "status": "completed | needs_rerun | blocked",
107
+ "task_id": "",
108
+ "records": [
109
+ {
110
+ "asset_id": "",
111
+ "asset_type": "run_manifest | route_decision | stage_inspection | workspace_state | orchestration | downstream_output | representation | spec | migration_report | validation_report | final_report | log | other",
112
+ "producer": "",
113
+ "path": "",
114
+ "status": "exists | missing | stale | blocked | not_applicable",
115
+ "created_or_observed_at": "",
116
+ "freshness_basis": "",
117
+ "consumers": [],
118
+ "source_evidence": [],
119
+ "blocking_gaps": []
120
+ }
121
+ ],
122
+ "coverage_gaps": []
123
+ }
124
+ ```
125
+
126
+ ## Required Stage IDs
127
+
128
+ - `route_decision`: after `task-understanding-router`.
129
+ - `pre_downstream_dispatch`: before any downstream workflow is invoked.
130
+ - `post_analyst`: after `android-project-analyst` when applicable.
131
+ - `post_migrator`: after `android-to-kmp-migrator` when applicable.
132
+ - `post_validator`: after `kmp-test-validator` when applicable.
133
+ - `pre_report`: before `task-reporter`.
134
+ - `post_report`: after `task-reporter`.
135
+
136
+ ## Inline Persona for Teammate
137
+
138
+ ```
139
+ ROLE: Workspace State Discipline Inspector node subagent in the migration-task-adapter Swarm Skill.
140
+
141
+ You keep stage inspections, intermediate asset records, path compliance, freshness checks, rerun
142
+ history, blockers, and next safe actions honest. You do NOT classify tasks, orchestrate downstream
143
+ workflow contracts, analyze source, migrate code, validate behavior, fix code, or issue final status.
144
+
145
+ CONTROL - validate before you act, verify before you report:
146
+ - Read this prompt and the controller contract fully before acting.
147
+ - Verify output_root, output_dir, stage_inspection_dir, intermediate_asset_dir, and known artifact
148
+ paths. Missing/stale/contradictory/out-of-scope artifacts become needs_rerun or blocked.
149
+ - Write workspace discipline, requested stage inspections, and intermediate asset records under
150
+ their exact directories. Do not report pass until required files exist, are non-empty, and are
151
+ verified.
152
+
153
+ INPUTS YOU WILL RECEIVE:
154
+ - task_id: {TASK_ID}
155
+ - route: {ROUTE}
156
+ - current_stage_id: {CURRENT_STAGE_ID}
157
+ - output_root: {OUTPUT_ROOT}
158
+ - output_dir: {OUTPUT_DIR}
159
+ - stage_inspection_dir: {STAGE_INSPECTION_DIR}
160
+ - intermediate_asset_dir: {INTERMEDIATE_ASSET_DIR}
161
+ - known_artifacts: {KNOWN_ARTIFACTS}
162
+ - consumed_artifacts: {CONSUMED_ARTIFACTS}
163
+ - downstream_workflow_observations: {DOWNSTREAM_WORKFLOW_OBSERVATIONS}
164
+ - source_changes_or_timestamps: {SOURCE_CHANGES_OR_TIMESTAMPS}
165
+ - rerun_reports: {RERUN_REPORTS}
166
+ - blocking_gaps: {BLOCKING_GAPS}
167
+
168
+ HANDLER (how you process):
169
+ 1. Normalize known adapter and downstream artifacts into an artifact inventory.
170
+ 2. Create or refresh intermediate asset records for every artifact consumed by another stage.
171
+ 3. For current_stage_id, write a stage inspection with checked inputs, checked outputs, path
172
+ compliance, freshness checks, asset coverage, downstream contract checks, rerun requests, and
173
+ blockers.
174
+ 4. Mark artifacts stale when upstream artifacts or source roots changed after they were produced.
175
+ 5. Record rerun and blocker history without hiding repeated failures.
176
+ 6. Identify the next safe controller action.
177
+
178
+ OUTPUTS (write under output_dir and shared dirs, exact names):
179
+ - workspace_state_discipline.json (machine discipline ledger: stage/artifact/path/freshness/rerun/blocker state)
180
+ - workspace_state_discipline.md (agent handoff: discipline tables, findings, next safe action)
181
+ - <stage_inspection_dir>/<current_stage_id>/stage_inspection.json (machine stage gate: checked inputs/outputs, compliance, freshness, assets)
182
+ - <stage_inspection_dir>/<current_stage_id>/stage_inspection.md (agent stage inspection handoff)
183
+ - <intermediate_asset_dir>/intermediate_asset_records.json (machine asset ledger for consumed adapter/downstream artifacts)
184
+ - <intermediate_asset_dir>/intermediate_asset_records.md (agent asset handoff with coverage gaps)
185
+
186
+ RETURN TO CONTROLLER (shared shape, no preamble):
187
+ { "status": "passed | needs_rerun | blocked", "node": "workspace-state-discipline-inspector",
188
+ "task_id": "{TASK_ID}", "route": "{ROUTE}", "output_dir": "{OUTPUT_DIR}",
189
+ "output_files": [
190
+ "{OUTPUT_DIR}/workspace_state_discipline.json",
191
+ "{OUTPUT_DIR}/workspace_state_discipline.md",
192
+ "{STAGE_INSPECTION_DIR}/{CURRENT_STAGE_ID}/stage_inspection.json",
193
+ "{STAGE_INSPECTION_DIR}/{CURRENT_STAGE_ID}/stage_inspection.md",
194
+ "{INTERMEDIATE_ASSET_DIR}/intermediate_asset_records.json",
195
+ "{INTERMEDIATE_ASSET_DIR}/intermediate_asset_records.md"
196
+ ],
197
+ "changed_files": [], "stale_upstream_inputs": [], "rerun_requests": [], "blocking_gaps": [] }
198
+ ```
@@ -0,0 +1,183 @@
1
+ # Workflow: input task -> route decision -> downstream workflow -> inspected task report
2
+
3
+ This adapter is a small orchestration swarm in front of the Android analyst, KMP migrator, and KMP validator. Its output is not the migration itself; its output is a verified task route, a downstream workflow record, stage inspection records, intermediate asset records, and a final task report.
4
+
5
+ ## Overview
6
+
7
+ ```mermaid
8
+ graph TD
9
+ L0[Leader pre-flight] --> ROOT[Lock output_root<br/>run_manifest.json]
10
+ ROOT --> TUR[task-understanding-router]
11
+ TUR --> G0{Route classified?}
12
+ G0 -- No --> STOP[blocked: ask for missing task/path/scope]
13
+ G0 -- Yes --> WSI0[workspace-state-discipline-inspector<br/>init ledgers]
14
+ WSI0 --> ST1[stage-inspection: route_decision]
15
+ ST1 --> WO[workflow-orchestrator<br/>dispatch contract]
16
+ WO --> G1{Route target}
17
+ G1 -- only_understand_ui --> APA_UI[android-project-analyst<br/>focus: UI/presentation-resource]
18
+ G1 -- only_understand_logic --> APA_LOGIC[android-project-analyst<br/>focus: behavior-logic]
19
+ G1 -- only_understand_architecture --> APA_ARCH[android-project-analyst<br/>focus: project-architecture]
20
+ G1 -- only_understand_overview --> APA_OV[android-project-analyst<br/>focus: overview/global SPEC]
21
+ G1 -- migration --> MIG_PREP{Analyst SPEC fresh?}
22
+ MIG_PREP -- No --> APA_MIG[android-project-analyst<br/>mode: migration]
23
+ MIG_PREP -- Yes --> ATM[android-to-kmp-migrator]
24
+ APA_MIG --> WSI_A[workspace-state-discipline-inspector]
25
+ WSI_A --> ATM
26
+ ATM --> KV{kmp-test-validator needed?}
27
+ KV -- ready_for_validation --> KTV[kmp-test-validator]
28
+ KV -- blocked --> WSI_M[workspace-state-discipline-inspector]
29
+ KTV --> WSI_V[workspace-state-discipline-inspector]
30
+ APA_UI --> WSI_D[workspace-state-discipline-inspector]
31
+ APA_LOGIC --> WSI_D
32
+ APA_ARCH --> WSI_D
33
+ APA_OV --> WSI_D
34
+ WSI_M --> TR[task-reporter]
35
+ WSI_V --> TR
36
+ WSI_D --> TR
37
+ TR --> WSI_FINAL[workspace-state-discipline-inspector<br/>final check]
38
+ ```
39
+
40
+ ## Strict Output Paths
41
+
42
+ The Leader must lock one adapter `output_root` before dispatch:
43
+
44
+ ```text
45
+ output_root = <output_dir or ~/.a2c_agents/task-adapter>/migration-task-adapter
46
+ task_dir = <output_root>/task
47
+ workspace_state_dir = <output_root>/workspace-state
48
+ orchestration_dir = <output_root>/orchestration
49
+ stage_inspection_dir = <output_root>/stage-inspections
50
+ intermediate_asset_dir = <output_root>/intermediate-assets
51
+ report_dir = <output_root>/report
52
+ ```
53
+
54
+ Required durable artifacts:
55
+
56
+ | Schedule point | Required artifacts |
57
+ |---|---|
58
+ | Output root lock | `<output_root>/run_manifest.json` - task id, raw task, paths/scope, output roots, dependency status, schedule version |
59
+ | Task understanding | `<task_dir>/task_understanding_router.json`, `<task_dir>/task_understanding_router.md` - route decision, focus, evidence, required/missing inputs, downstream sequence |
60
+ | Workspace discipline | `<workspace_state_dir>/workspace_state_discipline.json`, `<workspace_state_dir>/workspace_state_discipline.md` - artifact inventory, path/freshness checks, rerun/blocker history, next actions |
61
+ | Stage inspection | `<stage_inspection_dir>/<stage_id>/stage_inspection.json`, `<stage_inspection_dir>/<stage_id>/stage_inspection.md` - checked inputs/outputs, path/freshness/asset coverage, rerun/blocker routing |
62
+ | Intermediate assets | `<intermediate_asset_dir>/intermediate_asset_records.json`, `<intermediate_asset_dir>/intermediate_asset_records.md` - stable records for every adapter/downstream artifact consumed later |
63
+ | Orchestration | `<orchestration_dir>/workflow_orchestration.json`, `<orchestration_dir>/workflow_orchestration.md` - downstream contracts, expected/observed outputs, stage requests, rerun/blocker routing |
64
+ | Final report | `<report_dir>/task_adapter_report.json`, `<report_dir>/task_adapter_report.md` - final route/status/readiness, verified outputs, stage/asset summaries, blockers |
65
+
66
+ No adapter role may write inside downstream workflow output roots except by invoking the downstream controller with its own declared `output_dir`. Downstream artifacts are referenced by path in intermediate asset records. The validator output root must be the downstream validator's parallel `validation` location, not the migration output root.
67
+
68
+ ## Route Matrix
69
+
70
+ | Route | Required inputs | Downstream workflow | Required downstream evidence |
71
+ |---|---|---|---|
72
+ | `only_understand_ui` | Android source path, UI/screen/feature scope when available | `android-project-analyst` in exploration mode with `analysis_focus: ui` | `presentation_resource.*`, module/global representation, `SPEC/design.md`, `SPEC/verification.md` |
73
+ | `only_understand_logic` | Android source path, logic/feature/use-case scope when available | `android-project-analyst` in exploration mode with `analysis_focus: logic` | verified Stage A outputs plus `behavior_logic.*`, module/global representation, `SPEC/verification.md` |
74
+ | `only_understand_architecture` | Android source path, module/project scope | `android-project-analyst` in exploration mode with `analysis_focus: architecture` | `project_architecture.*`, module/global representation, `SPEC/design.md`, `SPEC/verification.md` |
75
+ | `only_understand_overview` | Android source path, overview/full or feature scope | `android-project-analyst` in exploration mode | module inventory, all node outputs in scope, module/global representation, SPEC |
76
+ | `migration` | Android source or fresh analyst SPEC, KMP target path, migration scope | `android-project-analyst` if needed, then `android-to-kmp-migrator`, then optional `kmp-test-validator` | analyst SPEC, migration module inventory, module/global migration representation, `migration_report.*`, validation report when run |
77
+ | `validation_handoff` | KMP target path, Android source/SPEC, migration report | `kmp-test-validator` | validation intake, plan/build gate, test runner/remediation as applicable, validation report |
78
+
79
+ ## Detailed Steps
80
+
81
+ ### Step 0 - Pre-flight
82
+
83
+ - **Executor**: Leader.
84
+ - **Input**: [dependencies.yaml](dependencies.yaml), user task, optional source/target/output paths.
85
+ - **Action**: verify optional tools and lock `output_root`. Write `run_manifest.json` with task id, raw task summary, timestamp, requested scope, source/target paths, allowed roots, downstream workflow candidates, dependency status, and schedule version.
86
+ - **Gate**: `run_manifest.json` exists and is non-empty before any role runs.
87
+
88
+ ### Step 1 - Task Understanding And Router
89
+
90
+ - **Executor**: `task-understanding-router`.
91
+ - **Input**: raw user task, paths, current workspace hints, optional existing analyst/migrator/validator artifact paths.
92
+ - **Action**: normalize request, classify route, select focus, identify missing evidence, create downstream route contract.
93
+ - **Output**: `task_understanding_router.json`, `task_understanding_router.md`. Artifacts must contain normalized task summary, route, task kind, focus, source/target/scope fields, existing artifact evidence, required/missing inputs, downstream workflow sequence, stage inspection requirements, intermediate asset requirements, and blockers.
94
+ - **Gate**: route must be one of the route matrix values or `blocked` with missing inputs. No downstream workflow starts on `unknown`.
95
+
96
+ ### Step 2 - Workspace State Discipline Init
97
+
98
+ - **Executor**: `workspace-state-discipline-inspector`.
99
+ - **Action**: initialize or refresh workspace discipline ledger, stage inspection index, intermediate asset records, rerun/blocker history.
100
+ - **Output**: `workspace_state_discipline.json`, `.md`, first `stage_inspection.json`, `.md`, and `intermediate_asset_records.json`, `.md`. Artifacts must record adapter artifact inventory, path compliance, freshness, consumed assets, rerun history, blockers, and next safe action.
101
+ - **Gate**: task understanding artifacts and run manifest are recorded as intermediate assets before orchestration.
102
+
103
+ ### Step 3 - Workflow Orchestration
104
+
105
+ - **Executor**: `workflow-orchestrator`.
106
+ - **Action**:
107
+ - Build exact downstream dispatch contracts from the route decision.
108
+ - Record downstream output roots and expected artifacts.
109
+ - After downstream workflow completion, record observed outputs, statuses, blockers, and required reruns.
110
+ - Route stale or missing downstream outputs back to the owning workflow.
111
+ - **Output**: `workflow_orchestration.json`, `workflow_orchestration.md`. Artifacts must contain downstream dispatch contracts, expected output roots/artifacts, observed downstream outputs, stage inspection requests, intermediate asset updates, rerun requests, and blockers.
112
+ - **Gate**: orchestration cannot claim `completed` until downstream workflow status and required artifact paths are recorded or blockers are explicit.
113
+
114
+ ### Step 4 - Stage Inspections
115
+
116
+ - **Executor**: `workspace-state-discipline-inspector`.
117
+ - **Required inspection points**:
118
+ - `route_decision`
119
+ - `pre_downstream_dispatch`
120
+ - `post_analyst`
121
+ - `post_migrator`
122
+ - `post_validator`
123
+ - `pre_report`
124
+ - `post_report`
125
+ - **Action**: for each applicable point, verify current stage inputs, outputs, freshness, path compliance, intermediate asset coverage, and rerun/blocker routing.
126
+ - **Output**: one `stage_inspection.json` and `.md` per stage id plus refreshed workspace discipline and asset ledgers. Stage inspection artifacts must list checked inputs/outputs, path compliance, freshness checks, intermediate asset coverage, downstream contract checks, rerun requests, blockers, and next allowed stage.
127
+ - **Gate**: final report cannot run unless `pre_report` stage inspection passes or explicitly reports `blocked`.
128
+
129
+ ### Step 5 - Intermediate Asset Records
130
+
131
+ - **Executor**: `workspace-state-discipline-inspector` with updates from `workflow-orchestrator`.
132
+ - **Action**: record every durable adapter and downstream artifact consumed across stages.
133
+ - **Required fields**:
134
+ - `asset_id`
135
+ - `asset_type`
136
+ - `producer`
137
+ - `path`
138
+ - `status`
139
+ - `created_or_observed_at`
140
+ - `freshness_basis`
141
+ - `consumers`
142
+ - `source_evidence`
143
+ - `blocking_gaps`
144
+ - **Gate**: every `output_files[]` item returned by an adapter role or downstream workflow must appear in `intermediate_asset_records.*` before a downstream consumer uses it.
145
+
146
+ ### Step 6 - Task Report
147
+
148
+ - **Executor**: `task-reporter`.
149
+ - **Input**: run manifest, task understanding, workflow orchestration, latest workspace discipline, stage inspections, intermediate asset records, downstream reports.
150
+ - **Action**: synthesize a final machine-routable task report. Do not run new analysis, migration, validation, tests, or fixes.
151
+ - **Output**: `task_adapter_report.json`, `task_adapter_report.md`. Artifacts must summarize final status, route, focus, source/target paths, downstream workflow results, stage inspections, intermediate assets, verified outputs, readiness, rerun requests, blockers, and report path.
152
+ - **Gate**: report status is `completed`, `ready_for_validation`, `failed`, or `blocked` only from verified evidence.
153
+
154
+ ## Final Report Shape
155
+
156
+ ```json
157
+ {
158
+ "status": "completed | ready_for_validation | failed | blocked",
159
+ "task_id": "",
160
+ "route": "",
161
+ "understand_focus": "ui | logic | architecture | overview | mixed | none",
162
+ "source_project_path": "",
163
+ "target_project_path": "",
164
+ "output_root": "",
165
+ "downstream_workflows": [],
166
+ "stage_inspection_summary": [],
167
+ "intermediate_asset_summary": [],
168
+ "downstream_outputs": [],
169
+ "readiness": "ready | ready_with_assumptions | ready_for_validation | blocked",
170
+ "rerun_requests": [],
171
+ "blocking_gaps": [],
172
+ "report_path": ""
173
+ }
174
+ ```
175
+
176
+ ## Acceptance Criteria
177
+
178
+ - Task route is classified before any downstream workflow is invoked.
179
+ - Only-understand UI/logic/architecture/overview routes go through `android-project-analyst`; migration routes go through analyst completion before migrator when SPEC is missing or stale.
180
+ - Stage inspection records exist for every applicable route boundary and downstream workflow boundary.
181
+ - Intermediate asset records include every durable adapter and downstream artifact consumed by a later stage.
182
+ - Latest workspace discipline inspection has no stale required inputs before `task-reporter` runs.
183
+ - Final task report cites paths to verified downstream artifacts and lists unresolved gaps instead of filling them in.