@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-migration/wow-migrator",
3
- "version": "0.1.1",
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",
@@ -1,37 +1,67 @@
1
- # Conversion Note: `android-project-analyst` → Swarm Skill
1
+ # Conversion Note: `android-project-analyst` → clustered Swarm Skill
2
2
 
3
- This skill was converted from a single controller-support skill (a flat SKILL.md registry plus 7 sibling node-spec files) into a compliant **Swarm Skill** using `swarmskill-creator` convert mode.
3
+ This file records the role-shape history for the `android-project-analyst` skill folder. It is not an active dispatch contract; active node contracts live in [SKILL.md](SKILL.md), [workflow.md](workflow.md), and the files under [roles](roles/).
4
4
 
5
- ## Source structure (before)
5
+ ## Phase 1 — Controller support skill to Swarm Skill
6
+
7
+ The skill was first converted from a single controller-support skill (a flat `SKILL.md` registry plus seven sibling node-spec files) into a compliant **Swarm Skill** using `swarmskill-creator` convert mode.
8
+
9
+ ### Source structure before Phase 1
6
10
 
7
11
  - `SKILL.md` — controller registry describing convert mode, node contracts, dispatch order, and the SPEC output contract.
8
- - 7 flat node specs at the skill root: `ui-understand.md`, `architecture-pattern.md`, `android-ecosystem.md`, `api-list.md`, `resource-understand.md`, `data-flow.md`, `logic-understand.md`. Each contained Role / Inputs / Mandatory Input Validation & Output Storage / Specific Task / Required Outputs / Return Format / Self-Check.
12
+ - Seven flat node specs at the skill root: `ui-understand.md`, `architecture-pattern.md`, `android-ecosystem.md`, `api-list.md`, `resource-understand.md`, `data-flow.md`, `logic-understand.md`. Each contained Role / Inputs / Mandatory Input Validation & Output Storage / Specific Task / Required Outputs / Return Format / Self-Check.
9
13
 
10
- ## What was lost in the pre-swarm form
14
+ ### What Phase 1 added
11
15
 
12
16
  The registry already separated controller from nodes, but it did not encode the team as a first-class artifact: there were no per-role anti-convergence mottos, no `Forbidden`/`Mandatory` boundary blocks the validator could check, no pasteable `Inline Persona` (so each dispatch re-derived the contract by hand), no Mermaid topology making the parallel-then-pipeline shape explicit, and no resource/behavioral guardrails (`max_parallel_teammates`, token/wall-clock budgets, degraded modes). The handoff gates between stages lived only in prose.
13
17
 
14
- ## Decomposition
18
+ The seven-role Swarm Skill preserved the source contracts while adding explicit topology, per-role boundaries, self-contained pasteable personas, budgets, and degraded modes.
19
+
20
+ ## Phase 2 — Seven roles to four clustered roles
21
+
22
+ The second pass analyzed each role's function and duty, found repeated cataloging across adjacent personas, and reduced active dispatch from seven roles to four clustered personas. The full analysis is in [ROLE_CLUSTERING.md](ROLE_CLUSTERING.md).
23
+
24
+ ## Phase 3 — Add workspace-state ledger role
25
+
26
+ The third pass adds `analysis-workspace-state`, following the ledger pattern used by `android-to-kmp-migrator` and `kmp-test-validator`. This role does not change the four clustered analysis personas. It tracks module/node artifact status, stale upstream inputs, rerun/blocker history, and next safe controller actions so global representations and SPEC files are not built from stale evidence.
15
27
 
16
- - **Pattern: Mixed B + C.** Stage A (`ui-understand`, `architecture-pattern`, `android-ecosystem`, `api-list`) is parallel decomposition (B) over disjoint slices. Stage B (`resource-understand`, `data-flow`) and Stage C (`logic-understand`) form a specialization pipeline (C) with hard handoff gates — each consumes verified upstream outputs and must not rebuild them.
17
- - **Disjointness check: PASS.** No node's deliverable can substitute for another's — UI surface vs. architecture style vs. platform ecosystem vs. API contracts vs. resources vs. data movement vs. control-flow behavior are mutually exclusive ownership domains, enforced by each role's `## Boundary > Forbidden` naming its siblings.
28
+ ## Old-to-new role map
18
29
 
19
- ## Content port map
30
+ | Old role(s) | New clustered role | Reason |
31
+ |---|---|---|
32
+ | `ui-understand` + `resource-understand` | `presentation-resource` | Resource usage and migration risk are meaningful only when tied to screens, components, navigation, and UI technology. |
33
+ | `architecture-pattern` + `android-ecosystem` | `project-architecture` | Module topology, architecture style, dependency ecosystem, DI scopes, generated tooling, and Android-only constraints form one project-structure reality check. |
34
+ | `api-list` + `data-flow` | `data-contract-flow` | APIs, local data sources, models, repositories, streams, cache/error behavior, transformations, and write-back paths are one data path. |
35
+ | `logic-understand` | `behavior-logic` | Behavior remains last because user/lifecycle/control-flow analysis requires verified upstream presentation, project, and data evidence. |
36
+ | none (new ledger role) | `analysis-workspace-state` | Workspace-state tracking is cross-cutting and read-only; it prevents stale module/node artifacts from being consumed downstream. |
20
37
 
