@osfactory/har 1.0.0-rc.2 → 1.1.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 (98) hide show
  1. package/dist/index.js +5231 -8674
  2. package/dist/templates/AGENTS.md.template +19 -66
  3. package/dist/templates/CLAUDE.md.template +1 -5
  4. package/dist/templates/adaptation-prompt-init.md +25 -29
  5. package/dist/templates/adaptation-prompt-maintain.md +5 -5
  6. package/dist/templates/adaptation-prompt-plugin.md +1 -1
  7. package/dist/templates/agent-skills/har-wt.md +2 -2
  8. package/dist/templates/agent-skills/setup-har.md +4 -4
  9. package/dist/templates/cursor-rule.mdc.template +7 -72
  10. package/dist/templates/har-boilerplate/gitignore.template +3 -1
  11. package/dist/templates/har-boilerplate/harness.env +1 -1
  12. package/dist/templates/har-boilerplate/justfile +11 -12
  13. package/dist/templates/har-boilerplate/stages.json +3 -9
  14. package/dist/templates/har-boilerplate-cli/gitignore.template +3 -1
  15. package/dist/templates/har-boilerplate-cli/harness.env +1 -1
  16. package/dist/templates/har-boilerplate-cli/justfile +9 -10
  17. package/dist/templates/har-boilerplate-cli/stages.json +2 -7
  18. package/dist/templates/har-boilerplate-ios/gitignore.template +2 -0
  19. package/dist/templates/har-boilerplate-ios/harness.env +1 -1
  20. package/dist/templates/har-boilerplate-ios/justfile +9 -10
  21. package/dist/templates/har-boilerplate-ios/stages.json +3 -8
  22. package/dist/templates/migration-prompt.md +4 -3
  23. package/dist/templates/plugins/custom-stage-skeleton.sh +2 -2
  24. package/dist/templates/plugins/gitleaks/.har/stages/secrets-scan.sh +2 -2
  25. package/dist/templates/plugins/gitleaks/template.manifest.json +1 -1
  26. package/dist/templates/plugins/kerno/.github/workflows/kerno.yml +1 -1
  27. package/dist/templates/plugins/kerno/.har/stages/KERNO.md +2 -2
  28. package/dist/templates/plugins/kerno/.har/stages/backend-validation.sh +3 -3
  29. package/dist/templates/plugins/kerno/README.md +2 -2
  30. package/dist/templates/plugins/kerno/template.manifest.json +1 -1
  31. package/dist/templates/plugins/playwright/.har/stages/PLAYWRIGHT.md +2 -2
  32. package/dist/templates/plugins/playwright/.har/stages/browser-e2e.sh +3 -3
  33. package/dist/templates/plugins/playwright/README.md +1 -1
  34. package/dist/templates/plugins/playwright/playwright.config.js +2 -2
  35. package/dist/templates/plugins/playwright/template.manifest.json +1 -1
  36. package/dist/templates/plugins/rocketsim/.har/stages/ROCKETSIM.md +1 -1
  37. package/dist/templates/plugins/rocketsim/.har/stages/rocketsim-flows.sh +3 -3
  38. package/dist/templates/plugins/rocketsim/README.md +1 -1
  39. package/dist/templates/plugins/rocketsim/flows/example-smoke.sh +1 -1
  40. package/dist/templates/plugins/rocketsim/template.manifest.json +1 -1
  41. package/dist/templates/plugins/semgrep/.har/stages/SEMGREP.md +1 -1
  42. package/dist/templates/plugins/semgrep/.har/stages/sast.sh +3 -3
  43. package/dist/templates/plugins/semgrep/README.md +2 -2
  44. package/dist/templates/plugins/semgrep/template.manifest.json +1 -1
  45. package/dist/templates/plugins/trivy/.har/stages/TRIVY.md +1 -1
  46. package/dist/templates/plugins/trivy/.har/stages/vuln-scan.sh +3 -3
  47. package/dist/templates/plugins/trivy/template.manifest.json +1 -1
  48. package/dist/templates/profiles/cli/docs/{claude-agent → readme}/definition-of-done.md +3 -3
  49. package/dist/templates/profiles/cli/docs/{claude-agent → readme}/do-not.md +1 -1
  50. package/dist/templates/profiles/cli/docs/{claude-agent → readme}/environment.md +3 -3
  51. package/dist/templates/profiles/cli/docs/readme/for-coding-agents.md +5 -7
  52. package/dist/templates/profiles/cli/docs/readme/port-shared-services-cli-profile.md +3 -3
  53. package/dist/templates/profiles/cli/docs/readme/quick-start.md +2 -9
  54. package/dist/templates/profiles/cli/docs/readme/verification-contract.md +5 -5
  55. package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +2 -3
  56. package/dist/templates/profiles/cli/profile.manifest.json +14 -11
  57. package/dist/templates/profiles/default/docs/readme/architecture.md +1 -1
  58. package/dist/templates/profiles/default/docs/{claude-agent → readme}/definition-of-done.md +3 -3
  59. package/dist/templates/profiles/default/docs/{claude-agent → readme}/do-not.md +2 -2
  60. package/dist/templates/profiles/default/docs/readme/environment.md +19 -0
  61. package/dist/templates/profiles/default/docs/readme/for-coding-agents.md +4 -6
  62. package/dist/templates/profiles/default/docs/readme/port-shared-services.md +5 -5
  63. package/dist/templates/profiles/default/docs/readme/quick-start.md +2 -9
  64. package/dist/templates/profiles/default/docs/readme/readiness-layers.md +4 -4
  65. package/dist/templates/profiles/default/docs/{claude-agent → readme}/readiness.md +1 -1
  66. package/dist/templates/profiles/default/docs/readme/verification-contract.md +4 -4
  67. package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +2 -3
  68. package/dist/templates/profiles/default/profile.manifest.json +21 -13
  69. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/definition-of-done.md +3 -3
  70. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/do-not.md +1 -1
  71. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/environment.md +4 -4
  72. package/dist/templates/profiles/ios/docs/readme/port-shared-services-ios-profile.md +3 -3
  73. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/project-commands.md +4 -4
  74. package/dist/templates/profiles/ios/docs/readme/quick-start.md +2 -9
  75. package/dist/templates/profiles/ios/docs/readme/simulators.md +2 -2
  76. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/user-flow-validation-rocketsim.md +2 -2
  77. package/dist/templates/profiles/ios/docs/readme/verification-contract.md +1 -1
  78. package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +2 -3
  79. package/dist/templates/profiles/ios/profile.manifest.json +15 -12
  80. package/dist/templates/runtime-bundles/shared-kernel/STAGES.md +1 -1
  81. package/dist/templates/runtime-bundles/shared-kernel/lib/verify-runner.mjs +1 -1
  82. package/dist/templates/shared-docs/readme/maintaining-this-harness.md +3 -3
  83. package/package.json +2 -1
  84. package/dist/prompts/system-authoring.md +0 -155
  85. package/dist/templates/profiles/default/docs/claude-agent/environment.md +0 -19
  86. package/dist/templates/profiles/ios/docs/claude-agent/intro.md +0 -3
  87. package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +0 -15
  88. package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +0 -35
  89. package/dist/templates/runtime-bundles/shared-kernel/launch.sh +0 -35
  90. package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +0 -35
  91. package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +0 -35
  92. package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +0 -35
  93. package/dist/templates/runtime-bundles/shared-kernel/verify.sh +0 -35
  94. package/dist/templates/shared-docs/claude-agent/intro.md +0 -3
  95. /package/dist/templates/profiles/cli/docs/{claude-agent → readme}/project-commands.md +0 -0
  96. /package/dist/templates/profiles/cli/docs/{claude-agent → readme}/readiness.md +0 -0
  97. /package/dist/templates/profiles/default/docs/{claude-agent → readme}/project-commands.md +0 -0
  98. /package/dist/templates/profiles/ios/docs/{claude-agent → readme}/readiness.md +0 -0
