@odarino/haren 1.4.0 → 1.7.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 (37) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +1 -1
  3. package/README.md +108 -9
  4. package/content/agents/architect.md +1 -1
  5. package/content/agents/developer.md +4 -3
  6. package/content/agents/planner.md +3 -1
  7. package/content/agents/reviewer.md +2 -0
  8. package/content/skills/audit-workspace/SKILL.md +2 -1
  9. package/content/skills/collect-components/SKILL.md +81 -0
  10. package/content/skills/decompose/SKILL.md +10 -16
  11. package/content/skills/discover/SKILL.md +6 -2
  12. package/content/skills/discover/blueprint.md +1 -0
  13. package/content/skills/discover/explore.md +1 -0
  14. package/content/skills/discover/inherit.md +1 -0
  15. package/content/skills/discover/migration.md +38 -0
  16. package/content/skills/evaluate/SKILL.md +24 -0
  17. package/content/skills/extract/SKILL.md +43 -0
  18. package/content/skills/generate-mockup/SKILL.md +41 -5
  19. package/content/skills/ideate/SKILL.md +2 -0
  20. package/content/skills/implement/SKILL.md +20 -11
  21. package/content/skills/plan/SKILL.md +57 -9
  22. package/content/skills/read-context/SKILL.md +12 -1
  23. package/content/skills/resolve-next-id/SKILL.md +9 -1
  24. package/content/skills/ui-review/SKILL.md +64 -0
  25. package/content/skills/update-tracking/SKILL.md +11 -1
  26. package/content/skills/validate-artifact/SKILL.md +34 -0
  27. package/content/skills/visual-companion/SKILL.md +285 -0
  28. package/content/templates/checklist.md +26 -0
  29. package/content/templates/component-catalog.md +41 -0
  30. package/content/templates/design.md +15 -0
  31. package/content/templates/deviation-log.md +13 -0
  32. package/content/templates/legacy-semantics.md +11 -0
  33. package/content/templates/parity-evidence.md +32 -0
  34. package/content/templates/unit-map.md +20 -0
  35. package/content/templates/unit-spec.md +43 -0
  36. package/dist/index.js +2681 -120
  37. package/package.json +4 -3
@@ -20,11 +20,47 @@ 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
- ## Modes
23
+ ## Wireframe modes
24
24
 
25
25
  - **Single** (default): one wireframe for one screen
26
26
  - **Options**: 2-3 labeled variants of one screen, for the user to compare and pick. The plan skill uses this mode
27
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
+ - `artifact`: write the ASCII wireframes into design.md as before. Also publish the options as a Claude Artifact page. See "Artifact mode".
35
+ - `ask`: ask the user before the first mockup of the session. See "Ask the user".
36
+
37
+ ### Ask the user
38
+
39
+ <HARD-GATE>
40
+ On `ask`, do not draw the first mockup of the session before the user picks a format. Never fall back to ASCII without asking.
41
+ </HARD-GATE>
42
+
43
+ Send the offer as its own message, with nothing else. List only the formats that work here: list Claude Artifact only if you have the `Artifact` tool, and the browser tab only if `haren companion` can run.
44
+
45
+ > How do you want to see the mockups? (1) ASCII in the terminal and in design.md, (2) Claude Artifact: a private web page on claude.ai, (3) local browser tab with clickable options. Add "always" to save the choice.
46
+
47
+ - With "always": run `haren track ui-mode <ascii|artifact|browser>`. Without it: use the choice for this session only.
48
+ - If only ASCII works here, say so in one line and use ASCII. Do not ask.
49
+
50
+ ### Artifact mode
51
+
52
+ Needs the `Artifact` tool (Claude Code with claude.ai). If the tool is missing, tell the user and use ASCII.
53
+
54
+ Use a plain HTML page, not an Artifact type such as Design or Slides, and skip the quickstart for a type. The page file must stay in `artifacts/04-plans/{module}/mockups/`. Give the page a `<title>` of 2-4 words (for example `Checkout Layout Options`) and the icon `layout`.
55
+
56
+ 1. Draw the ASCII options first (Options mode below). They stay the source of truth in design.md.
57
+ 2. Build one HTML page: one card per option, side by side on wide screens and stacked on phones. Label each card `Option A`/`B`/`C` and show its trade-off line. Mark the recommended option. Use synthetic data only.
58
+ 3. Render each option as a real UI mock (HTML/CSS), not as ASCII in a `<pre>`. Follow the artifact-design skill for the page rules.
59
+ 4. Write the page to `artifacts/04-plans/{module}/mockups/{screen}.html` and publish it with the `Artifact` tool. Publish again from the same path for a new round, so the URL stays the same. Do not register the page with `haren track artifact`: the `.html` files in `mockups/` are working files, and `haren track check` only checks `.md` files. design.md is the registered record
60
+ 5. Give the user the link. Tell the user that the page is private until they share it. Ask for the pick in the terminal.
61
+ 6. After the pick, write the chosen option as ASCII into design.md `## Screens`. Put the link under `**Chosen:**` in this format: `**Mockup page:** <url> (Claude Artifact, private)`.
62
+ 7. If the pick is not the recommended option, check that it does not change a reuse verdict or a task. If it does, update `## Existing Code`, tasks.md and checklist.md, and tell the user what changed.
63
+
28
64
  ### Options mode
