@hybridlabor-api/aos 4.17.0 → 4.18.1

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 (88) hide show
  1. package/.claude/hooks/aos-bus.mjs +8 -4
  2. package/.claude/hooks/go-gate.mjs +1 -1
  3. package/.claude/hooks/go-token.mjs +17 -2
  4. package/.claude/hooks/memb-inject.mjs +61 -37
  5. package/.codex-plugin/plugin.json +1 -1
  6. package/.opencode/commands/bdb-aos-plan.md +1 -1
  7. package/README.md +1 -0
  8. package/THIRD_PARTY_NOTICES.md +2 -2
  9. package/bin/aos-acp.mjs +27 -1
  10. package/bin/aos-doctor.mjs +36 -1
  11. package/bin/aos-uninstall.mjs +16 -2
  12. package/bin/go-check.mjs +79 -0
  13. package/bin/guarded-patterns.json +106 -0
  14. package/commands/plan.md +1 -1
  15. package/docs/codenotch.md +44 -0
  16. package/docs/codex-gate-smoke.md +43 -0
  17. package/docs/delegation-routing.md +32 -0
  18. package/docs/go-check.md +60 -0
  19. package/docs/master-session-acp.md +2 -0
  20. package/docs/opencode-setup.md +18 -0
  21. package/installer.js +155 -70
  22. package/lib/codenotch.js +389 -0
  23. package/lib/retired-skills.js +101 -0
  24. package/mcps/mcsc/README.md +1 -1
  25. package/mcps/mcsc/packages/core/src/adapters/agy.js +3 -1
  26. package/mcps/mcsc/packages/core/src/adapters/codex.js +2 -1
  27. package/mcps/mcsc/packages/core/src/adapters/opencode.js +2 -1
  28. package/mcps/mcsc/packages/core/src/depth.js +16 -0
  29. package/mcps/mcsc/packages/mcp/server.js +15 -2
  30. package/package.json +2 -2
  31. package/plugin-commands.json +1 -2
  32. package/plugin.json +1 -4
  33. package/plugins/bdb-aos-codex/.codex-plugin/plugin.json +1 -1
  34. package/plugins/bdb-aos-codex/skills/plan/SKILL.md +1 -1
  35. package/scripts/codex-gate-smoke.mjs +73 -0
  36. package/skills/basic/master-session/SKILL.md +11 -0
  37. package/skills/global_config/agenttrail/SKILL.md +3 -1
  38. package/skills/global_config/agenttrail/bin/agenttrail.mjs +255 -117
  39. package/skills/global_config/agenttrail/bin/ensure.mjs +60 -40
  40. package/skills/global_config/agenttrail/bin/repoid.mjs +70 -0
  41. package/skills/global_config/agenttrail/public/index.html +9 -1
  42. package/skills/global_config/aos-setup/scripts/aos-doctor.mjs +1 -1
  43. package/skills/global_config/bdb-memb-mcp/SKILL.md +5 -4
  44. package/skills/global_config/bdb-visual-edit/SKILL.md +28 -32
  45. package/skills/global_config/bdb-visual-edit/references/vite-react-source-attr.md +2 -2
  46. package/skills/global_config/bdb-visual-edit/scripts/locate-source.mjs +135 -0
  47. package/skills/global_config/bdb-visual-edit/scripts/sanitize-element.mjs +30 -2
  48. package/skills/global_config/mcsc/SKILL.md +9 -1
  49. package/skills/global_config/plan-arbiter/SKILL.md +1 -1
  50. package/skills/global_config/plan-canvas/SKILL.md +42 -4
  51. package/skills/global_config/plan-canvas/scripts/lib/plan-builder/README.md +1 -1
  52. package/skills/global_config/plan-canvas/scripts/lib/plan-builder/render.js +2 -2
  53. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/geometry.js +76 -0
  54. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/index.js +596 -0
  55. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/model.js +192 -0
  56. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/toolbar.js +99 -0
  57. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-server.js +282 -0
  58. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotation-schema.js +210 -0
  59. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/route.js +10 -0
  60. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/sdk.js +6 -230
  61. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/server.js +45 -4
  62. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/sessions.js +60 -21
  63. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/trail-on-approve.js +103 -0
  64. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/ui.js +19 -7
  65. package/skills/global_config/plan-canvas/scripts/plan-canvas.js +118 -20
  66. package/skills/global_config/subagent-setup/SKILL.md +6 -0
  67. package/skills/global_config/subagent-setup/scripts/setup-subagents.mjs +20 -1
  68. package/skills/playbooks/pb-idea-to-launch/SKILL.md +2 -2
  69. package/skills/playbooks/pb-redesign-app/SKILL.md +3 -3
  70. package/skills/playbooks/pb-release-aos/SKILL.md +2 -2
  71. package/skills/playbooks/pb-ship/SKILL.md +2 -2
  72. package/skills/playbooks/pb-worktrees-land/SKILL.md +2 -2
  73. package/skills/global_config/bdb-visual-edit/scripts/pick-snippet.js +0 -27
  74. package/skills/global_config/visual-edit/README.md +0 -96
  75. package/skills/global_config/visual-edit/SKILL.md +0 -615
  76. package/skills/global_config/visual-plan/README.md +0 -93
  77. package/skills/global_config/visual-plan/SKILL.md +0 -544
  78. package/skills/global_config/visual-plan/references/canvas.md +0 -139
  79. package/skills/global_config/visual-plan/references/connection.md +0 -51
  80. package/skills/global_config/visual-plan/references/document-quality.md +0 -186
  81. package/skills/global_config/visual-plan/references/exemplar.md +0 -62
  82. package/skills/global_config/visual-plan/references/local-files.md +0 -99
  83. package/skills/global_config/visual-plan/references/wireframe.md +0 -319
  84. package/skills/global_config/visual-recap/README.md +0 -103
  85. package/skills/global_config/visual-recap/SKILL.md +0 -560
  86. package/skills/global_config/visual-recap/references/connection.md +0 -51
  87. package/skills/global_config/visual-recap/references/local-files.md +0 -99
  88. package/skills/global_config/visual-recap/references/wireframe.md +0 -319
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridlabor-api/aos",
3
- "version": "4.17.0",
3
+ "version": "4.18.1",
4
4
  "description": "AOS — A Curated AI AGENT OS. Optimized agent skills and add-ons like memB, OpenWiki, Heimdall Token Saver, and Godmode architectures.",
