@odarino/haren 1.3.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +209 -33
  3. package/content/agents/architect.md +5 -2
  4. package/content/agents/developer.md +6 -6
  5. package/content/agents/ideator.md +2 -2
  6. package/content/agents/planner.md +4 -1
  7. package/content/agents/researcher.md +1 -1
  8. package/content/agents/reviewer.md +13 -4
  9. package/content/skills/audit-workspace/SKILL.md +2 -1
  10. package/content/skills/create-artifact/SKILL.md +2 -5
  11. package/content/skills/decompose/SKILL.md +10 -13
  12. package/content/skills/discover/SKILL.md +7 -2
  13. package/content/skills/discover/blueprint.md +1 -0
  14. package/content/skills/discover/explore.md +1 -0
  15. package/content/skills/discover/inherit.md +1 -0
  16. package/content/skills/discover/migration.md +38 -0
  17. package/content/skills/evaluate/SKILL.md +34 -3
  18. package/content/skills/extract/SKILL.md +43 -0
  19. package/content/skills/extract-stories/SKILL.md +1 -1
  20. package/content/skills/generate-mockup/SKILL.md +44 -5
  21. package/content/skills/ideate/SKILL.md +5 -3
  22. package/content/skills/implement/SKILL.md +21 -12
  23. package/content/skills/onboard/SKILL.md +17 -2
  24. package/content/skills/plan/SKILL.md +69 -6
  25. package/content/skills/read-context/SKILL.md +12 -1
  26. package/content/skills/release/SKILL.md +61 -0
  27. package/content/skills/research/SKILL.md +1 -1
  28. package/content/skills/resolve-next-id/SKILL.md +9 -1
  29. package/content/skills/ui-review/SKILL.md +64 -0
  30. package/content/skills/update-links/SKILL.md +1 -1
  31. package/content/skills/update-tracking/SKILL.md +77 -23
  32. package/content/skills/validate-artifact/SKILL.md +21 -0
  33. package/content/skills/visual-companion/SKILL.md +288 -0
  34. package/content/templates/design.md +28 -0
  35. package/content/templates/deviation-log.md +13 -0
  36. package/content/templates/legacy-semantics.md +11 -0
  37. package/content/templates/parity-evidence.md +32 -0
  38. package/content/templates/release-plan.md +29 -0
  39. package/content/templates/spec.md +10 -0
  40. package/content/templates/unit-map.md +20 -0
  41. package/content/templates/unit-spec.md +43 -0
  42. package/dist/index.js +3071 -128
  43. package/package.json +2 -2
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Phung Vu
3
+ Copyright (c) 2026 odarino
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -22,7 +22,7 @@ research → discover → decompose → plan → implement → evaluate
22
22
 
23
23
  Instead of letting an LLM jump straight to code, haren enforces a phased
24
24
  workflow: brainstorm and research first, decompose into modules, write a plan,
25
- *then* implement. The result is fewer wasted tokens, fewer half-built features,
25
+ _then_ implement. The result is fewer wasted tokens, fewer half-built features,
26
26
  and a paper trail of decisions you can actually review.
27
27
 
28
28
  ---
@@ -30,7 +30,7 @@ and a paper trail of decisions you can actually review.
30
30
  ## Why
31
31
 
32
32
  LLM coding agents are eager. Ask for a feature and they'll start writing files
33
- before anyone has agreed on *what* is being built. haren adds the missing
33
+ before anyone has agreed on _what_ is being built. haren adds the missing
34
34
  front-half of the SDLC and **gates implementation behind planning** — a module
35
35
  cannot be coded until it has reached `planned` status. The gate is enforced by a
36
36
  hook, not just a prompt, so the discipline holds even when the model forgets.
@@ -163,7 +163,7 @@ haren is its own repo next to the code repos.
163
163
  workspace/ (no .git)
164
164
  ├── backend/ (.git)
165
165
  ├── frontend/ (.git)
166
- ├── cmis_ai_rules/ (.git — the haren repo, any folder name)
166
+ ├── haren-rules/ (.git — the haren repo, any folder name)
167
167
  ├── CLAUDE.md # generated per machine, not versioned
168
168
  └── .claude/ # generated per machine, not versioned
169
169
  ```
@@ -177,12 +177,13 @@ every repo.
177
177
 
178
178
  ## Commands
179
179
 
180
- | Command | What it does |
181
- |---------|--------------|
182
- | `haren init` | Set up haren in the current directory: scaffold a new haren folder, or set up a cloned one. Interactive, or pass flags (below). |
180
+ | Command | What it does |
181
+ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
182
+ | `haren init` | Set up haren in the current directory: scaffold a new haren folder, or set up a cloned one. Interactive, or pass flags (below). |
183
183
  | `haren upgrade` | Update framework files in an existing haren folder to the installed version, and migrate old `manifest.yaml` / `progress.json`. It also restores missing plugins from `plugins.json`. Use `--yes` to accept plugins from unofficial sources. |
184
- | `haren plugin` | Manage plugins: `add <name\|source>`, `remove <name>`, `list`, `doctor`, `run <hook>`. See [PLUGINS.md](PLUGINS.md). |
185
- | `haren agent` | Manage the local agent bridge *(experimental — for the in-progress Haren Portal)*. |
184
+ | `haren plugin` | Manage plugins: `add <name\|source>`, `remove <name>`, `list`, `doctor`, `run <hook>`. See [PLUGINS.md](PLUGINS.md). |
185
+ | `haren migrate` | Migration mode only: `inventory [--module m]`, `extract <unit>`, `gate <unit> [--approve]`. It runs the adapter commands. See [Migration mode](#migration-mode). |
186
+ | `haren agent` | Manage the local agent bridge _(experimental — for the in-progress Haren Portal)_. |
186
187
 
187
188
  `haren agent` works in both layouts. It uses the git remote of the haren repo as
188
189
  the Portal project key.
@@ -194,7 +195,7 @@ Run `haren` with no arguments for help.
194
195
  ```bash
