@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.
- package/LICENSE +1 -1
- package/README.md +209 -33
- package/content/agents/architect.md +5 -2
- package/content/agents/developer.md +6 -6
- package/content/agents/ideator.md +2 -2
- package/content/agents/planner.md +4 -1
- package/content/agents/researcher.md +1 -1
- package/content/agents/reviewer.md +13 -4
- package/content/skills/audit-workspace/SKILL.md +2 -1
- package/content/skills/create-artifact/SKILL.md +2 -5
- package/content/skills/decompose/SKILL.md +10 -13
- package/content/skills/discover/SKILL.md +7 -2
- package/content/skills/discover/blueprint.md +1 -0
- package/content/skills/discover/explore.md +1 -0
- package/content/skills/discover/inherit.md +1 -0
- package/content/skills/discover/migration.md +38 -0
- package/content/skills/evaluate/SKILL.md +34 -3
- package/content/skills/extract/SKILL.md +43 -0
- package/content/skills/extract-stories/SKILL.md +1 -1
- package/content/skills/generate-mockup/SKILL.md +44 -5
- package/content/skills/ideate/SKILL.md +5 -3
- package/content/skills/implement/SKILL.md +21 -12
- package/content/skills/onboard/SKILL.md +17 -2
- package/content/skills/plan/SKILL.md +69 -6
- package/content/skills/read-context/SKILL.md +12 -1
- package/content/skills/release/SKILL.md +61 -0
- package/content/skills/research/SKILL.md +1 -1
- package/content/skills/resolve-next-id/SKILL.md +9 -1
- package/content/skills/ui-review/SKILL.md +64 -0
- package/content/skills/update-links/SKILL.md +1 -1
- package/content/skills/update-tracking/SKILL.md +77 -23
- package/content/skills/validate-artifact/SKILL.md +21 -0
- package/content/skills/visual-companion/SKILL.md +288 -0
- package/content/templates/design.md +28 -0
- package/content/templates/deviation-log.md +13 -0
- package/content/templates/legacy-semantics.md +11 -0
- package/content/templates/parity-evidence.md +32 -0
- package/content/templates/release-plan.md +29 -0
- package/content/templates/spec.md +10 -0
- package/content/templates/unit-map.md +20 -0
- package/content/templates/unit-spec.md +43 -0
- package/dist/index.js +3071 -128
- package/package.json +2 -2
|
@@ -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
|
-
-
|
|
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.
|
|
@@ -26,7 +26,7 @@ Iteration file (07-iterations) | Link to iteration-scoped designs in 04-plans
|
|
|
26
26
|
2. For each referenced artifact:
|
|
27
27
|
- Open it
|
|
28
28
|
- Add a link back to the new artifact in its "Related Artifacts" section
|
|
29
|
-
3.
|
|
29
|
+
3. If link relationships changed, update the index row with `haren track artifact <id> --type <type> --path <path>`. Never edit artifact-index.md by hand
|
|
30
30
|
|
|
31
31
|
## Rules
|
|
32
32
|
|
|
@@ -1,42 +1,69 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: update-tracking
|
|
3
|
-
description: Update progress.json and
|
|
3
|
+
description: Update progress.json, the artifact index and events with the haren track CLI
|
|
4
4
|
type: utility
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Update Tracking
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Record module status, feature status, commits, artifacts and events with the `haren track` CLI. The CLI validates each transition, updates `lastUpdated` and appends the matching event.
|
|
10
|
+
|
|
11
|
+
<HARD-GATE>
|
|
12
|
+
Never edit `progress.json`, `events/events.jsonl` or `artifacts/_registry/artifact-index.md` by hand, with sed, or with jq. Always use a `haren track` command. If a command fails, show the error to the user. Do not work around it with a hand edit.
|
|
13
|
+
</HARD-GATE>
|
|
14
|
+
|
|
15
|
+
Run every command from the haren folder.
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
| Goal | Command |
|
|
20
|
+
|------|---------|
|
|
21
|
+
| Set module status | `haren track status <module> <status> [--branch <name>] [--repos <key1,key2>]` |
|
|
22
|
+
| Add a feature (status `pending`) | `haren track feature <module> <feature>` |
|
|
23
|
+
| Set feature status | `haren track feature <module> <feature> <status>` |
|
|
24
|
+
| Record a commit | `haren track commit <module> <repoKey> <sha>` |
|
|
25
|
+
| Register an artifact | `haren track artifact <id> --type <type> --path <path> [--module <m>] [--status <s>]` |
|
|
26
|
+
| Append another event | `haren track event <type> [--module m] [--phase p] [--feature f] [--data '<json>']` |
|
|
27
|
+
| Open the code gate for a user request | `haren track override on --reason "<text>" [--hours <n>]` |
|
|
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) |
|
|
35
|
+
|
|
36
|
+
The `status`, `feature`, `commit`, `artifact` and `override` commands append their own events. Do not also run `haren track event` for the same change.
|
|
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.
|
|
10
39
|
|
|
11
40
|
## Operations
|
|
12
41
|
|
|
13
42
|
### Update Feature Status
|
|
14
|
-
1.
|
|
15
|
-
2.
|
|
16
|
-
3. If
|
|
17
|
-
4. Append event to events/events.jsonl
|
|
18
|
-
5. If `plugins.json` exists in the haren folder, run `haren plugin run on-task-status --payload '{"module":"<module>","feature":"<feature>","status":"<new status>"}'`. Show its output lines. A warning does not undo the status change
|
|
43
|
+
1. Run `haren track feature <module> <feature> <status>`. The CLI rejects an invalid transition
|
|
44
|
+
2. If all features in a module are "passing", suggest module completion review
|
|
45
|
+
3. If `plugins.json` exists in the haren folder, run `haren plugin run on-task-status --payload '{"module":"<module>","feature":"<feature>","status":"<new status>"}'`. Show its output lines. A warning does not undo the status change
|
|
19
46
|
|
|
20
47
|
### Update Module Status
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
23
|
-
3. Append event to events/events.jsonl
|
|
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
|
|
24
50
|
|
|
25
51
|
### Add Feature to Module
|
|
26
|
-
1.
|
|
27
|
-
2. Update progress.json
|
|
52
|
+
1. Run `haren track feature <module> <feature>`. The feature starts as `pending`
|
|
28
53
|
|
|
29
54
|
### Record Commit
|
|
30
|
-
1.
|
|
31
|
-
2.
|
|
32
|
-
|
|
55
|
+
1. Run `haren track commit <module> <repoKey> <sha>`. This sets `lastCommit.<repoKey>` for the module. `lastCommit` is a map from repo key to SHA, never a plain string (see skill.md "Repos and Git")
|
|
56
|
+
2. The module `branch` is `feat/{module-slug}`. The module `repos` are the `repos:` keys in the module's `module.md`. If the module uses a different base branch (see skill.md "Dependent modules"), record it in the session log
|
|
57
|
+
|
|
58
|
+
### Register Artifact
|
|
59
|
+
1. Run `haren track artifact <id> --type <type> --path <path> --module <module>` after you write a new artifact. Add `--status <s>` when the artifact has a status
|
|
33
60
|
|
|
34
61
|
### Reconcile with Git
|
|
35
62
|
1. For each module, and for each repo key in its `repos` (or in its `lastCommit` map): resolve the repo folder as in skill.md "Repos and Git"
|
|
36
63
|
2. Read the tip of the module branch: `git -C <repo> rev-parse <branch>`, where `<branch>` is the module's recorded `branch` (fallback `feat/{module-slug}`, then `HEAD` if the branch does not exist)
|
|
37
64
|
3. Compare it with `lastCommit.<repoKey>`. Treat the key `default` as described in skill.md "Repos and Git". Check `git -C <repo> merge-base --is-ancestor <recorded sha> <tip>`
|
|
38
65
|
- If it succeeds, there is no drift. Later commits are normal, including haren-only commits in the monorepo layout
|
|
39
|
-
4. Only if it fails, report drift. After the user agrees,
|
|
66
|
+
4. Only if it fails, report drift. After the user agrees, run `haren track commit <module> <repoKey> <sha>` with the latest commit on the branch that changed files outside the haren folder
|
|
40
67
|
- Monorepo layout: `git -C <repo> log -1 --format=%H <tip> -- ':(top,exclude)<haren folder path relative to the repo root>'`
|
|
41
68
|
- Workspace layout: the tip
|
|
42
69
|
5. Flag any ambiguous state changes for human review
|
|
@@ -44,17 +71,45 @@ Update module and feature status in progress.json with validated transitions.
|
|
|
44
71
|
### Transition Iteration (only if iterations enabled)
|
|
45
72
|
1. Check if all tasks in the current iteration have status "passing"
|
|
46
73
|
2. If yes:
|
|
47
|
-
- Increment `currentIteration` in progress.json
|
|
74
|
+
- Ask the user to confirm the move to the next iteration. Increment `currentIteration` in progress.json only through the CLI if it has a command for it; otherwise ask the user to make the change
|
|
48
75
|
- Update the iteration file (`07-iterations/iteration-{N}.md`) status to `complete`
|
|
49
76
|
- If next iteration exists (already planned), set its status to `in-progress`
|
|
50
77
|
- If no next iteration exists, suggest running the plan skill to slice the next iteration from the master plan
|
|
51
|
-
-
|
|
78
|
+
- Run `haren track event iteration-complete --data '{"iteration":<N>}'`
|
|
52
79
|
3. Iteration transitions cannot be skipped — iteration N must complete before N+1 starts
|
|
53
80
|
|
|
81
|
+
## Event Schema (`events/events.jsonl`)
|
|
82
|
+
|
|
83
|
+
Each line is one JSON object. Common fields:
|
|
84
|
+
|
|
85
|
+
| Field | Required | Value |
|
|
86
|
+
|-------|----------|-------|
|
|
87
|
+
| `type` | yes | Event type, kebab-case (for example `feature-ready`) |
|
|
88
|
+
| `timestamp` | yes | ISO 8601 time. The CLI sets it |
|
|
89
|
+
| `module` | when the event is about a module | Module slug |
|
|
90
|
+
| `phase` | when known | One of the phase values below |
|
|
91
|
+
| `feature` | when the event is about a feature | Feature key from `progress.json` |
|
|
92
|
+
|
|
93
|
+
Per-type fields come from the command, or from `--data` for `haren track event`. The `--data` JSON is merged into the line. Common event types:
|
|
94
|
+
|
|
95
|
+
| Type | Written by | Extra fields |
|
|
96
|
+
|------|------------|--------------|
|
|
97
|
+
| `module-status` | `haren track status` | `from`, `to`, `phase` |
|
|
98
|
+
| `feature-status` | `haren track feature` | `from`, `to` |
|
|
99
|
+
| `commit` | `haren track commit` | `repo`, `sha` |
|
|
100
|
+
| `artifact` | `haren track artifact` | `id`, `artifactType`, `path`, `status` |
|
|
101
|
+
| `gate-override` | `haren track override` | `action` (`on`/`off`), `reason`, `until` |
|
|
102
|
+
| `feature-ready` | `haren track event feature-ready` | optional `repos` and SHAs |
|
|
103
|
+
| `escalate-human` | `haren track event escalate-human` | `attempt`, reason |
|
|
104
|
+
| `iteration-complete` | `haren track event iteration-complete` | `iteration` |
|
|
105
|
+
| `release-step` | `haren track event release-step` | `step`, `repo`, result |
|
|
106
|
+
|
|
107
|
+
**Phase values:** `ideate`, `discover`, `research`, `decompose`, `plan`, `implement`, `evaluate`, `release`, `blocked`.
|
|
108
|
+
|
|
54
109
|
## Valid Module Transitions
|
|
55
110
|
|
|
56
111
|
```
|
|
57
|
-
discovered → decomposed → planned → implementing → evaluating → completed
|
|
112
|
+
discovered → decomposed → planned → implementing → evaluating → completed → released
|
|
58
113
|
↑ |
|
|
59
114
|
└── fix ───────┘
|
|
60
115
|
|
|
|
@@ -73,7 +128,6 @@ pending → in-progress → evaluating → passing
|
|
|
73
128
|
|
|
74
129
|
## Rules
|
|
75
130
|
|
|
76
|
-
- Always
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
- Never silently change status — log everything
|
|
131
|
+
- Always use `haren track`. Never edit `progress.json`, `events/events.jsonl` or `artifact-index.md` with sed, jq or a text editor
|
|
132
|
+
- The CLI validates transitions. Show its error to the user when it rejects one
|
|
133
|
+
- Every status change appends an event. Never change status silently
|
|
@@ -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,11 +11,39 @@ 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 |
|
|
17
25
|
|----------|--------|------------------------|-----------|
|
|
18
26
|
|
|
27
|
+
## Screens
|
|
28
|
+
<!-- Only if the module adds or changes screens. -->
|
|
29
|
+
|
|
30
|
+
### Screen: {screen name}
|
|
31
|
+
**Chosen:** option {A|B|C}
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
{ASCII wireframe of the chosen option}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
| Option | Trade-off | Result |
|
|
38
|
+
|--------|-----------|--------|
|
|
39
|
+
| A | {one line} | chosen / rejected: {reason} |
|
|
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
|
+
|
|
19
47
|
## File Structure
|
|
20
48
|
```
|
|
21
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} |
|