21
- | Source node-spec content | Ported to |
38
+ ## Current decomposition
39
+
40
+ - **Pattern: Workspace-state + Mixed B + C.** `analysis-workspace-state` is initialized after output-root lock and refreshed after each major artifact group. Stage A (`presentation-resource`, `project-architecture`, `data-contract-flow`) is parallel decomposition (B) over clustered slices. Stage B (`behavior-logic`) is a gated specialization step (C) that consumes verified, non-stale upstream outputs and must not rebuild them.
41
+ - **Boundary check: PASS.** Clustered roles remove the most common duplicate cataloging while preserving distinct ownership: workspace ledger vs. presentation/resource evidence vs. project architecture/ecosystem evidence vs. data contract/flow evidence vs. behavior/control evidence.
42
+
43
+ ## Current content port map
44
+
45
+ | Contract content | Current location |
22
46
  |---|---|
23
- | `## Role` first paragraph | role `## Identity` (rewritten as a 1-line motto + context) |
24
- | `## Specific Task` numbered steps | role `## Inline Persona for Teammate` HANDLER |
25
- | `## Mandatory Input Validation And Output Storage` | role `## Boundary > Mandatory` + Inline Persona CONTROL block |
26
- | `Do not:` lists + sibling routing | role `## Boundary > Forbidden` |
27
- | `## Required Outputs` JSON/MD | role `## Output Schema` + Inline Persona OUTPUTS |
28
- | `## Return Format` | role Inline Persona RETURN TO CONTROLLER |
29
- | `## Self-Check` | role `## Success Criteria` |
30
- | Controller dispatch order + verification | `workflow.md` (staged steps + gates) |
47
+ | Active role registry | `SKILL.md` frontmatter |
48
+ | Staged dispatch order + verification | `workflow.md` |
31
49
  | Mandatory contract enforcement + agent-only rules | `bind.md` § Behavioral Constraints |
32
50
  | Node failure / rerun handling | `bind.md` § Failure Handling |
33
- | SPEC output contract + MCP context | `SKILL.md` body (preserved) |
51
+ | Function/duty analysis and old-to-new map | `ROLE_CLUSTERING.md` |
52
+ | Per-role identity, boundary, schema, and teammate persona | `roles/<clustered-role>.md` |
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:
34
60
 
35
- ## Team-vs-single delta
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.
36
66
 
37
- The conversion preserves every source contract while adding: explicit parallel/pipeline topology with verifiable gates, per-role anti-overlap boundaries that name siblings, self-contained pasteable personas (no re-derivation per dispatch), resource/token/wall-clock budgets, and concrete degraded modes for large monorepos and missing tooling. The same-name controller subagent in `kmp-migration/agents/android-project-analyst.md` is unchanged in behavior; its `Control Nodes` table now points at `roles/<id>.md`.
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.
@@ -1,81 +1,70 @@
1
1
  ---
2
2
  name: android-project-analyst
3
3
  description: |
4
- 7-role parallel-then-pipeline (B+C) Swarm Skill that converts a Legacy Android project into verified, source-traceable node artifacts and an integrated SPEC package (PRD/DESIGN/PLAN/verification).
5
- Use when the android-project-analyst controller must understand, document, onboard, or migration-prep an existing Android project across UI, architecture, ecosystem, API, resource, data-flow, and logic.
4
+ 5-role module-first Swarm Skill that converts a Legacy Android project into module-scoped artifacts, a workspace-state ledger, a global representation, and an integrated SPEC package (PRD/DESIGN/PLAN/verification) under strict output paths.
5
+ Use when the android-project-analyst controller must understand, document, onboard, or migration-prep an existing Android project by dividing it into modules first, including UI and logic coverage, then combining module representations into a full-project representation.
6
6
  Do NOT use for quick file/symbol lookup, non-Android codebases, or single-agent skill authoring.
7
- version: "0.2"
7
+ version: "0.4"
8
8
  kind: swarm-skill
9
9
  disable-model-invocation: true
10
10
  roles:
11
- - id: ui-understand
11
+ - id: analysis-workspace-state
12
12
  kind: ai_agent
13
- purpose: UI surface owner entry points, screen inventory, XML/Compose hierarchy, navigation edges, shared components, UI module boundaries.
13
+ purpose: Analysis ledgermodule status, node output inventory, stale inputs, rerun/blocker history, artifact readiness, and next actions. No source analysis or SPEC writing.
14
14
  skills: []
15
- tools: [rg]
16
- - id: architecture-pattern
15
+ tools: [git]
16
+ - id: presentation-resource
17
17
  kind: ai_agent
18
- purpose: Architecture owner — Gradle/package topology, architecture style, layer roles, dependency direction, boundary violations, legacy hybrids.
18
+ purpose: Presentation and resource owner — screens, UI technologies, navigation, UI modules, local/remote image and media resources, safe downloads, and UI/resource migration implications.
19
19
  skills: []