5
5
  "main": "installer.js",
6
6
  "engines": {
@@ -29,7 +29,7 @@
29
29
  "plugin:build": "node scripts/build-plugin-manifest.mjs",
30
30
  "plugin:check": "node scripts/build-plugin-manifest.mjs --check",
31
31
  "doctor": "node bin/aos-doctor.mjs",
32
- "test": "node scripts/validate-skills.mjs --selftest && node scripts/validate-skills.mjs && node scripts/build-plugin-manifest.mjs --check && node --test tests/opencode-graph-gate.test.js && node --test tests/cross-harness-hooks.test.js && node --test tests/plan-canvas-security.test.mjs && node --test tests/plan-canvas-modes.test.mjs && node --test tests/swarm-wiring.test.js && node tests/aos-store.test.mjs && node --test tests/aos-store-ui.test.mjs && node tests/aos-store-scenario.test.mjs && node tests/aos-doctor.test.mjs && node tests/build-plugin-manifest.test.mjs && node --test tests/plugin-commands.test.js && node --test tests/playbooks.test.mjs && node --test tests/agent-models.test.js && node --test tests/installer-p3.test.js && node --test tests/plugin-migration.test.js && node --test tests/installer-binary.test.js && node --test tests/installer-version.test.js && node --test tests/mcsc-server.test.js && node --test tests/antigravity-hooks.test.js && node --test tests/windows-hooks.test.js && node --test tests/plan-builder.test.mjs && node --test tests/plan-builder-trail.test.mjs && node --test tests/plan-builder-showcase.test.mjs && node --test tests/plan-builder-templates.test.mjs && node --test tests/plan-canvas-home.test.mjs && node --test tests/launchpad-installer.test.js && node --test tests/launchpad-plan-canvas.test.js && node --test tests/go-token.test.js && node --test tests/go-gate-modes.test.js && node --test tests/go-gate-review.test.js && node --test tests/go-gate-review2.test.js && node --test tests/opencode-gogate.test.js && node --test tests/master-session-skill.test.js && node --test tests/aos-acp.test.js && node --test tests/opencode-go-token.test.js && node --test tests/opencode-adapter.test.js && node --test tests/opencode-install.test.js && node --test tests/pr-recap.test.mjs && node --test tests/bdb-visual-edit.test.mjs && node --test tests/opencode-trail-autostart.test.mjs && node --test tests/trail-autostart-hook.test.mjs && node --test tests/agenttrail-ensure.test.mjs && node --test tests/aos-bus.test.js && node --test tests/installer-quick-update.test.js"
32
+ "test": "node scripts/validate-skills.mjs --selftest && node scripts/validate-skills.mjs && node scripts/build-plugin-manifest.mjs --check && node --test tests/opencode-graph-gate.test.js && node --test tests/cross-harness-hooks.test.js && node --test tests/plan-canvas-security.test.mjs && node --test tests/plan-canvas-modes.test.mjs && node --test tests/swarm-wiring.test.js && node tests/aos-store.test.mjs && node --test tests/aos-store-ui.test.mjs && node tests/aos-store-scenario.test.mjs && node tests/aos-doctor.test.mjs && node tests/build-plugin-manifest.test.mjs && node --test tests/plugin-commands.test.js && node --test tests/playbooks.test.mjs && node --test tests/agent-models.test.js && node --test tests/installer-p3.test.js && node --test tests/plugin-migration.test.js && node --test tests/installer-binary.test.js && node --test tests/installer-version.test.js && node --test tests/mcsc-server.test.js && node --test tests/antigravity-hooks.test.js && node --test tests/windows-hooks.test.js && node --test tests/plan-builder.test.mjs && node --test tests/plan-builder-trail.test.mjs && node --test tests/plan-builder-showcase.test.mjs && node --test tests/plan-builder-templates.test.mjs && node --test tests/plan-canvas-home.test.mjs && node --test tests/launchpad-installer.test.js && node --test tests/launchpad-plan-canvas.test.js && node --test tests/go-token.test.js && node --test tests/go-gate-modes.test.js && node --test tests/go-gate-review.test.js && node --test tests/go-gate-review2.test.js && node --test tests/opencode-gogate.test.js && node --test tests/master-session-skill.test.js && node --test tests/aos-acp.test.js && node --test tests/opencode-go-token.test.js && node --test tests/opencode-adapter.test.js && node --test tests/opencode-install.test.js && node --test tests/pr-recap.test.mjs && node --test tests/bdb-visual-edit.test.mjs && node --test tests/opencode-trail-autostart.test.mjs && node --test tests/trail-autostart-hook.test.mjs && node --test tests/agenttrail-ensure.test.mjs && node --test tests/aos-bus.test.js && node --test tests/installer-quick-update.test.js && node --test tests/no-builderio-visual.test.mjs && node --test tests/retired-skills.test.mjs && node --test tests/plan-canvas-annotate-server.test.mjs && node --test tests/plan-canvas-annotation-schema.test.mjs && node --test tests/plan-canvas-annotate-client.test.mjs && node --test tests/plan-canvas-trail-on-approve.test.mjs && node --test tests/plan-canvas-revive.test.mjs && node --test tests/plan-canvas-route.test.mjs && node --test tests/bdb-visual-edit-locate.test.mjs && node --test tests/agenttrail-worktrees.test.mjs && node --test tests/plan-canvas-e2e-app.test.mjs && node --test tests/plan-canvas-r1.test.mjs && node --test tests/agenttrail-lanes.test.mjs && node --test tests/memb-ambient.test.js && node --test tests/mcsc-depth.test.js && node --test tests/go-check.test.js && node --test tests/coordination-hygiene.test.js && node --test tests/codex-gate-smoke.test.js && node --test tests/setup-subagents-resolve.test.js && node --test tests/codenotch.test.js && node --test tests/installer-dist-tag.test.js"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
@@ -58,12 +58,11 @@
58
58
  "description": "Plan end to end: draft, render in plan-canvas or Plan Builder, annotate, await approval, then hand off.",
59
59
  "skills": [
60
60
  "concise-planning",
61
- "visual-plan",
62
61
  "plan-canvas",
63
62
  "writing-plans"
64
63
  ],
65
64
  "bodies": {
66
- "claude": "Run the full planning pipeline: 1) draft the plan with `concise-planning`; 2) always offer the choice between plan-canvas and Plan Builder (`visual-plan`) for rendering; 3) collect annotations and wait for the human's approval; 4) only after approval continue with `writing-plans` or `/bdb-aos:graph`. Topic: $ARGUMENTS"
65
+ "claude": "Run the full planning pipeline: 1) draft the plan with `concise-planning`; 2) always offer the choice between plan-canvas and Plan Builder (`aos-plan-canvas open <dir> --mode bdb-plan-builder`) for rendering; 3) collect annotations and wait for the human's approval; 4) only after approval continue with `writing-plans` or `/bdb-aos:graph`. Topic: $ARGUMENTS"
67
66
  }
68
67
  },