@@ -5,72 +5,25 @@ This repository uses a **`.har/` harness** for isolated agent development.
5
5
  <!-- har:agent-environment:start -->
6
6
  ## HAR / agent environment
7
7
 
8
- The harness is not just a verification gate — it is **how you run this project**.
9
- To see the app live (manual testing, browser sessions, screenshots, driving the UI),
10
- use `har env launch <id>` or `./.har/launch.sh <id>`. It already encodes database
11
- setup, ports, env vars, and process management — never hand-roll `docker` / dev-server
12
- startup, and never claim a task "can't be verified live" without launching a slot first.
13
-
14
- If a harness command fails, fix the harness (or report the failure) — do not quietly
15
- fall back to ad-hoc commands.
16
-
17
- ### Before making changes
18
-
19
- 1. On the **main checkout**, switch to the intended base (usually `main`) — launch
20
- creates a worktree from that HEAD.
21
- 2. **Launch first** — MCP `har_launch_environment` / `har env launch 1`. Use the
22
- returned **work dir** for ALL edits (never the main checkout).
23
- **Bind tracker work** when the task names a durable issue or ticket (GitHub,
24
- Linear, etc.): pass a short repo-scoped `--work-id` / `workUnitId` (e.g.
25
- `widget-123`), `--work-source` / `source`, `--work-url` / `sourceUrl`, and
26
- `--work-title` / `title` when known. Skip binding for ad-hoc work with no
27
- tracker identity.
28
- 3. Read [`.har/README.md`](.har/README.md), [`.har/stages.json`](.har/stages.json), then
29
- [`.har/CLAUDE.agent.md`](.har/CLAUDE.agent.md) (slot URLs / definition of done).
30
- 4. Hot-reload usually applies; if not, `./.har/agent-cli.sh <id> restart` (no-op on
31
- cli/ios profiles without managed processes).
32
-
33
- **Occupied slots always block.** Run `complete` / `teardown`, then `launch`. Resume
34
- failed/starting launches with `--resume` / `recover`. Prefer a free slot (2+) over
35
- sharing slot 1 across unrelated chats. Check `har_get_status` / `har env status` first.
36
- Commit early — teardown keeps the branch, not uncommitted work.
37
-
38
- ### After making changes
39
-
40
- Prefer MCP → CLI → shell. Quick verify for the loop; **full verify before done**.
41
-
42
- - MCP: `har_run_verification` / `full: true`; finish with `har_complete_environment`
43
- (propose; wait for approval) or `har_teardown_environment`
44
- - CLI: `har env verify 1`, `har env verify 1 --full`, `complete 1`, `teardown 1`
45
- - Shell: `./.har/verify.sh 1`, `./.har/verify.sh 1 --full`, `./.har/teardown.sh 1`
46
-
47
- Commit in the session worktree. Run JSON stays in the main checkout `.har/runs/`.
48
-
49
- ### Definition of done
50
-
51
- - Full verify passes; edits only in the session worktree; tests cover new behavior;
52
- changes committed; show preview URLs; then **session handoff** (below).
53
-
54
- ### Session handoff (required)
55
-
56
- After full verify and commit, stop. Include summary, session branch
57
- (`.har/slots/agent-<id>.json`), and preview URLs. Wait — never autonomously
58
- complete, teardown, push, or open a PR. **Default:** when `gh`/GitHub MCP is available,
59
- recommend **Complete + open a PR** (still needs approval). Alternatives: **Complete only**,
60
- or **Something else**. Without PR tooling, recommend **Complete only** and give the
61
- session branch for a manual push.
62
-
63
- ### Commit gate
64
-
65
- Full verify records a tree hash under `.har/validations/`. With `har hooks install`,
66
- commits must match a passing full verify. Re-verify after any edit; `git add -A`.
67
- Do not bypass (`--no-verify`, `HAR_SKIP_GATE=1`).
68
-
69
- ### Cursor IDE
70
-
71
- If `.cursor/rules/har-workflow.mdc` exists, the same harness workflow is injected into
72
- every Cursor agent session automatically. Run `har env init` or `har env maintain` to
73
- create or refresh it.
8
+ This repository uses a `.har/` harness. It is **how you run and verify this
9
+ project** — launch a slot for live apps, browsers and screenshots; never
10
+ hand-roll docker or dev-server startup. If a harness command fails, fix the
11
+ harness or report it; do not fall back to ad-hoc commands.
12
+
13
+ 1. **Launch first** — `har_launch_environment` / `har env launch <id>`. Make ALL
14
+ edits under the returned **work dir**, never the main checkout. Bind tracker
15
+ work with `--work-id` / `--work-url` when the task names an issue.
16
+ 2. **Verify before done** — `har_run_verification` (`full: true`) /
17
+ `har env verify <id> --full`. Commit in the session worktree.
18
+ 3. **Stop at handoff** — report summary, session branch and preview URLs, then
19
+ wait. Never autonomously `complete`, `teardown`, push, or open a PR.
20
+
21
+ Occupied slots always block: `complete` / `teardown`, then launch. Customize the
22
+ harness only through `harness.env`, `stages.json` + `.har/stages/`, `.har/hooks/`
23
+ and `.har/plugins/` — there is no generated `.har/*.sh` entry-point surface.
24
+
25
+ Full detail — slot environment, readiness, definition of done, project commands,
26
+ commit gate: [`.har/README.md`](.har/README.md) and [`.har/stages.json`](.har/stages.json).
74
27
  <!-- har:agent-environment:end -->