20
- tools: [rg]
21
- - id: android-ecosystem
22
- kind: ai_agent
23
- purpose: Ecosystem owner — Gradle/SDK/build config, Jetpack & third-party deps, DI, persistence, background work, platform services, Android-only constraints.
24
- skills: []
25
- tools: [rg]
26
- - id: api-list
20
+ tools: [rg, curl]
21
+ - id: project-architecture
27
22
  kind: ai_agent
28
- purpose: API/data-source owner — network stack, service declarations, request/response models, consumers, local sources, cache/error/pagination, unknown APIs.
23
+ purpose: Project architecture owner — Gradle/module topology, architecture style, layer roles, dependency ecosystem, Jetpack/DI/platform services, generated tooling, and Android-only constraints.
29
24
  skills: []
30
25
  tools: [rg]
31
- - id: resource-understand
32
- kind: ai_agent
33
- purpose: Resource owner — local & online image/media resources, safe downloaded copies, usage map, placeholder/error/theme links, migration implications.
34
- skills: []
35
- tools: [rg, curl]
36
- - id: data-flow
26
+ - id: data-contract-flow
37
27
  kind: ai_agent
38
- purpose: Data-flow owner — sources through repositories, mappers, reactive streams, caches, write-back paths, and UI state propagation.
28
+ purpose: Data contract and flow owner — network/local data contracts, models, consumers, repositories, streams, transformations, cache/error/pagination, write-back, and UI state propagation.
39
29
  skills: []
40
30
  tools: [rg]
41
- - id: logic-understand
31
+ - id: behavior-logic
42
32
  kind: ai_agent
43
- purpose: Logic/control-flow owner — user actions, lifecycle, state holders, business rules, side effects, state machines, cross-module interactions.
33
+ purpose: Behavior and control-flow owner — user actions, lifecycle, state holders, business rules, side effects, state machines, navigation effects, gates, and cross-module interactions.
44
34
  skills: []
45
35
  tools: [rg]
46
36
  ---
47
37
 
48
38
  # Android Project Analyst Swarm Skill
49
39
 
50
- This is the agent-facing registry and team definition for the `android-project-analyst` controller (the same-name subagent in `kmp-migration/agents/`). It converts a Legacy Android source project into verified analysis artifacts for downstream onboarding, exploration, and migration agents.
40
+ This is the agent-facing registry and team definition for the `android-project-analyst` controller (the same-name subagent in `kmp-migration/agents/`). It converts a Legacy Android source project into verified module artifacts, a global project representation, and SPEC artifacts for downstream onboarding, exploration, and migration agents.
51
41
 
52
- The team is **Mixed B+C**: four foundation nodes run in **parallel** (B) over disjoint slices, then a **gated pipeline** (C) runs resource + data-flow, then logic. A single agent role-playing all seven slices systematically under-delivers it converges on whichever slice it started with, blurs ownership boundaries, and silently rebuilds the same catalog three times. Isolating each slice into an owned node with a hard handoff gate keeps every claim traceable to source and prevents the controller from inventing un-evidenced architecture. The controller (Leader) owns routing, contract enforcement, reconciliation, and SPEC integration; nodes own bounded analysis only.
42
+ The team is **module-first Mixed B+C with a workspace-state ledger**: the Leader partitions the project into `analysis_modules`, maintains `analysis-workspace-state` before downstream consumption, runs three foundation nodes in **parallel** (B) inside each module, then a final **gated specialization** node (C) synthesizes module behavior from verified upstream outputs. The Leader writes a module representation per module before combining them into `global_representation.*` and SPEC. The controller owns routing, strict output-path enforcement, reconciliation, workspace-state refreshes, and SPEC integration; nodes own bounded module analysis only.
53
43
 
54
44
  ## Workflow
55
45
 
56
46
  The full playbook (Mermaid topology, per-step gates, integration rules, Final Report format) is in [workflow.md](workflow.md). Protocol summary:
57
47
 
