@odarino/haren 1.4.0 → 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.
@@ -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
@@ -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,7 +18,7 @@ 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>` |
@@ -26,9 +26,17 @@ Run every command from the haren folder.
26
26
  | Append another event | `haren track event <type> [--module m] [--phase p] [--feature f] [--data '<json>']` |
27
27
  | Open the code gate for a user request | `haren track override on --reason "<text>" [--hours <n>]` |
28
28
  | Close the code gate again | `haren track override off` |
29
+ | Set unit status (migration mode) | `haren track unit <module> <unit> <status>` |
30
+ | Set the dependencies of a module | `haren track depends <module> [<dep> ...]` |
31
+ | Make or update the unit map | `haren migrate inventory [--module m]` |
32
+ | Extract one unit from the legacy source | `haren migrate extract <unit>` |
33
+ | Run the spec gate of one unit | `haren migrate gate <unit> [--approve]` |
34
+ | Check manifest repos and the artifact index | `haren track check` (run before every phase transition) |
29
35
 
30
36
  The `status`, `feature`, `commit`, `artifact` and `override` commands append their own events. Do not also run `haren track event` for the same change.
31
37
 
38
+ 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.
39
+
32
40
  ## Operations
33
41
 
34
42
  ### Update Feature Status
@@ -38,6 +46,7 @@ The `status`, `feature`, `commit`, `artifact` and `override` commands append the
38
46
 
39
47
  ### Update Module Status
40
48
  1. Run `haren track status <module> <status>`. The CLI rejects an invalid transition
49
+ 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
50
 
42
51
  ### Add Feature to Module
43
52
  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:
@@ -57,6 +60,24 @@ Iteration-scoped designs are filtered subsets of the master design. Relaxed chec
57
60
  - [ ] Cross-reference to spec: `Spec: artifacts/03-modules/{module}/spec.md`
58
61
  - [ ] Cross-reference to master design: `Master: artifacts/04-plans/{module}/design.md`
59
62
 
63
+ ### Unit Spec (02-discovery/units/<unit>/spec.md)
64
+ - [ ] Sections: Purpose, Fields, Bindings, Writes, Behavior, Legacy traps, Parity checklist
65
+ - [ ] With an adapter: `gate.json` in the unit folder has `pass: true`
66
+ - [ ] Without an adapter: the Manual gate is ticked, with reviewer and date
67
+
68
+ ### Deviation Log (03-modules/deviation-log.md)
69
+ - [ ] Each row has all columns: ID, Unit, Legacy behavior, Target behavior, Reason, Approved by, Date, Status
70
+ - [ ] Each row has an approver
71
+ - [ ] Status is `approved` or `revoked`. No row is deleted
72
+
73
+ ### Parity Evidence (06-evaluation/parity-evidence/)
74
+ - [ ] User, tenant and locale are equal on the legacy side and the target side
75
+ - [ ] `verdict` is `matches-legacy`, `target-bug` or `approved-deviation`
76
+
77
+ ## Workspace Check (all phase transitions)
78
+
79
+ 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.
80
+
60
81
  ## Output
61
82
 
62
83
  ```