75
28
 
76
29
  ## Project-specific notes
@@ -1,5 +1 @@
1
- # __PROJECT_DISPLAY_NAME__
2
-
3
- Read [AGENTS.md](./AGENTS.md) and [.har/README.md](./.har/README.md) before changing this project.
4
- Harness workflow is enforced automatically in Cursor via `.cursor/rules/har-workflow.mdc`
5
- (created by `har env init`).
1
+ @AGENTS.md
@@ -5,8 +5,8 @@ Adapt the `.har/` harness in this repository so AI coding agents can run the pro
5
5
  Explore this repository, then edit files in `.har/` directly to make the harness runnable for this project.
6
6
 
7
7
  `.har/` is a **configuration surface** — the runtime machinery lives in the HAR
8
- package behind the `./.har/*.sh` shims. Never edit the shims or invent new config
9
- files; every customization has a sanctioned home:
8
+ package. CLI and MCP are the only entry points. Never add lifecycle wrappers
9
+ or invent new config files; every customization has a sanctioned home:
10
10
 
11
11
  | Customization | Home |
12
12
  |---------------|------|
@@ -16,9 +16,9 @@ files; every customization has a sanctioned home:
16
16
  | Anything bigger | Plugins (`har env add-plugin`, `har plugin create` for local) |
17
17
  | Full runtime ownership (rare) | `har env eject` |
18
18
 
19
- ## HAR profiles (pick the right one at init)
19
+ ## HAR profiles (pick the right one at scaffold)
20
20
 
21
- `har env init` scaffolds from one of three boilerplate profiles — **choose the profile that matches this repository**:
21
+ The scaffold comes from one of three boilerplate profiles — **choose the profile that matches this repository**:
22
22
 
23
23
  | Profile | Best for | What you get |
24
24
  |---------|----------|--------------|
@@ -26,11 +26,7 @@ files; every customization has a sanctioned home:
26
26
  | `cli` | **CLI tools, libraries, test-suite repos** (typical SWE-bench) | Git worktree by default, no PM2; optional Docker for databases; run project commands in isolation |
27
27
  | `ios` | **Mobile iOS / Swift** | xcodebuild + iOS Simulator; scheme/project/simulator in `harness.env` |
28
28
 
29
- ```bash
30
- har env init # default (SaaS/web)
31
- har env init --profile cli # libraries / CLI / polyglot test repos
32
- har env init --profile ios # iOS apps
33
- ```
29
+ If you must re-scaffold (destructive): `har env init --force --profile default|cli|ios`.
34
30
 
35
31
  Do **not** disable worktrees, rewrite launch into repo-root-only mode, or pick the wrong profile unless the project truly requires it.
36
32
 
@@ -55,8 +51,8 @@ Replace all TODO placeholders. Key files:
55
51
  Identify the **primary application** — the ONE app coding agents will modify and run per-slot. Everything else is shared and runs once for all slots:
56
52
 
57
53
  1. **Primary app** → set `HARNESS_PRIMARY_APP` in `harness.env`; wire ONLY its dev processes into `ecosystem.agent.template.cjs` (a primary app may still need several processes, e.g. api + frontend of the same app).