58
- 0. **Pre-flight: check dependencies** — read [dependencies.yaml](dependencies.yaml) and verify `rg` / `curl`. Both are `required: false`; built-in Grep/Read substitute for `rg`, and missing `curl` degrades resource downloads to `download_gaps`. Report status; **user decides** whether to proceed.
59
- 1. **Trigger + mode + shared brief** — Leader verifies Android evidence and scope, selects `exploration` or `migration`, and builds a minimal shared brief. Default `output_dir` = `~/.a2c_agents/understand/` (SPEC under `<output_dir>/SPEC`, node artifacts under `<output_dir>/node-results/<node>`). See [bind.md](bind.md) for over-scale degradation.
60
- 2. **Stage A (parallel, B-pattern)** — dispatch `ui-understand`, `architecture-pattern`, `android-ecosystem`, `api-list`. Gate: each return is `completed` with verified non-empty `output_files`, else re-dispatch with the failure reason.
61
- 3. **Stage B (gated handoff, C-pattern)** after Stage A verifies, dispatch `resource-understand` and `data-flow` with upstream output paths.
62
- 4. **Stage C (final stage)** — after Stage B verifies, dispatch `logic-understand` with all upstream paths.
63
- 5. **Integrate** — reconcile verified outputs into a coverage matrix + evidence index; conflicts affecting architecture/data-flow/ecosystem/migration become `Needs confirmation`.
64
- 6. **Final: write SPEC + verdict** — Leader writes `prd.md`, `design.md`, `verification.md` (+ `plan.md` for migration) under `<output_dir>/SPEC`, then emits the completion report. Leader surfaces conflicts verbatim, never mediates.
48
+ 0. **Pre-flight: check dependencies** — read [dependencies.yaml](dependencies.yaml) and verify `rg` / `curl` / `git`. All are `required: false`; built-in Grep/Read substitute for `rg`, missing `curl` degrades presentation/resource downloads to `download_gaps`, and missing `git` degrades stale-input detection. Report status; **user decides** whether to proceed.
49
+ 1. **Trigger + output root lock** — Leader verifies Android evidence and scope, selects `exploration` or `migration`, locks `output_root = <output_dir or ~/.a2c_agents/understand>/android-project-analyst`, and writes `run_manifest.json`.
50
+ 2. **Workspace state** — dispatch `analysis-workspace-state` under `<output_root>/workspace-state/`; refresh it after module inventory, each module node group, each module representation, global representation, and SPEC.
51
+ 3. **Module inventory** Leader writes `module-index/module_inventory.json` and `.md`, dividing the project into deterministic `analysis_modules` with UI, logic, data, resource, and dependency scopes.
52
+ 4. **Per-module Stage A (parallel, B-pattern)** — for each `module_id`, dispatch `presentation-resource`, `project-architecture`, and `data-contract-flow` under `<output_root>/modules/<module_id>/node-results/<node_id>/`.
53
+ 5. **Per-module Stage B (gated behavior stage, C-pattern)** — after that module's Stage A verifies and workspace-state marks upstream outputs fresh, dispatch `behavior-logic` under the same module root.
54
+ 6. **Module representation** — Leader writes `<output_root>/modules/<module_id>/representation/module_representation.json` and `.md` before moving to the next module.
55
+ 7. **Global representation + SPEC** — Leader combines module representations into `<output_root>/global/global_representation.json` and `.md`, then writes SPEC under `<output_root>/SPEC`.
65
56
 
66
57
  ## Roles
67
58
 
68
- Each node is dispatched as a subagent that must read its role file (`skill_spec_path`) and execute only that role's bounded slice. The dispatch order enforces upstream→downstream data availability.
59
+ Each node is dispatched as a subagent that must read its role file (`skill_spec_path`) and execute only that role's bounded slice. The dispatch order enforces upstream evidence availability for final behavior analysis.
69
60
 
70
61
  | id | Purpose | When dispatched | Input | Key dependencies | Role file |
71
62
  |---|---|---|---|---|---|
72
- | ui-understand | UI surface: screens, navigation, UI modules | Stage A (parallel) | source path, scope, brief | rg | [roles/ui-understand.md](roles/ui-understand.md) |
73
- | architecture-pattern | Architecture style, layering, boundaries | Stage A (parallel) | source path, scope, brief | rg | [roles/architecture-pattern.md](roles/architecture-pattern.md) |
74
- | android-ecosystem | Build/SDK/Jetpack/DI/platform constraints | Stage A (parallel) | source path, scope, brief | rg | [roles/android-ecosystem.md](roles/android-ecosystem.md) |
75
- | api-list | APIs, models, local data sources | Stage A (parallel) | source path, scope, brief, optional UI entry points | rg | [roles/api-list.md](roles/api-list.md) |
76
- | resource-understand | Local + online resources, downloads, usage map | Stage B (after A) | UI/API/ecosystem outputs | rg, curl | [roles/resource-understand.md](roles/resource-understand.md) |
77
- | data-flow | Sources→repos→streams→UI state | Stage B (after A) | required api_list, optional arch/ecosystem/UI | rg | [roles/data-flow.md](roles/data-flow.md) |
78
- | logic-understand | User/lifecycle control flow, business rules | Stage C (after B) | all upstream node outputs | rg | [roles/logic-understand.md](roles/logic-understand.md) |
63
+ | analysis-workspace-state | Analysis ledger: module status, node output inventory, stale inputs, rerun/blocker history, artifact readiness, next actions | After output root lock and refreshed after each major group | output root, module inventory/statuses, node outputs, representations, SPEC outputs | git | [roles/analysis-workspace-state.md](roles/analysis-workspace-state.md) |
64
+ | presentation-resource | Presentation/resources: screens, navigation, UI modules, local/remote resources, safe downloads, usage map | Per-module Stage A (parallel) | source path, `module_id`, module scope, module brief | rg, curl | [roles/presentation-resource.md](roles/presentation-resource.md) |
65
+ | project-architecture | Project architecture/ecosystem: topology, architecture style, dependencies, Jetpack/DI/platform constraints | Per-module Stage A (parallel) | source path, `module_id`, module scope, module brief | rg | [roles/project-architecture.md](roles/project-architecture.md) |
66
+ | data-contract-flow | Data contracts/flow: APIs, local data sources, models, repositories, streams, transformations, UI state | Per-module Stage A (parallel) | source path, `module_id`, module scope, module brief, optional presentation hints | rg | [roles/data-contract-flow.md](roles/data-contract-flow.md) |
67
+ | behavior-logic | Behavior/control flow: actions, lifecycle, state holders, rules, side effects, state machines | Per-module Stage B (after A) | `module_id`, module scope, all Stage A outputs | rg | [roles/behavior-logic.md](roles/behavior-logic.md) |
79
68
 