@@ -0,0 +1,288 @@
1
+ ---
2
+ name: visual-companion
3
+ description: Show mockups, layout options and diagrams in a browser tab and read the user's clicks
4
+ type: utility
5
+ ---
6
+
7
+ # Visual Companion
8
+
9
+ The visual companion is a local browser tab. It shows mockups, layout options and diagrams. The user clicks an option, and you read the click on your next turn.
10
+
11
+ ## When to Use
12
+
13
+ Decide for each question, not for each session. The test: **does the user understand this better when they see it?**
14
+
15
+ **Use the browser** when the content is visual:
16
+
17
+ - **UI mockups**: wireframes, layouts, navigation structures, component designs
18
+ - **Layout comparisons**: two layouts, two color schemes, two design directions
19
+ - **Diagrams**: system components, data flow, state machines, flowcharts
20
+ - **Side-by-side views**: a mockup next to a screenshot, before and after
21
+ - **Design polish**: look and feel, spacing, visual hierarchy
22
+
23
+ **Use the terminal** when the content is text or a table:
24
+
25
+ - **Requirements and scope questions**: "what does X mean?", "which features are in scope?"
26
+ - **Conceptual A/B/C choices**: approaches that you describe in words
27
+ - **Tradeoffs**: pros and cons, comparison tables
28
+ - **Technical decisions**: API design, data model, architecture
29
+ - **Clarifying questions**: the answer is words, not a visual preference
30
+
31
+ A question about a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual. Use the terminal. "Which of these wizard layouts is better?" is visual. Use the browser.
32
+
33
+ ## Mode
34
+
35
+ Read `ui.mockups` in `manifest.yaml`.
36
+
37
+ - `ascii`: never use the browser. Use ASCII wireframes (see generate-mockup/).
38
+ - `browser`: use the browser for visual questions. Do not ask first.
39
+ - `ask`: at the first visual question in a session, send the offer as its own message, with nothing else:
40
+
41
+ > This next part is easier to show than to describe. I can open a browser tab with mockups and options. Choose: (1) this time, (2) always, (3) no, use ASCII.
42
+
43
+ - On (1): use the browser for this session.
44
+ - On (2): run `haren track ui-mode browser`, then use the browser.
45
+ - On (3): ask "Always use ASCII?". If yes, run `haren track ui-mode ascii`. Use ASCII.
46
+
47
+ ## How It Works
48
+
49
+ The companion server watches a folder for HTML files. It shows the newest file in the browser. You write HTML into `screen_dir`. The user sees it and clicks to select options. The server writes the clicks to `state_dir/events`. You read that file on your next turn.
50
+
51
+ **Content fragments vs full documents:** If your file starts with `<!DOCTYPE` or `<html`, the server sends it as it is (it only adds the helper script). Otherwise, the server puts your content in the frame template: header, theme CSS, connection status and click handling. **Write content fragments by default.** Write a full document only when you need full control of the page.
52
+
53
+ ## Start
54
+
55
+ ```bash
56
+ haren companion start --open
57
+
58
+ # Prints: {"type":"server-started","port":52341,
59
+ # "url":"http://localhost:52341/?key=ab12...",
60
+ # "screen_dir":"<haren>/.companion/12345-1706000000/content",
61
+ # "state_dir":"<haren>/.companion/12345-1706000000/state"}
62
+ ```
63
+
64
+ 1. Save `screen_dir` and `state_dir` from the output.
65
+ 2. Give the user the full URL from the `url` field. With `--open`, the browser opens itself, but headless or remote setups need the URL.
66
+
67
+ **Caution:** the URL contains a session key (`?key=...`). The server rejects requests without the key. Always give the complete URL. Never strip the query string. Never give a bare `http://host:port`.
68
+
69
+ If the companion runs already, `haren companion start` uses the same session again. It ignores extra flags (for example `--port`) and prints a warning. To find the connection data later, run `haren companion status`, or read `state_dir/server-info`.
70
+
71
+ **Windows, and hosts that stop background processes:** run `haren companion start --open --foreground` in a background shell (for example `run_in_background: true` on the Bash tool). The process must stay alive across turns.
72
+
73
+ If the browser cannot reach the URL (remote or container setups), bind a different host:
74
+
75
+ ```bash
76
+ haren companion start --open --host 0.0.0.0 --url-host localhost
77
+ ```
78
+
79
+ Other options: `--port <n>`, `--idle-timeout-minutes <n>`.
80
+
81
+ The server watches the agent process that started it (the owner). When the owner exits, the server does not stop at once. It starts a grace period of 10 minutes. The server stops with reason `owner-exited` only when all of these are true:
82
+
83
+ - The owner is gone.
84
+ - No browser tab is connected.
85
+ - No request came in during the grace period.
86
+
87
+ A print-mode agent (for example `claude -p`) exits after each turn. The URL stays valid for the grace period, so the user can review the screen. With `--open` in a print-mode run, the browser tab stays connected. The server keeps running until the user closes the tab. Then the grace period applies. To stop it at once, run `haren companion stop`. To change the grace period, add `--owner-grace-minutes <n>` (a positive integer). A restart uses the same value again.
88
+
89
+ If the owner check is wrong, or the server must outlive the agent, add `--no-owner-watch`. Then only the idle timeout and `haren companion stop` stop it.
90
+
91
+ ## The Loop
92
+
93
+ 1. **Check the server**: run `haren companion status` before every push. Exit 0 means it runs. If it stopped, run `haren companion start --open`. It restarts the same session with the same URL, key, port, `screen_dir` and `state_dir`. The open tab connects again, and you do not need to send a new URL. If the CLI prints "port changed, give the user the new URL", the old port was busy. Then give the user the new URL.
94
+ 2. **Write the screen**: write a new HTML file in `screen_dir` with your file tool. Do not use cat or a heredoc. Write each screen with the file-write tool under a new file name. Do not copy a file with cp -p or a clone: the server picks the newest file by modification time.
95
+ - Use a semantic name: `layout.html`, `visual-style.html`, `navigation.html`.
96
+ - Never use a file name again. For a new version, write `layout-v2.html`, `layout-v3.html`.
97
+ 3. **Tell the user and end the turn**:
98
+ - Give the URL again (at every step).
99
+ - Give a short summary of the screen, for example "Showing 3 layout options for the dashboard".
100
+ - Ask the user to answer in the terminal: "Look at the options and tell me what you think. Click an option to select it."
101
+ - End your turn.
102
+ 4. **On the next turn**: read `state_dir/events` if it exists. It is JSONL. The last click is usually the choice. If the file does not exist, the user did not click. Merge the clicks with the terminal message. The terminal message is the primary feedback.
103
+ 5. **Iterate or advance**: if the feedback changes the screen, write a new version file. Go to the next question only when the user accepts the current step.
104
+ 6. **Go back to the terminal**: when the next step is text, push `waiting.html` (or `waiting-2.html`) to remove the old content:
105
+
106
+ ```html
107
+ <div style="display:flex;align-items:center;justify-content:center;min-height:60vh"><p class="subtitle">Continuing in terminal...</p></div>
108
+ ```
109
+
110
+ ## Durable Record
111
+
112
+ The browser screens are temporary. Always write the chosen option as an ASCII wireframe into the artifact too (`design.md` in plan, the review file in evaluate). Record the choice and the reason. The artifact is the record, not the screen.
113
+
114
+ ## Minimal Example
115
+
116
+ ```html
117
+ <h2>Which layout works better?</h2>
118
+ <p class="subtitle">Think about readability and visual hierarchy</p>
119
+
120
+ <div class="options">
121
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
122
+ <div class="letter">A</div>
123
+ <div class="content">
124
+ <h3>Single column</h3>
125
+ <p>One focused column of content</p>
126
+ </div>
127
+ </div>
128
+ <div class="option" data-choice="b" onclick="toggleSelect(this)">
129
+ <div class="letter">B</div>
130
+ <div class="content">
131
+ <h3>Two columns</h3>
132
+ <p>Sidebar navigation with main content</p>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ ```
137
+
138
+ You do not need `<html>`, CSS or `<script>` tags. The server adds them.
139
+
140
+ ## CSS Classes
141
+
142
+ The frame template gives these classes.
143
+
144
+ ### Options (A/B/C choices)
145
+
146
+ ```html
147
+ <div class="options">
148
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
149
+ <div class="letter">A</div>
150
+ <div class="content"><h3>Title</h3><p>Description</p></div>
151
+ </div>
152
+ </div>
153
+ ```
154
+
155
+ **Multi-select:** add `data-multiselect` to the container. Each click then toggles one item.
156
+
157
+ ```html
158
+ <div class="options" data-multiselect>
159
+ <!-- same option markup -->
160
+ </div>
161
+ ```
162
+
163
+ ### Cards (visual designs)
164
+
165
+ ```html
166
+ <div class="cards">
167
+ <div class="card" data-choice="design1" onclick="toggleSelect(this)">
168
+ <div class="card-image"><!-- mockup content --></div>
169
+ <div class="card-body"><h3>Name</h3><p>Description</p></div>
170
+ </div>
171
+ </div>
172
+ ```
173
+
174
+ ### Mockup container
175
+
176
+ ```html
177
+ <div class="mockup">
178
+ <div class="mockup-header">Preview: Dashboard layout</div>
179
+ <div class="mockup-body"><!-- mockup HTML --></div>
180
+ </div>
181
+ ```
182
+
183
+ ### Split view (side by side)
184
+
185
+ ```html
186
+ <div class="split">
187
+ <div class="mockup"><!-- left --></div>
188
+ <div class="mockup"><!-- right --></div>
189
+ </div>
190
+ ```
191
+
192
+ ### Pros and cons
193
+
194
+ ```html
195
+ <div class="pros-cons">
196
+ <div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
197
+ <div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
198
+ </div>
199
+ ```
200
+
201
+ ### Mock elements (wireframe parts)
202
+
203
+ ```html
204
+ <div class="mock-nav">Logo | Home | Orders | Settings</div>
205
+ <div style="display: flex;">
206
+ <div class="mock-sidebar">Navigation</div>
207
+ <div class="mock-content">Main content area</div>
208
+ </div>
209
+ <button class="mock-button">Action</button>
210
+ <input class="mock-input" placeholder="Input field">
211
+ <div class="placeholder">Placeholder area</div>
212
+ ```
213
+
214
+ ### Compare (mockup next to screenshot, with a verdict)
215
+
216
+ Use this in evaluate to compare the approved mockup with a screenshot of the built screen.
217
+
218
+ ```html
219
+ <h2>Does the built screen match the mockup?</h2>
220
+ <div class="compare">
221
+ <div class="pane"><div class="label">Mockup</div><!-- mockup HTML --></div>
222
+ <div class="pane"><div class="label">Screenshot</div><img src="/files/orders-list.png" alt="Built orders list"></div>
223
+ </div>
224
+ <div class="verdict">
225
+ <button class="pass" data-choice="pass" onclick="toggleSelect(this)">Pass</button>
226
+ <button class="fail" data-choice="fail" onclick="toggleSelect(this)">Fail</button>
227
+ </div>
228
+ ```
229
+
230
+ ### Findings (review results by severity)
231
+
232
+ Use this to show ui-review/ results.
233
+
234
+ ```html
235
+ <h2>UI review: Orders list</h2>
236
+ <ul class="findings">
237
+ <li class="blocker"><strong>UR-1 blocker</strong>: no error state when the load fails</li>
238
+ <li class="major"><strong>UR-2 major</strong>: the filter input has no label</li>
239
+ <li class="minor"><strong>UR-3 minor</strong>: the page title and menu item use different words</li>
240
+ </ul>
241
+ ```
242
+
243
+ ### Text and sections
244
+
245
+ - `h2`: page title
246
+ - `h3`: section heading
247
+ - `.subtitle`: secondary text below the title
248
+ - `.section`: content block with a bottom margin
249
+ - `.label`: small uppercase label
250
+
251
+ ## Events Format
252
+
253
+ The `text` field is a short label: the option heading, or the letter and the title, or the first 200 characters of the text.
254
+
255
+ The server writes the user's clicks to `state_dir/events`, one JSON object for each line. The server clears the file when a new screen appears.
256
+
257
+ ```jsonl
258
+ {"type":"click","choice":"a","text":"Option A - Single column","timestamp":1706000101}
259
+ {"type":"click","choice":"b","text":"Option B - Two columns","timestamp":1706000115}
260
+ ```
261
+
262
+ `timestamp` is in unix seconds. The full list shows the path of the user. The last click is usually the final choice. Many clicks between options can show doubt. Ask about it.
263
+
264
+ ## Design Tips
265
+
266
+ - **Show 2-4 options** on each screen.
267
+ - **Match the fidelity to the question**: wireframes for layout, more detail for polish questions.
268
+ - **Explain the question on each page**: write "Which layout is easier to scan?", not only "Pick one".
269
+ - **Use real content when it matters**: placeholder text can hide design problems.
270
+ - **Iterate before you advance**: if the feedback changes the screen, write a new version.
271
+
272
+ ## File Naming
273
+
274
+ - Use semantic names: `layout.html`, `visual-style.html`.
275
+ - Never use a file name again. Each screen is a new file.
276
+ - For versions, add a suffix: `layout-v2.html`, `layout-v3.html`.
277
+ - The server shows the newest file by modification time.
278
+ - A restart of a stopped session moves the screens older than the stop to `content/archive/<epoch>/`. A screen written after the stop stays current. The server does not show archived screens.
279
+
280
+ ## Cleanup
281
+
282
+ ```bash
283
+ haren companion stop
284
+ ```
285
+
286
+ The screen files stay in `<haren>/.companion/` for reference.
287
+
288
+ Adapted from the superpowers visual companion (MIT).
@@ -11,6 +11,14 @@ date: {date}
11
11
  ## Data Model