58
- 2. **External dependencies** (database, cache, queue, mail, ...) → keep/add them as services in `docker-compose.agent.yml`, delete the menu entries the project doesn't use, and list the needed ones in `HARNESS_INFRA_SERVICES` (e.g. `"db redis"`). They start once via `setup-infra.sh` on fixed ports and serve every slot.
59
- 3. **Internal supporting services** (a monolith/monorepo's other services the agent depends on but is not changing) → do NOT start them per-slot. Run them once and shared: as compose services in `docker-compose.agent.yml`, or as PM2 processes in `.har/ecosystem.shared.config.cjs` (processes named `har-shared-<name>`, started automatically by `setup-infra.sh` when the file exists). Point the primary app at them through `env.template`.
54
+ 2. **External dependencies** (database, cache, queue, mail, ...) → keep/add them as services in `docker-compose.agent.yml`, delete the menu entries the project doesn't use, and list the needed ones in `HARNESS_INFRA_SERVICES` (e.g. `"db redis"`). They start once via `har env setup-infra` on fixed ports and serve every slot.
55
+ 3. **Internal supporting services** (a monolith/monorepo's other services the agent depends on but is not changing) → do NOT start them per-slot. Run them once and shared: as compose services in `docker-compose.agent.yml`, or as PM2 processes in `.har/ecosystem.shared.config.cjs` (processes named `har-shared-<name>`, started automatically by `har env setup-infra` when the file exists). Point the primary app at them through `env.template`.
60
56
 
61
57
  Simple single-app repos need none of the extra machinery: one primary app, usually one `db` in `HARNESS_INFRA_SERVICES`, no shared ecosystem file.
62
58
 
@@ -76,8 +72,8 @@ Verification is data: `.har/stages.json` lists the pipeline in
76
72
  `verificationStages` (execution order), and every id resolves to a registered
77
73
  stage with `"tier": "quick" | "full"`. Adapt verification by editing the stage
78
74
  entries — commands, tiers, order — or adding stage scripts (see
79
- `.har/STAGES.md`). **Never edit `.har/verify.sh`**; it is a thin iterator that
80
- runs the registry. The scaffolded defaults (`typecheck`, `unit-tests`, `lint`,
75
+ `.har/STAGES.md`). Do not add lifecycle wrappers — `har env verify` runs the
76
+ registry. The scaffolded defaults (`typecheck`, `unit-tests`, `lint`,
81
77
  `readiness`, plus `api-health` on web profiles) are derived from
82
78
  `HARNESS_ECOSYSTEM` — a starting point, not the repo's final contract. Replace
83
79
  conventions that do not match this project. Use toolchain variables from
@@ -161,12 +157,13 @@ are user-owned: never drift-checked; `har env doctor` only validates names and
161
157
  executability. Use registered stages for verification steps; use hooks for
162
158
  lifecycle side effects.
163
159
 
164
- ### `.har/CLAUDE.agent.md`
165
- Detailed agent instructions: commands, credentials, architecture, definition of done.
160
+ ### `.har/README.md`
161
+ The harness reference agents read: slot environment, readiness / what "agent
162
+ usable" means here, definition of done, project commands, architecture.
166
163
 
167
164
  ### `.har/env.template`, `docker-compose.agent.yml`
168
- Adapt as needed for the project's infra (`setup-infra.sh` is a shim — the
169
- services it starts come from these two files plus `HARNESS_INFRA_SERVICES`).
165
+ Adapt as needed for the project's infra (`har env setup-infra` starts
166
+ services from these two files plus `HARNESS_INFRA_SERVICES`).
170
167
 
171
168
  ### Port allocation & shared services
172
169
 
@@ -195,7 +192,7 @@ Onboarding may set an initial `agentSlots.max` in `.har/stages.json`. After you
195
192
  - [ ] For each service in `HARNESS_INFRA_SERVICES`, a matching lane exists in `HARNESS_INFRA_PORT_LANES` in `harness.env`
196
193
  - [ ] `.har/README.md` has a **Port & shared services** section (allocation table, shared vs per-slot, do-not rules)
197
194
  - [ ] App code and tests read ports from `.env.agent.<id>` / `agent-cli.sh` / slot registry — no hardcoded `3000`, `15432`, `3847`, etc.
198
- - [ ] `env.template` and `CLAUDE.agent.md` show resolved ports via variables, not literals
195
+ - [ ] `env.template` and `.har/README.md` show resolved ports via variables, not literals
199
196
  - [ ] Monorepos with `har control up`: document slot-1 conflict if the app port overlaps (e.g. Mission Control on 3847)
200
197
 
201
198
  ### Git worktree
@@ -210,20 +207,19 @@ Coding agents discover the harness through two files:
210
207
 
211
208
  Do **not** create `AGENT.md` (singular) — that legacy name is obsolete. If `AGENT.md` exists, merge any unique notes into `AGENTS.md` and delete `AGENT.md`.
212
209
 
213
- If **`har env init` already created `AGENTS.md`**, refresh the **HAR / agent environment** section and fill in **Project-specific notes** — do not wipe unrelated content.
210
+ If **the scaffold already created `AGENTS.md`**, refresh the **HAR / agent environment** section and fill in **Project-specific notes** — do not wipe unrelated content.
214
211
 
215
212
  If **no `AGENTS.md` exists**, create one at the repo root using this structure:
216
213
 
217
- - Link to `.har/README.md` and `.har/CLAUDE.agent.md`
214
+ - Link to `.har/README.md`
218
215
  - State plainly: **the harness is how you run this project** — to see the app live (manual testing, browser, screenshots), `launch` a slot; never hand-roll docker/dev-server startup, and never work around a failing harness command with ad-hoc setup (fix or report it instead)
219
216
  - Commands: HAR MCP tools or `har env launch/verify/teardown`