29
65
 
30
66
  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
@@ -32,14 +68,13 @@ Generate ASCII wireframes for UI screens described in specs or designs. Output i
32
68
  3. Mark one variant as recommended and say why in one sentence
33
69
  4. Show the variants side by side in one message (see Output Format). If the terminal is narrow, show them one under the other
34
70
  5. Ask the user to pick one. Do not continue to the next screen before the pick
35
- 6. Optional browser view: if the user asks, or if the screens are hard to read as ASCII, write `artifacts/04-plans/{module}/mockups/{screen-slug}.html`. The file shows the options side by side in columns, with the label and the trade-off over each. Use plain HTML and inline CSS only, with no external scripts. Tell the user the file path to open in a browser
36
- 7. Use only synthetic data in mockups (for example "Alex Sample", `user@example.com`). Never copy real third-party personal data
71
+ 6. Use only synthetic data in mockups (for example "Alex Sample", `user@example.com`). Never copy real third-party personal data
37
72
 
38
73
  ## ASCII Wireframe Conventions
39
74
 
40
75
  ```
41
76
  ┌─────────────────────────────────────────────┐ ← outer border
42
- │ Page Title [Button] │ ← header bar
77
+ │ Page Title [Button] │ ← header bar
43
78
  ├─────────────────────────────────────────────┤ ← divider
44
79
  │ ┌──────────┐ ┌───────────────────────────┐ │ ← two-column
45
80
  │ │ Sidebar │ │ Main Content │ │
@@ -165,7 +200,8 @@ After the pick, put the chosen wireframe and the option table in the `## Screens
165
200
  - Keep wireframes simple — communicate layout, not pixel-perfect design
166
201
  - Use placeholder text: `[Field Label]`, `[Button Text]`, `Row data`
167
202
  - Show realistic column counts and proportions
203
+ - 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.
168
204
  - Max width: 60 characters for wireframe content (30 characters per option when options are side by side)
169
205
  - If a screen has tabs or states, show the primary state unless asked
170
206
  - **Ask the user** if the layout looks right before moving to the next screen
171
- - Wireframes go into `design.md`. The only separate file is the optional HTML view in options mode
207
+ - Wireframes go into `design.md`. Do not write separate mockup files
@@ -139,6 +139,8 @@ 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)
@@ -15,18 +15,25 @@ Execute the implementation plan for a module, one feature at a time.
15
15
  ## Pre-Implementation (every session)
16
16
 
17
17
  1. Run read-context skill to orient
18
- 2. Read tasks from the **active plan path** (see skill.md Plan Paths convention)
19
- 3. Read `progress.json` to find current feature status
20
- 4. Read `artifacts/05-implementation/{module}/task-{N}-{slug}.md` if it exists for the target feature (previous session context)
21
- 5. If iterations enabled, also read the **master plan path** for broader module context if needed
22
- 6. Pick the highest-priority feature in "pending" status
23
- 7. Set up the module branch. Follow skill.md "Repos and Git":
18
+ 2. Read tasks and `checklist.md` from the **active plan path** (see skill.md Plan Paths convention). If checklist.md is missing, tell the user and ask to run the plan skill or continue without it
19
+ 3. Read `artifacts/03-modules/component-catalog.md` if it exists. Use its entries before you write new UI components, services or functions
20
+ 4. Read `progress.json` to find current feature status
21
+ 5. Read `artifacts/05-implementation/{module}/task-{N}-{slug}.md` if it exists for the target feature (previous session context)
22
+ 6. If iterations enabled, also read the **master plan path** for broader module context if needed
23
+ 7. Pick the highest-priority feature in "pending" status
24
+ 8. Set up the module branch. Follow skill.md "Repos and Git":
24
25
  - 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
