@odarino/haren 1.3.3 → 1.6.0

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 (43) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +209 -33
  3. package/content/agents/architect.md +5 -2
  4. package/content/agents/developer.md +6 -6
  5. package/content/agents/ideator.md +2 -2
  6. package/content/agents/planner.md +4 -1
  7. package/content/agents/researcher.md +1 -1
  8. package/content/agents/reviewer.md +13 -4
  9. package/content/skills/audit-workspace/SKILL.md +2 -1
  10. package/content/skills/create-artifact/SKILL.md +2 -5
  11. package/content/skills/decompose/SKILL.md +10 -13
  12. package/content/skills/discover/SKILL.md +7 -2
  13. package/content/skills/discover/blueprint.md +1 -0
  14. package/content/skills/discover/explore.md +1 -0
  15. package/content/skills/discover/inherit.md +1 -0
  16. package/content/skills/discover/migration.md +38 -0
  17. package/content/skills/evaluate/SKILL.md +34 -3
  18. package/content/skills/extract/SKILL.md +43 -0
  19. package/content/skills/extract-stories/SKILL.md +1 -1
  20. package/content/skills/generate-mockup/SKILL.md +44 -5
  21. package/content/skills/ideate/SKILL.md +5 -3
  22. package/content/skills/implement/SKILL.md +21 -12
  23. package/content/skills/onboard/SKILL.md +17 -2
  24. package/content/skills/plan/SKILL.md +69 -6
  25. package/content/skills/read-context/SKILL.md +12 -1
  26. package/content/skills/release/SKILL.md +61 -0
  27. package/content/skills/research/SKILL.md +1 -1
  28. package/content/skills/resolve-next-id/SKILL.md +9 -1
  29. package/content/skills/ui-review/SKILL.md +64 -0
  30. package/content/skills/update-links/SKILL.md +1 -1
  31. package/content/skills/update-tracking/SKILL.md +77 -23
  32. package/content/skills/validate-artifact/SKILL.md +21 -0
  33. package/content/skills/visual-companion/SKILL.md +288 -0
  34. package/content/templates/design.md +28 -0
  35. package/content/templates/deviation-log.md +13 -0
  36. package/content/templates/legacy-semantics.md +11 -0
  37. package/content/templates/parity-evidence.md +32 -0
  38. package/content/templates/release-plan.md +29 -0
  39. package/content/templates/spec.md +10 -0
  40. package/content/templates/unit-map.md +20 -0
  41. package/content/templates/unit-spec.md +43 -0
  42. package/dist/index.js +3071 -128
  43. package/package.json +2 -2
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: migration
3
+ description: Discovery strategy for a rewrite of a legacy system with parity as the bar
4
+ ---
5
+
6
+ # Migration Mode
7
+
8
+ A rewrite of a legacy system. The bar is parity with the legacy system, plus approved deviations.
9
+
10
+ The legacy repo is read-only. Do not write to it.
11
+
12
+ In this file, `<haren>` is the haren folder. The adapter plugin is the plugin that `migration.adapter` names.
13
+
14
+ ## Process
15
+
16
+ 1. Read `manifest.yaml`. Find the `migration` block and the legacy repo. Resolve repo paths in manifest.yaml from the haren folder, not from the workspace root.
17
+ 2. Make the unit inventory:
18
+ - With an adapter plugin (`migration.adapter` is set): run `haren migrate inventory`. It writes `artifacts/02-discovery/unit-map.md`. No module exists yet, so it registers no unit status. The decompose phase does that.
19
+ - Without an adapter plugin: list the units from the legacy source. Write `unit-map.md` from the `unit-map.md` template. Do not run `haren track unit` yet: the modules do not exist before the decompose phase.
20
+ 3. Group the units into modules:
21
+ - Put units of the same family in the same module.
22
+ - Put units that write the same tables in the same module.
23
+ - A parent unit travels with its popups. Never split a popup from its parent.
24
+ 4. Write the module of each unit into the Module column of `unit-map.md`. Do not run `haren migrate inventory` again here. The decompose phase creates the modules and registers the units.
25
+ 5. Record the shared components (tables and routines that units in more than one module use).
26
+ 6. Make sure that the semantics rulebook exists:
27
+ - If `artifacts/01-research/legacy-semantics.md` is missing, copy the semantics file from the installed adapter plugin: `<haren>/.plugins/<adapter>/<adapter.semantics>`. Read the `adapter.semantics` path in `<haren>/.plugins/<adapter>/haren-plugin.json`. Do not copy from the adapter source folder.
28
+ - If there is no adapter plugin, start from the `legacy-semantics.md` template.
29
+ - Use the ID `LSEM-NNN` (see the `resolve-next-id` skill). Register it: `haren track artifact <id> --type legacy-semantics --path artifacts/01-research/legacy-semantics.md`.
30
+ 7. Write the context brief. Include the legacy stack, the unit counts per family, the shared components, and the suggested modules.
31
+ - discover/SKILL.md step 6 registers the context brief. Do not register it again.
32
+ 8. After step 6 of `discover/SKILL.md` registers the context brief, run `haren track check`. Then go to the `decompose` phase.
33
+
34
+ ## Output
35
+
36
+ - `artifacts/02-discovery/unit-map.md`
37
+ - `artifacts/02-discovery/context-brief.md`
38
+ - `artifacts/01-research/legacy-semantics.md`
@@ -33,6 +33,33 @@ Run through each criterion:
33
33
  - Check test coverage for the feature
34
34
  4. **Integration**: Does it work with module interfaces?
35
35
  - Verify exposed interfaces match the spec's interface contracts