195
196
  haren init \
196
197
  --project "my-app" \
197
- --mode blueprint \ # blueprint | explore | inherit | undecided
198
+ --mode blueprint \ # blueprint | explore | inherit | migration | undecided
198
199
  --language English \
199
200
  --editor both \ # claude-code | cursor | both
200
201
  --iterations \ # enable iteration-based planning
@@ -203,15 +204,15 @@ haren init \
203
204
 
204
205
  Layout and folder flags:
205
206
 
206
- | Flag | Effect |
207
- |------|--------|
208
- | `--dir <path>` | Run in this directory instead of the current one. |
209
- | `--layout monorepo\|workspace` | Skip layout detection. |
210
- | `--haren-dir <name>` | Name of the new haren folder (default `haren`). |
211
- | `--yes` | Accept the defaults and skip the confirm prompt. Required when there is no terminal. |
212
- | `--dry-run` | Print the plan and exit. Nothing is written. |
213
- | `--plugin <name\|source>` | Install a plugin. Repeat the flag for more plugins. |
214
- | `--force` | Re-scaffold an existing haren folder. It keeps the folder name, the layout, and the repos in `manifest.yaml`. |
207
+ | Flag | Effect |
208
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------- |
209
+ | `--dir <path>` | Run in this directory instead of the current one. |
210
+ | `--layout monorepo\|workspace` | Skip layout detection. |
211
+ | `--haren-dir <name>` | Name of the new haren folder (default `haren`). |
212
+ | `--yes` | Accept the defaults and skip the confirm prompt. Required when there is no terminal. |
213
+ | `--dry-run` | Print the plan and exit. Nothing is written. |
214
+ | `--plugin <name\|source>` | Install a plugin. Repeat the flag for more plugins. |
215
+ | `--force` | Re-scaffold an existing haren folder. It keeps the folder name, the layout, and the repos in `manifest.yaml`. |
215
216
 
216
217
  ### The plan preview
217
218
 
@@ -220,7 +221,7 @@ Layout and folder flags:
220
221
  ```
221
222
  Plan:
222
223
  /path/to/workspace/
223
- ├── cmis_ai_rules/ + create (git init, own repo)
224
+ ├── haren-rules/ + create (git init, own repo)
224
225
  │ ├── manifest.yaml + create layout: workspace
225
226
  │ ├── artifacts/ + create
226
227
  │ └── hooks/ + create
@@ -245,8 +246,8 @@ generated per machine and are not versioned. If you already have content in
245
246
  The haren repo is the source of truth. A teammate does not run a full init.
246
247
 
247
248
  ```bash
248
- git clone <haren-repo-url> workspace/cmis_ai_rules
249
- cd workspace/cmis_ai_rules
249
+ git clone <haren-repo-url> workspace/haren-rules
250
+ cd workspace/haren-rules
250
251
  haren init