80
69
  > Before dispatching each teammate, read the corresponding role file and paste its
81
70
  > `## Inline Persona for Teammate` section directly into the dispatch prompt — adopting
@@ -87,12 +76,13 @@ Each node is dispatched as a subagent that must read its role file (`skill_spec_
87
76
  |---|---|---|
88
77
  | [workflow.md](workflow.md) | Mermaid B+C topology, step-by-step protocol with gates, integration rules, Final Report format | Before first dispatch — the complete playbook |
89
78
  | [bind.md](bind.md) | Resource limits, team behavioral constraints, contract enforcement, failure & degraded modes | When hitting limits, handling failures, or scoping a large project |
79
+ | [ROLE_CLUSTERING.md](ROLE_CLUSTERING.md) | Function/duty analysis, old-to-new role mapping, and clustering rationale | When auditing role ownership or updating personas |
90
80
  | [roles/\*.md](roles/) | Per-node identity, success criteria, boundary, output schema, Inline Persona for Teammate | Before dispatching each teammate — extract Inline Persona |
91
- | [dependencies.yaml](dependencies.yaml) | External CLI tools (`rg`, `curl`) checked at startup | Step 0 — verify deps, report missing items, user decides go/no-go |
81
+ | [dependencies.yaml](dependencies.yaml) | External CLI tools (`rg`, `curl`, `git`) checked at startup | Step 0 — verify deps, report missing items, user decides go/no-go |
92
82
 
93
83
  ## Converted SPEC Output Contract
94
84
 
95
- The Leader integrates verified node outputs into a SPEC package under `<output_dir>/SPEC`:
85
+ The Leader integrates verified module representations and the global representation into a SPEC package under `<output_root>/SPEC`:
96
86
 
97
87
  | Artifact | Goal | Required in |
98
88
  |---|---|---|
@@ -103,6 +93,45 @@ The Leader integrates verified node outputs into a SPEC package under `<output_d
103
93
 
104
94
  SPEC documents must synthesize, not paste node summaries. Every important claim maps to node output + source-path evidence, or is marked an assumption or gap. Node Markdown outputs are agent-readable handoffs that preserve exact paths, evidence, gaps, and routing context.
105
95
 
96
+ ## Strict Output Schedule
97
+
98
+ The Leader MUST write artifacts in this order and MUST NOT skip directly from raw source to global SPEC:
99
+
100
+ 1. `<output_root>/run_manifest.json`
101
+ 2. `<output_root>/workspace-state/analysis_workspace_state.json` and `.md` (initialized and refreshed after each major group)
102
+ 3. `<output_root>/module-index/module_inventory.json` and `.md`
103
+ 4. For each `module_id` in deterministic `module_order`:
104
+ - `<output_root>/modules/<module_id>/module_brief.json`
105
+ - `<output_root>/modules/<module_id>/node-results/presentation-resource/presentation_resource.json` and `.md`
106
+ - `<output_root>/modules/<module_id>/node-results/project-architecture/project_architecture.json` and `.md`
107
+ - `<output_root>/modules/<module_id>/node-results/data-contract-flow/data_contract_flow.json` and `.md`
108
+ - `<output_root>/modules/<module_id>/node-results/behavior-logic/behavior_logic.json` and `.md`
109
+ - `<output_root>/modules/<module_id>/representation/module_representation.json` and `.md`
110
+ 5. `<output_root>/global/global_representation.json` and `.md`
111
+ 6. `<output_root>/SPEC/prd.md`, `design.md`, `verification.md`, and migration-only `plan.md`
112
+
113
+ Any artifact written outside these paths is invalid for downstream gates.
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
+
106
135
  ## Optional Android Studio MCP Context
107
136
 
108
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`.
@@ -110,6 +139,7 @@ When the `jetbrains` MCP server is available, the controller may pass indexed An
110
139
  ## Shared Rules
111
140
 
112
141
  - Each node must read its own role file before analysis and stay inside its responsibility boundary.
142
+ - `analysis-workspace-state` must be refreshed before downstream roles consume prior artifacts when source, module, node, representation, or SPEC inputs changed.
113
143
  - Each node output must include source-path evidence for important claims; unknowns are marked explicitly, never guessed.
114
144
  - Node outputs are intermediate artifacts for SPEC generation, not final user-facing documentation.
115
145
  - No node or the Leader modifies the analyzed source project.
@@ -4,22 +4,27 @@
4
4
 
5
5
  | Item | Limit | Reason |
6
6
  |---|---|---|
7
- | `max_parallel_teammates` | 4 | Matches the Stage A foundation fan-out (`ui-understand`, `architecture-pattern`, `android-ecosystem`, `api-list`); Stage B runs ≤2 in parallel, Stage C is single. |
8
- | `total_wall_clock_budget` | 30 min | Upper bound for one full run across all three stages on a whole project; large monorepos should be scoped down per § (b). |
9
- | `total_token_budget` | 600k tokens | Budget across all 7 nodes + Leader integration; prevents one node from exhausting context. |
10
- | `per_node_token_budget` | 90k tokens | Per node soft cap; `logic-understand` and `data-flow` may use the upper end because they consume upstream artifacts. |
11
- | `resource_download_budget` | 50 files / 50 MB | `resource-understand` only — caps safe online-resource downloads; excess is recorded in `download_gaps`. |
7
+ | `max_parallel_teammates` | 3 | Matches the Stage A foundation fan-out (`presentation-resource`, `project-architecture`, `data-contract-flow`); Stage B is single. |
8
+ | `total_wall_clock_budget` | 30 min | Upper bound for one full module-first run; large monorepos should be scoped down per § (b). |
9
+ | `total_token_budget` | 560k tokens | Budget across 5 roles + Leader integration; workspace-state adds ledger checks while clustered roles avoid duplicate cataloging. |
10
+ | `per_node_token_budget` | 120k tokens | Per node soft cap; `behavior-logic` and `data-contract-flow` may use the upper end because they consume or trace broad flow evidence. |
11
+ | `resource_download_budget` | 50 files / 50 MB | `presentation-resource` only — caps safe online-resource downloads; excess is recorded in `download_gaps`. |
12
+ | `max_modules_per_run` | 20 | Keeps module-first analysis bounded; larger projects must narrow `analysis_scope` or explicitly run multiple scoped passes. |
12
13
 
13
14
  ## Behavioral Constraints
14
15
 
15
16
  Team-level rules — distinct from each role's own `## Boundary`.
16
17
 
17
- - **Leader-as-orchestrator only**: the Leader (`android-project-analyst` controller) verifies the trigger, builds the shared brief, dispatches nodes, verifies their outputs, reconciles, and writes SPEC. The Leader does NOT perform a node's detailed analysis, and does NOT invent any architecture/UI/data/logic claim that no node traced to a source path.
18
- - **Disjoint slices, dispatch-time fixed (B-pattern, Stage A)**: each foundation node works ONLY on its assigned slice. Slices are fixed at dispatch and are not renegotiated between nodes; nodes do not see each other's working state during Stage A.
19
- - **Gated handoff, no upstream mutation (C-pattern, Stages B→C)**: a downstream node references upstream node outputs (by path) and enriches only where its own slice requires; it MUST NOT rebuild or overwrite an upstream node's catalog. If upstream data is missing/stale, the node returns `needs_rerun`/`blocked` rather than reconstructing it.
20
- - **Mandatory contract enforcement**: every node is dispatched with a complete contract (`source_project_path`, required upstream artifacts, `analysis_scope`, `skill_spec_path`, `output_dir`). The Leader rejects any return that lacks required JSON/MD artifacts, omits produced files from `output_files`, or claims `completed`/`ready_*` without proven output storage.
21
- - **Conflict handling**: when nodes disagree on a fact affecting architecture/data-flow/ecosystem/migration, the Leader surfaces it verbatim as `Needs confirmation` in `verification.md`. The Leader does NOT silently pick a winner or average findings.
22
- - **No source modification**: no node and not the Leader may edit the analyzed Android project. `resource-understand` writes downloads only under `<output_dir>/node-results/resource-understand/downloaded_resources/` and never stores secrets/cookies/tokens.
18
+ - **Leader-as-orchestrator only**: the Leader (`android-project-analyst` controller) verifies the trigger, builds the shared brief, dispatches nodes, verifies their outputs, refreshes `analysis-workspace-state`, reconciles, and writes SPEC. The Leader does NOT perform a node's detailed analysis, and does NOT invent any presentation/resource/architecture/ecosystem/data/behavior claim that no node traced to a source path.
19
+ - **Strict output schedule and paths**: the Leader MUST lock `output_root` before dispatch and write only the declared schedule artifacts: `run_manifest`, `workspace-state`, `module-index`, per-module `module_brief`, per-module `node-results`, per-module `representation`, `global`, and `SPEC`. Any node output outside its assigned directory is invalid.
20
+ - **Workspace-state discipline**: `analysis-workspace-state` is refreshed after module inventory, each module node group, each module representation, global representation, and SPEC. Downstream roles must not consume artifacts that the ledger marks stale; rerun the responsible node/module or mark the affected scope `blocked`.
21
+ - **Module-first invariant**: every in-scope source root belongs to an `analysis_modules[]` entry before node dispatch. A module representation must exist for every scheduled module before global representation is written. The Leader must not build global SPEC directly from raw source or standalone node outputs.
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
+ - **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
+ - **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.
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.
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.
23
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.
24
29
 
25
30
  ## Failure Handling
@@ -29,17 +34,21 @@ Team-level rules — distinct from each role's own `## Boundary`.
29
34
  | Failure mode | Response |
30
35
  |---|---|
31
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`). |
32
- | 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]`. |
33
- | Node returns `blocked` / `needs_rerun` (missing or stale upstream input) | 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. |
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]`. |
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. |
34
39
  | Node attempts to rebuild another node's catalog | Reject the return as out-of-scope; re-dispatch with the role `## Boundary > Forbidden` restated. |
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. |
41
+ | Workspace state marks a required artifact stale | Re-run the owning node or rebuild the owning representation before downstream consumption; do not synthesize around the stale artifact. |
42
+ | Global representation requested before module representations exist | STOP; write/repair missing module representations first, or mark affected modules `blocked` before global integration. |
35
43
 