36
+ 5. **Screens** (only if the spec has a `## Screens` section): does each changed screen match the chosen mockup?
37
+ - Compare layout, elements, states and labels with the chosen option in the spec
38
+ - If the app can run, start it and take a screenshot of each changed screen. Save it under `artifacts/06-evaluation/{module}/screens/` and link it in the review
39
+ - If the app cannot run, say so in the review and compare the code with the mockup
40
+ - A difference from the chosen mockup is a fail unless the session log records a reason the user approved
41
+ - Read `ui.mockups` in `manifest.yaml`. On `ask`, follow the offer in the visual-companion skill
42
+ - Browser mode (`ui.mockups` is `browser`, or the user chose the browser): push one `.compare` screen per changed screen with the visual-companion skill (chosen mockup | screenshot). Rebuild the chosen option from the ASCII wireframe in design.md with the HTML mock elements. Read the `pass` or `fail` click from `state_dir/events`. Confirm the verdict with the user in the terminal
43
+ - ASCII mode: compare as above in the terminal
44
+ - No screenshot (the app cannot run): use the ASCII path. Run the `ui-review` skill on the screen derived from the code, or record in the review that the screen check was skipped and why. Do not push `.compare`.
45
+ - Both modes: run the `ui-review` skill on each screenshot. Add the findings table to the review
46
+ - An open blocker (no fix and not 'accepted by user') is a fail.
47
+ 6. **Privacy**: fixtures, examples, seeds, test data and screenshots contain no real third-party personal data (names, emails, phone numbers, addresses, handles, photos). Synthetic data only. Real personal data is a fail
48
+
49
+ ### Migration mode only
50
+
51
+ For each unit of the module:
52
+
53
+ 1. Run the Parity checklist of `artifacts/02-discovery/units/<unit>/spec.md`.
54
+ 2. If `migration.liveLegacy` is `true`, compare on both systems. Use the same user, tenant and locale on both.
55
+ 3. Close each difference only by one of these:
56
+ - a fix in the target code
57
+ - a parity evidence file at `artifacts/06-evaluation/parity-evidence/<unit>-<n>.md` (template `parity-evidence.md`)
58
+ - an `approved` row in `artifacts/03-modules/deviation-log.md`
59
+ 4. When all differences are closed, run `haren track unit <module> <unit> verified`. If you did not use the live legacy system, set `static-review-only` instead.
60
+ 5. After the BA signs off, run `haren track unit <module> <unit> parity-signed`.
61
+
62
+ Set the module to `completed` only after all its units are `parity-signed`.
36
63
 
37
64
  ## Output
38
65
 
@@ -72,6 +99,8 @@ If iterations are enabled (check manifest.yaml for `iterations` block), include
72
99
  | Completeness | pass/fail | {detail} |
73
100
  | Correctness | pass/fail | {detail} |
74
101
  | Integration | pass/fail | {detail} |
102
+ | Screens | pass/fail/n.a. | {mockup option, screenshot links} |
103
+ | Privacy | pass/fail | {detail} |
75
104
 
76
105
  ## Issues
77
106
  {If fail — numbered list with file:line, description, suggested fix}
@@ -86,9 +115,11 @@ The `task-{N}-{slug}-test-report.md` captures test execution output and coverage
86
115
 
87
116
  ## After Review
88
117
 
89
- - **Pass**: Update feature status to "passing" via update-tracking skill
90
- - **Fail (attempt < 3)**: Update feature status to "fixing", developer reads review.md and fixes
91
- - **Fail (attempt 3)**: Update feature status to "blocked", emit "escalate-human" event
118
+ - Register the review: `haren track artifact <id> --type review --path <review path> --module <module>`
119
+ - **Pass**: `haren track feature <module> <feature> passing`
120
+ - **Fail (attempt < 3)**: `haren track feature <module> <feature> fixing`. The developer reads review.md and fixes
121
+ - **Fail (attempt 3)**: `haren track feature <module> <feature> blocked`, then `haren track event escalate-human --module <module> --phase evaluate --feature <feature> --data '{"attempt":3}'`
122
+ - Never edit `progress.json` or `events/events.jsonl` by hand (see update-tracking skill)
92
123
 
93
124
  ## Rules
94
125
 
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: extract
3
+ description: Extract each legacy unit into a technical spec and pass the spec gate
4
+ type: sequential
5
+ agent: researcher
6
+ ---
7
+
8
+ # Extract
9
+
10
+ Turn each legacy unit into an approved unit spec. Run this phase after `decompose` and before `plan`.
11
+
12
+ <HARD-GATE>
13
+ Never set `spec-approved` without user approval.
14
+ </HARD-GATE>
15
+
16
+ ## Process
17
+
18
+ Resolve repo paths in manifest.yaml from the haren folder, not from the workspace root.
19
+
20
+ Do these steps for each unit of the module:
21
+
22
+ 1. Get the legacy source of the unit:
23
+ - With an adapter: run `haren migrate extract <unit>`. The files go to `artifacts/02-discovery/units/<unit>/`.
24
+ - Without an adapter: read the legacy source. Run `haren track unit <module> <unit> extracted`.
25
+ 2. Read `artifacts/01-research/legacy-semantics.md` first.
26
+ 3. Write `artifacts/02-discovery/units/<unit>/spec.md`:
27
+ - With an adapter: use the adapter skill named in the plugin's `haren-plugin.json`, key `adapter.skills.spec`.
28
+ - Without an adapter: use the `unit-spec.md` template.
29
+ 4. Run `haren track unit <module> <unit> spec-draft`. Use the ID `UNITSPEC-<unit>` (see the `resolve-next-id` skill). Register the spec now, before approval: `haren track artifact <id> --type unit-spec --path artifacts/02-discovery/units/<unit>/spec.md --module <module>`. Then `haren track check` passes while the unit waits for approval.
30
+ 5. Run `haren migrate gate <unit>`. Fix the spec for each finding. Run the gate again until it shows PASS. Exit code 3 means the gate passed but the user did not approve yet. Go to step 6. Do not treat it as a failure.
31
+ 6. Show the spec and the gate result to the user. Wait for approval.
32
+ 7. Only after the user approves:
33
+ - With an adapter: run `haren migrate gate <unit> --approve`.
34
+ - Without an adapter: tick the Manual gate section of the spec. Then run `haren track unit <module> <unit> spec-approved`.
35
+ 8. Update the artifact row: run the same `haren track artifact <id> ...` command with `--status approved`.
36
+
37
+ ## Rules
38
+
39
+ - A unit in `blocked` status skips the `gate.json` check in `haren track check`. Before approval work, move the unit back to its previous status with `haren track unit <module> <unit> <status>`.
40
+ - Never write into the legacy repo (`readOnly: true`). The gate blocks Edit and Write there. For Bash commands, the guard is best effort only, so do not use the shell to change legacy files. Keep the legacy repo read-only at the filesystem or git level where possible.
41
+ - When you find a new platform trap, add a row to `legacy-semantics.md`.
42
+ - The module spec links the unit specs. It does not restate them.
43
+ - Do not write code in this phase.
@@ -245,7 +245,7 @@ Rules for the story index:
245
245
  - **Status** defaults to `draft` (mirrors the spec status)