251
252
  ```
252
253
 
@@ -271,6 +272,181 @@ A skill for a new developer or a new workspace. It does three things:
271
272
  It never clones and never changes git state. To clone a missing repo, run
272
273
  `haren init`.
273
274
 
275
+ ### Migration mode
276
+
277
+ Use `--mode migration` to rewrite a legacy system when parity with the old system is the bar.
278
+ The legacy repo has `role: legacy` and `readOnly: true` in `manifest.yaml`. The code gate blocks all Edit and Write calls into it. The gate override does not lift this block.
279
+ For Bash commands, the guard is best effort: it blocks common writes (redirects, `sed -i`, `rm`, `git commit`, and so on), but a shell can hide a write. Also make the legacy repo read-only at the filesystem or git level where possible, for example a read-only checkout or a clone with no push access.
280
+
281
+ The unit is the work item, for example one screen. Each unit has a status: `inventoried`, `extracted`, `spec-draft`, `spec-approved`, `built`, `verified`, `parity-signed`. The side statuses are `blocked` and `static-review-only`. Use `haren track unit <module> <unit> <status>` to move it. A module cannot pass a stage while a unit is below it.
282
+
283
+ An adapter plugin reads the legacy format. Install one with `haren plugin add <source>`. Then run:
284
+
285
+ ```bash
286
+ haren migrate inventory [--module m] # list units, write unit-map.md
287
+ haren migrate extract <unit> # extract the unit, then write the spec
288
+ haren migrate gate <unit> [--approve] # run the spec gate; --approve records the human approval
289
+ haren track check # also checks unit rules in migration mode
290
+ ```
291
+
292
+ `haren migrate gate` exit codes: 0 = the gate passed and the spec is approved. 1 = a gate FAIL or an adapter error. 3 = the gate passed but the spec is not approved yet (no TTY and no `--approve`). Exit 3 is not a failure: review the spec, then re-run with `--approve`. An agent must ask the user on exit 3. With a TTY, declining the approval prompt exits 0 with "Not approved". Exit 3 is only the no-TTY case without `--approve`.
293
+
294
+ A gate FAIL and an adapter error are different results. An adapter error changes no status. A gate FAIL on a `spec-approved` unit moves it back to `spec-draft`. An adapter command stops after 300 seconds by default. Set `HAREN_ADAPTER_TIMEOUT_MS` to change the limit.
295
+
296
+ #### Write an adapter
297
+
298
+ An adapter is a plugin with `harenApi: "2"` and an `adapter` block in `haren-plugin.json`. The block has `unitKind`, `commands` (`inventory`, `extract`, `gate`), `skills.spec`, and an optional `semantics` file.
299
+ Each command is a string. The CLI splits it into arguments and does not use a shell. It replaces these placeholders: `{legacyRoot}`, `{unit}`, `{unitDir}`, `{specPath}`.
300
+ Each command prints one JSON object on stdout. The CLI checks the shape:
301
+
302
+ ```jsonc
303
+ // inventory
304
+ { "units": [ { "id": "SCR_A001", "parent": null, "family": "order", "title": "Order list" } ] }
305
+ // extract
306
+ { "unit": "SCR_A001", "files": ["ir.xml", "view.txt"] }
307
+ // gate
308
+ { "unit": "SCR_A001", "pass": false,
309
+ "findings": [ { "severity": "error", "rule": "missing-binding", "message": "..." } ] }
310
+ ```
311
+
312
+ A non-zero exit code or a wrong shape is an adapter error. See `examples/adapters/sample` for a working adapter with a fake screen format and a fixture legacy repo.
313
+
314
+ ### `haren track`
315
+
316
+ Use `haren track` to update `progress.json`, the artifact index, and
317
+ `events/events.jsonl`. Do not edit these files by hand with `jq` or `sed`.
318
+ The command finds the haren folder from the current folder. Use `--haren-dir <path>`
319
+ or `HAREN_DIR` to choose one. It keeps all other keys in `progress.json`.
320
+
321
+ ```bash
322
+ haren track status <module> <status> [--branch <name>] [--repos <key1,key2>]
323
+ haren track feature <module> <feature> [status]
324
+ haren track commit <module> <repoKey> <sha>
325
+ haren track artifact <id> --type <type> --path <path> [--module <m>] [--status <s>]
326
+ haren track event <type> [--module m] [--phase p] [--feature f] [--data '<json object>']
327
+ haren track unit <module> <unit> <status> # migration mode only
328
+ haren track depends <module> [dep ...] # set module dependencies; rejects a cycle
329
+ haren track override on --reason "<text>" [--hours <n>]
330
+ haren track override off
331
+ haren track check # manifest repos + artifact index consistency; exits 1 on FAIL
332
+ ```
333
+
334
+ - `status` checks the module transition. It creates a missing module only at
335
+ `discovered` or `decomposed`. Transitions:
336
+ `discovered → decomposed → planned → implementing → evaluating → completed → released`.
337
+ `implementing` and `evaluating` can go to `blocked`. `blocked` goes back to
338
+ `implementing` or `planned`. `--branch` sets the module branch. `--repos` sets the module
339
+ repos. Each repo key must exist in `manifest.yaml`. With the same status as the module,
340
+ the command only updates the branch and repos.
341
+ - `feature` without a status adds the feature as `pending`. With a status it checks
342
+ the transition: `pending → in-progress → evaluating → passing | fixing | blocked`,
343
+ `fixing → evaluating`, `blocked → in-progress`.
344
+ - `commit` sets `lastCommit[repoKey]`, adds `repoKey` to the module `repos`, and
345
+ sets `branch` to `feat/<module>` if it has no value.
346
+ - `artifact` adds or updates the row with this ID in
347
+ `artifacts/_registry/artifact-index.md`. `--type` is free text. `--status`
348
+ defaults to `draft`.
349
+ - `override on` lets the code gate allow all writes for a fix that the user asked
350
+ for. It sets `gateOverride: { reason, until }` in `progress.json`. `--hours`
351
+ defaults to 2. After the time ends, the gate ignores the override. Run
352
+ `override off` when the fix is done. `HAREN_GATE=off` has the same effect for
353
+ one process.
354
+
355
+ The command exits with code 1 and a message for an invalid transition, an unknown
356
+ module, or a bad option.
357
+
358
+ #### Code gate
359
+
360
+ The `brainstorm-gate` hook allows a write outside the haren folder only inside
361
+ the repos of a module at `planned`, `implementing`, `evaluating`, `completed`, or
362
+ `released` (the keys in the module `repos`). A repo with `role: e2e` is allowed
363
+ when any module is at `planned` or later. A module with no `repos`, or with the
364
+ key `default`, allows all files. Files outside the workspace folder follow the
365
+ same "any planned module" rule. An active override allows all writes.
366
+
367
+ #### `events/events.jsonl`
368
+
369
+ One JSON object per line. Fields:
370
+
371
+ | Field | Value |
372
+ | ----------- | --------------------------------------------- |
373
+ | `type` | Event type (required) |
374
+ | `timestamp` | ISO time (required, `haren track` sets it) |
375
+ | `module` | Module name |
376
+ | `phase` | One of the phase values below |
377
+ | `feature` | Feature name |
378
+ | other | Data for the event type (see below, `--data`) |
379
+
380
+ Phase values: `ideate`, `discover`, `research`, `decompose`, `plan`, `implement`,
381
+ `evaluate`, `release`, `blocked`.
382
+
383
+ Event types that `haren track` writes:
384
+
385
+ | Type | Written by | Other fields |
386
+ | ---------------- | ---------------- | --------------------------------------------------- |
387
+ | `module-status` | `track status` | `from` (null for a new module), `to`, `phase` |
388
+ | `feature-status` | `track feature` | `feature`, `from` (null for a new feature), `to` |
389
+ | `commit` | `track commit` | `repo`, `sha` |
390
+ | `artifact` | `track artifact` | `id`, `artifactType`, `path`, `status` |
391
+ | `gate-override` | `track override` | `action` (`on` or `off`), `reason` and `until` (on) |
392
+
393
+ Skills also write these types with `haren track event`: `ideate-complete`,
394
+ `discover-complete`, `feature-ready`, `escalate-human`, `iteration-complete`,
395
+ `release-step`. Any other type is accepted.
396
+
397
+ ### Visual companion
398
+
399
+ The visual companion shows UI mockups in a browser. The plan and evaluate phases use it
400
+ when the UI mode allows it. Choose the UI mode with `haren track ui-mode <ask|ascii|browser>`.
401
+ The mode is stored in `manifest.yaml` as `ui.mockups`. The default is `ask`.
402
+
403
+ | Mode | What happens |
404
+ | --------- | ------------------------------------------------------------------ |
405
+ | `ask` | The agent offers the browser before it shows a screen. |
406
+ | `ascii` | The agent shows ASCII wireframes in the terminal only. |
407
+ | `browser` | The agent shows option screens in the browser. You click a choice. |
408
+
409
+ ```bash
410
+ haren companion start [--open] [--foreground] [--host <h>] [--url-host <h>] \
411
+ [--idle-timeout-minutes <n>] [--port <n>] [--key <k>] [--no-owner-watch] \
412
+ [--owner-grace-minutes <n>]
413
+ haren companion status # exit 0 when a server runs, 1 when not
414
+ haren companion stop
415
+ ```
416
+
417
+ - `start` prints one JSON line:
418
+ `{"type":"server-started","port","url","screen_dir","state_dir"}`.
419
+ - A restart of a stopped session reuses its folder, key and port. It also reuses
420
+ `--host`, `--url-host`, `--idle-timeout-minutes` and `--owner-grace-minutes` from `state/options.json`. If the
421
+ port is busy, the server takes a new port and prints a note on stderr.
422
+ - When the agent process that started the server exits, a grace period starts
423
+ (default 10 minutes, `--owner-grace-minutes <n>`). The server stops after the grace
424
+ period only when no browser tab is connected and no request came in. Use
425
+ `--no-owner-watch` to keep it running. Both minute flags must be positive integers.
426
+ With `--open` in a print-mode run, the browser tab stays connected, so the server keeps
427
+ running until the user closes the tab (then the grace period applies) or runs `haren companion stop`.
428
+ - A restart moves old screens to `content/archive/<epoch>/`.
429
+ - `stop` with no running server prints `No companion server is running.` and exits 0.
430
+ - Session files are in `<haren folder>/.companion/<pid>-<epoch>/`. The agent writes
431
+ HTML screens to `content/`. Your clicks go to `state/events` as JSON lines:
432
+ `{"type":"click","choice","text","timestamp"}`.
433
+ - The `visual-companion` skill drives the server. The `ui-review` skill checks a
434
+ screen against a rubric. The plan, evaluate and generate-mockup skills use the mode.
435
+
436
+ Security notes:
437
+
438
+ - The server binds to `127.0.0.1`.
439
+ - A secret key is in the URL. The server then sets a `SameSite=Strict` cookie.
440
+ The key is in `state/key` (mode 0600). The key is not on the server command line.
441
+ - The session folders are mode 0700. The state files are mode 0600.
442
+ - The server sends `Referrer-Policy: no-referrer`.
443
+ - The `/files` route serves only the `content/` folder.
444
+ - `.companion/` is in `.gitignore`. Do not commit it.
445
+
446
+ The companion server is adapted from the visual companion in
447
+ [Superpowers](https://github.com/obra/superpowers) by Jesse Vincent (MIT license).
448
+ See `apps/cli/src/companion/NOTICE`.
449
+
274
450
  ---
275
451
 
276
452
  ## How it works
@@ -279,12 +455,12 @@ It never clones and never changes git state. To clone a missing repo, run
279
455
 
280
456
  You pick a mode at init that matches where your project stands:
281
457
 
282
- | Mode | When |
283
- |------|------|
458
+ | Mode | When |
459
+ | ----------- | ------------------------------------------------------------ |
284
460
  | `blueprint` | Greenfield project that already has docs/specs to work from. |
285
- | `explore` | Greenfield project starting from just an idea. |
286
- | `inherit` | Brownfield project with an existing codebase. |
287
- | `undecided` | Let the agent help you choose on first session. |
461
+ | `explore` | Greenfield project starting from just an idea. |
462
+ | `inherit` | Brownfield project with an existing codebase. |
463
+ | `undecided` | Let the agent help you choose on first session. |
288
464
 
289
465
  ### Phases & the code gate
290
466
 
@@ -296,7 +472,7 @@ discovered → specified → planned → implementing → evaluating → complet
296
472
 
297
473
  A `brainstorm-gate` hook blocks `Edit`/`Write` on any file **outside the haren folder**
298
474
  until at least one module reaches `planned`. Discovery docs and specs are not
299
- enough — planning must be done first. (Writes *inside* the haren folder are always
475
+ enough — planning must be done first. (Writes _inside_ the haren folder are always
300
476
  allowed so the planning phases can produce their artifacts.)
301
477
 
302
478
  ### Agents
@@ -336,19 +512,19 @@ haren/ # any folder name works
336
512
 
337
513
  ```yaml