12
12
  {Database schemas, key data structures}
13
13
 
14
+ ## Existing Code
15
+ <!-- Required. Search ALL target repos, not only the module's own package. -->
16
+ <!-- One row for each table the module writes and each side effect it triggers (notification, mail, file, external call, audit log). -->
17
+
18
+ | Table / side effect | Existing writer or caller (file:line) | Verdict | Note |
19
+ |---------------------|---------------------------------------|---------|------|
20
+ | {table or effect} | {path:line, or "none found: <search command>"} | reuse / extend / supersede / duplicate (justify) | {why} |
21
+
14
22
  ## Key Decisions
15
23
 
16
24
  | Decision | Choice | Alternatives Considered | Rationale |
@@ -30,6 +38,12 @@ date: {date}
30
38
  |--------|-----------|--------|
31
39
  | A | {one line} | chosen / rejected: {reason} |
32
40
 
41
+ ## UI Review
42
+ <!-- Only if the module adds or changes screens. Use the ui-review skill. Severity: blocker | major | minor. A blocker needs a fix or "accepted by user". -->
43
+
44
+ | ID | Screen | Heuristic | Severity | Finding | Fix |
45
+ |----|--------|-----------|----------|---------|-----|
46
+
33
47
  ## File Structure
34
48
  ```
35
49
  {planned file layout in target repo}
@@ -0,0 +1,13 @@
1
+ ---
2
+ type: deviation-log
3
+ ---
4
+
5
+ # Deviation Log
6
+
7
+ Never delete a row. Revoke it.
8
+
9
+ Status is `approved` or `revoked`.
10
+
11
+ | ID | Unit | Legacy behavior | Target behavior | Reason | Approved by | Date | Status |
12
+ |----|------|-----------------|-----------------|--------|-------------|------|--------|
13
+ | DEV-001 | SCR_A001 | {legacy behavior} | {target behavior} | {reason} | {approver} | {date} | approved |
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: legacy-semantics
3
+ ---
4
+
5
+ # Legacy Semantics
6
+
7
+ The rulebook of source-platform traps. Read it before you write a unit spec.
8
+
9
+ | Rule ID | Platform behavior | Wrong reading | Correct reading | Found by |
10
+ |---------|-------------------|---------------|-----------------|----------|
11
+ | LS-001 | {what the platform does} | {the reading that looks right} | {the correct reading} | {unit or person} |
@@ -0,0 +1,32 @@
1
+ ---
2
+ unit: {SCR_A001}
3
+ difference: {one line about the difference}
4
+ verdict: {matches-legacy | target-bug | approved-deviation}
5
+ ---
6
+
7
+ # Parity Evidence: {SCR_A001}
8
+
9
+ ## Environment
10
+ The user, tenant and locale must be equal on both sides.
11
+
12
+ | Side | User | Tenant | Locale |
13
+ |------|------|--------|--------|
14
+ | Legacy | {user} | {tenant} | {locale} |
15
+ | Target | {user} | {tenant} | {locale} |
16
+
17
+ ## Steps
18
+ 1. {step}
19
+
20
+ ## Legacy result
21
+ {What the legacy system showed.}
22
+
23
+ ## Target result
24
+ {What the target system showed.}
25
+
26
+ ## Evidence
27
+ - Screenshots: {paths}
28
+ - Network: {request and response}
29
+ - SQL: {query and rows, for example from ORDER_TBL}
30
+
31
+ ## Verdict
32
+ {matches-legacy | target-bug | approved-deviation}. {If approved-deviation, give the DEV-ID.}
@@ -0,0 +1,20 @@
1
+ ---
2
+ type: unit-map
3
+ ---
4
+
5
+ # Unit Map
6
+
7
+ Generated by `haren migrate inventory`. Edit only the Module column.
8
+
9
+ | Unit | Parent | Family | Title | Module |
10
+ |------|--------|--------|-------|--------|
11
+ | SCR_A001 | - | {family} | {title} | {module} |
12
+ | SCR_A001_P1 | SCR_A001 | {family} | {title} | {module} |
13
+
14
+ ## Shared components
15
+
16
+ A re-run of `haren migrate inventory` writes the unit table again and keeps this section.
17
+
18
+ | Component | Used by units | Module |
19
+ |-----------|---------------|--------|
20
+ | {ORDER_TBL or a shared routine} | SCR_A001, SCR_A002 | {module} |
@@ -0,0 +1,43 @@
1
+ ---
2
+ unit: {SCR_A001}
3
+ module: {module}
4
+ source: {legacy path of the unit}
5
+ ---
6
+
7
+ # Unit Spec: {SCR_A001}
8
+
9
+ ## Purpose
10
+ {What the user does on this unit. One paragraph.}
11
+
12
+ ## Fields
13
+ | Field | Type | Required | Default | Validation |
14
+ |-------|------|----------|---------|------------|
15
+
16
+ ## Bindings
17
+ | Binding | Source (table.column or query) | Read or write |
18
+ |---------|-------------------------------|---------------|
19
+
20
+ ## Writes
21
+ | Table | Operation | Condition |
22
+ |-------|-----------|-----------|
23
+ | {ORDER_TBL} | insert | {when} |
24
+
25
+ Side effects (notification, mail, file, external API, audit log, numbering):
26
+ - {side effect}
27
+
28
+ ## Behavior
29
+ 1. {event} → {result}
30
+
31
+ ## Legacy traps
32
+ - {Rule ID from `artifacts/01-research/legacy-semantics.md`}: {how it applies here}
33
+
34
+ ## Parity checklist
35
+ - [ ] {observable behavior to compare on legacy and target}
36
+
37
+ ## Manual gate
38
+ Use this section only when the workspace has no adapter gate.
39
+
40
+ - [ ] Every binding is covered in the spec
41
+ - [ ] Every write is covered in the spec
42
+ - Reviewer: {name}
43
+ - Date: {date}