69
68
  "brainstorm": {
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdb-aos",
3
- "version": "4.17.0",
3
+ "version": "4.18.1",
4
4
  "description": "Full BDB Agent OS suite: 200+ curated skills, 13 subagents and the startcycle pipelines for Claude Code. Gate hooks and MCP servers are installed by the AOS installer.",
5
5
  "author": {
6
6
  "name": "Tim Rennings / Hybridlabor Global LLC",
@@ -222,9 +222,6 @@
222
222
  "./skills/global_config/vercel-ai-sdk-expert",
223
223
  "./skills/global_config/vercel-deployment",
224
224
  "./skills/global_config/verification-before-completion",
225
- "./skills/global_config/visual-edit",
226
- "./skills/global_config/visual-plan",
227
- "./skills/global_config/visual-recap",
228
225
  "./skills/global_config/wcag-audit-patterns",
229
226
  "./skills/global_config/web-artifacts-builder",
230
227
  "./skills/global_config/web-performance-optimization",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdb-aos",
3
- "version": "4.17.0",
3
+ "version": "4.18.1",
4
4
  "description": "Full BDB Agent OS suite for Codex: command entry points ($bdb-aos:setup, $bdb-aos:init, ...) generated from plugin-commands.json.",
5
5
  "author": {
6
6
  "name": "Tim Rennings / Hybridlabor Global LLC",
@@ -3,4 +3,4 @@ name: plan
3
3
  description: "Plan end to end: draft, render in plan-canvas or Plan Builder, annotate, await approval, then hand off. Generated from plugin-commands.json; invoke as $bdb-aos:plan."
4
4
  ---
5
5
 
6
- Run the full planning pipeline: 1) draft the plan with `concise-planning`; 2) always offer the choice between plan-canvas and Plan Builder (`visual-plan`) for rendering; 3) collect annotations and wait for the human's approval; 4) only after approval continue with `writing-plans` or `$bdb-aos:graph`. Topic: whatever the user wrote after the skill name
6
+ Run the full planning pipeline: 1) draft the plan with `concise-planning`; 2) always offer the choice between plan-canvas and Plan Builder (`aos-plan-canvas open <dir> --mode bdb-plan-builder`) for rendering; 3) collect annotations and wait for the human's approval; 4) only after approval continue with `writing-plans` or `$bdb-aos:graph`. Topic: whatever the user wrote after the skill name
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ // Plan and runner for the Codex hook smoke test. Default: print the plan, run nothing.
3
+ // `--run` calls Codex, which calls a paid API, so it also needs AOS_CODEX_SMOKE=1 and a login
4
+ // inside the throwaway CODEX_HOME (printed in the plan). Everything about firing under ACP
5
+ // is UNVERIFIED until this has been run; see docs/codex-gate-smoke.md.
6
+
7
+ import { spawnSync } from "node:child_process";
8
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
9
+ import { tmpdir } from "node:os";
10
+ import { dirname, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
14
+
15
+ const PROBE = `import { appendFileSync, readFileSync } from "node:fs";
16
+ let input = {};
17
+ try { input = JSON.parse(readFileSync(0, "utf8")); } catch {}
18
+ const cmd = input?.tool_input?.command ?? "";
19
+ appendFileSync(process.env.AOS_SMOKE_MARKER, JSON.stringify({ at: new Date().toISOString(), keys: Object.keys(input), cmd }) + "\\n");
20
+ if (String(cmd).includes("SMOKE_DENY")) { process.stderr.write("smoke: denied by probe hook\\n"); process.exit(2); }
21
+ `;
22
+
23
+ export function buildConfig(probePath) {
24
+ return [
25
+ "[features]",
26
+ "hooks = true",
27
+ "",
28
+ "[[hooks.PreToolUse]]",
29
+ 'matcher = "^(Bash|run_command)$"',
30
+ "[[hooks.PreToolUse.hooks]]",
31
+ 'type = "command"',
32
+ `command = ${JSON.stringify(`node "${probePath}"`)}`,
33
+ "timeout = 10",
34
+ "",
35
+ ].join("\n");
36
+ }
37
+
38
+ export function steps({ dir = "<tmpdir>", bypassTrust = false } = {}) {
39
+ const env = `CODEX_HOME=${dir}/codex-home AOS_SMOKE_MARKER=${dir}/marker.jsonl`;
40
+ const trust = bypassTrust ? " --dangerously-bypass-hook-trust" : "";
41
+ return [
42
+ { id: "setup", text: `Throwaway CODEX_HOME ${dir}/codex-home with config.toml holding the [[hooks.PreToolUse]] stanza that runs ${dir}/probe-hook.mjs. Log in inside it (codex login, or OPENAI_API_KEY); never copy credentials from ~/.codex.` },
43
+ { id: "exec-fires", cmd: `${env} codex exec${trust} --skip-git-repo-check -C ${dir} "Run the shell command: echo smoke-ok"`, expect: "marker.jsonl gains a line with cmd containing 'echo smoke-ok'. If not, hooks do not fire under codex exec (or the hook was not trusted)." },
44
+ { id: "exec-denies", cmd: `${env} codex exec${trust} --skip-git-repo-check -C ${dir} "Run the shell command: echo SMOKE_DENY"`, expect: "marker line for SMOKE_DENY exists and the command did not run (the agent reports it was blocked)." },
45
+ { id: "acp-fires", cmd: `${env} node ${join(root, "bin", "aos-acp.mjs")} codex --name smoke --cwd ${dir} --allow-default allow --timeout 180 --prompt "Run the shell command: echo smoke-acp"`, expect: "marker.jsonl gains a line with 'echo smoke-acp'. UNVERIFIED: if only the aos-acp permission request fires and the hook does not, aos-acp stays the only gate for Codex." },
46
+ { id: "record", text: "Write the observed result of each step (and the Codex version) into docs/codex-gate-smoke.md, replacing UNVERIFIED with the date and the result. Hook input keys are in marker.jsonl ('keys')." },
47
+ ];
48
+ }
49
+
50
+ const invokedAs = (() => { try { return realpathSync(process.argv[1] || ""); } catch { return ""; } })();
51
+ if (invokedAs === fileURLToPath(import.meta.url)) {
52
+ const run = process.argv.includes("--run");
53
+ const bypassTrust = process.argv.includes("--bypass-trust");
54
+ if (!run) {
55
+ console.log("Codex hook smoke plan (nothing is executed; add --run with AOS_CODEX_SMOKE=1 to run it)\n");
56
+ for (const s of steps({ bypassTrust })) console.log(`[${s.id}] ${s.cmd ?? s.text}${s.expect ? `\n expect: ${s.expect}` : ""}`);
57
+ process.exit(0);
58
+ }
59
+ if (process.env.AOS_CODEX_SMOKE !== "1") { console.error("refusing to run: this calls a paid API. Set AOS_CODEX_SMOKE=1."); process.exit(2); }
60
+ const dir = mkdtempSync(join(tmpdir(), "aos-codex-smoke-"));
61
+ writeFileSync(join(dir, "probe-hook.mjs"), PROBE);
62
+ const home = join(dir, "codex-home");
63
+ mkdirSync(home);
64
+ writeFileSync(join(home, "config.toml"), buildConfig(join(dir, "probe-hook.mjs")));
65
+ const marker = join(dir, "marker.jsonl");
66
+ for (const s of steps({ dir, bypassTrust }).filter((x) => x.cmd)) {
67
+ const before = existsSync(marker) ? readFileSync(marker, "utf8").split("\n").length : 0;
68
+ const r = spawnSync("sh", ["-c", s.cmd], { stdio: "inherit", timeout: 240000 });
69
+ const after = existsSync(marker) ? readFileSync(marker, "utf8").split("\n").length : 0;
70
+ console.log(`[${s.id}] exit ${r.status}; hook fired: ${after > before ? "YES" : "NO"}; expect: ${s.expect}`);
71
+ }
72
+ console.log(`marker and config kept in ${dir} (remove it yourself when done)`);
73
+ }
@@ -20,6 +20,17 @@ One session is the **master**: it keeps the overview, asks workers for status, a
20
20
  - agy: no sanctioned ACP adapter (`antigravity-acp` breaches Google's Antigravity terms). Adopt agy sessions or delegate via the `mcsc` skill.
21
21
  - If AO is installed, `ao-orchestrator` may run the same workers; it adds nothing the token protocol needs.
22
22
 
23
+ ### Routing: which channel for which job
24
+
25
+ | Job | Channel |
26
+ |---|---|
27
+ | One-shot task for another harness | `mcsc` (one level deep, `delegate_agy` is read-only) |
28
+ | A worker that may need a GO | `aos-acp` |
29
+ | A message to a running OpenCode session | `aos-bus` |
30
+ | A durable fleet across repos | AO (optional; AOS must work without it) |
31
+
32
+ Details and limits (`opencode run --auto` auto-approves tool calls, a GO is never inherited): `docs/delegation-routing.md`.
33
+
23
34
  ### `aos-acp` in one paragraph
24
35
 
25
36
  `bin/aos-acp.mjs` is a zero-dependency ACP client: it spawns the adapter (`npx -y @agentclientprotocol/codex-acp`, `opencode acp`, `npx -y @agentclientprotocol/claude-agent-acp`), runs `initialize` → `session/new` → `session/prompt`, streams the worker's text to stdout and logs every event to `~/.aos/acp/<name>.jsonl`. A `session/request_permission` for a guarded command (the go-gate list) is answered `allow_once` only with a valid GO token for `<name>`; with `--go-wait <sec>` the request is parked (log event `permission_pending`, show it as `GO needed`) until the token appears or the wait ends. Everything else follows `--allow-default deny|allow` (deny by default). `--model <id>` is sent as ACP `session/set_config_option` (`configId: "model"`, id is adapter-specific, e.g. `sonnet`, `provider/model`); `fable` ids are rejected (workers run opus, sonnet or haiku), default is the adapter default and is logged. ACP workers are not in `ListAgents`: the roster lists them from the logs.
@@ -33,7 +33,9 @@ It prints the URL (default http://localhost:5330, next free port if taken). Open
33
33
  aos-trail --ensure [--cwd <dir>] [--plan <file>] [--session <id>] [--json]
34
34
  ```
35
35
 
36
- Starts the map detached if none runs for this repo (matched via `/whoami` `repoPath` on 127.0.0.1:5330-5344), opens it at most once per session (state in `$TMPDIR/aos-trail-ensure/`), and always exits 0. Plan: `--plan`, else `production_artifacts/00_execution_plan.md`, else the single `production_artifacts/*/00_execution_plan.md`; it needs a `{#id}` marker. No open under `CI`, SSH, or headless Linux; with `AO_BROWSER_CAPABILITY` it runs `ao preview <url>`. `--json` prints `{url,started,opened,reason,plan,hint}`. Test overrides: `AOS_TRAIL_OPENER` (opener command), `AOS_TRAIL_PORTS=lo-hi` (probe range).
36
+ Starts the map detached if none runs for this repo (matched via `/whoami` `repoPath` on 127.0.0.1:5330-5344). `repoPath` is the repo's main checkout, so every git worktree of a repo finds the same map; the map shows each worktree as its own lane (branch and folder) and files hook events by their `cwd`. `/whoami` also lists `worktrees`, opens it at most once per session (state in `$TMPDIR/aos-trail-ensure/`), and always exits 0. Plan: `--plan`, else `production_artifacts/00_execution_plan.md`, else the single `production_artifacts/*/00_execution_plan.md`; it needs a `{#id}` marker. No open under `CI`, SSH, or headless Linux; with `AO_BROWSER_CAPABILITY` it runs `ao preview <url>`. `--json` prints `{url,started,opened,reason,plan,hint}`. Test overrides: `AOS_TRAIL_OPENER` (opener command), `AOS_TRAIL_PORTS=lo-hi` (probe range).
37
+
38
+ Lanes: main first, then at most 11 worktrees; the slots go to the most recently active ones (a lane with events in the last 10 min keeps its slot), and events from any further worktree of the repo are filed in one `other worktrees` lane, never in main. `/whoami` carries `protocol: 2`. `--ensure` replaces a daemon on this repo (or one of its worktrees) that lacks it: the new map starts first, then the old one is asked to quit via `POST /shutdown` (JSON body naming its own `repoPath`); a daemon that cannot (older ones have no such API) keeps running and `hint` says which port to stop. Two concurrent `--ensure` runs share a lock file in `$TMPDIR/aos-trail-ensure/`. `/setup` on a map with several lanes needs `{"lane": "<key>"}` and writes into that checkout.
37
39
 
38
40
  ## Plan convention
39
41