338
514
  haren:
339
- version: 1.2.0 # the marker; haren finds the folder by this key
340
- layout: workspace # monorepo | workspace
515
+ version: 1.2.0 # the marker; haren finds the folder by this key
516
+ layout: workspace # monorepo | workspace
341
517
  project: shop
342
518
  mode: blueprint
343
519
  language: English
344
520
 
345
521
  repos:
346
522
  backend:
347
- path: ../backend # relative to the haren folder
523
+ path: ../backend # relative to the haren folder
348
524
  remote: git@github.com:acme/shop-backend.git
349
525
  default_branch: main
350
- role: backend # frontend | backend | e2e | other
351
- stack: node-express # role, stack, test_cmd, default_branch: set by /haren-onboard
526
+ role: backend # frontend | backend | e2e | other
527
+ stack: node-express # role, stack, test_cmd, default_branch: set by /haren-onboard
352
528
  test_cmd: bun test
353
529
  frontend:
354
530
  path: ../frontend
@@ -423,7 +599,7 @@ upgrade needs Bun ≥ 1.2.21.
423
599
 
424
600
  haren's workflow philosophy is heavily inspired by
425
601
  **[Superpowers](https://github.com/obra/superpowers)** by Jesse Vincent — the
426
- discipline of *brainstorm → write a plan → execute with fresh subagents → review*,
602
+ discipline of _brainstorm → write a plan → execute with fresh subagents → review_,
427
603
  the test-driven and YAGNI-minded approach, and the idea of gating implementation
428
604
  behind an approved design all trace back to that work. haren packages a similar
429
605
  philosophy into a phased, artifact-driven SDLC for product teams. Many thanks.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: architect
3
3
  description: Decomposes projects into bounded modules with interfaces and dependencies
4
- phases: [decompose]
4
+ phases: [decompose, release]
5
5
  ---
6
6
 
7
7
  # Architect
@@ -13,6 +13,7 @@ You are a system architect within the Haren framework. Your job is to break a pr
13
13
  ## When Active
14
14
 
15
15
  - **Decompose phase**: After discovery is complete, to produce a module map
16
+ - **Release phase**: When modules are `completed`, to plan the release order across modules (see release skill). Never deploy unless the user asks
16
17
 
17
18
  ## Capabilities
18
19
 
@@ -61,9 +62,11 @@ are foundational — wrong splits cascade through the entire project.
61
62
  - Interfaces (what it exposes to other modules)
62
63
  - Dependencies (what it needs from other modules)
63
64
  - Target repo(s) — referencing keys from `manifest.yaml` repos section
65
+ - Screens — the screens the module adds or changes, one line each. Do not draw mockups here. The planner makes 2-3 mockup options per screen with the `generate-mockup` skill
64
66
  3. The module dependency graph must be a DAG — validate with validate-artifact skill
65
67
  4. Use `create-artifact` skill to write module files with correct templates
66
68
  5. Prefer smaller modules over larger ones — each should be independently plannable
67
69
  6. If a module spans multiple repos, document which parts go where
68
70
  7. **Never finalize boundaries without user approval** — present, discuss, then write
69
- 8. **One decision at a time** — don't dump the entire decomposition in one message
71
+ 8. Record module dependencies with `haren track depends <module> <dep> [<dep> ...]`. They set the branch base, the merge order and the release order (see skill.md "Dependent modules")
72
+ 9. **One decision at a time** — don't dump the entire decomposition in one message
@@ -51,15 +51,15 @@ At the beginning of each session, present the pending features and ask:
51
51
  2. **Ask the user which feature to work on** — don't silently pick one
52
52
  3. Implement ONE feature at a time — do not batch
53
53
  4. Follow TDD: write failing test → implement → verify → commit
54
- 5. Delegate to superpowers:subagent-driven-development for execution
55
- 6. At the start of each session, set up the branch `feat/{module-slug}` in every repo the module touches (see skill.md "Repos and Git" and the implement skill). Ask the user first if a repo has uncommitted changes. Changes inside the haren folder do not count as uncommitted changes for this check. Create a missing branch from the repo's `default_branch`, or from the current branch if `default_branch` is not set. If the module lists no repos, follow the skill.md "Repos and Git" "No repos listed" fallback (the key `default`). If the module status is `planned`, set it to `implementing` via update-tracking skill.
54
+ 5. Delegate to superpowers:subagent-driven-development for execution. Exception: for a small task (see "Fast path" in the implement skill), implement directly with TDD in the main session. If the user asks for the full path, always delegate
55
+ 6. At the start of each session, set up the branch `feat/{module-slug}` in every repo the module touches (see skill.md "Repos and Git" and the implement skill). Ask the user first if a repo has uncommitted changes. Changes inside the haren folder do not count as uncommitted changes for this check. Create a missing branch from the repo's `default_branch`, or from the current branch if `default_branch` is not set. If the module lists no repos, follow the skill.md "Repos and Git" "No repos listed" fallback (the key `default`). If the module depends on a module that is not merged yet, follow skill.md "Dependent modules". If the module status is `planned`, set it to `implementing` with `haren track status <module> implementing`.
56
56
  7. After each feature:
57
57
  - (a) Commit the code in each repo that changed, with a descriptive message. In the monorepo layout, make one code commit for all repo keys; see skill.md "Repos and Git"
58
- - (b) Record each commit SHA in `progress.json` `lastCommit.<repoKey>` and set the feature status to "evaluating" via update-tracking skill
58
+ - (b) Record each commit SHA in `lastCommit.<repoKey>` with `haren track commit <module> <repoKey> <sha>`. Set the feature status with `haren track feature <module> <feature> evaluating`
59
59
  - Append to the task's session log (`task-{N}-{slug}.md`) with what was done, decisions made, and the commit SHA per repo. If iterations are enabled (manifest.yaml has `iterations` block), include the **Iteration:** field in the session log header; if not enabled, omit it
60
- - Emit "feature-ready" event via events/events.jsonl
60
+ - Append the "feature-ready" event: `haren track event feature-ready --module <module> --phase implement --feature <feature>`
61
61
  - (c) Commit the haren files (session log, `progress.json` and `events/events.jsonl`) in the haren repo, listing the code commits in the message. 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.
62
- 8. Never modify files in the haren folder except `progress.json`, session logs and `events/events.jsonl`. Never push. Never create pull requests unless the user asks.
63
- 9. If blocked, update feature status to "blocked" and surface to user
62
+ 8. Never modify files in the haren folder except session logs. Change `progress.json` and `events/events.jsonl` only with `haren track`. Never edit them with sed or jq. Never push. Never create pull requests unless the user asks.
63
+ 9. If blocked, run `haren track feature <module> <feature> blocked` and surface to user
64
64
  10. **If you need to deviate from the plan, ask first** — "The plan says X but I think Y would be better because Z. Should I deviate?" Don't deviate silently.
65
65
  11. At session end, ask: "Should I continue with the next feature, or pause here?"
@@ -32,7 +32,7 @@ You are an ideation agent within the Haren framework. Your job is to take raw id
32
32
 
33
33
  - `artifacts/01-research/RESEARCH-{NNN}-{slug}.md` (one per spike, created by research skill)
34
34
  - `artifacts/00-baseline/concept-brief.md` (the final deliverable)
35
- - Updated `artifacts/_registry/artifact-index.md`
35
+ - New rows in `artifacts/_registry/artifact-index.md`, added with `haren track artifact`
36
36
  - Updated `manifest.yaml` — mode set to `blueprint`, concept brief added to `sources` array
37
37
 
38
38
  ## Pipeline
@@ -65,4 +65,4 @@ Follow the ideate skill pipeline in order. Intensity adapts based on maturity as
65
65
  7. Never present research findings without pivot alternatives if problems are found
66
66
  8. Always present concept brief summary to the user and get confirmation before writing
67
67
  9. After writing concept brief, add it to the `sources` array in `manifest.yaml` and set `mode: blueprint`
68
- 10. Use `create-artifact` skill to write the concept brief and update `artifact-index.md`
68
+ 10. Use `create-artifact` skill to write the concept brief. It registers the file with `haren track artifact`
@@ -56,6 +56,7 @@ architecture patterns, or any choice where multiple valid alternatives exist.
56
56
  - "We'll use SQLite" → Instead: "For the database, here are 3 options: (A) SQLite — simple, no server... (B) PostgreSQL — scalable... (C) MongoDB — flexible schema... I recommend B because... What do you think?"
57
57
  - "We'll use JWT for auth" → Instead: present options
58
58
  - "We'll use React" → Instead: present options (unless already specified in context brief)
59
+ - "The list screen shows cards" → Instead: make 2-3 mockup options with the `generate-mockup` skill (options mode), show them side by side, and let the user pick
59
60
 
60
61
  **What you CAN decide without asking:**
61
62
  - File naming conventions (follow existing patterns)
@@ -78,4 +79,6 @@ architecture patterns, or any choice where multiple valid alternatives exist.
78
79
  9. If the module depends on another module's interfaces, reference those explicitly
79
80
  10. **Never silently pick a technology, pattern, or approach** — present options first
80
81
  11. When iterations are enabled (check manifest.yaml), after creating master spec/design, propose iteration groupings and wait for user approval before writing iteration-scoped artifacts
81
- 12. **Changelog on every spec edit** — when modifying `spec.md`, always add a new row to the Changelog table (Date, Story if applicable, Change summary, Reason). Never skip this.
82
+ 12. **Screens before spec** — if the module adds or changes screens, get the user's pick of one mockup option per screen before you write the spec or the design. Record it in the `## Screens` section
83
+ 13. Change status, artifacts and events only with `haren track` (see update-tracking skill). Never edit progress.json by hand
84
+ 14. **Changelog on every spec edit** — when modifying `spec.md`, always add a new row to the Changelog table (Date, Story if applicable, Change summary, Reason). Never skip this.
@@ -50,7 +50,7 @@ You are a researcher and discovery agent within the Haren framework. Your job is
50
50
  - `inherit` → read `skills/discover/inherit.md`
51
51
  - If mode is unrecognized or missing → **ask the user**, don't guess
52
52
  3. Use `create-artifact` skill to write artifacts with correct templates
53
- 4. Update `artifacts/_registry/artifact-index.md` after creating artifacts
53
+ 4. Register each new artifact with `haren track artifact` (see create-artifact skill). Never edit `artifacts/_registry/artifact-index.md` by hand
54
54
  5. Never write code — your job is understanding, not implementation
55
55
  6. **If you encounter ambiguity, ask the user rather than guessing**
56
56
  7. For `inherit` mode: if no sibling repos are listed in manifest, ask the user which repos to analyze
@@ -42,6 +42,15 @@ You are a code reviewer and evaluator within the Haren framework. Your job is to
42
42
  2. **Completeness** — are all spec requirements covered?
43
43
  3. **Correctness** — do tests pass? edge cases handled?
44
44
  4. **Integration** — does it work with other modules' interfaces?
45
+ 5. **Screens** — if the spec has a `## Screens` section, does each changed screen match the chosen mockup? When the app can run, attach a screenshot of each changed screen as evidence
46
+ 6. **Privacy** — fixtures, examples, seeds, test data and screenshots must not contain real third-party personal data. Synthetic data only
47
+
48
+ ## Checklist
49
+
50
+ - [ ] Each acceptance criterion tested
51
+ - [ ] All tests run and pass
52
+ - [ ] Changed screens match the chosen mockup in the spec (screenshot evidence when the app can run)
53
+ - [ ] Fixtures, examples, seeds and screenshots use synthetic data, with no real third-party personal data
45
54
 
46
55
  ## Judgment Calls
47
56
 
@@ -65,10 +74,10 @@ When the spec is ambiguous or you need to make a judgment call, **ask instead of
65
74
  - If fail: specific issues with file paths, line numbers, and suggested fixes
66
75
  - If pass: brief summary of what was verified
67
76
  - **Assumptions made:** list any spec interpretations you made (so the user can correct them)
68
- 4. Update progress.json via update-tracking skill:
69
- - Pass → feature status to "passing"
70
- - Fail (attempt < 3) → feature status to "fixing"
71
- - Fail (attempt 3) → feature status to "blocked", emit "escalate-human" event
77
+ 4. Update status with `haren track` (see update-tracking skill). Never edit progress.json by hand:
78
+ - Pass → `haren track feature <module> <feature> passing`
79
+ - Fail (attempt < 3) → `haren track feature <module> <feature> fixing`
80
+ - Fail (attempt 3) → `haren track feature <module> <feature> blocked`, then `haren track event escalate-human --module <module> --feature <feature> --data '{"attempt":3}'`
72
81
  5. Delegate to superpowers:requesting-code-review for structured review
73
82
  6. Do NOT rubber-stamp — a tuned skeptical evaluator catches what a generous one misses
74
83
  7. **If unsure about a judgment call, ask the user** — don't silently pass or fail
@@ -130,7 +130,8 @@ Cross-check `_registry/artifact-index.md` against actual files:
130
130
 
131
131
  - Every file in `02-discovery/` through `07-iterations/` should have a registry entry
132
132
  - Every registry entry should point to an existing file
133
- - **Report:** unregistered files as WARN, broken registry entries as FAIL
133
+ - Run `haren track check` for this check. It also fails when progress.json uses a repo key that manifest.yaml does not declare
134
+ - **Report:** unregistered files, broken registry entries and undeclared repo keys as FAIL
134
135
 
135
136
  ### 7. Progress.json ↔ Tasks.md Consistency
136
137
 
@@ -26,16 +26,13 @@ Write a new artifact file using the correct template and update the artifact reg
26
26
 
27
27
  4. **Write file** to the correct path
28
28
 
29
- 5. **Update registry**: Append entry to `artifacts/_registry/artifact-index.md`:
30
- ```
31
- | {ID} | {type} | {module} | {status} | {path} |
32
- ```
29
+ 5. **Update registry**: run `haren track artifact <ID> --type <type> --path <path> [--module <module>] [--status <status>]`. The CLI adds the row to `artifacts/_registry/artifact-index.md`. Never edit the index by hand, with sed or with jq
33
30
 
34
31
  6. **Update links**: Call update-links skill if this artifact references others
35
32
 
36
33
  ## Rules
37
34
 
38
35
  - Always use the template — don't write freeform artifacts
39
- - Always update the registry — it's the master index
36
+ - Always update the registry with `haren track artifact` — it's the master index
40
37
  - Create parent directories if they don't exist
41
38
  - Use resolve-next-id skill for sequential IDs (RESEARCH artifacts)
@@ -47,23 +47,19 @@ These decisions affect ALL modules and must be resolved first.
47
47
  - `artifacts/03-modules/module-map.md` (use create-artifact skill)
48
48
  - `artifacts/03-modules/{module}/module.md` for each module (use create-artifact skill) — each module gets its own folder so that `spec.md` (BA-owned) can sit alongside it later
49
49
  9. Validate with validate-artifact skill (checks for cycles, missing interfaces)
50
- 10. Update progress.json — each module gets "decomposed" status. Write every module with this shape:
51
- ```json
52
- "<module>": {
53
- "status": "decomposed",
54
- "currentPhase": "decompose",
55
- "features": {},
56
- "lastCommit": {},
57
- "branch": "feat/<module>",
58
- "repos": ["<repo key from manifest>"],
59
- "lastUpdated": "<ISO 8601 timestamp>"
60
- }
61
- ```
62
- `features` stays `{}` until the plan phase adds tasks. `branch` and `repos` are optional. Without `branch`, haren uses `feat/<module>`.
50
+ 10. Register each module with `haren track status <module> decomposed --branch feat/<module> --repos <key1,key2>`. Use the repo keys from `manifest.yaml`. The CLI rejects a key that is not in the manifest. `--branch` is optional: without it, haren uses `feat/<module>`. To change the branch or repos later, run the same command with the same status. Never edit progress.json by hand. The plan phase adds the features.
51
+ 11. Record the dependencies of each module with `haren track depends <module> <dep> [<dep> ...]`. Run it with no `<dep>` to clear them. The command checks that the modules exist and rejects a cycle. Do not edit progress.json by hand. The implement skill and skill.md "Dependent modules" use this map to choose the base branch and the merge order. The release skill uses it for the release order
52
+ 12. Migration mode only (`mode: migration`): the modules come from the Module column of `artifacts/02-discovery/unit-map.md`.
53
+ 1. Make sure each module in the column is registered as in step 10. Do not run `haren track status <module> decomposed` again without `--repos` or `--branch`: the module is already `decomposed` and the CLI rejects the move. Run it with `--repos` or `--branch` only to change them.
54
+ 2. Run `haren migrate inventory` once, with no `--module` flag. It reads the Module column of each known unit and registers the unit as `inventoried` in that module. The `--module` flag only sets the module of units that are new to the map.
55
+ 3. Check the output for a `warning: skipped` line. Fix the module name or create the module, then run inventory again.
56
+ 4. Run `haren track check`.
57
+ 13. Register each artifact: `haren track artifact <id> --type <type> --path <path>`
63
58
 
64
59
  ## Module Map Format
65
60
 
66
61
  The module-map.md should contain:
62
+
67
63
  - Overview of all modules
68
64
  - Dependency graph (mermaid diagram)
69
65
  - Suggested implementation order (topological sort of dependencies)
@@ -72,6 +68,7 @@ The module-map.md should contain:
72
68
  ## Module Definition Format
73
69
 
74
70
  Each module .md file should follow `templates/module.md`:
71
+
75
72
  - Frontmatter: name, repos, dependencies
76
73
  - Description and responsibilities
77
74
  - Interfaces (exposed)
@@ -28,6 +28,7 @@ Before starting discovery, determine the intent:
28
28
  - **explore** mode: routes through brainstorming for collaborative design (preserved for users who explicitly set `mode: explore` in manifest.yaml — the default path for new ideas is now through `ideate`)
29
29
  - **blueprint** mode: if baseline docs exist in `artifacts/00-baseline/`, the existing blueprint strategy processes them first. Brainstorming triggers only for new features not covered by baseline docs.
30
30
  - **inherit** mode: existing codebase analysis runs first. Brainstorming triggers for new features on top of the existing code.
31
+ - **migration** mode: a rewrite of a legacy system with parity as the bar. The unit inventory runs first. After `decompose`, the `extract` skill makes one approved spec per unit before `plan`.
31
32
  - **undecided** mode: brainstorming helps determine the mode as part of the discovery process
32
33
 
33
34
  ## Process
@@ -37,10 +38,13 @@ Before starting discovery, determine the intent:
37
38
  - `blueprint` → read `skills/discover/blueprint.md`
38
39
  - `explore` → read `skills/discover/explore.md`
39
40
  - `inherit` → read `skills/discover/inherit.md`
41
+ - `migration` → read `skills/discover/migration.md`
40
42
  3. Follow the strategy to produce a context brief
41
43
  4. Write output using create-artifact skill: `artifacts/02-discovery/context-brief.md`
42
44
  5. Validate output with validate-artifact skill
43
- 6. Update progress.json — project moves past discovery
45
+ 6. Register the context brief. Get the next artifact ID with the `resolve-next-id` skill. Run `haren track artifact <id> --type context-brief --path artifacts/02-discovery/context-brief.md`. Append the phase event: `haren track event discover-complete --phase discover`
46
+
47
+ For a visual question (screen flow, layout, diagram), use the visual-companion skill. Decide per question.
44
48
 
45
49
  ## Output
46
50
 
@@ -49,6 +53,7 @@ A single `context-brief.md` that contains:
49
53
  - Key requirements (functional and non-functional)
50
54
  - Constraints and assumptions
51
55
  - Identified risks
56
+ - Screens: the main screens that users see, as a list with one line each. Do not draw them here. The plan phase makes 2-3 mockup options per changed screen with the `generate-mockup` skill
52
57
  - Suggested module boundaries (high-level, refined in Decompose)
53
58
 
54
- All three modes produce the same output format — the strategy only changes how the information is gathered.
59
+ All modes produce the same output format — the strategy only changes how the information is gathered.
@@ -19,6 +19,7 @@ You have existing documentation to work from.
19
19
  3. Identify gaps — requirements that are mentioned but not detailed
20
20
  4. Ask the user to clarify gaps (one question at a time)
21
21
  5. Synthesize into context-brief.md format
22
+ 6. discover/SKILL.md step 6 registers the context brief. Do not register it again.
22
23
 
23
24
  ## Tips
24
25
 
@@ -25,6 +25,7 @@ After brainstorming completes, register all output artifacts using the create-ar
25
25
  3. After brainstorming produces the design, register artifacts via create-artifact skill
26
26
  4. Validate output with validate-artifact skill
27
27
  5. Synthesize into context-brief.md format if brainstorming didn't produce one directly
28
+ 6. discover/SKILL.md step 6 registers the context brief. Do not register it again.
28
29
 
29
30
  ## Tips
30
31
 
@@ -26,6 +26,7 @@ Existing codebase plus documentation — understand what exists before planning
26
26
  - What's been built but isn't in the docs?
27
27
  5. Ask the user to clarify goals for the next phase of work
28
28
  6. Synthesize into context-brief.md format
29
+ 7. discover/SKILL.md step 6 registers the context brief. Do not register it again.
29
30
 
30
31
  ## Tips
31
32