@osfactory/har 1.0.0-rc.2 → 1.0.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/dist/index.js +4827 -8265
- package/dist/templates/AGENTS.md.template +19 -66
- package/dist/templates/CLAUDE.md.template +1 -5
- package/dist/templates/adaptation-prompt-init.md +7 -6
- package/dist/templates/adaptation-prompt-maintain.md +4 -4
- package/dist/templates/agent-skills/har-wt.md +1 -1
- package/dist/templates/cursor-rule.mdc.template +7 -72
- package/dist/templates/har-boilerplate/gitignore.template +3 -1
- package/dist/templates/har-boilerplate-cli/gitignore.template +3 -1
- package/dist/templates/har-boilerplate-ios/gitignore.template +2 -0
- package/dist/templates/migration-prompt.md +2 -1
- package/dist/templates/profiles/cli/docs/{claude-agent → readme}/definition-of-done.md +3 -3
- package/dist/templates/profiles/cli/docs/{claude-agent → readme}/do-not.md +1 -1
- package/dist/templates/profiles/cli/docs/{claude-agent → readme}/environment.md +3 -3
- package/dist/templates/profiles/cli/docs/readme/for-coding-agents.md +5 -7
- package/dist/templates/profiles/cli/docs/readme/port-shared-services-cli-profile.md +3 -3
- package/dist/templates/profiles/cli/docs/readme/quick-start.md +3 -9
- package/dist/templates/profiles/cli/docs/readme/verification-contract.md +2 -2
- package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +2 -2
- package/dist/templates/profiles/cli/profile.manifest.json +14 -11
- package/dist/templates/profiles/default/docs/readme/architecture.md +1 -1
- package/dist/templates/profiles/default/docs/{claude-agent → readme}/definition-of-done.md +3 -3
- package/dist/templates/profiles/default/docs/{claude-agent → readme}/do-not.md +2 -2
- package/dist/templates/profiles/default/docs/readme/environment.md +19 -0
- package/dist/templates/profiles/default/docs/readme/for-coding-agents.md +4 -6
- package/dist/templates/profiles/default/docs/readme/port-shared-services.md +5 -5
- package/dist/templates/profiles/default/docs/readme/quick-start.md +3 -9
- package/dist/templates/profiles/default/docs/readme/readiness-layers.md +4 -4
- package/dist/templates/profiles/default/docs/{claude-agent → readme}/readiness.md +1 -1
- package/dist/templates/profiles/default/docs/readme/verification-contract.md +1 -1
- package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +2 -2
- package/dist/templates/profiles/default/profile.manifest.json +21 -13
- package/dist/templates/profiles/ios/docs/{claude-agent → readme}/definition-of-done.md +3 -3
- package/dist/templates/profiles/ios/docs/{claude-agent → readme}/do-not.md +1 -1
- package/dist/templates/profiles/ios/docs/{claude-agent → readme}/environment.md +4 -4
- package/dist/templates/profiles/ios/docs/readme/port-shared-services-ios-profile.md +3 -3
- package/dist/templates/profiles/ios/docs/{claude-agent → readme}/project-commands.md +4 -4
- package/dist/templates/profiles/ios/docs/readme/quick-start.md +3 -9
- package/dist/templates/profiles/ios/docs/readme/simulators.md +2 -2
- package/dist/templates/profiles/ios/docs/{claude-agent → readme}/user-flow-validation-rocketsim.md +2 -2
- package/dist/templates/profiles/ios/docs/readme/verification-contract.md +1 -1
- package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +2 -2
- package/dist/templates/profiles/ios/profile.manifest.json +15 -12
- package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +44 -6
- package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +20 -3
- package/dist/templates/runtime-bundles/shared-kernel/launch.sh +20 -3
- package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +20 -3
- package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +20 -3
- package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +20 -3
- package/dist/templates/runtime-bundles/shared-kernel/verify.sh +20 -3
- package/package.json +2 -1
- package/dist/prompts/system-authoring.md +0 -155
- package/dist/templates/profiles/default/docs/claude-agent/environment.md +0 -19
- package/dist/templates/profiles/ios/docs/claude-agent/intro.md +0 -3
- package/dist/templates/shared-docs/claude-agent/intro.md +0 -3
- /package/dist/templates/profiles/cli/docs/{claude-agent → readme}/project-commands.md +0 -0
- /package/dist/templates/profiles/cli/docs/{claude-agent → readme}/readiness.md +0 -0
- /package/dist/templates/profiles/default/docs/{claude-agent → readme}/project-commands.md +0 -0
- /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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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/` — the generated `.har/*.sh` shims are not an editing 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
|
|
@@ -161,8 +161,9 @@ are user-owned: never drift-checked; `har env doctor` only validates names and
|
|
|
161
161
|
executability. Use registered stages for verification steps; use hooks for
|
|
162
162
|
lifecycle side effects.
|
|
163
163
|
|
|
164
|
-
### `.har/
|
|
165
|
-
|
|
164
|
+
### `.har/README.md`
|
|
165
|
+
The harness reference agents read: slot environment, readiness / what "agent
|
|
166
|
+
usable" means here, definition of done, project commands, architecture.
|
|
166
167
|
|
|
167
168
|
### `.har/env.template`, `docker-compose.agent.yml`
|
|
168
169
|
Adapt as needed for the project's infra (`setup-infra.sh` is a shim — the
|
|
@@ -195,7 +196,7 @@ Onboarding may set an initial `agentSlots.max` in `.har/stages.json`. After you
|
|
|
195
196
|
- [ ] For each service in `HARNESS_INFRA_SERVICES`, a matching lane exists in `HARNESS_INFRA_PORT_LANES` in `harness.env`
|
|
196
197
|
- [ ] `.har/README.md` has a **Port & shared services** section (allocation table, shared vs per-slot, do-not rules)
|
|
197
198
|
- [ ] 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
|
|
199
|
+
- [ ] `env.template` and `.har/README.md` show resolved ports via variables, not literals
|
|
199
200
|
- [ ] Monorepos with `har control up`: document slot-1 conflict if the app port overlaps (e.g. Mission Control on 3847)
|
|
200
201
|
|
|
201
202
|
### Git worktree
|
|
@@ -214,7 +215,7 @@ If **`har env init` already created `AGENTS.md`**, refresh the **HAR / agent env
|
|
|
214
215
|
|
|
215
216
|
If **no `AGENTS.md` exists**, create one at the repo root using this structure:
|
|
216
217
|
|
|
217
|
-
- Link to `.har/README.md`
|
|
218
|
+
- Link to `.har/README.md`
|
|
218
219
|
- 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
220
|
- Commands: HAR MCP tools or `har env launch/verify/teardown`
|
|
220
221
|
- Shell shims: `./.har/launch.sh`, `./.har/verify.sh`, `./.har/teardown.sh` — same runtime and run records
|
|
@@ -223,7 +224,7 @@ If **no `AGENTS.md` exists**, create one at the repo root using this structure:
|
|
|
223
224
|
|
|
224
225
|
If **`AGENTS.md` already exists** (project-owned), add or update a concise **HAR / agent environment** section — do not replace unrelated content.
|
|
225
226
|
|
|
226
|
-
Keep **`CLAUDE.md`** as
|
|
227
|
+
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
228
|
|
|
228
229
|
### Monorepos / multiple harnesses
|
|
229
230
|
|
|
@@ -249,7 +250,7 @@ not yours to trim, and wholesale deletion just manufactures drift):
|
|
|
249
250
|
- [ ] `HARNESS_INFRA_SERVICES` lists exactly the services this project uses, each with a lane in `HARNESS_INFRA_PORT_LANES`
|
|
250
251
|
- [ ] All per-slot data stores are provisioned, not just the primary database
|
|
251
252
|
- [ ] If full seed/setup is skipped, `.har/` provides a minimal bootstrap or documents why none is needed
|
|
252
|
-
- [ ] `.har/
|
|
253
|
+
- [ ] `.har/README.md` defines what "agent usable" means for this repo (credentials, default data, smoke workflow) and shows only real URLs/ports/commands
|
|
253
254
|
- [ ] `.har/README.md` documents port allocation and the shared-service model
|
|
254
255
|
- [ ] No hardcoded default ports (`3000`, `15432`, `3847`, …) in app code, tests, or harness docs — use agent env / slot registry
|
|
255
256
|
|
|
@@ -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`, `
|
|
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/
|
|
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/`
|
|
@@ -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`
|
|
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
|
|
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
|
|
|
@@ -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/
|
|
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
|
|
|
@@ -1,79 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: HAR harness workflow — read before
|
|
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.
|
|
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
|
-
|
|
11
|
-
|
|
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
|
|
20
|
+
# Generated at launch (also listed in repo-root .gitignore)
|
|
19
21
|
.env.agent.*
|
|
20
22
|
ecosystem.agent.*.config.cjs
|
|
@@ -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
|
|
20
|
+
# Generated at launch (also listed in repo-root .gitignore)
|
|
19
21
|
.env.agent.*
|
|
20
22
|
ecosystem.agent.*.config.cjs
|
|
@@ -50,5 +50,6 @@ Record the migration and clean up the migration artifacts (`.har/migrate/`, this
|
|
|
50
50
|
1. Never edit `.har/manifest.json` by hand — it is managed by the har CLI.
|
|
51
51
|
2. Do not delete `.har/migrate/backup/` until finalize — it is the only copy of the pre-1.0 adaptations.
|
|
52
52
|
3. Keep `stages.json` stage ids stable — run records and Mission Control reference them.
|
|
53
|
-
4. Update `.har/README.md`
|
|
53
|
+
4. Update `.har/README.md` if commands or workflow notes changed — 1.0 does not
|
|
54
|
+
generate `.har/CLAUDE.agent.md`; its content belongs there.
|
|
54
55
|
5. Commit the migrated harness (shims, `harness.env`, `stages.json`, `.har/hooks/`) once verified — `.har/migrate/` and this prompt are transient and stay untracked.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
## Definition of done
|
|
2
2
|
|
|
3
|
-
- [ ] Full verification returns `"status": "pass"` (`har env verify
|
|
3
|
+
- [ ] Full verification returns `"status": "pass"` (`har env verify <id> --full`, MCP `har_run_verification` with `full: true`, or `har env verify <id> --full`)
|
|
4
4
|
- [ ] The slot is agent-usable for this repo's documented smoke workflow when runtime services are involved
|
|
5
5
|
- [ ] Full verify runs every registered stage in `stages.json` `verificationStages` (Playwright, custom checks, …) — when `stages/browser-e2e.sh` exists, adapt specs under `tests/` for UI changes
|
|
6
6
|
- [ ] New behavior has automated test coverage
|
|
7
7
|
- [ ] Changes committed **in the session worktree** with a clear message
|
|
8
8
|
- [ ] Present session handoff (summary, branch, preview URLs) and **wait for user** before `complete`, push, or PR
|
|
9
|
-
- [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete
|
|
9
|
+
- [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete <id>` (or MCP `har_complete_environment`) — full verify + validation + teardown, branch kept
|
|
10
10
|
|
|
11
11
|
### Session handoff
|
|
12
12
|
|
|
@@ -18,6 +18,6 @@ else as alternatives. If PR tooling is unavailable, recommend complete and repor
|
|
|
18
18
|
the session branch for a manual push. Prefer `complete` over bare `teardown` when
|
|
19
19
|
the work succeeded. See `.cursor/rules/har-workflow.mdc` for the handoff shape.
|
|
20
20
|
|
|
21
|
-
Quick loop: MCP `har_run_verification`, `har env verify
|
|
21
|
+
Quick loop: MCP `har_run_verification`, `har env verify <id>`, or `har env verify <id>`
|
|
22
22
|
|
|
23
23
|
Stages are the harness's single vocabulary for checks: templates and custom stages compile to generic kinds in `.har/stages.json`, and you interact with them only through the registry (`har_run_stage`, `verify`), never stack-specific tooling. Authoring guide: `.har/STAGES.md`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Do not
|
|
2
2
|
|
|
3
3
|
- Work around a failing harness command with ad-hoc setup — fix the harness or report the failure
|
|
4
|
-
- Edit `.env.agent
|
|
4
|
+
- Edit `.env.agent.<id>` by hand
|
|
5
5
|
- Run `verify` before `launch` when e2e needs a running server
|
|
6
6
|
- Edit the main checkout — all edits go under the session work dir
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
| | |
|
|
4
4
|
|--|--|
|
|
5
|
-
| **Agent ID** |
|
|
6
|
-
| **Work dir** | Fresh session worktree per launch — see the launch output or `.har/slots/agent
|
|
5
|
+
| **Agent ID** | <id> |
|
|
6
|
+
| **Work dir** | Fresh session worktree per launch — see the launch output or `.har/slots/agent-<id>.json` |
|
|
7
7
|
|
|
8
8
|
**Never edit the main checkout** — launch FIRST, then make ALL file edits under the work dir from the launch output. An occupied slot always blocks a new launch — run `har env teardown <id>` (or `complete <id>`) first, then launch again.
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
|
|
11
|
+
har env agent <id> status
|
|
12
12
|
```
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
## For coding agents
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
When the project needs Postgres, Redis, or similar, add the service to `docker-compose.agent.yml` (or keep one from the menu), list it in `HARNESS_INFRA_SERVICES` in `harness.env`, and use `setup-infra.sh` — never run raw `docker compose` for shared infra. Shared services run once on fixed ports and serve every agent slot.
|
|
3
|
+
1. Read repo [`AGENTS.md`](../AGENTS.md)
|
|
4
|
+
2. Read this file and `stages.json` — this file is the harness reference:
|
|
5
|
+
slot environment, readiness, definition of done, project commands
|
|
6
|
+
3. Drive the harness with HAR MCP tools or `har env …`; never hardcode ports —
|
|
7
|
+
ask `har env agent <id> url`
|
|
@@ -9,17 +9,17 @@ This profile has **no PM2 app ports** — agents run project commands directly i
|
|
|
9
9
|
| Shared Postgres | Per machine | `HARNESS_DB_PORT_DEFAULT` | Scan `HARNESS_DB_PORT_SCAN_START..END` |
|
|
10
10
|
| Other compose services | Per machine | `HARNESS_*_PORT_DEFAULT` for that service | Scan configured ranges in `harness.env` |
|
|
11
11
|
|
|
12
|
-
When a repo adds a local HTTP server for integration tests, prefer reading ports from `.env.agent.<id>` or
|
|
12
|
+
When a repo adds a local HTTP server for integration tests, prefer reading ports from `.env.agent.<id>` or `har env agent <id>` rather than hardcoding values.
|
|
13
13
|
|
|
14
14
|
### Shared vs per-slot
|
|
15
15
|
|
|
16
16
|
| Resource | Model | Configuration |
|
|
17
17
|
|----------|-------|---------------|
|
|
18
18
|
| Postgres / Redis / mail / … | One shared container on a scanned host port | `HARNESS_INFRA_SERVICES` + matching vars in `harness.env` |
|
|
19
|
-
| Per-slot databases | Cloned from template DB when `db` is enabled | `launch
|
|
19
|
+
| Per-slot databases | Cloned from template DB when `db` is enabled | `har env launch` |
|
|
20
20
|
| Application code | Isolated git worktree per slot | `HARNESS_USE_WORKTREE=true` |
|
|
21
21
|
|
|
22
22
|
### Do not
|
|
23
23
|
|
|
24
24
|
- Hardcode `15432` or other default infra ports in tests — read `AGENT_DB_PORT` from `.env.agent.<id>` or `har_pg`
|
|
25
|
-
- Run raw `docker compose` for harness infrastructure — use `setup-infra
|
|
25
|
+
- Run raw `docker compose` for harness infrastructure — use `har env setup-infra`
|
|
@@ -11,14 +11,8 @@ har env teardown 1
|
|
|
11
11
|
|
|
12
12
|
In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verification`, and `har_teardown_environment`.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
./.har/setup-infra.sh # when HARNESS_INFRA_SERVICES is non-empty
|
|
18
|
-
./.har/launch.sh 1
|
|
19
|
-
./.har/verify.sh 1 # quick: ecosystem smoke (compile/import/build)
|
|
20
|
-
./.har/verify.sh 1 --full # + conventional tests, lint, browser-e2e (if installed)
|
|
21
|
-
./.har/teardown.sh 1
|
|
22
|
-
```
|
|
14
|
+
`./.har/*.sh` exist as compatibility shims over the same runtime — generated,
|
|
15
|
+
never edited, and not the way to drive the harness. Take explicit ownership of
|
|
16
|
+
them with `har env eject`.
|
|
23
17
|
|
|
24
18
|
Read **`stages.json`** and **`verificationStages`**. Optional: `har env add-plugin playwright`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Verification contract
|
|
2
2
|
|
|
3
|
-
Steps in `verify
|
|
3
|
+
Steps in `har env verify` are **project-specific examples** — adapt them to your stack
|
|
4
4
|
during `har env init` / `har env maintain` / benchmark setup. The table describes
|
|
5
5
|
each tier's intent, not a fixed command list.
|
|
6
6
|
|
|
@@ -19,4 +19,4 @@ harness skips slow local-dev setup, document the skipped steps and add a minimal
|
|
|
19
19
|
bootstrap/readiness check when agents need default data, credentials, or an
|
|
20
20
|
authenticated workflow.
|
|
21
21
|
|
|
22
|
-
Use `har env launch 1 --no-worktree`
|
|
22
|
+
Use `har env launch 1 --no-worktree` only when working in the repo root.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
| `hooks/` | Optional lifecycle hooks (`pre-launch.sh`, `post-launch.sh`, `pre-verify.sh`, `pre-teardown.sh`, `post-teardown.sh`) |
|
|
12
12
|
| `plugins/` | Optional local plugins (`har plugin create <id>`) |
|
|
13
13
|
| `docker-compose.agent.yml` | Optional shared infrastructure containers (services listed in `HARNESS_INFRA_SERVICES`) |
|
|
14
|
-
|
|
|
14
|
+
| `.har/README.md` | Detailed instructions for coding agents |
|
|
15
15
|
| `STAGES.md` | Stage registry and script-contract guide |
|
|
16
16
|
| `justfile` | Optional shortcuts (requires `just`) |
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
| File | Purpose |
|
|
21
21
|
|------|---------|
|
|
22
|
-
| `launch
|
|
22
|
+
| `har env launch` / `har env verify` / `har env teardown` / `har env setup-infra` / `preflight.sh` / `agent-cli.sh` | Thin shims forwarding to the packaged runtime (`har env …`); same run records on every surface |
|
|
23
23
|
| `manifest.json` | Runtime version, profile, checksums — managed by the har CLI |
|
|
24
24
|
| `runs/` | Run history from every entry point — `.har/runs/YYYY-MM-DD/HH-mm-ss_<stageId>_agent-<id>.json` (gitignored) |
|
|
25
25
|
| `artifacts/` | Stage outputs: reports, traces, logs |
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "cli",
|
|
3
|
-
"description": "CLI/library
|
|
3
|
+
"description": "CLI/library \u2014 shared kernel + CLI overlay (no PM2)",
|
|
4
4
|
"bundles": [
|
|
5
|
-
{
|
|
6
|
-
|
|
5
|
+
{
|
|
6
|
+
"id": "shared-kernel",
|
|
7
|
+
"path": "runtime-bundles/shared-kernel"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "runtime-cli",
|
|
11
|
+
"path": "har-boilerplate-cli"
|
|
12
|
+
}
|
|
7
13
|
],
|
|
8
14
|
"capabilities": {
|
|
9
15
|
"processManager": "none",
|
|
@@ -44,20 +50,17 @@
|
|
|
44
50
|
"intro",
|
|
45
51
|
"what-s-in-here",
|
|
46
52
|
"quick-start",
|
|
53
|
+
"environment",
|
|
47
54
|
"verification-contract",
|
|
55
|
+
"definition-of-done",
|
|
56
|
+
"readiness",
|
|
48
57
|
"run-history",
|
|
49
58
|
"for-coding-agents",
|
|
59
|
+
"project-commands",
|
|
50
60
|
"port-shared-services-cli-profile",
|
|
61
|
+
"do-not",
|
|
51
62
|
"maintaining-this-harness",
|
|
52
63
|
"session-lifecycle"
|
|
53
|
-
],
|
|
54
|
-
"CLAUDE.agent.md": [
|
|
55
|
-
"intro",
|
|
56
|
-
"environment",
|
|
57
|
-
"readiness",
|
|
58
|
-
"definition-of-done",
|
|
59
|
-
"project-commands",
|
|
60
|
-
"do-not"
|
|
61
64
|
]
|
|
62
65
|
}
|
|
63
66
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Architecture
|
|
2
2
|
|
|
3
|
-
Each agent slot gets isolated app ports. Defaults follow `BASE + (AGENT_ID × HARNESS_PORT_STEP)`; when a default is busy, `launch
|
|
3
|
+
Each agent slot gets isolated app ports. Defaults follow `BASE + (AGENT_ID × HARNESS_PORT_STEP)`; when a default is busy, `har env launch` scans the slot lane (`STEP` increments) and writes the resolved ports to `.env.agent.<id>` and `.har/slots/agent-<id>.json`.
|
|
4
4
|
|
|
5
5
|
Configure how many slots your machine can run in parallel in `.har/stages.json` (`agentSlots`). Bash scripts and the CLI read that first; `harness.env` keeps legacy `HARNESS_AGENT_SLOT_*` exports in sync via `har env maintain --finalize`.
|
|
6
6
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
## Definition of done
|
|
2
2
|
|
|
3
|
-
- [ ] Full verification returns `"status": "pass"` (`har env verify
|
|
3
|
+
- [ ] Full verification returns `"status": "pass"` (`har env verify <id> --full`, MCP `har_run_verification` with `full: true`, or `har env verify <id> --full`)
|
|
4
4
|
- [ ] The slot is agent-usable for this repo's documented smoke workflow, not only health-check green
|
|
5
5
|
- [ ] Full verify runs every registered stage in `stages.json` `verificationStages` (Playwright, custom checks, …) — when `stages/browser-e2e.sh` exists, adapt specs under `tests/` for UI changes
|
|
6
6
|
- [ ] New behavior has automated test coverage (unit and/or browser as appropriate)
|
|
7
7
|
- [ ] Changes committed **in the session worktree** with a clear message
|
|
8
8
|
- [ ] The user got the preview URLs to test the app themselves
|
|
9
9
|
- [ ] Present session handoff (summary, branch, preview URLs) and **wait for user** before `complete`, push, or PR
|
|
10
|
-
- [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete
|
|
10
|
+
- [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete <id>` (or MCP `har_complete_environment`) — full verify + validation + teardown, branch kept
|
|
11
11
|
|
|
12
12
|
### Session handoff
|
|
13
13
|
|
|
@@ -19,6 +19,6 @@ else as alternatives. If PR tooling is unavailable, recommend complete and repor
|
|
|
19
19
|
the session branch for a manual push. Prefer `complete` over bare `teardown` when
|
|
20
20
|
the work succeeded. See `.cursor/rules/har-workflow.mdc` for the handoff shape.
|
|
21
21
|
|
|
22
|
-
Quick loop during development: MCP `har_run_verification`, `har env verify
|
|
22
|
+
Quick loop during development: MCP `har_run_verification`, `har env verify <id>`, or `har env verify <id>` (smoke + health only; `--full` adds the registered verification stages).
|
|
23
23
|
|
|
24
24
|
Stages are the harness's single vocabulary for checks: templates and custom stages compile to generic kinds in `.har/stages.json`, and you interact with them only through the registry (`har_run_stage`, `verify`), never stack-specific tooling. Authoring guide: `.har/STAGES.md`.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
- Hand-roll docker/dev-server startup — `launch` is how you run the app (manual testing, browser, screenshots included)
|
|
4
4
|
- Work around a failing harness command with ad-hoc setup — fix the harness or report the failure
|
|
5
5
|
- Hardcode ports — use agent env / `agent-cli.sh url`
|
|
6
|
-
- Run raw `docker compose` for shared harness infra — use `setup-infra
|
|
6
|
+
- Run raw `docker compose` for shared harness infra — use `har env setup-infra`
|
|
7
7
|
- Start other services of the repo in your slot — only the primary app runs per-slot; shared services are already running
|
|
8
|
-
- Edit `.env.agent
|
|
8
|
+
- Edit `.env.agent.<id>` or PM2 ecosystem files by hand
|
|
9
9
|
- Run `verify` before `launch` when health or e2e steps need a running server
|
|
10
10
|
- Edit the main checkout — all edits go under the session work dir
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Environment
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
|--|--|
|
|
5
|
+
| **Agent ID** | <id> |
|
|
6
|
+
| **Frontend** | http://localhost:${FE_PORT} |
|
|
7
|
+
| **API** | http://localhost:${API_PORT} |
|
|
8
|
+
| **Database** | `agent_<id>` on `localhost:${DB_PORT}` (when `db` is in `HARNESS_INFRA_SERVICES`) |
|
|
9
|
+
| **Work dir** | Fresh session worktree per launch — see the launch output or `.har/slots/agent-<id>.json` |
|
|
10
|
+
|
|
11
|
+
**Never edit the main checkout** — launch FIRST, then make ALL file edits under the work dir from the launch output. Edits there hot-reload in the running slot; use `har env agent <id> restart` if a change doesn't take. An occupied slot always blocks a new launch — run `har env teardown <id>` (or `complete`) first, then launch again.
|
|
12
|
+
|
|
13
|
+
This slot runs **only the primary application** (`HARNESS_PRIMARY_APP`). External dependencies and any supporting services run once, shared by all slots — `har env setup-infra` manages them; never start them yourself.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
har env agent <id> status
|
|
17
|
+
har env agent <id> logs api
|
|
18
|
+
har env agent <id> health
|
|
19
|
+
```
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
## For coding agents
|
|
2
2
|
|
|
3
3
|
1. Read repo [`AGENTS.md`](../AGENTS.md)
|
|
4
|
-
2. Read this file and `stages.json`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Always use `./.har/agent-cli.sh <id> ...` — never hardcoded ports.
|
|
4
|
+
2. Read this file and `stages.json` — this file is the harness reference:
|
|
5
|
+
slot environment, readiness, definition of done, project commands
|
|
6
|
+
3. Drive the harness with HAR MCP tools or `har env …`; never hardcode ports —
|
|
7
|
+
ask `har env agent <id> url`
|