246
246
  - **Source** comes from the story's `Source:` line
247
247
  - If the index already exists, merge new stories — do not drop existing rows that may have updated PIC/Status values
248
- - Register the file in `artifacts/_registry/artifact-index.md` if that file exists
248
+ - Register the file with `haren track artifact <id> --type story-index --path <path>`
249
249
 
250
250
  ### Step 9: Summary
251
251
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: generate-mockup
3
- description: Generate ASCII wireframe mockups for screens during design phase
3
+ description: Generate ASCII wireframe mockups for screens, as one wireframe or as 2-3 options to compare
4
4
  type: utility
5
5
  ---
6
6
 
@@ -10,7 +10,7 @@ Generate ASCII wireframes for UI screens described in specs or designs. Output i
10
10
 
11
11
  ## When to Use
12
12
 
13
- - During the **plan** phase when designing screens for a module
13
+ - During the **plan** phase, for each screen the module adds or changes (options mode)
14
14
  - When the user asks to visualize a UI layout
15
15
  - When the spec references screens that need visual definition
16
16
 
@@ -20,11 +20,33 @@ Generate ASCII wireframes for UI screens described in specs or designs. Output i
20
20
  - Key UI elements (components, fields, actions)
21
21
  - Layout hints (sidebar, modal, table, form, tabs, etc.)
22
22
 
23
+ ## Wireframe modes
24
+
25
+ - **Single** (default): one wireframe for one screen
26
+ - **Options**: 2-3 labeled variants of one screen, for the user to compare and pick. The plan skill uses this mode
27
+
28
+ ### UI mode (ui.mockups)
29
+
30
+ Read `ui.mockups` in `manifest.yaml`. If the key is missing, use `ask`.
31
+
32
+ - `ascii`: use the ASCII steps in this skill only.
33
+ - `browser`: write the ASCII wireframes into design.md as before. Also push one options screen with the visual-companion skill. Use `.options` or `.cards`, with one `.mockup` per option. Build each mockup from the HTML mock elements of the visual-companion skill. Read the click from `state_dir/events`. After the pick, write the chosen option as ASCII into design.md.
34
+ - `ask`: follow the offer in the visual-companion skill. Then use the `ascii` or the `browser` path.
35
+
36
+ ### Options mode
37
+
38
+ 1. Make 2-3 variants of the same screen. Label them `Option A`, `Option B`, `Option C`. Each variant must differ in a real decision (layout, grouping, navigation, density), not only in style
39
+ 2. Under each variant, write one line: `Trade-off: {gain} — {cost}`
40
+ 3. Mark one variant as recommended and say why in one sentence
41
+ 4. Show the variants side by side in one message (see Output Format). If the terminal is narrow, show them one under the other
42
+ 5. Ask the user to pick one. Do not continue to the next screen before the pick
43
+ 6. Use only synthetic data in mockups (for example "Alex Sample", `user@example.com`). Never copy real third-party personal data
44
+
23
45
  ## ASCII Wireframe Conventions
24
46
 
25
47
  ```
26
48
  ┌─────────────────────────────────────────────┐ ← outer border
27
- │ Page Title [Button] │ ← header bar
49
+ │ Page Title [Button] │ ← header bar
28
50
  ├─────────────────────────────────────────────┤ ← divider
29
51
  │ ┌──────────┐ ┌───────────────────────────┐ │ ← two-column
30
52
  │ │ Sidebar │ │ Main Content │ │
@@ -129,12 +151,29 @@ Place wireframes in the design.md under the relevant screen:
129
151
  \```
130
152
  ```
131
153
 
154
+ ### Options mode output
155
+
156
+ ```markdown
157
+ ### Screen: {Screen Name} — options
158
+
159
+ Option A Option B
160
+ ┌──────────────────────┐ ┌──────────────────────┐
161
+ │ ... │ │ ... │
162
+ └──────────────────────┘ └──────────────────────┘
163
+ Trade-off: {gain} — {cost} Trade-off: {gain} — {cost}
164
+
165
+ Recommended: B, because {reason}.
166
+ ```
167
+
168
+ After the pick, put the chosen wireframe and the option table in the `## Screens` section of design.md (see `templates/design.md`).
169
+
132
170
  ## Rules
133
171
 
134
172
  - Keep wireframes simple — communicate layout, not pixel-perfect design
135
173
  - Use placeholder text: `[Field Label]`, `[Button Text]`, `Row data`
136
174
  - Show realistic column counts and proportions