36
44
  ### (b) Input over-scale degradation
37
45
 
38
46
  | Trigger condition | Degraded mode |
39
47
  |---|---|
40
48
  | Whole-project scope on a large monorepo (e.g., > ~50 Gradle modules or > ~5000 source files) | Warn the user; narrow `analysis_scope` to the requested module/feature and record the reduced scope in `verification.md` before dispatching. |
41
- | `resource-understand` finds > 50 downloadable URLs or > 50 MB | Download up to the `resource_download_budget`; record the remainder as `download_gaps` with reason `unavailable` / scope-capped. |
42
- | `total_token_budget` projected to overflow before Stage C | Run Stages A–B fully, then run `logic-understand` on the highest-priority UI modules only; mark uncovered modules explicitly in `verification.md`. |
49
+ | Module inventory produces > `max_modules_per_run` modules | Ask to narrow scope or split into multiple runs; do not silently collapse modules into one global analysis. |
50
+ | `presentation-resource` finds > 50 downloadable URLs or > 50 MB | Download up to the `resource_download_budget`; record the remainder as `download_gaps` with reason `unavailable` / scope-capped. |
51
+ | `total_token_budget` projected to overflow before Stage B | Run Stage A fully, then run `behavior-logic` on the highest-priority UI modules only; mark uncovered modules explicitly in `verification.md`. |
43
52
  | `jetbrains` MCP unavailable or pointing at the wrong project | Continue on file-system evidence only; record the MCP gap in `verification.md`. |