220
- - Shell shims: `./.har/launch.sh`, `./.har/verify.sh`, `./.har/teardown.sh` — same runtime and run records
221
- - Rules (no hardcoded ports, use `./.har/agent-cli.sh`, do not touch other agents' resources)
217
+ - Rules (no hardcoded ports, use `har env agent <id> …`, do not touch other agents' resources)
222
218
  - Project-specific notes (stack, credentials, definition of done)
223
219
 
224
220
  If **`AGENTS.md` already exists** (project-owned), add or update a concise **HAR / agent environment** section — do not replace unrelated content.
225
221
 
226
- Keep **`CLAUDE.md`** as a thin pointer to `AGENTS.md` (Claude Code auto-loads `CLAUDE.md`). Do not paste the full harness workflow into `CLAUDE.md`.
222
+ Keep **`CLAUDE.md`** as the line `@AGENTS.md` (Claude Code auto-loads `CLAUDE.md` and follows the import). Never paste the harness workflow into it — `AGENTS.md` is the single instruction file.
227
223
 
228
224
  ### Monorepos / multiple harnesses
229
225
 
@@ -235,30 +231,30 @@ If this repository contains **more than one project or `.har` harness** (check f
235
231
 
236
232
  Include a **Run history** subsection:
237
233
 
238
- - Every entry point (`./.har/*.sh` shims, `har env …`, MCP) writes the same run records to `.har/runs/YYYY-MM-DD/HH-mm-ss_<stageId>_agent-<id>.json`
234
+ - Every entry point (`har env …`, MCP) writes the same run records to `.har/runs/YYYY-MM-DD/HH-mm-ss_<stageId>_agent-<id>.json`
239
235
  - With worktrees, code runs in the worktree but run JSON lives in the main checkout `.har/runs/`
240
- - The `./.har/*.sh` shims forward to the same runtime — evidence records are identical from any surface
236
+ - CLI and MCP are the only entry points — evidence records are identical from either surface
241
237
 
242
238
  ## Step 4 — Adaptation completeness (required)
243
239
 
244
240
  Before finishing, confirm the harness describes this project truthfully — do
245
- **not** go hunting for machinery to prune (the shims and packaged runtime are
241
+ **not** go hunting for machinery to prune (the packaged runtime is
246
242
  not yours to trim, and wholesale deletion just manufactures drift):
247
243
 
248
244
  - [ ] No `TODO` placeholders remain anywhere in `.har/`
249
245
  - [ ] `HARNESS_INFRA_SERVICES` lists exactly the services this project uses, each with a lane in `HARNESS_INFRA_PORT_LANES`
250
246
  - [ ] All per-slot data stores are provisioned, not just the primary database
251
247
  - [ ] If full seed/setup is skipped, `.har/` provides a minimal bootstrap or documents why none is needed
252
- - [ ] `.har/CLAUDE.agent.md` defines what "agent usable" means for this repo (credentials, default data, smoke workflow) and shows only real URLs/ports/commands
248
+ - [ ] `.har/README.md` defines what "agent usable" means for this repo (credentials, default data, smoke workflow) and shows only real URLs/ports/commands
253
249
  - [ ] `.har/README.md` documents port allocation and the shared-service model
254
250
  - [ ] No hardcoded default ports (`3000`, `15432`, `3847`, …) in app code, tests, or harness docs — use agent env / slot registry
255
251
 
256
252
  ## Rules
257
253
 
258
- 1. Customize only through the contract: config in `harness.env`, stages in `stages.json` / `.har/stages/`, hooks in `.har/hooks/`, plugins in `.har/plugins/` — never edit the generated `*.sh` shims
254
+ 1. Customize only through the contract: config in `harness.env`, stages in `stages.json` / `.har/stages/`, hooks in `.har/hooks/`, plugins in `.har/plugins/` — never add lifecycle `.sh` wrappers
259
255
  2. Always update `.har/README.md` to reflect current harness state
260
256
  3. Reuse existing project commands from package.json, Makefile, CI, etc.
261
257
  4. Replace all TODO placeholders
262
258
  5. Do not edit `.har/manifest.json` — managed by the har CLI
263
259
 
264
- When finished, summarize what you changed, confirm verification commands (`har env verify 1 --full` or `./.har/verify.sh 1 --full`) are correct for this stack, and record the adaptation with `har env maintain --finalize --summary "<what changed>"`.
260
+ When finished, summarize what you changed, confirm verification commands (`har env verify 1 --full`) are correct for this stack, and record the adaptation with `har env maintain --finalize --summary "<what changed>"`.
@@ -31,7 +31,7 @@ Prefer targeted edits over full rewrites. Key files to review:
31
31
  ### `.har/README.md` (required)
32
32
  Keep this accurate — it is the harness index. Update whenever scripts, stages, or workflow change.
33
33
 
34
- ### `.har/harness.env`, `stages.json`, `ecosystem.agent.template.cjs`, `CLAUDE.agent.md`
34
+ ### `.har/harness.env`, `stages.json`, `ecosystem.agent.template.cjs`, `README.md`
35
35
  Align commands and instructions with the current stack. Verify steps must use toolchain paths from `.env.agent.<id>` (`PYTHON_BIN`, `NPM_BIN`, `XCODEBUILD_BIN`, …) — never hardcoded venv or interpreter paths. `NPM_BIN` may be bun, pnpm, or yarn, so Node steps must use `${NPM_BIN:-npm} run <script>` and avoid npm-only flags such as `--prefix`. Replace stock ecosystem conventions that do not match the repository; do not leave npm/pytest/go/cargo/maven/gradle examples in place by accident.
36
36
 
37
37
  ### `.har/env.template`, `docker-compose.agent.yml`
@@ -62,7 +62,7 @@ Look specifically for drift introduced since the last adaptation:
62
62
  - `verificationStages` became health-only and no longer checks the key workflow
63
63
  that makes the slot usable.
64
64
 
65
- Update `.har/CLAUDE.agent.md` with skipped setup steps, substitutes, credentials,
65
+ Update `.har/README.md` with skipped setup steps, substitutes, credentials,
66
66
  and the repo-specific definition of "agent usable."
67
67
 
68
68
  ### Custom lifecycle behavior — `.har/hooks/`
@@ -81,7 +81,7 @@ scripts for a lifecycle side effect, move that code into a hook.
81
81
  Platform-shape upgrades are **code, not a checklist**: the har CLI carries a
82
82
  versioned migration registry keyed on the manifest's `runtimeVersion`.
83
83
  `har env maintain` detects an old harness shape, writes `.har/MIGRATE-PROMPT.md`,
84
- and `har env maintain --migrate` applies the mechanical steps (shims, pure-config
84
+ and `har env maintain --migrate` applies the mechanical steps (delete leftover wrappers, pure-config
85
85
  `harness.env` with `HARNESS_INFRA_SERVICES` / `HARNESS_INFRA_PORT_LANES`
86
86
  conversions, machinery removal) with backups under `.har/migrate/backup/`.
87
87
 
@@ -96,7 +96,7 @@ come back here afterwards. Two standing rules:
96
96
 
97
97
  If harness commands, rules, or workflow changed, update the **HAR / agent environment** section in repo-root `AGENTS.md`:
98
98
 
99
- - Links to `.har/README.md` and `.har/CLAUDE.agent.md`
99
+ - Links to `.har/README.md`
100
100
  - Commands: HAR MCP tools or `har env …`
101
101
  - Shell shims: `./.har/*.sh` — thin delegates to `har env`, same run records
102
102
  - Run history (worktree runs record to the main checkout `.har/runs/`)
@@ -105,7 +105,7 @@ If harness commands, rules, or workflow changed, update the **HAR / agent enviro
105
105
 
106
106
  If `AGENTS.md` does not mention HAR yet, add a concise section. If it already has a HAR section, update it minimally — do not replace unrelated content.
107
107
 
108
- Do **not** create `AGENT.md` (singular). If legacy `AGENT.md` exists, merge unique notes into `AGENTS.md` and delete `AGENT.md`. Keep `CLAUDE.md` as a thin pointer to `AGENTS.md`.
108
+ Do **not** create `AGENT.md` (singular). If legacy `AGENT.md` exists, merge unique notes into `AGENTS.md` and delete `AGENT.md`. Keep `CLAUDE.md` as the line `@AGENTS.md`.
109
109
 
110
110
  ## Rules
111
111
 
@@ -31,7 +31,7 @@ stage entries in `.har/stages.json`. Never edit the shims.
31
31
  ## Prove it green
32
32
 
33
33
  ```bash
34
- har env launch 1 # or ./.har/launch.sh 1
34
+ har env launch 1
35
35
  har env verify 1 --full # must pass INCLUDING {{STAGE_IDS}}
36
36
  ```
37
37
 
@@ -16,7 +16,7 @@ har env status # or ./.har/agent-cli.sh 1 status
16
16
  ## 2. Launch — BEFORE editing any file
17
17
 
18
18
  ```bash
19
- har env launch <id> # or ./.har/launch.sh <id>
19
+ har env launch <id>
20
20
  ```
21
21
 
22
22
  Launch creates a fresh session worktree from HEAD and prints its **work dir** (also recorded in `.har/slots/agent-<id>.json`, path like `~/worktrees/<base>-<sha4>-har-agent-<id>-<rand4>`). If a previous launch failed partway, retry with `--resume` instead of starting fresh.
@@ -43,7 +43,7 @@ completion to HAR.
43
43
  - The main checkout must stay clean (`git status` there shows no changes from you).
44
44
  - Edits hot-reload in the running slot; use `./.har/agent-cli.sh <id> restart` if a change doesn't take.
45
45
  - Commit early and often on the session branch — teardown keeps the branch, not uncommitted work.
46
- - After launch, read `.har/CLAUDE.agent.md` in the worktree for slot URLs and the definition of done.
46
+ - After launch, read `.har/README.md` in the worktree for slot URLs and the definition of done.
47
47
 
48
48
  ## 4. Verify through the harness
49
49
 
@@ -42,15 +42,15 @@ Tell the user which profile you picked and why before continuing.
42
42
 
43
43
  ## 4. Initialize the harness
44
44
 
45
- ```bash
46
- har env init --profile <profile> # omit --profile for default
47
- ```
45
+ Call `har_init_harness` with the chosen `profile` (`default`, `cli`, or `ios`).
46
+ Do not run `har onboard` (that wizard is for humans) and do not advertise
47
+ `har env init` as the first-run command.
48
48
 
49
49
  If `.har/` already exists, stop and suggest `/har-maintain` instead.
50
50
 
51
51
  ## 5. Perform the adaptation yourself
52
52
 
53
- `har env init` prints an adaptation prompt and writes it to `.har/ADAPT-PROMPT.md`. Read that file and **execute its instructions yourself, now, in this session** — tailor the harness configuration surface (`harness.env`, `stages.json` + `.har/stages/`, `.har/hooks/`, `docker-compose.agent.yml`, `env.template`) and `AGENTS.md` to this repository's real stack, ports, and commands. The `./.har/*.sh` files are generated shims over the packaged runtime — never edit them.
53
+ `har_init_harness` writes an adaptation prompt to `.har/ADAPT-PROMPT.md`. Read that file and **execute its instructions yourself, now, in this session** — tailor the harness configuration surface (`harness.env`, `stages.json` + `.har/stages/`, `.har/hooks/`, `docker-compose.agent.yml`, `env.template`) and `AGENTS.md` to this repository's real stack, ports, and commands. The `./.har/*.sh` files are generated shims over the packaged runtime — never edit them.
54
54
 
55
55
  ## 6. Register the project's checks as stages
56
56
 
@@ -1,79 +1,14 @@
1
1
  ---
2
- description: HAR harness workflow — read before change, verify before done
2
+ description: HAR harness workflow — read AGENTS.md before changing anything
3
3
  alwaysApply: true
4
4
  ---
5
5
 
6
6
  # HAR Harness Workflow
7
7
 
8
- This repository uses a `.har/` agent harness. Follow this on every change.
8
+ This repository uses a `.har/` agent harness. **Read [`AGENTS.md`](../../AGENTS.md)
9
+ and follow it** — it is the single source of truth for the harness workflow
10
+ (launch a slot first, edit only in the work dir, full verify before done, stop at
11
+ handoff). `.har/README.md` has the harness detail.
9
12
 
10
- The harness is **how you run the project**, not only how you verify it. Launch a
11
- slot for live apps, browsers, and screenshots — never hand-roll docker/dev-server
12
- startup. If a harness command fails, fix the harness or surface the failure. Customize
13
- only via the contract (`harness.env`, `stages.json` + `.har/stages/`, `.har/hooks/`, `.har/plugins/`) — never edit the generated `./.har/*.sh` shims.
14
-
15
- ## Before making changes
16
-
17
- 1. On the **main checkout**, switch to the intended base (usually `main`) — launch
18
- creates a worktree from that HEAD.
19
- 2. **Launch first** — MCP `har_launch_environment` / `har env launch 1`. Use the
20
- returned **work dir** for ALL edits (never the main checkout). Path looks like
21
- `~/worktrees/<base>-<sha4>-har-agent-<id>-<rand4>` (see `.har/slots/agent-<id>.json`).
22
- **Bind tracker work** when the task names an issue or ticket — short `--work-id`
23
- (e.g. `widget-123`) plus `--work-source` / `--work-url` / `--work-title`. Skip for ad-hoc work.
24
- 3. Read `AGENTS.md`, `.har/README.md`, `.har/stages.json`, then
25
- `.har/CLAUDE.agent.md` (slot URLs / definition of done).
26
- 4. Hot-reload usually applies; if not, `./.har/agent-cli.sh <id> restart` (no-op on
27
- cli/ios profiles without managed processes).
28
-
29
- **Occupied slots always block.** Run `complete` / `teardown`, then `launch`. Resume
30
- failed/starting launches with `--resume` / `recover`. Prefer a free slot (2+) over
31
- sharing slot 1 across unrelated chats. Check `har_get_status` / `har env status`
32
- first. Commit early — teardown keeps the branch, not uncommitted work. Gitignored
33
- paths are ephemeral. With telemetry on, Mission Control derives session purpose from
34
- the first captured user prompt.
35
-
36
- <!-- Monorepo: if this repository contains multiple .har harnesses, list them here
37
- and pick by the files you are changing. Example:
38
-
39
- ## Harnesses in this repo
40
-
41
- | Path | Runs | Use when changing |
42
- |------|------|-------------------|
43
- | `.har/` | backend + frontend | `src/`, `packages/` |
44
- | `apps/admin/.har/` | admin dashboard | `apps/admin/` |
45
-
46
- Run harness commands from the directory that owns the harness (e.g. `cd apps/admin`). -->
47
-
48
- ## After making changes
49
-
50
- Prefer MCP → CLI → shell. Quick verify for the loop; **full verify before done**.
51
-
52
- - MCP: `har_run_verification` / `full: true`; finish with `har_complete_environment`
53
- (propose; wait for approval) or `har_teardown_environment`
54
- - CLI: `har env verify 1`, `har env verify 1 --full`, `complete 1`, `teardown 1`
55
- - Shell: `./.har/verify.sh 1`, `./.har/verify.sh 1 --full`, `./.har/teardown.sh 1`
56
-
57
- Commit in the session worktree. Run JSON stays in the main checkout `.har/runs/`.
58
- UI changes with Playwright: update specs under `tests/` (full verify includes browser-e2e).
59
-
60
- ## Definition of done
61
-
62
- - Full verify passes; edits only in the session worktree; tests cover new behavior;
63
- changes committed; show preview URLs; then **session handoff** (below).
64
-
65
- ## Session handoff (required)
66
-
67
- After full verify and commit, stop. Include summary, session branch
68
- (`.har/slots/agent-<id>.json`), and preview URLs. Wait — never autonomously
69
- complete, teardown, push, or open a PR. **Default (1 is the default):** when
70
- `gh`/GitHub MCP is available, recommend **Complete + open a PR** — push → open
71
- PR → `har env complete` / `har_complete_environment` (branch kept). Still needs
72
- approval. Alternatives: **Complete only**, or **Something else**. Without PR
73
- tooling, recommend **Complete only** and give the session branch for a manual push.
74
-
75
- ## Commit gate
76
-
77
- Full verify records a tree hash under `.har/validations/`. With `har hooks install`,
78
- commits must match a passing full verify. Re-verify after any edit; `git add -A`.
79
- Do not bypass (`--no-verify`, `HAR_SKIP_GATE=1`).
13
+ This rule exists only to guarantee that instruction reaches every Cursor session;
14
+ it deliberately does not restate the workflow, so there is one copy to keep current.
@@ -9,12 +9,14 @@ artifacts/
9
9
  state/
10
10
  maintain/
11
11
  ADAPT-PROMPT.md
12
+ migrate/
13
+ MIGRATE-PROMPT.md
12
14
  AGENTS.md.proposed
13
15
  AGENTS.md.proposed.meta.json
14
16
  AGENT.md.proposed
15
17
  AGENT.md.proposed.meta.json
16
18
  slots/
17
19
 
18
- # Generated by launch.sh (also listed in repo-root .gitignore)
20
+ # Generated at launch (also listed in repo-root .gitignore)
19
21
  .env.agent.*
20
22
  ecosystem.agent.*.config.cjs
@@ -1,5 +1,5 @@
1
1
  # Shared harness configuration — edit to match your project
2
- # Generated by har env init, maintained over time with har env maintain
2
+ # Generated when the harness is scaffolded, maintained with har env maintain
3
3
  #
4
4
  # This file is pure KEY=value config (plus comments) and is schema-validated
5
5
  # on read. Runtime helpers (har_infra_enabled, har_pg, port resolution) live
@@ -2,38 +2,37 @@
2
2
 
3
3
  set shell := ["bash", "-cu"]
4
4
 
5
+ repo := justfile_directory() + "/.."
6
+
5
7
  setup:
6
- ./setup-infra.sh
8
+ har env setup-infra --repo {{repo}}
7
9
 
8
10
  launch id:
9
- ./launch.sh {{id}}
11
+ har env launch {{id}} --repo {{repo}}
10
12
 
11
13
  teardown id:
12
- ./teardown.sh {{id}}
14
+ har env teardown {{id}} --repo {{repo}}
13
15
 
14
16
  verify id:
15
- ./verify.sh {{id}}
17
+ har env verify {{id}} --repo {{repo}}
16
18
 
17
19
  verify-full id:
18
- ./verify.sh {{id}} --full
20
+ har env verify {{id}} --full --repo {{repo}}
19
21
 
20
22
  status:
21
- #!/usr/bin/env bash
22
- for id in 1 2 3 4 5; do
23
- ./agent-cli.sh "$id" status 2>/dev/null || true
24
- done
23
+ har env status --repo {{repo}}
25
24
 
26
25
  launch-all count:
27
26
  #!/usr/bin/env bash
28
27
  for id in $(seq 1 {{count}}); do
29
- ./launch.sh "$id"
28
+ har env launch "$id" --repo "{{repo}}"
30
29
  done
31
30
 
32
31
  teardown-all:
33
32
  #!/usr/bin/env bash
34
33
  for id in 1 2 3 4 5; do
35
- ./teardown.sh "$id" 2>/dev/null || true
34
+ har env teardown "$id" --repo "{{repo}}" 2>/dev/null || true
36
35
  done
37
36
 
38
37
  cli id cmd *args:
39
- ./agent-cli.sh {{id}} {{cmd}} {{args}}
38
+ har env agent {{id}} {{cmd}} {{args}} --repo {{repo}}
@@ -13,14 +13,12 @@
13
13
  {
14
14
  "id": "setup-infra",
15
15
  "kind": "setup",
16
- "description": "Shared infrastructure (Docker, template DB)",
17
- "command": "./.har/setup-infra.sh"
16
+ "description": "Shared infrastructure (Docker, template DB)"
18
17
  },
19
18
  {
20
19
  "id": "launch",
21
20
  "kind": "launch",
22
21
  "description": "Launch an isolated agent environment slot",
23
- "command": "./.har/launch.sh {agentId}",
24
22
  "artifacts": [
25
23
  {
26
24
  "path": ".env.agent.{agentId}",
@@ -33,7 +31,6 @@
33
31
  "id": "verify",
34
32
  "kind": "verify",
35
33
  "description": "Verification pipeline: runs stages.json verificationStages in order (tier \"quick\" by default; --full runs the whole list)",
36
- "command": "./.har/verify.sh {agentId}",
37
34
  "acceptsArgs": [
38
35
  "--full"
39
36
  ],
@@ -49,7 +46,6 @@
49
46
  "id": "status",
50
47
  "kind": "inspect",
51
48
  "description": "Inspect a running agent environment slot",
52
- "command": "./.har/agent-cli.sh {agentId} status",
53
49
  "artifacts": [
54
50
  {
55
51
  "path": ".har/logs",
@@ -61,14 +57,12 @@
61
57
  {
62
58
  "id": "logs",
63
59
  "kind": "inspect",
64
- "description": "Read recent logs for an agent slot",
65
- "command": "./.har/agent-cli.sh {agentId} logs"
60
+ "description": "Read recent logs for an agent slot"
66
61
  },
67
62
  {
68
63
  "id": "teardown",
69
64
  "kind": "teardown",
70
- "description": "Stop processes and release agent slot resources",
71
- "command": "./.har/teardown.sh {agentId}"
65
+ "description": "Stop processes and release agent slot resources"
72
66
  },
73
67
  {
74
68
  "id": "typecheck",
@@ -9,12 +9,14 @@ artifacts/
9
9
  state/
10
10
  maintain/
11
11
  ADAPT-PROMPT.md
12
+ migrate/
13
+ MIGRATE-PROMPT.md
12
14
  AGENTS.md.proposed
13
15
  AGENTS.md.proposed.meta.json
14
16
  AGENT.md.proposed
15
17
  AGENT.md.proposed.meta.json
16
18
  slots/
17
19
 
18
- # Generated by launch.sh (also listed in repo-root .gitignore)
20
+ # Generated at launch (also listed in repo-root .gitignore)
19
21
  .env.agent.*
20
22
  ecosystem.agent.*.config.cjs
@@ -1,5 +1,5 @@
1
1
  # CLI / library harness — optional Docker via HARNESS_INFRA_SERVICES, no PM2
2
- # Generated by har env init --profile cli
2
+ # Generated when the harness is scaffolded (--profile cli)
3
3
  #
4
4
  # This file is pure KEY=value config (plus comments) and is schema-validated
5
5
  # on read. Runtime helpers (har_infra_enabled, har_pg, port resolution) live
@@ -2,26 +2,25 @@
2
2
 
3
3
  set shell := ["bash", "-cu"]
4
4
 
5
+ repo := justfile_directory() + "/.."
6
+
5
7
  setup:
6
- ./setup-infra.sh
8
+ har env setup-infra --repo {{repo}}
7
9
 
8
10
  launch id:
9
- ./launch.sh {{id}}
11
+ har env launch {{id}} --repo {{repo}}
10
12
 
11
13
  teardown id:
12
- ./teardown.sh {{id}}
14
+ har env teardown {{id}} --repo {{repo}}
13
15
 
14
16
  verify id:
15
- ./verify.sh {{id}}
17
+ har env verify {{id}} --repo {{repo}}
16
18
 
17
19
  verify-full id:
18
- ./verify.sh {{id}} --full
20
+ har env verify {{id}} --full --repo {{repo}}
19
21
 
20
22
  status:
21
- #!/usr/bin/env bash
22
- for id in 1 2 3; do
23
- ./agent-cli.sh "$id" status 2>/dev/null || true
24
- done
23
+ har env status --repo {{repo}}
25
24
 
26
25
  cli id cmd *args:
27
- ./agent-cli.sh {{id}} {{cmd}} {{args}}
26
+ har env agent {{id}} {{cmd}} {{args}} --repo {{repo}}