137
- - Max width: 60 characters for wireframe content
175
+ - Alignment: Every row in a box has the same width as its border. Pad cells with spaces. Check the column widths before you output the wireframe. Count the characters of each row when you are not sure.
176
+ - Max width: 60 characters for wireframe content (30 characters per option when options are side by side)
138
177
  - If a screen has tabs or states, show the primary state unless asked
139
178
  - **Ask the user** if the layout looks right before moving to the next screen
140
- - Wireframes go into `design.md`, not a separate file
179
+ - Wireframes go into `design.md`. Do not write separate mockup files
@@ -126,7 +126,7 @@ Review research findings for significant problems:
126
126
  type: concept-brief
127
127
  generated_by: ideate
128
128
  ```
129
- 5. Update `progress.json` with ideate phase status:
129
+ 5. Record the ideate result with `haren track event ideate-complete --phase ideate --data '<json>'`, where `<json>` holds these fields. Never edit `progress.json` by hand:
130
130
  ```json
131
131
  {
132
132
  "ideate": {
@@ -139,12 +139,14 @@ Review research findings for significant problems:
139
139
  }
140
140
  ```
141
141
 
142
+ For a visual question (screen flow, layout, diagram), use the visual-companion skill. Decide per question.
143
+
142
144
  ## Output
143
145
 
144
146
  - Research artifacts: `artifacts/01-research/RESEARCH-{NNN}-{slug}.md` (1-3 per ideation)
145
147
  - Concept brief: `artifacts/00-baseline/concept-brief.md`
146
148
  - Updated `manifest.yaml` with mode and sources
147
- - Updated `progress.json` with ideate status
148
- - Updated `artifacts/_registry/artifact-index.md`
149
+ - An `ideate-complete` event in `events/events.jsonl`
150
+ - New rows in `artifacts/_registry/artifact-index.md`, added with `haren track artifact`
149
151
 
150
152
  After completion, the Discover phase picks up the concept brief as a baseline doc in blueprint mode. No manual handoff required.
@@ -24,27 +24,36 @@ Execute the implementation plan for a module, one feature at a time.
24
24
  - Read the module's repos from the `repos:` front matter of `artifacts/03-modules/{module}/module.md`. If it lists no repos, follow "No repos listed" in skill.md "Repos and Git"
25
25
  - For each repo: if it has uncommitted changes, stop and ask the user what to do. Changes inside the haren folder do not count as uncommitted changes for this check
26
26
  - For each repo: if the branch `feat/{module-slug}` does not exist, create it from the repo's `default_branch`, or from the current branch if `default_branch` is not set. Then switch to it
27
- - Record `branch` and `repos` for the module in `progress.json` via update-tracking skill
28
- - If the module status is `planned`, set it to `implementing` via update-tracking skill
27
+ - If the module depends on a module that is not merged yet, follow skill.md "Dependent modules" for the base branch
28
+ - If the module status is `planned`, set it to `implementing` with `haren track status <module> implementing`
29
+
30
+ ### Migration mode only
31
+
32
+ - Read `artifacts/03-modules/deviation-log.md` before each task.
33
+ - Never change behavior that has an `approved` deviation row back to the legacy behavior.
34
+ - After all tasks of a unit pass, run `haren track unit <module> <unit> built`.
29
35
 
30
36
  ## Implementation Loop
31
37
 
32
38
  For each feature:
33
39
 
34
- 1. Update feature status to "in-progress" via update-tracking skill
35
- 2. Delegate to superpowers:subagent-driven-development:
36
- - Pass the full task description from tasks.md
37
- - Pass the design context from design.md
38
- - Ensure TDD discipline via superpowers:test-driven-development
40
+ 1. Update feature status: `haren track feature <module> <feature> in-progress`
41
+ 2. Choose the path by task size (see "Fast path" below):
42
+ - **Small task:** implement it directly in the main session with superpowers:test-driven-development
43
+ - **Other tasks:** delegate to superpowers:subagent-driven-development. Pass the full task description from tasks.md and the design context from design.md. Ensure TDD discipline via superpowers:test-driven-development
39
44
  3. After implementation:
40
45
  - (a) Commit the code in each repo that the feature changed: `git -C <repo> commit` with a descriptive message. In the monorepo layout, make one code commit for all repo keys; see skill.md "Repos and Git"
41
- - (b) Record each new commit SHA in `progress.json` `lastCommit.<repoKey>` via update-tracking skill
42
- - Update feature status to "evaluating" via update-tracking skill
46
+ - (b) Record each new commit SHA in `lastCommit.<repoKey>`: `haren track commit <module> <repoKey> <sha>`
47
+ - Update feature status: `haren track feature <module> <feature> evaluating`
43
48
  - Append to task session log (`task-{N}-{slug}.md`): what was done, decisions made, any deviations from plan, and the commit SHA for each repo
44
- - Emit "feature-ready" event to events/events.jsonl
49
+ - Append the "feature-ready" event: `haren track event feature-ready --module <module> --phase implement --feature <feature>`
45
50
  - (c) Commit the haren files (session log, `progress.json` and `events/events.jsonl`) in the haren repo. List the code commits in the message, for example `docs(checkout): task 2 session log — backend@abc1234, frontend@def5678`. In the monorepo layout the haren folder is in the same repo, so (a) and (c) are two commits on the same branch: the code commit first, then the haren commit. In the workspace layout, commit the haren files on the haren repo's current branch. Do not create a module branch in the haren repo.
46
51
  - Never push
47
52
 
53
+ ## Fast path
54
+
55
+ A task is **small** when it changes about 30 lines or fewer, adds no new external dependency and has no schema migration. The plan marks a small module (see the plan skill). For a small task, skip superpowers:subagent-driven-development. Write the failing test, implement, verify and commit in the main session. TDD and the commit steps stay the same. If the user asks for the full path, use superpowers:subagent-driven-development for every task.
56
+
48
57
  ## Session Log
49
58
 
50
59
  Each task gets its own session log file under `artifacts/05-implementation/{module}/`:
@@ -72,7 +81,7 @@ If iterations are enabled (check manifest.yaml for `iterations` block), include
72
81
 
73
82
  - One feature at a time — finish and commit before starting the next
74
83
  - Always write tests before implementation (TDD)
75
- - If blocked, set feature to "blocked" and surface to user — don't guess
84
+ - If blocked, run `haren track feature <module> <feature> blocked` and surface to user — don't guess
76
85
  - If you need to deviate from the plan, document why in the session log
77
- - Never modify files in the haren folder except `progress.json`, session logs and `events/events.jsonl`
86
+ - Never modify files in the haren folder except session logs. Change `progress.json` and `events/events.jsonl` only with `haren track` (see update-tracking skill). Never edit them with sed or jq
78
87
  - Never push. Never create pull requests unless the user asks
@@ -23,14 +23,27 @@ Do these steps for each entry in `repos`:
23
23
  3. Decide these values:
24
24
  - `stack`: a short kebab-case name, for example `node-express`, `react-vite`, `nextjs`, `go`, `java-spring`, `python-fastapi`.
25
25
  - `test_cmd`: the command that runs the tests, from the package scripts or the build tool, for example `bun test`, `pnpm test`, `go test ./...`, `mvn test`, `pytest`. If you are not sure, leave it empty.
26
- - `default_branch`: run `git -C <repo> symbolic-ref --short refs/remotes/origin/HEAD` and remove the `origin/` prefix. If the command fails, use the current branch (see the detached HEAD rule below). Use "main" only if no branch can be found, and say so in the table.
26
+ - `default_branch`: keep an existing value. Else try these steps in order and stop at the first result:
27
+ 1. `git -C <repo> symbolic-ref --short refs/remotes/origin/HEAD`. Remove the `origin/` prefix.
28
+ 2. The first of `origin/main`, `origin/master`, `origin/develop` that exists. Test each with `git -C <repo> rev-parse --verify --quiet <ref>`. Remove the `origin/` prefix.
29
+ 3. The first local branch of `main`, `master` that exists (`git -C <repo> rev-parse --verify --quiet <branch>`).
30
+ 4. Ask the user.
31
+ Never use the current branch when it looks like a work branch (`feat/`, `feature/`, `fix/`, `bugfix/`, `hotfix/`, `chore/`, `release/`). Say in the table which step gave the value.
27
32
  - `role`: `frontend` for a UI app (React, Vue, Angular, Svelte, Next.js, Nuxt, a Vite web app). `backend` for an API or a service. `e2e` for a repo that holds mainly end-to-end tests. `other` for all other repos. Keep an existing `role`. If it looks wrong, ask the user.
28
33
  - Current branch: run `git -C <repo> branch --show-current`. If it prints nothing, the repo is on a detached HEAD. Report "detached HEAD at <short sha>" and get the sha with `git -C <repo> rev-parse --short HEAD`.
29
34
  4. Show one table to the user: repo, stack, test_cmd, default_branch, role. Mark the values that change.
30
35
  5. Ask: "Write these values into manifest.yaml?"
31
36
  6. Write only after the user agrees. Change only these fields of the `repos` entries. Write them in this order: `path`, `remote`, `default_branch`, `role`, `stack`, `test_cmd`. Keep every other line and every comment in `manifest.yaml`.
32
37
 
33
- If `repos` is empty, say so in the table output: "No repos listed in manifest.yaml." Suggest that the user adds repo entries (in the monorepo layout, folders such as `../backend`). `skill.md` "Repos and Git" has a "No repos listed" fallback: in the monorepo layout, the repo that holds the haren folder is the only repo, with the key `default`. Mention it. Then continue with steps 2-4.
38
+ If `repos` is empty, say so in the table output: "No repos listed in manifest.yaml." `skill.md` "Repos and Git" has a "No repos listed" fallback: in the monorepo layout, the repo that holds the haren folder is the only repo, with the key `default`. Mention it.
39
+
40
+ In the monorepo layout, propose `repos` entries:
41
+
42
+ 1. Find the package folders in the repo root. Read the `workspaces` field of `package.json`, `pnpm-workspace.yaml`, `go.work`, and the `<modules>` of a root `pom.xml`. Also check `apps/*`, `packages/*` and `services/*`.
43
+ 2. For each package folder, propose one entry. The key is the folder name. The `path` is relative to the haren folder (for example `../apps/backend`). Do steps 1.2 and 1.3 for each entry.
44
+ 3. Show the proposed entries as a table. Ask: "Add these repos to manifest.yaml?" Write only after the user agrees.
45
+
46
+ In the workspace layout, suggest that the user adds repo entries. Then continue with steps 2-4.
34
47
 
35
48
  ## 2. Health check
36
49
 
@@ -43,6 +56,8 @@ Check each repo in `repos`. In the workspace layout, also check the haren folder
43
56
  | Uncommitted changes | `git -C <repo> status --porcelain` prints lines | "uncommitted changes (N files)" |
44
57
  | Branch | Only when `default_branch` is known. `git -C <repo> branch --show-current` is not `default_branch`. On a detached HEAD, report "detached HEAD at <short sha>". | "on `<branch>`, default is `<default_branch>`". If a module in `progress.json` uses this branch (`modules.*.branch`), add "(module `<module>`)" and do not show it as a problem. |
45
58
 
59
+ **Key drift.** For each repo key, check that the `path` is a real folder. For each module in `progress.json`, check its `repos` keys. Each key must exist in `manifest.yaml`. The module's code must be under that key's `path`: compare the files of its recorded commits (`git -C <repo> show --name-only --format= <sha>` for each `lastCommit` SHA) with the `path`. Report each mismatch, for example "module `share` uses key `types`, but its code is in `packages/shared`". Do not fix it. Suggest the change and ask.
60
+
46
61
  The haren folder has no `default_branch`. For the haren folder, report only its current branch. Do not compare it with a default branch.
47
62
 
48
63
  Do not fetch. Do not fix anything. Report only.
@@ -17,16 +17,41 @@ Create a complete, actionable plan for implementing a single module.
17
17
  4. Read context brief: `artifacts/02-discovery/context-brief.md`
18
18
  5. Read any relevant research: `artifacts/01-research/`
19
19
  6. Check dependencies: are dependent modules' interfaces defined?
20
+ 7. **Migration mode only** (`mode: migration` in manifest.yaml):
21
+ - Read the unit specs of the module: `artifacts/02-discovery/units/<unit>/spec.md`
22
+ - Read `artifacts/03-modules/deviation-log.md`
23
+ - The reuse inventory (Step 4) includes every table and side effect in the Writes section of each legacy unit
24
+ - Each task references its unit IDs (for example SCR_A001) as well as its STORY-IDs
25
+
26
+ ### Step 4: Reuse inventory (before decisions and tasks)
27
+
28
+ <HARD-GATE>
29
+ Do not write design.md or tasks.md before the reuse inventory is done.
30
+ A plan that builds behavior which already exists in a target repo is a defect.
31
+ </HARD-GATE>
32
+
33
+ 1. List every table the module writes and every side effect it triggers (notification, SMS, mail, file, external API, audit log, numbering)
34
+ 2. For each item, search ALL target repos in manifest.yaml `repos`. Do not stop at the module's own package or at class names that match the screen name. Search by table name, by side effect (for example `send`, `notify`, `mail`), and by the shared service folders
35
+ 3. Record each hit with `file:line` and one verdict: reuse, extend, supersede or duplicate. Record "none found" with the search command that you ran
36
+ 4. Read the hits that are a shared service. Check its doc comment for a caller/shared split
37
+ 5. Put the result in the `## Existing Code` section of design.md. Tasks must use the verdicts: no task builds a "reuse" item again
38
+ 6. If the inventory is large, also write it as a research artifact `artifacts/01-research/{module}-reuse-audit.md` and link it from the design
20
39
 
21
40
  ### Step 5: Gather decisions BEFORE writing artifacts
22
41
 
23
42
  <HARD-GATE>
24
43
  Before writing any artifact, identify all decision points in the module and
25
44
  resolve them with the user. Do NOT write spec.md or design.md with assumptions.
45
+ Decision points include technical decisions (database, framework, auth, APIs)
46
+ and UI/UX decisions (screen layout, navigation, empty and error states, how
47
+ content is grouped). If the module adds or changes screens, the user picks one
48
+ mockup option per changed screen before you write the spec or the design.
26
49
  </HARD-GATE>
27
50
 
28
51
  **Decision gathering process:**
29
- 1. List all technical decisions this module requires (database, framework, auth, APIs, etc.)
52
+ 1. List all decisions this module requires:
53
+ - Technical: database, framework, auth, APIs, etc.
54
+ - UI/UX: one decision for each screen that the module adds or changes
30
55
  2. For each decision, check if it's already resolved:
31
56
  - Specified in context-brief.md → use it, no need to ask
32
57
  - Specified in module definition → use it, no need to ask
@@ -39,6 +64,18 @@ resolve them with the user. Do NOT write spec.md or design.md with assumptions.
39
64
  4. **One question at a time** — don't dump all decisions in one message
40
65
  5. Document each decision in the design artifact with rationale
41
66
 
67
+ **UI decisions (only if the module adds or changes screens):**
68
+ 1. Read `ui.mockups` in `manifest.yaml` (`ask` | `ascii` | `browser`, default `ask`). On `ask`, follow the offer in the visual-companion skill
69
+ 2. List the changed screens from the spec, the module definition and the stories
70
+ 3. For each screen, use the `generate-mockup` skill in options mode. Make 2-3 labeled options (A, B, C). Give each option a one-line trade-off and mark your recommendation
71
+ 4. Show the options:
72
+ - ASCII path: show the options side by side in one message
73
+ - Browser path: push the options screen with the visual-companion skill. Read the click from `state_dir/events`. Confirm the choice with the user in the terminal
74
+ 5. ASCII path: ask the user to pick one option. Both paths: one screen at a time
75
+ 6. Record the chosen option and the rejected options with the reason in the `## Screens` section of the design. Add the same to the `## Screens` section of the spec, and add a Changelog row for that spec edit
76
+ 7. After the choice, run the `ui-review` skill on the chosen option. Write the findings table under `## UI Review` in the design. In the browser path, also push the `.findings` screen
77
+ 8. **Caution:** a blocker stops the module. Fix each blocker in the mockup and run the `ui-review` skill again, or write "accepted by user" in the Fix column, before the module goes to `planned`
78
+
42
79
  **Example flow:**
43
80
  ```
44
81
  You: "For the auth module, I need to decide on a few things.
@@ -51,6 +88,13 @@ You: "For the auth module, I need to decide on a few things.
51
88
  User: "go with A"
52
89
 
53
90
  You: "Got it, PostgreSQL. Next: for authentication strategy..."
91
+
92
+ You: "The module changes the Post detail screen. Here are 3 options:
93
+ A) One long text — simple, but long posts are hard to scan
94
+ B) Parts as separate cards — clear parts, more scrolling
95
+ C) Parts joined by a connector line — shows the thread, more work
96
+ [mockups A, B, C side by side]
97
+ I'd recommend B because [reason]. Which one?"
54
98
  ```
55
99
 
56
100
  ### Step 6: Write artifacts (after all decisions are resolved)
@@ -71,8 +115,11 @@ Write to: `artifacts/04-plans/{module}/design.md` (master — always written her
71
115
 
72
116
  Using `templates/design.md`:
73
117
  - Architecture overview
118
+ - **Existing code** (from the reuse inventory in Step 4)
74
119
  - Data model
75
120
  - **Key technical decisions with rationale** (from step 5 — include what was chosen and why)
121
+ - **Screens** (if the module adds or changes screens): the chosen mockup per screen and the rejected options with the reason
122
+ - **UI Review** (if screens): the findings table from the `ui-review` skill
76
123
  - File structure plan
77
124
  - External dependencies
78
125
 
@@ -86,16 +133,29 @@ Using `templates/tasks.md`:
86
133
  - Tasks should be small enough for one implementation session
87
134
  - Include test tasks alongside implementation tasks
88
135
 
136
+ #### Register the drafts
137
+
138
+ Register each artifact right after you write it, before the user approves it. Then `haren track check` passes while you wait for the approval:
139
+
140
+ - `haren track artifact <id> --type design --path artifacts/04-plans/{module}/design.md --module <module> --status draft`
141
+ - `haren track artifact <id> --type tasks --path <path of tasks.md> --module <module> --status draft`
142
+ - If you wrote spec.md: `haren track artifact <id> --type spec --path artifacts/03-modules/{module}/spec.md --module <module> --status draft`
143
+
89
144
  ### Step 7: Review with user
90
145
 
91
- Present each artifact section by section. Ask "does this look right?" after each.
146
+ **Small module:** the module has 3 tasks or fewer, each task changes about 30 lines or fewer, it adds no new external dependency and it has no schema migration. For a small module, show the design and the tasks in one message and ask for one approval. Write "Size: small" in the design. The implement skill then uses its fast path.
147
+
148
+ **Other modules:** present each artifact section by section. Ask "does this look right?" after each.
92
149
  Only proceed to the next artifact after the current one is approved.
93
150
 
151
+ The user can always ask for the full path. Then review section by section.
152
+
94
153
  ### Step 8: Finalize
95
154
 
96
- 1. Validate all three artifacts with validate-artifact skill
97
- 2. Update progress.json — module status to "planned"
98
- 3. If `plugins.json` exists in the haren folder, run `haren plugin run after-plan --payload '{"module":"<module>","tasksFile":"<path of tasks.md relative to the haren folder>"}'` and show its output lines. A warning does not block the plan. The CLI adds the missing features to progress.json, so do not add them yourself
155
+ 1. Validate all three artifacts with validate-artifact skill. This runs `haren track check`
156
+ 2. After the user approves an artifact, run the same `haren track artifact <id> ...` command with `--status approved`. Register an artifact that has no row yet in the same way
157
+ 3. Set the module status: `haren track status <module> planned`. Never edit progress.json by hand
158
+ 4. If `plugins.json` exists in the haren folder, run `haren plugin run after-plan --payload '{"module":"<module>","tasksFile":"<path of tasks.md relative to the haren folder>"}'` and show its output lines. A warning does not block the plan. The CLI adds the missing features to progress.json, so do not add them yourself
99
159
 
100
160
  ### Step 9: Iteration slicing (only if iterations enabled)
101
161
 
@@ -125,11 +185,13 @@ After creating the master spec and design, and after all tasks are defined:
125
185
  - Planned deliverables: the tasks for this iteration
126
186
  - Demo script: outline of what can be demonstrated
127
187
 
128
- 5. **Update progress.json**: Ensure `currentIteration` is set to 1 (should already be set by init)
188
+ 5. **Check progress.json**: Check that `currentIteration` in progress.json is 1. If it is not, tell the user. Do not edit the file by hand.
129
189
 
130
190
  ## Rules
131
191
 
132
192
  - **Never silently pick a technology** — present options, let the user choose
193
+ - **Never silently pick a screen layout** — show 2-3 mockup options, let the user choose
194
+ - Never skip the UI review for a changed screen.
133
195
  - **One question at a time** — don't overwhelm with multiple decisions
134
196
  - The spec is the contract the evaluator checks against — be precise and testable
135
197
  - Tasks should reference exact file paths in the target repo
@@ -137,3 +199,4 @@ After creating the master spec and design, and after all tasks are defined:
137
199
  - Include edge cases and error scenarios in the spec
138
200
  - The design must document every decision with "chosen: X, alternatives: Y/Z, rationale: ..."
139
201
  - If unsure about anything, ask — don't guess
202
+ - **Never plan new code before the reuse inventory** — search all target repos for existing writers and callers first
@@ -12,15 +12,22 @@ Orient yourself at the start of every session or before taking any action.
12
12
 
13
13
  1. **Read manifest.yaml**
14
14
  - Project name, mode, repos, sources
15
+ - The ui mode: `ui.mockups` (`ask` | `ascii` | `browser`). If the key is missing, report `ask`
15
16
  - Resolve each repo folder as in skill.md "Repos and Git". Warn if a folder is missing, and suggest `haren init` (it clones missing repos)
16
17
 
17
18
  2. **Read progress.json**
18
19
  - List all modules and their current status
19
20
  - List all features and their status within active modules
21
+ - In migration mode, count the units of each module per status (`modules.<m>.units`). Name the legacy repo and mark it read-only
20
22
 
21
23
  3. **Read artifact-index.md**
22
24
  - Understand what artifacts exist
23
25
  - Note any gaps (e.g., module has no plan yet)
26
+ - Run `haren track check`. A FAIL means the workspace state is not reliable:
27
+ - a repo key in progress.json has no entry in manifest.yaml `repos` → ask the user for the path and add the entry
28
+ - an artifact file has no index row → register it with `haren track artifact`
29
+ - an index row points to a missing file → ask the user, then fix the row
30
+ - Report each FAIL line to the user before other work
24
31
 
25
32
  4. **Scan `artifacts/00-baseline/`**
26
33
  - List any files found (PDFs, docs, markdown, etc.)
@@ -76,6 +83,10 @@ Haren repo: {branch, clean | N changed files} ← workspace layout only
76
83
  - Iteration {N}: ✓ spec.md | ✗ spec.md, ✓ design.md | ✗ design.md, ✓ tasks.md | ✗ tasks.md
77
84
  - ...
78
85
 
86
+ ## Units (migration mode only)
87
+ - Legacy repo: {repo key} (read-only)
88
+ - {module}: {count} inventoried, {count} extracted, {count} spec-draft, {count} spec-approved, {count} built, {count} verified, {count} parity-signed
89
+
79
90
  ## Plugins
80
91
  {output lines of `haren plugin run session-start`, or omit if there is no plugins.json}
81
92
 
@@ -93,5 +104,5 @@ Haren repo: {branch, clean | N changed files} ← workspace layout only
93
104
 
94
105
  - Always run this before any other action
95
106
  - If progress.json doesn't exist, suggest running discover phase
96
- - If manifest.yaml is missing repos, warn but don't block
107
+ - If manifest.yaml is missing repos and no module uses a repo yet, warn but don't block. If a module already uses a repo, `haren track check` fails: fix manifest.yaml first
97
108
  - Surface drift between progress.json and git state to the user
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: release
3
+ description: Plan the release order across completed modules and record each module as released
4
+ type: sequential
5
+ agent: architect
6
+ ---
7
+
8
+ # Release
9
+
10
+ Write one release plan for the modules that are ready to ship. The plan gives the order of the steps across modules and repos, for example DB migration → backend → mobile → web. Then record each module as `released` after the user confirms the deployment.
11
+
12
+ <HARD-GATE>
13
+ Never deploy, push, tag or run a migration yourself. The user runs each deploy step. Run a deploy command only when the user asks you to run that exact step.
14
+ </HARD-GATE>
15
+
16
+ ## Inputs
17
+
18
+ - `progress.json` — module status and the `dependencies` map
19
+ - `manifest.yaml` — `repos` with `path`, `default_branch` and `role`
20
+ - `artifacts/03-modules/module-map.md` and each `artifacts/03-modules/{module}/module.md`
21
+ - `artifacts/04-plans/{module}/design.md` — data model changes, migrations, external dependencies
22
+ - `artifacts/06-evaluation/{module}/` — reviews (every feature must pass)
23
+
24
+ ## Process
25
+
26
+ 1. Run read-context skill to orient
27
+ 2. List the modules in status `completed`. Ask the user which of them go into this release
28
+ 3. For each selected module, check:
29
+ - Every feature is `passing`
30
+ - The module branch is merged into each repo's `default_branch`, or the user tells you the merge plan
31
+ - Each dependency (progress.json `dependencies`) is released or is in this release
32
+ Report each failed check. Do not continue until the user decides
33
+ 4. Build the release order:
34
+ - Follow the `dependencies` map: a module comes after the modules it depends on
35
+ - Inside that order, use this default by kind of step: DB migration → shared packages → backend → mobile → web → feature flags or config
36
+ - A backend change that breaks old clients needs a note: old mobile versions stay in use after the release
37
+ 5. For each step, fill in: module, repo key, branch or tag, preconditions, deploy command, verify command, rollback, owner. Read the deploy and verify commands from the repo (scripts, CI files, README). If you cannot find one, write `ask the user` and ask
38
+ 6. Present the order to the user as a table. Ask "does this order look right?" Change it until the user approves
39
+ 7. Write `artifacts/03-modules/release-plan.md` from `templates/release-plan.md` with create-artifact skill. If the file exists, add a new release section at the top. Do not remove old releases
40
+ 8. Register it: `haren track artifact <id> --type release-plan --path artifacts/03-modules/release-plan.md`
41
+
42
+ ## During the release
43
+
44
+ For each step, in order:
45
+
46
+ 1. Tell the user the step, its preconditions and its deploy command
47
+ 2. Wait for the user to run it (or to ask you to run it)
48
+ 3. Ask the user to confirm the verify result
49
+ 4. Record it: `haren track event release-step --module <module> --phase release --data '{"step":<n>,"repo":"<repoKey>","result":"ok"}'`
50
+ 5. If a step fails, stop. Show the rollback for this step and for the steps before it that depend on it. Record `result` as `failed`. Ask the user what to do
51
+
52
+ After the user confirms that all steps of a module are deployed, run `haren track status <module> released`.
53
+
54
+ ## Rules
55
+
56
+ - One release plan file for all modules: `artifacts/03-modules/release-plan.md`
57
+ - Never deploy, push, tag or migrate unless the user asks for that exact step
58
+ - Every step has a rollback. If a step has no safe rollback (for example a destructive migration), mark it and ask the user to approve it
59
+ - Set `released` only after the user confirms the deployment
60
+ - Change status and events only with `haren track` (see update-tracking skill)
61
+ - Fixtures, seed data and examples in the plan use synthetic data only
@@ -22,7 +22,7 @@ Any time during the project lifecycle when a question needs investigation before
22
22
  2. **Resolve ID**: Use resolve-next-id skill to get next RESEARCH ID
23
23
  3. **Conduct research**: Investigate using available tools (web search, code reading, docs)
24
24
  4. **Document findings**: Write structured research artifact
25
- 5. **Update registry**: Use create-artifact skill to write file and update artifact-index.md
25
+ 5. **Update registry**: Use create-artifact skill to write the file. It registers the file with `haren track artifact`
26
26
 
27
27
  ## Output Format
28
28