26
  - 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
27
  - 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
28
  - If the module depends on a module that is not merged yet, follow skill.md "Dependent modules" for the base branch
28
29
  - If the module status is `planned`, set it to `implementing` with `haren track status <module> implementing`
29
30
 
31
+ ### Migration mode only
32
+
33
+ - Read `artifacts/03-modules/deviation-log.md` before each task.
34
+ - Never change behavior that has an `approved` deviation row back to the legacy behavior.
35
+ - After all tasks of a unit pass, run `haren track unit <module> <unit> built`.
36
+
30
37
  ## Implementation Loop
31
38
 
32
39
  For each feature:
@@ -34,14 +41,16 @@ For each feature:
34
41
  1. Update feature status: `haren track feature <module> <feature> in-progress`
35
42
  2. Choose the path by task size (see "Fast path" below):
36
43
  - **Small task:** implement it directly in the main session with superpowers:test-driven-development
37
- - **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
38
- 3. After implementation:
44
+ - **Other tasks:** delegate to superpowers:subagent-driven-development. Pass the full task description from tasks.md, the checklist section of the task and the design context from design.md. Ensure TDD discipline via superpowers:test-driven-development
45
+ 3. Before the code commit, go through the task's section in `checklist.md`. Tick an item (`- [x]`) only when you verified it in the code or in a test run. Do not tick from the design alone. If the code differs from the item, keep it unticked and add `— changed: {what and why}`. If an item does not apply or you cannot do it, keep it unticked and add `— skipped: {reason}`. Do not commit while an item is unticked without a reason. The main session ticks the items, also when a subagent wrote the code
46
+ 4. After implementation:
39
47
  - (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"
40
- - (b) Record each new commit SHA in `lastCommit.<repoKey>`: `haren track commit <module> <repoKey> <sha>`
48
+ - (b) Record each new commit SHA in `lastCommit.<repoKey>`. The repo key is a key of manifest.yaml `repos`, or `default` when `repos` is empty. Never guess a key such as `backend`: `haren track commit <module> <repoKey> <sha>`
49
+ - Run the collect-components skill in incremental mode on the new code commits. It updates `artifacts/03-modules/component-catalog.md`
41
50
  - Update feature status: `haren track feature <module> <feature> evaluating`
42
51
  - 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
43
52
  - Append the "feature-ready" event: `haren track event feature-ready --module <module> --phase implement --feature <feature>`
44
- - (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.
53
+ - (c) Commit the haren files (session log, `checklist.md`, `component-catalog.md`, `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.
45
54
  - Never push
46
55
 
47
56
  ## Fast path
@@ -77,5 +86,5 @@ If iterations are enabled (check manifest.yaml for `iterations` block), include
77
86
  - Always write tests before implementation (TDD)
78
87
  - If blocked, run `haren track feature <module> <feature> blocked` and surface to user — don't guess
79
88
  - If you need to deviate from the plan, document why in the session log
80
- - 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
89
+ - Never modify files in the haren folder except session logs, the ticks in `checklist.md` and `component-catalog.md` (through the collect-components skill). Change `progress.json` and `events/events.jsonl` only with `haren track` (see update-tracking skill). Never edit them with sed or jq
81
90
  - Never push. Never create pull requests unless the user asks
@@ -17,6 +17,26 @@ 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
+ 0. Read `artifacts/03-modules/component-catalog.md`. If it does not exist and a target repo has code, run the collect-components skill (full scan) first. Use the catalog entries as the first candidates for reuse
34
+ 1. List every table the module writes and every side effect it triggers (notification, SMS, mail, file, external API, audit log, numbering)
35
+ 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
36
+ 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
37
+ 4. Read the hits that are a shared service. Check its doc comment for a caller/shared split
38
+ 5. List the UI components, shared services and shared functions from the catalog that the module will use. Put the result in the `## Existing Code` section of design.md. Tasks must use the verdicts: no task builds a "reuse" item again
39
+ 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
40
 
21
41
  ### Step 5: Gather decisions BEFORE writing artifacts
22
42
 
@@ -46,11 +66,16 @@ mockup option per changed screen before you write the spec or the design.
46
66
  5. Document each decision in the design artifact with rationale
47
67
 
48
68
  **UI decisions (only if the module adds or changes screens):**
49
- 1. List the changed screens from the spec, the module definition and the stories
50
- 2. 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
51
- 3. Show the options side by side in one message. If the user wants a browser view, also write the HTML file that the skill describes
52
- 4. Ask the user to pick one option. One screen at a time
53
- 5. 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
69
+ 1. Read `ui.mockups` in `manifest.yaml` (`ask` | `ascii` | `browser` | `artifact`, default `ask`). On `ask`, follow the offer in the generate-mockup skill
70
+ 2. List the changed screens from the spec, the module definition and the stories
71
+ 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
72
+ 4. Show the options:
73
+ - ASCII path: show the options side by side in one message
74
+ - 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
75
+ 5. ASCII path: ask the user to pick one option. Both paths: one screen at a time
76
+ 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
77
+ 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
78
+ 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`
54
79
 
55
80
  **Example flow:**
56
81
  ```
@@ -91,9 +116,11 @@ Write to: `artifacts/04-plans/{module}/design.md` (master — always written her
91
116
 
92
117
  Using `templates/design.md`:
93
118
  - Architecture overview
119
+ - **Existing code** (from the reuse inventory in Step 4)
94
120
  - Data model
95
121
  - **Key technical decisions with rationale** (from step 5 — include what was chosen and why)
96
122
  - **Screens** (if the module adds or changes screens): the chosen mockup per screen and the rejected options with the reason
123
+ - **UI Review** (if screens): the findings table from the `ui-review` skill
97
124
  - File structure plan
98
125
  - External dependencies
99
126
 
@@ -107,9 +134,27 @@ Using `templates/tasks.md`:
107
134
  - Tasks should be small enough for one implementation session
108
135
  - Include test tasks alongside implementation tasks
109
136
 
137
+ #### Checklist (implementation checklist)
138
+ Write to: the active plan path, next to tasks.md, as `checklist.md`. When iterations are enabled, write it in Step 9 for each iteration, not at the root level.
139
+
140
+ Using `templates/checklist.md`:
141
+ - One `## Task N` section per task in tasks.md, with the same number and title
142
+ - Each item is a concrete check, not a generic one. Name the test file and cases, the catalog entries to reuse, the files, the contract and the edge cases of that task
143
+ - The Reuse item takes its entries from `## Existing Code` and the component catalog
144
+ - Add project-specific items from the design (for example i18n, audit log, migration rollback)
145
+
146
+ #### Register the drafts
147
+
148
+ Register each artifact right after you write it, before the user approves it. Then `haren track check` passes while you wait for the approval:
149
+
150
+ - `haren track artifact <id> --type design --path artifacts/04-plans/{module}/design.md --module <module> --status draft`
151
+ - `haren track artifact <id> --type tasks --path <path of tasks.md> --module <module> --status draft`
152
+ - `haren track artifact <id> --type checklist --path <path of checklist.md> --module <module> --status draft`
153
+ - If you wrote spec.md: `haren track artifact <id> --type spec --path artifacts/03-modules/{module}/spec.md --module <module> --status draft`
154
+
110
155
  ### Step 7: Review with user
111
156
 
112
- **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.
157
+ **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, the tasks and the checklist in one message and ask for one approval. Write "Size: small" in the design. The implement skill then uses its fast path.
113
158
 
114
159
  **Other modules:** present each artifact section by section. Ask "does this look right?" after each.
115
160
  Only proceed to the next artifact after the current one is approved.
@@ -118,8 +163,8 @@ The user can always ask for the full path. Then review section by section.
118
163
 
119
164
  ### Step 8: Finalize
120
165
 
121
- 1. Validate all three artifacts with validate-artifact skill
122
- 2. Register each new artifact: `haren track artifact <id> --type <type> --path <path> --module <module>`
166
+ 1. Validate all plan artifacts (spec, design, tasks, checklist) with validate-artifact skill. This runs `haren track check`
167
+ 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
123
168
  3. Set the module status: `haren track status <module> planned`. Never edit progress.json by hand
124
169
  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
125
170
 
@@ -143,6 +188,7 @@ After creating the master spec and design, and after all tasks are defined:
143
188
  - Create `artifacts/04-plans/{module}/iteration-{N}/design.md` — filtered subset of master design containing only decisions relevant to this iteration's tasks
144
189
  - Create `artifacts/04-plans/{module}/iteration-{N}/tasks.md` — only the tasks assigned to this iteration, each referencing STORY-IDs
145
190
  - Each scoped design must include: `Master: artifacts/04-plans/{module}/design.md` as a cross-reference
191
+ - Create `artifacts/04-plans/{module}/iteration-{N}/checklist.md` — the checklist sections of the tasks in this iteration
146
192
  - Each scoped tasks file must include: `Spec: artifacts/03-modules/{module}/spec.md` as a cross-reference
147
193
  - Note: iteration-scoped specs are NOT created — the spec in `03-modules/` is the single source of truth (BA-owned)
148
194
 
@@ -151,12 +197,13 @@ After creating the master spec and design, and after all tasks are defined:
151
197
  - Planned deliverables: the tasks for this iteration
152
198
  - Demo script: outline of what can be demonstrated
153
199
 
154
- 5. **Update progress.json**: Ensure `currentIteration` is set to 1 (should already be set by init)
200
+ 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.
155
201
 
156
202
  ## Rules
157
203
 
158
204
  - **Never silently pick a technology** — present options, let the user choose
159
205
  - **Never silently pick a screen layout** — show 2-3 mockup options, let the user choose
206
+ - Never skip the UI review for a changed screen.
160
207
  - **One question at a time** — don't overwhelm with multiple decisions
161
208
  - The spec is the contract the evaluator checks against — be precise and testable
162
209
  - Tasks should reference exact file paths in the target repo
@@ -164,3 +211,4 @@ After creating the master spec and design, and after all tasks are defined:
164
211
  - Include edge cases and error scenarios in the spec
165
212
  - The design must document every decision with "chosen: X, alternatives: Y/Z, rationale: ..."
166
213
  - If unsure about anything, ask — don't guess
214
+ - **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` | `artifact`). 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
@@ -10,18 +10,26 @@ Determine the next available ID for a given artifact type to prevent conflicts.
10
10
 
11
11
  ## Process
12
12
 
13
+ For numbered types (for example RESEARCH and LSEM):
14
+
13
15
  1. Scan the target directory for existing artifacts
14
16
  2. Extract numeric IDs from filenames (e.g., RESEARCH-001 → 1)
15
17
  3. Return next sequential ID, zero-padded to 3 digits
16
18
 
19
+ For `UNITSPEC-<unit>`, use the unit ID. It has no number.
20
+
21
+ For LSEM, scan the registered legacy-semantics artifacts in `artifacts/_registry/artifact-index.md`. A workspace has one rulebook, so the ID is normally LSEM-001.
22
+
17
23
  ## ID Formats
18
24
 
19
25
  | Type | Format | Example |
20
26
  |------|--------|---------|
21
27
  | RESEARCH | RESEARCH-{NNN}-{slug} | RESEARCH-001-auth-approach |
28
+ | unit-spec | `UNITSPEC-<unit>` (one per unit, no number) | UNITSPEC-SCR_A001 |
29
+ | legacy-semantics | `LSEM-NNN` | LSEM-001 |
22
30
 
23
31
  ## Rules
24
32
 
25
- - Always zero-pad to 3 digits (001, 002, etc.)
33
+ - For numbered types, always zero-pad to 3 digits (001, 002, etc.)
26
34
  - Scan actual files, not just the registry (registry might be stale)
27
35
  - Return both the ID and suggested filename
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: ui-review
3
+ description: Review a screen mockup or screenshot against UX heuristics and report findings by severity
4
+ type: utility
5
+ ---
6
+
7
+ # UI Review
8
+
9
+ Review one screen against a fixed set of UX heuristics. Report each problem as a finding with a severity and a fix.
10
+
11
+ ## When to Use
12
+
13
+ - In the **plan** phase, after the user chooses a mockup for a screen.
14
+ - In the **evaluate** phase, on a screenshot of the built screen.
15
+ - When the user asks for a UX review of a screen.
16
+
17
+ ## Input
18
+
19
+ - The chosen mockup (ASCII wireframe or companion HTML) or a screenshot of the screen.
20
+ - The spec stories for the screen (acceptance criteria, roles, data).
21
+
22
+ ## Checklist
23
+
24
+ Check each item. Record a finding for each problem.
25
+
26
+ 1. **States**: empty, loading, error, success, no permission.
27
+ 2. **Accessibility**: text contrast, focus and tab order, labels and alt text, touch target size.
28
+ 3. **Navigation**: exit, back, breadcrumb or location.
29
+ 4. **Consistency**: other screens, design system if any.
30
+ 5. **Content**: clear labels, error messages say how to fix.
31
+ 6. **Responsive**: narrow and wide.
32
+
33
+ ## Severity
34
+
35
+ - `blocker`: the user cannot complete the task, or the screen fails a basic accessibility need.
36
+ - `major`: the user can complete the task, but with difficulty or a high chance of error.
37
+ - `minor`: a small problem in polish or consistency.
38
+
39
+ ## Output
40
+
41
+ Write one table:
42
+
43
+ ```markdown
44
+ | ID | Screen | Heuristic | Severity | Finding | Fix |
45
+ |----|--------|-----------|----------|---------|-----|
46
+ | UR-1 | Orders list | States | blocker | No error state when the load fails | Add an error message with a retry button |
47
+ | UR-2 | Orders list | Accessibility | major | The filter input has no label | Add a visible label "Filter orders" |
48
+ | UR-3 | Orders list | Consistency | minor | The title and the menu item use different words | Use "Orders" in both |
49
+ ```
50
+
51
+ Severity is one of `blocker | major | minor`.
52
+
53
+ ## Where It Goes
54
+
55
+ - **Plan**: add the table under `## UI Review` in `design.md` of the module.
56
+ - **Evaluate**: add the table to the review file of the module.
57
+ - **Browser mode** (`ui.mockups` is `browser`, or the user chose the browser): also push a `.findings` screen with the visual companion (see visual-companion/).
58
+
59
+ ## Rule
60
+
61
+ **Caution:** a blocker stops the module. Before the module goes to `planned`, do one of these for each blocker:
62
+
63
+ 1. Fix it in the mockup, and review the screen again.
64
+ 2. Get the user to accept it. Write "accepted by user" in the Fix column.
@@ -18,17 +18,26 @@ Run every command from the haren folder.
18
18
 
19
19
  | Goal | Command |
20
20
  |------|---------|
21
- | Set module status | `haren track status <module> <status>` |
21
+ | Set module status | `haren track status <module> <status> [--branch <name>] [--repos <key1,key2>]` |
22
22
  | Add a feature (status `pending`) | `haren track feature <module> <feature>` |
23
23
  | Set feature status | `haren track feature <module> <feature> <status>` |
24
24
  | Record a commit | `haren track commit <module> <repoKey> <sha>` |
25
+ | Remove a stale repo key | `haren track commit <module> <repoKey> --remove` |
25
26
  | Register an artifact | `haren track artifact <id> --type <type> --path <path> [--module <m>] [--status <s>]` |
26
27
  | Append another event | `haren track event <type> [--module m] [--phase p] [--feature f] [--data '<json>']` |
27
28
  | Open the code gate for a user request | `haren track override on --reason "<text>" [--hours <n>]` |
28
29
  | Close the code gate again | `haren track override off` |
30
+ | Set unit status (migration mode) | `haren track unit <module> <unit> <status>` |
31
+ | Set the dependencies of a module | `haren track depends <module> [<dep> ...]` |
32
+ | Make or update the unit map | `haren migrate inventory [--module m]` |
33
+ | Extract one unit from the legacy source | `haren migrate extract <unit>` |
34
+ | Run the spec gate of one unit | `haren migrate gate <unit> [--approve]` |
35
+ | Check manifest repos and the artifact index | `haren track check` (run before every phase transition) |
29
36
 
30
37
  The `status`, `feature`, `commit`, `artifact` and `override` commands append their own events. Do not also run `haren track event` for the same change.
31
38
 
39
+ In migration mode, `haren migrate gate <unit>` runs the adapter gate. A gate FAIL on a `spec-approved` unit moves the unit back to `spec-draft`. An adapter command that runs longer than 300 seconds stops with an error. Set `HAREN_ADAPTER_TIMEOUT_MS` to change this limit.
40
+
32
41
  ## Operations
33
42
 
34
43
  ### Update Feature Status
@@ -38,6 +47,7 @@ The `status`, `feature`, `commit`, `artifact` and `override` commands append the
38
47
 
39
48
  ### Update Module Status
40
49
  1. Run `haren track status <module> <status>`. The CLI rejects an invalid transition
50
+ 2. To set the module branch and repos, add `--branch <name>` and `--repos <key1,key2>`. Each repo key must be in `manifest.yaml`. If you give the same status as the module has now, the CLI only updates the branch and repos
41
51
 
42
52
  ### Add Feature to Module
43
53
  1. Run `haren track feature <module> <feature>`. The feature starts as `pending`
@@ -43,6 +43,9 @@ Required sections:
43
43
  - [ ] Architecture overview
44
44
  - [ ] Data model (or "N/A" with justification)
45
45
  - [ ] Key technical decisions
46
+ - [ ] Existing Code section (reuse inventory). For each table that the module writes and each side effect that it triggers, the section lists the existing writers and callers in all target repos with `file:line`, or states "none found" with the search command. A design that says "new" for a behavior must name what it leaves behind. Missing or empty section → FAIL
47
+ - [ ] Cheap mechanical check: for each table under "Data Model → Owned (write)", search all target repos for writes to it (for example `INSERT INTO <table>`, `UPDATE <table>`, ORM save calls). A hit that the Existing Code section does not mention → FAIL
48
+ - [ ] If the design has `## Screens`, it must have `## UI Review` with the findings table. A blocker row must have a fix or "accepted by user" in the Fix column. A missing section or an open blocker → FAIL
46
49
 
47
50
  ### Tasks (04-plans)
48
51
  Required:
@@ -50,6 +53,19 @@ Required:
50
53
  - [ ] Each task has: title, description, files
51
54
  - [ ] Tasks are ordered
52
55
 
56
+ ### Checklist (04-plans)
57
+ Required:
58
+ - [ ] One `## Task N` section for each task in tasks.md of the same plan path, with the same number
59
+ - [ ] Each section has a Tests item and a Reuse item. Generic items only ("write tests") → FAIL
60
+ - [ ] After implement: each unticked item has `— skipped: {reason}` or `— changed: {what and why}`
61
+ - [ ] The Reuse items name entries that exist in `## Existing Code` or in `artifacts/03-modules/component-catalog.md`, or say "none"
62
+
63
+ ### Component Catalog (03-modules)
64
+ Required:
65
+ - [ ] Front matter `updated:` and `last_scan:`
66
+ - [ ] Each entry has Kind, Path (`repoKey:file:line`), API, Use for, Used by
67
+ - [ ] Each Path exists in the repo
68
+
53
69
  ### Iteration-Scoped Design (04-plans, iterations only)
54
70
  Iteration-scoped designs are filtered subsets of the master design. Relaxed checks:
55
71
  - [ ] Architecture overview (can reference master for full detail)
@@ -57,6 +73,24 @@ Iteration-scoped designs are filtered subsets of the master design. Relaxed chec
57
73
  - [ ] Cross-reference to spec: `Spec: artifacts/03-modules/{module}/spec.md`
58
74
  - [ ] Cross-reference to master design: `Master: artifacts/04-plans/{module}/design.md`
59
75
 
76
+ ### Unit Spec (02-discovery/units/<unit>/spec.md)
77
+ - [ ] Sections: Purpose, Fields, Bindings, Writes, Behavior, Legacy traps, Parity checklist
78
+ - [ ] With an adapter: `gate.json` in the unit folder has `pass: true`
79
+ - [ ] Without an adapter: the Manual gate is ticked, with reviewer and date
80
+
81
+ ### Deviation Log (03-modules/deviation-log.md)
82
+ - [ ] Each row has all columns: ID, Unit, Legacy behavior, Target behavior, Reason, Approved by, Date, Status
83
+ - [ ] Each row has an approver
84
+ - [ ] Status is `approved` or `revoked`. No row is deleted
85
+
86
+ ### Parity Evidence (06-evaluation/parity-evidence/)
87
+ - [ ] User, tenant and locale are equal on the legacy side and the target side
88
+ - [ ] `verdict` is `matches-legacy`, `target-bug` or `approved-deviation`
89
+
90
+ ## Workspace Check (all phase transitions)
91
+
92
+ Before any phase transition, run `haren track check`. Its FAIL lines are FAIL lines of this validation: unregistered artifact files, index rows that point to missing files, and repo keys that manifest.yaml does not declare.
93
+
60
94
  ## Output
61
95
 
62
96
  ```