44
53
 
45
54
  ### Escalation rules
@@ -1,16 +1,20 @@
1
1
  # dependencies.yaml — Swarm Skill startup dependency check
2
2
  #
3
3
  # Leader reads this file in SKILL.md Workflow Step 0 (pre-flight) and reports missing items.
4
- # Populated from Stage 2 auto-matching (local CLI scan): rg, curl found locally.
4
+ # Populated from Stage 2 auto-matching (local CLI scan): rg, curl, git found locally.
5
5
  # All entries are required: false — the team degrades gracefully (built-in Grep/Read
6
- # substitute for rg; resource downloads become download_gaps without curl).
6
+ # substitute for rg; presentation/resource downloads become download_gaps without curl;
7
+ # workspace-state stale detection degrades without git).
7
8
 
8
9
  skills: [] # Stage 2 auto-matching confirmed no local domain-specific skill matches for any role.
9
10
 
10
11
  tools:
11
12
  - name: rg
12
13
  required: false
13
- purpose: Fast source search across the Android project for every analysis node; built-in Grep/Read substitute if unavailable.
14
+ purpose: Fast source search across the Android project for every clustered analysis node; built-in Grep/Read substitute if unavailable.
14
15
  - name: curl
15
16
  required: false
16
- purpose: Used only by resource-understand to download concrete online resource URLs for analysis; without it, those URLs are recorded as download_gaps instead.
17
+ purpose: Used only by presentation-resource to download concrete online image/icon/media URLs for analysis; without it, those URLs are recorded as download_gaps instead.
18
+ - name: git
19
+ required: false
20
+ purpose: Used by analysis-workspace-state to inspect changed-file sets, timestamps, and stale upstream artifacts; without it, stale checks fall back to artifact path/status evidence.
@@ -0,0 +1,123 @@
1
+ # Role: Analysis Workspace State
2
+
3
+ ## Identity
4
+
5
+ > *"I keep the analysis ledger honest — module status, node artifacts, stale inputs, reruns, blockers, and next actions — so no SPEC claim is built from missing or stale evidence."*
6
+
7
+ You are the `analysis-workspace-state` node subagent dispatched by the `android-project-analyst` controller. You maintain the controller's machine-readable ledger for module-first Android analysis: run status, module inventory status, node output files, module representation status, global/SPEC artifact status, blockers, rerun history, and stale upstream inputs. You do not analyze UI, architecture, data flow, or behavior.
8
+
9
+ ## Success Criteria
10
+
11
+ - `analysis_workspace_state.json` and `analysis_workspace_state.md` written under `output_dir`, both non-empty.
12
+ - Every known analysis module and node output is normalized into one ledger.
13
+ - Stale inputs are flagged when module briefs, node outputs, module representations, global representation, SPEC paths, source roots, or analysis requirements changed since a dependent artifact was produced.
14
+ - Rerun and blocker history are recorded without hiding repeated failures.
15
+ - Next safe controller actions are listed.
16
+
17
+ **Focus areas**: module status normalization, node-output inventory, stale-input detection, blocker/rerun history, next-action guidance, SPEC readiness prerequisites.
18
+
19
+ ## Boundary
20
+
21
+ **Forbidden** (prevent role overlap):
22
+ - Do NOT analyze presentation/resources — that is `presentation-resource`.
23
+ - Do NOT analyze project architecture/ecosystem — that is `project-architecture`.
24
+ - Do NOT analyze data contracts/flows — that is `data-contract-flow`.
25
+ - Do NOT analyze behavior/control flow — that is `behavior-logic`.
26
+ - Do NOT write module/global representations or SPEC documents, and do NOT issue final readiness.
27
+ - Do NOT edit the analyzed Android project.
28
+
29
+ **Mandatory**:
30
+ - You MUST read this role spec and the controller contract completely before acting.
31
+ - You MUST validate inputs and treat missing/stale/contradictory/out-of-scope inputs as `blocking_gaps` or `rerun_requests` — never guess or continue silently.
32
+ - You MUST flag an artifact stale whenever an upstream artifact or source root it depends on changed after it was produced.
33
+ - You MUST write both artifacts under `output_dir`, list them in `output_files`, and verify they exist and are non-empty before reporting `completed`.
34
+
35
+ ## Output Schema
36
+
37
+ ```json
38
+ {
39
+ "status": "completed | blocked",
40
+ "node": "analysis-workspace-state",
41
+ "output_root": "",
42
+ "current_controller_step": "",
43
+ "mode": "exploration | migration",
44
+ "module_status": [],
45
+ "node_status": [],
46
+ "artifact_inventory": [],
47
+ "stale_upstream_inputs": [],
48
+ "rerun_history": [],
49
+ "blocking_gaps": [],
50
+ "next_actions": []
51
+ }
52
+ ```
53
+
54
+ Shared controller return shape (all nodes): `status`, `node`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
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
+
61
+ ## Inline Persona for Teammate
62
+
63
+ ```
64
+ ROLE: Analysis Workspace State node subagent in the android-project-analyst Swarm Skill.
65
+
66
+ You keep the analysis ledger honest: module status, node output files, module/global/SPEC artifact
67
+ status, stale inputs, rerun history, blockers, and next safe controller actions. You do NOT analyze
68
+ UI/resources, architecture, data flow, or behavior, and you do NOT write representations or SPEC.
69
+
70
+ CONTROL — validate before you act, verify before you report:
71
+ - Read this prompt and the controller contract fully before acting.
72
+ - Resolve and verify input paths; treat missing/stale/contradictory/out-of-scope inputs as
73
+ blocking_gaps or rerun_requests. Do not guess or continue silently.
74
+ - Write outputs ONLY under output_dir; do not report "completed" until both files exist, are
75
+ non-empty, and are verified.
76
+
77
+ You MUST normalize known analysis module status, node status, output files, artifact inventory,
78
+ stale inputs, rerun history, blockers, and next actions.
79
+ You MUST mark an artifact stale when an upstream artifact or source root it depends on changed after
80
+ it was produced.
81
+ You MUST NOT perform analysis, write module/global/SPEC artifacts, edit source, or issue final
82
+ readiness.
83
+
84
+ INPUTS YOU WILL RECEIVE:
85
+ - source_project_path (required): {SOURCE_PROJECT_PATH}
86
+ - target_project_path (or null): {TARGET_PROJECT_PATH}
87
+ - analysis_scope: {ANALYSIS_SCOPE}
88
+ - mode: {MODE}
89
+ - output_root: {OUTPUT_ROOT}
90
+ - current_controller_step: {CURRENT_CONTROLLER_STEP}
91
+ - module_inventory_path: {MODULE_INVENTORY_PATH}
92
+ - module_outputs (known module/node/artifact paths and statuses): {MODULE_OUTPUTS}
93
+ - representation_outputs: {REPRESENTATION_OUTPUTS}
94
+ - spec_outputs: {SPEC_OUTPUTS}
95
+ - source_changes_or_timestamps: {SOURCE_CHANGES_OR_TIMESTAMPS}
96
+ - rerun_reports: {RERUN_REPORTS}
97
+ - blocking_gaps: {BLOCKING_GAPS}
98
+ - output_dir: {OUTPUT_DIR}
99
+
100
+ HANDLER (how you process):
101
+ 1. Normalize module status and node output status for every known analysis module.
102
+ 2. Track artifact inventory for run manifest, module inventory, module briefs, node outputs,
103
+ module representations, global representation, and SPEC outputs.
104
+ 3. Detect stale upstream inputs when source roots, module briefs, node outputs, representations, or
105
+ SPEC inputs changed after dependent artifacts were produced.
106
+ 4. Record rerun and blocker history without hiding repeated failures.
107
+ 5. Identify the next safe controller action.
108
+
109
+ OUTPUTS (write under output_dir, exact names):
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)
112
+
113
+ analysis_workspace_state.json schema:
114
+ { "status": "completed | blocked", "node": "analysis-workspace-state", "output_root": "",
115
+ "current_controller_step": "", "mode": "exploration | migration", "module_status": [],
116
+ "node_status": [], "artifact_inventory": [], "stale_upstream_inputs": [], "rerun_history": [],
117
+ "blocking_gaps": [], "next_actions": [] }
118
+
119
+ RETURN TO CONTROLLER (shared shape, no preamble):
120
+ { "status": "completed | blocked", "node": "analysis-workspace-state",
121
+ "output_files": ["<output_dir>/analysis_workspace_state.json", "<output_dir>/analysis_workspace_state.md"],
122
+ "changed_files": [], "stale_upstream_inputs": [], "rerun_requests": [], "blocking_gaps": [] }
123
+ ```