@hybridlabor-api/aos 4.16.0 → 4.18.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 (147) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude/hooks/aos-bus.mjs +8 -4
  3. package/.claude/hooks/env-file-protection.mjs +19 -1
  4. package/.claude/hooks/go-gate.mjs +788 -69
  5. package/.claude/hooks/go-grant.mjs +88 -0
  6. package/.claude/hooks/go-token.mjs +17 -2
  7. package/.claude/hooks/memb-inject.mjs +61 -37
  8. package/.claude/settings.json +8 -0
  9. package/.codex-plugin/plugin.json +36 -6
  10. package/.opencode/commands/bdb-aos-brainstorm.md +5 -0
  11. package/.opencode/commands/bdb-aos-doctor.md +5 -0
  12. package/.opencode/commands/bdb-aos-graph.md +5 -0
  13. package/.opencode/commands/bdb-aos-init.md +5 -0
  14. package/.opencode/commands/bdb-aos-loop.md +5 -0
  15. package/.opencode/commands/bdb-aos-mastersession.md +5 -0
  16. package/.opencode/commands/bdb-aos-memb.md +5 -0
  17. package/.opencode/commands/bdb-aos-orchestrator.md +5 -0
  18. package/.opencode/commands/bdb-aos-plan.md +5 -0
  19. package/.opencode/commands/bdb-aos-playbooks.md +5 -0
  20. package/.opencode/commands/bdb-aos-setup.md +5 -0
  21. package/.opencode/commands/bdb-aos-shipping.md +5 -0
  22. package/.opencode/commands/bdb-aos-startproject.md +5 -0
  23. package/.opencode/commands/bdb-aos-store.md +5 -0
  24. package/.opencode/plugins/bdb-aos.js +54 -10
  25. package/README.md +5 -4
  26. package/THIRD_PARTY_NOTICES.md +2 -2
  27. package/agy-commands/loop.md +5 -0
  28. package/bin/aos-acp.mjs +27 -1
  29. package/bin/aos-doctor.mjs +41 -4
  30. package/bin/aos-uninstall.mjs +41 -3
  31. package/bin/go-check.mjs +79 -0
  32. package/bin/guarded-patterns.json +106 -0
  33. package/commands/brainstorm.md +5 -0
  34. package/commands/doctor.md +5 -0
  35. package/commands/graph.md +5 -0
  36. package/commands/init.md +5 -0
  37. package/commands/loop.md +5 -0
  38. package/commands/mastersession.md +5 -0
  39. package/commands/memb.md +5 -0
  40. package/commands/orchestrator.md +5 -0
  41. package/commands/plan.md +5 -0
  42. package/commands/playbooks.md +5 -0
  43. package/commands/setup.md +5 -0
  44. package/commands/shipping.md +5 -0
  45. package/commands/startproject.md +5 -0
  46. package/commands/store.md +5 -0
  47. package/docs/codenotch.md +44 -0
  48. package/docs/codex-agy-setup.md +16 -0
  49. package/docs/codex-gate-smoke.md +43 -0
  50. package/docs/delegation-routing.md +32 -0
  51. package/docs/go-check.md +60 -0
  52. package/docs/master-session-acp.md +2 -0
  53. package/docs/opencode-setup.md +54 -0
  54. package/docs/plugin-migration.md +61 -0
  55. package/installer.js +351 -121
  56. package/lib/codenotch.js +389 -0
  57. package/lib/plugin-migration.js +462 -0
  58. package/lib/retired-skills.js +101 -0
  59. package/lib/store-ui/index.html +9 -1
  60. package/lib/store-ui/server.mjs +2 -0
  61. package/mcps/mcsc/README.md +1 -1
  62. package/mcps/mcsc/packages/core/src/adapters/agy.js +3 -1
  63. package/mcps/mcsc/packages/core/src/adapters/codex.js +2 -1
  64. package/mcps/mcsc/packages/core/src/adapters/opencode.js +2 -1
  65. package/mcps/mcsc/packages/core/src/depth.js +16 -0
  66. package/mcps/mcsc/packages/mcp/server.js +15 -2
  67. package/package.json +7 -2
  68. package/plugin-commands.json +143 -0
  69. package/plugin.json +299 -0
  70. package/plugins/bdb-aos-codex/.codex-plugin/plugin.json +38 -0
  71. package/plugins/bdb-aos-codex/skills/brainstorm/SKILL.md +6 -0
  72. package/plugins/bdb-aos-codex/skills/doctor/SKILL.md +6 -0
  73. package/plugins/bdb-aos-codex/skills/graph/SKILL.md +6 -0
  74. package/plugins/bdb-aos-codex/skills/init/SKILL.md +6 -0
  75. package/plugins/bdb-aos-codex/skills/loop/SKILL.md +6 -0
  76. package/plugins/bdb-aos-codex/skills/mastersession/SKILL.md +6 -0
  77. package/plugins/bdb-aos-codex/skills/memb/SKILL.md +6 -0
  78. package/plugins/bdb-aos-codex/skills/orchestrator/SKILL.md +6 -0
  79. package/plugins/bdb-aos-codex/skills/plan/SKILL.md +6 -0
  80. package/plugins/bdb-aos-codex/skills/playbooks/SKILL.md +6 -0
  81. package/plugins/bdb-aos-codex/skills/setup/SKILL.md +6 -0
  82. package/plugins/bdb-aos-codex/skills/shipping/SKILL.md +6 -0
  83. package/plugins/bdb-aos-codex/skills/startproject/SKILL.md +6 -0
  84. package/plugins/bdb-aos-codex/skills/store/SKILL.md +6 -0
  85. package/scripts/build-plugin-manifest.mjs +202 -3
  86. package/scripts/codex-gate-smoke.mjs +73 -0
  87. package/skills/basic/master-session/SKILL.md +11 -0
  88. package/skills/bdb-aos/scripts/list-playbooks.mjs +72 -0
  89. package/skills/global_config/agenttrail/SKILL.md +3 -1
  90. package/skills/global_config/agenttrail/bin/agenttrail.mjs +255 -117
  91. package/skills/global_config/agenttrail/bin/ensure.mjs +60 -40
  92. package/skills/global_config/agenttrail/bin/repoid.mjs +70 -0
  93. package/skills/global_config/agenttrail/public/index.html +9 -1
  94. package/skills/global_config/aos-setup/scripts/aos-doctor.mjs +1 -1
  95. package/skills/global_config/bdb-memb-mcp/SKILL.md +5 -4
  96. package/skills/global_config/bdb-visual-edit/SKILL.md +28 -32
  97. package/skills/global_config/bdb-visual-edit/references/vite-react-source-attr.md +2 -2
  98. package/skills/global_config/bdb-visual-edit/scripts/locate-source.mjs +135 -0
  99. package/skills/global_config/bdb-visual-edit/scripts/sanitize-element.mjs +30 -2
  100. package/skills/global_config/gogate/SKILL.md +123 -0
  101. package/skills/global_config/loop-templates/SKILL.md +27 -0
  102. package/skills/global_config/loop-templates/references/ci-until-green.md +27 -0
  103. package/skills/global_config/loop-templates/references/daily-summary.md +27 -0
  104. package/skills/global_config/loop-templates/references/pr-to-merge.md +27 -0
  105. package/skills/global_config/loop-templates/references/review-rounds.md +27 -0
  106. package/skills/global_config/mcsc/SKILL.md +9 -1
  107. package/skills/global_config/plan-arbiter/SKILL.md +1 -1
  108. package/skills/global_config/plan-canvas/SKILL.md +42 -4
  109. package/skills/global_config/plan-canvas/scripts/lib/plan-builder/README.md +1 -1
  110. package/skills/global_config/plan-canvas/scripts/lib/plan-builder/render.js +2 -2
  111. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/geometry.js +76 -0
  112. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/index.js +596 -0
  113. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/model.js +192 -0
  114. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/toolbar.js +99 -0
  115. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-server.js +282 -0
  116. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotation-schema.js +210 -0
  117. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/route.js +10 -0
  118. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/sdk.js +6 -230
  119. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/server.js +45 -4
  120. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/sessions.js +60 -21
  121. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/trail-on-approve.js +103 -0
  122. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/ui.js +19 -7
  123. package/skills/global_config/plan-canvas/scripts/plan-canvas.js +118 -20
  124. package/skills/global_config/subagent-setup/SKILL.md +6 -0
  125. package/skills/global_config/subagent-setup/scripts/setup-subagents.mjs +20 -1
  126. package/skills/playbooks/pb-idea-to-launch/SKILL.md +2 -2
  127. package/skills/playbooks/pb-redesign-app/SKILL.md +3 -3
  128. package/skills/playbooks/pb-release-aos/SKILL.md +2 -2
  129. package/skills/playbooks/pb-ship/SKILL.md +2 -2
  130. package/skills/playbooks/pb-worktrees-land/SKILL.md +2 -2
  131. package/.codex-plugin/marketplace.json +0 -11
  132. package/skills/global_config/bdb-visual-edit/scripts/pick-snippet.js +0 -27
  133. package/skills/global_config/visual-edit/README.md +0 -96
  134. package/skills/global_config/visual-edit/SKILL.md +0 -615
  135. package/skills/global_config/visual-plan/README.md +0 -93
  136. package/skills/global_config/visual-plan/SKILL.md +0 -544
  137. package/skills/global_config/visual-plan/references/canvas.md +0 -139
  138. package/skills/global_config/visual-plan/references/connection.md +0 -51
  139. package/skills/global_config/visual-plan/references/document-quality.md +0 -186
  140. package/skills/global_config/visual-plan/references/exemplar.md +0 -62
  141. package/skills/global_config/visual-plan/references/local-files.md +0 -99
  142. package/skills/global_config/visual-plan/references/wireframe.md +0 -319
  143. package/skills/global_config/visual-recap/README.md +0 -103
  144. package/skills/global_config/visual-recap/SKILL.md +0 -560
  145. package/skills/global_config/visual-recap/references/connection.md +0 -51
  146. package/skills/global_config/visual-recap/references/local-files.md +0 -99
  147. package/skills/global_config/visual-recap/references/wireframe.md +0 -319
@@ -0,0 +1,16 @@
1
+ # Codex and Antigravity (agy) plugin setup
2
+
3
+ Both manifests are generated from `plugin-commands.json` by `node scripts/build-plugin-manifest.mjs` and checked by `--check` (stale or missing files, version drift against `package.json`, referenced files, no `disable-model-invocation` in any Codex output).
4
+
5
+ ## Codex
6
+
7
+ - **Load:** `codex plugin marketplace add <path-to-this-repo>` (it reads `.agents/plugins/marketplace.json`), then `codex plugin add bdb-aos@bdb-aos`.
8
+ - **Invoke:** `$bdb-aos:<cmd>`, for example `$bdb-aos:setup`. Codex has no `/` command for plugin skills.
9
+ - **How it is built:** each command becomes a wrapper skill in `plugins/bdb-aos-codex/skills/<cmd>/SKILL.md`. The plugin ships only these wrappers; the 200+ AOS skills reach Codex through the installer's `~/.codex/skills` copies, and a wrapper tells the model which one to run.
10
+ - **Bodies:** `bodies.codex` is optional; without it the Claude body is used with `/bdb-aos:<cmd>` rewritten to `$bdb-aos:<cmd>`.
11
+
12
+ ## Antigravity (agy)
13
+
14
+ - **Load:** `agy plugin install` against `plugins/bdb-aos` (its `plugin.json` sits at the plugin root), or `agy plugin validate plugins/bdb-aos` to check it.
15
+ - **Invoke:** `/bdb-aos:<cmd>`, for example `/bdb-aos:setup`.
16
+ - **Bodies:** commands reuse `commands/<cmd>.md`. A command with `bodies.agy` is written to `agy-commands/<cmd>.md` and wired instead.
@@ -0,0 +1,43 @@
1
+ # Codex hook smoke test (plan only, not run)
2
+
3
+ Question: does a `PreToolUse` hook fire (a) under `codex exec` and (b) under `aos-acp codex`? If it fires, `go-gate.mjs` is the inner gate for Codex like it is for agy and OpenCode. If it does not under ACP, `aos-acp` stays the only gate for Codex and keeps refusing guarded commands without a GO token.
4
+
5
+ **Status: nothing here has been run.** Codex calls a paid API, so the test needs a working login and your knowledge. Everything below that says UNVERIFIED stays that way until `scripts/codex-gate-smoke.mjs --run` was executed and the result is written in the table at the end.
6
+
7
+ ## What is known (codex-cli 0.154.0, from the plan's section 9b)
8
+
9
+ - `codex features list` shows `hooks stable true`; events include PreToolUse, PermissionRequest, PostToolUse, SessionStart, UserPromptSubmit, Stop.
10
+ - Config: `[[hooks.PreToolUse]]` with `matcher` (regex on the tool name) and `[[hooks.PreToolUse.hooks]]` with `type = "command"`, `command`, `timeout` in `~/.codex/config.toml`.
11
+ - Deny: exit 2 with the reason on stderr, or JSON `decision: "block"` with a reason. `go-gate.mjs` already does this for Codex.
12
+ - Codex keeps a trust state per hook (`--dangerously-bypass-hook-trust` exists). New or changed hooks probably need your approval: **UNVERIFIED**.
13
+ - Hook input: `transcript_path`, `prompt`, `tool_input.command` confirmed; `session_id` and `tool_name` not confirmed.
14
+
15
+ ## Installer
16
+
17
+ The default install already writes the go-gate `[[hooks.PreToolUse]]` stanza (matcher `^(Bash|run_command)$`) into the Codex `config.toml` block between `# AOS:HOOKS:START` and `# AOS:HOOKS:END`. `aos --codex-gate` prints exactly that stanza plus the trust note and exits without writing anything, so you can inspect or copy it. Codex asks you to trust new or changed hooks; approve the go-gate hook there or it stays inactive.
18
+
19
+ ## Procedure
20
+
21
+ `node scripts/codex-gate-smoke.mjs` prints the plan and executes nothing. `AOS_CODEX_SMOKE=1 node scripts/codex-gate-smoke.mjs --run` runs it in a throwaway `CODEX_HOME` with a probe hook that appends each hook call to a marker file (and denies a command containing `SMOKE_DENY`). Log in inside that `CODEX_HOME` yourself; the script never reads `~/.codex`. `--bypass-trust` adds `--dangerously-bypass-hook-trust` to the Codex calls.
22
+
23
+ | Step | Command shape | Pass |
24
+ |---|---|---|
25
+ | exec-fires | `codex exec ... "Run the shell command: echo smoke-ok"` | marker has a line for that command |
26
+ | exec-denies | same with `echo SMOKE_DENY` | marker line exists and the command did not run |
27
+ | acp-fires | `aos-acp codex --name smoke --cwd <dir> --allow-default allow --prompt "Run the shell command: echo smoke-acp"` | marker has a line for that command |
28
+
29
+ The `CODEX_HOME` variable and the `-C` flag of `codex exec` are assumed from general knowledge of the CLI and are UNVERIFIED; adjust the plan if Codex rejects them.
30
+
31
+ ## Decision after the run
32
+
33
+ - exec fires, ACP fires: wire go-gate as the inner gate for Codex under ACP; `aos-acp codex` can then default to `--no-consume` like claude and opencode (the hook consumes the token).
34
+ - exec fires, ACP does not: keep `aos-acp codex` as the gate (`consume` stays on); document that Codex workers are covered only by `aos-acp`.
35
+ - exec does not fire: check the trust state first; otherwise Codex has no inner gate at all.
36
+
37
+ ## Results
38
+
39
+ | Step | Date | Codex version | Result |
40
+ |---|---|---|---|
41
+ | exec-fires | | | UNVERIFIED |
42
+ | exec-denies | | | UNVERIFIED |
43
+ | acp-fires | | | UNVERIFIED |
@@ -0,0 +1,32 @@
1
+ # Delegation routing: which channel for which job
2
+
3
+ AOS works without AO. Pick the channel by the job, not by habit.
4
+
5
+ | Job | Channel | Why |
6
+ |---|---|---|
7
+ | One-shot task for another harness (research, review, a bounded edit) | `mcsc` (`delegate_opencode`, `delegate_codex`, `delegate_agy`) | one call, one answer, live events on agenttrail |
8
+ | A worker that may need a GO (push, merge, publish, destructive) | `aos-acp` | ACP client: guarded commands need a GO token for the worker name, `--go-wait` parks the request, events go to agenttrail and `~/.aos/acp/<name>.jsonl` |
9
+ | A message to an OpenCode session that is already running | `aos-bus` | `aos-bus send <name> <text>`; OpenCode only, never counts as a human GO |
10
+ | A durable fleet of long-lived workers across repos | AO (optional) | the daemon, dashboard and worktrees; AOS must keep working without it |
11
+
12
+ Both `mcsc` and `aos-acp` write the same event protocol to agenttrail (`SessionStart`, `PreToolUse`, `PostToolUse`, `SessionEnd`), so the GO board reads one source.
13
+
14
+ ## Limits that apply to every row
15
+
16
+ - **mcsc is one level deep.** Every adapter sets `MCSC_DEPTH` to the caller's depth plus one; a server that starts at depth 1 or more refuses all delegation. A delegated agent cannot delegate again.
17
+ - **`delegate_agy` is read-only until tested.** Use it for research, review and analysis. Its `write` flag (`--mode accept-edits`) is untested and not part of the contract.
18
+ - **`opencode run --auto` auto-approves tool calls.** It skips the permission prompt, so nothing but the gate hooks stands between the worker and a guarded command. Prefer `aos-acp opencode` (permissions answered by the GO rules) or `mcsc`; use `--auto` only in a throwaway worktree with the go-gate plugin loaded, and never to run a guarded action.
19
+ - **agy over ACP:** no sanctioned adapter (`antigravity-acp` breaches Google's Antigravity terms). Use `mcsc` or adopt an agy session.
20
+ - **A GO is not inherited.** A worker, subagent or delegated run never gets its caller's GO; a blocked command is not retried without a fresh one.
21
+ - **Coverage:** `aos-acp` sees only what the agent asks permission for. A worker running with permissions bypassed asks for nothing, so the hook inside the harness stays the main layer. Hook firing under ACP is verified for Claude only; for Codex it is UNVERIFIED (`docs/codex-gate-smoke.md`).
22
+
23
+ ## The `opencode-subagent` skill
24
+
25
+ That skill is installed under `~/.agents/skills/` and is not part of this repository, so it cannot be changed from here. Its text should say:
26
+
27
+ - delegate with `mcsc` (`delegate_opencode`) for one-shot tasks and `aos-acp opencode --name <worker> --cwd <worktree> --prompt "<task>"` for workers that may need a GO;
28
+ - warn that `opencode run --auto` auto-approves tool calls and bypasses the permission prompt, and name the exception above.
29
+
30
+ ## For AO
31
+
32
+ AO is an optional consumer. A bounded call to `~/.aos/bin/go-check.mjs` decides whether a guarded command may run (`docs/go-check.md`). AOS documents AO only as the last row of the table.
@@ -0,0 +1,60 @@
1
+ # go-check: one GO check for callers that are not a hook
2
+
3
+ `go-check.mjs` answers "may this worker run this guarded command?" with the same classifier and token logic as `go-gate.mjs`, so AO (or any other supervisor) does not rebuild transcript and token handling. The installer places it at a fixed path you can find without running `aos` (an `aos` call starts the installer):
4
+
5
+ ```
6
+ ~/.aos/bin/go-check.mjs the CLI
7
+ ~/.aos/bin/go-gate.mjs copy it imports (same directory)
8
+ ~/.aos/bin/guarded-patterns.json the guarded patterns, for reference
9
+ ```
10
+
11
+ Source: `bin/go-check.mjs`, `bin/guarded-patterns.json` (regenerate with `node bin/go-check.mjs --write-patterns bin/guarded-patterns.json`; a test fails on drift).
12
+
13
+ ## Call
14
+
15
+ ```
16
+ node ~/.aos/bin/go-check.mjs --session <Name> --command "<shell string>" [--consume]
17
+ ```
18
+
19
+ - `--session` is the stable worker slug (`AOS_SESSION_NAME`). The token for `GO <Name>` is looked up under that name.
20
+ - `--command` is a **shell string**, not an argv array. The patterns are anchored on `^`, `;`, `|`, `&&`, `$(`, backticks and wrappers (`sudo`, `env`, `bash -c`, ...). The caller must build the string from its provider's tool input (for ACP, `RawInput`). If the form of an `execute` call is unknown, treat it as guarded-unknown: hand it to the human approval surface, never allow it automatically.
21
+ - Without `--consume` the token is only verified. With `--consume` it is used up (one token, one guarded command). Pass `--consume` only on the final allow.
22
+
23
+ ## Output and exit codes
24
+
25
+ stdout is one JSON line: `{"guarded": bool|null, "ok": bool, "scope": [...]|null, "reason": "..."}`.
26
+
27
+ | Exit | Meaning | Caller |
28
+ |---|---|---|
29
+ | 0 | allowed: not guarded, or a valid GO token (consumed with `--consume`) | allow |
30
+ | 1 | guarded and no valid GO (also: the command touches the GO/grant store) | hand over to the human surface |
31
+ | 2 | error (bad arguments, missing `go-gate.mjs`, unreadable state) | treat as denied, never allow |
32
+
33
+ `scope` is the list of grant scopes the command needs (`push-feature`, `push-main`, `merge`, `publish`, `destructive`, `github-write`), or `null` when a guarded part has no scope. Scopes are informational here: they do not select a grant.
34
+
35
+ ## What it deliberately does not do
36
+
37
+ - **Tokens only (v1).** A valid `~/.aos/go/<Name>.token` (under 10 min old, names this session, master transcript still ends with that `GO <Name>`, not yet used) covers any guarded command, including `gh pr merge 117`. `GO #117` style PR-scoped GOs live in the transcript path of `go-gate.mjs` and are not read here.
38
+ - **Mode `soft` grants are never read.** They belong to the human session (`~/.aos/gate`), and a worker must not be able to use them.
39
+ - **Mode `off` never applies.** go-check does not look at the gate store at all.
40
+ - **It never mints a token.** With `AOS_ACP_CLIENT=1` (set in every AO worker environment) the result is the same: no token is written anywhere. Tokens are created only by the `UserPromptSubmit` hook `go-token.mjs` from a human-typed `GO <Name>`.
41
+ - **No network, no stdin, no subprocess.** One call takes roughly 60 to 150 ms. Callers should still apply their own timeout (3 s suggested); a timeout counts as exit 2.
42
+
43
+ ## Coverage limits (inherited, say them out loud)
44
+
45
+ - The ACP client only sees what the agent asks for. `bypassPermissions` never sends `session/request_permission`, and a TUI (PTY) session has no AO interception point. The hook inside the harness stays the main layer; go-check is the second layer for harnesses without hooks.
46
+ - Whether Claude's hook fires under `bypassPermissions`, and whether Codex hooks fire under ACP, is UNVERIFIED (see `docs/codex-gate-smoke.md`).
47
+ - A token that is still valid is not bound to one command: it covers the next guarded command the worker asks about. `--consume` makes it one command.
48
+
49
+ ## Patterns file
50
+
51
+ `guarded-patterns.json` holds `{version, source, scopes, patterns: [{source, flags}]}` in JavaScript RegExp syntax. It uses lookaheads, which Go's RE2 does not support, so do not port it. Call go-check instead; the file exists so AO can show or diff the list.
52
+
53
+ ## Failure cases for AO
54
+
55
+ | Situation | Behaviour |
56
+ |---|---|
57
+ | `~/.aos/bin/go-check.mjs` missing (AOS not installed) | feature off, AO behaves as before |
58
+ | installed, exit 2, no `node`, or timeout | do not allow; hand over |
59
+ | exit 1 | hand over to the approval surface |
60
+ | exit 0 | allow; `--consume` only at the final allow |
@@ -42,6 +42,8 @@ Double gate: opencode and claude workers also run their own AOS gate inside the
42
42
 
43
43
  `~/.aos/acp/<name>.jsonl` (override `--log`): `start`, `send`, `initialized`, `session`, `text`, `tool_call`, `tool_call_update`, `permission_pending`, `permission`, `done`, `error`, `agent_stderr`. The master builds its roster and GO board for ACP workers from these files; `ListAgents` does not see them.
44
44
 
45
+ The same run is also posted to agenttrail with mcsc's protocol (`mcps/mcsc/packages/core/src/trail.js`): `SessionStart` and `SessionEnd` (session id `aos-acp-<pid>-<ms>`, agent `<adapter>:<name>`), and `PreToolUse` / `PostToolUse` per ACP `tool_call` / `tool_call_update` (`tool_name` from the ACP `kind`, `tool_input.file_path` from `locations`, `tool_input.command` from `rawInput`). Best effort, 300 ms per port, `AGENTTRAIL_PORT` overrides the 5330 to 5344 scan.
46
+
45
47
  ## Open points
46
48
 
47
49
  - Codex live run not verified (auth). With `OPENAI_API_KEY` or a ChatGPT login it should pass the same smoke.
@@ -0,0 +1,54 @@
1
+ # OpenCode setup
2
+
3
+ The AOS installer copies these into `~/.config/opencode` (`%APPDATA%\opencode` on Windows):
4
+
5
+ - `plugins/bdb-aos.js` with `plugins/aos-hooks/` and `plugins/lib/` (go-gate, loop keeper, bus)
6
+ - `commands/startcycle-graph.md` and one generated `commands/bdb-aos-<cmd>.md` per AOS command, called as `/bdb-aos-<cmd>` (flat hyphen names; a colon is not valid in Windows file names)
7
+
8
+ The command files are generated from `plugin-commands.json` by `node scripts/build-plugin-manifest.mjs` and checked by `--check`. A command may carry `bodies.opencode`; without it the Claude body is used with `/bdb-aos:<cmd>` rewritten to `/bdb-aos-<cmd>`.
9
+
10
+ ## Updating and your edits
11
+
12
+ - A command file you edited is kept; the shipped version lands next to it as `<file>.new`.
13
+ - A file that already existed under a shipped name but was never installed by AOS is kept the same way.
14
+ - The installer never deletes files it did not create.
15
+
16
+ ## Lean MCP set
17
+
18
+ OpenCode deliberately runs a small MCP set (`memb_mcp`, `deja`, `zavora_computer_use`). AOS never copies other harnesses' MCP lists into OpenCode and never adds ComfyUI or show-control MCPs there. Media playbooks stop with "Missing MCP" on OpenCode by design.
19
+
20
+ ## Optional components (off by default)
21
+
22
+ ```bash
23
+ AOS_OPENCODE_OPTIONAL=ponytail,loop,rtk aos # or: aos --opencode-optional=ponytail,loop,rtk
24
+ ```
25
+
26
+ - `ponytail`: appends `@dietrichgebert/ponytail@4.10.0` to `plugin[]`
27
+ - `loop`: appends `@bybrawe/opencode-loop@0.6.2` to `plugin[]`
28
+ - `rtk`: prints `brew install rtk && rtk init -g --opencode`; AOS installs nothing
29
+
30
+ Entries are appended only when no entry for that package exists, after a timestamped `opencode.jsonc.<ts>.bak` backup. AOS never runs foreign installers (the `opencode-loop` npx installer rewrites the config) and skips `orca-opencode-status.js` (the Orca app maintains it) and `dag.jsonc` / GraphAgent (AGPL engine, different program).
31
+
32
+ ## Optional permission (off by default)
33
+
34
+ ```bash
35
+ AOS_OPENCODE_PERMISSION=external_directory aos # or: aos --opencode-permission=external_directory
36
+ ```
37
+
38
+ Without it OpenCode asks on every access outside the working directory, including `~/.agents` skills. The opt-in sets only `permission.external_directory`, scoped to AOS paths:
39
+
40
+ ```json
41
+ "permission": { "external_directory": { "~/.agents/**": "allow", "~/.config/opencode/**": "allow" } }
42
+ ```
43
+
44
+ - An existing `permission.external_directory` (any form) is left untouched and a note is printed. A string `permission` (for example `"allow"`) is refused, not replaced. Unparseable config is refused.
45
+ - A timestamped `.bak` backup is made before the change; a second run changes nothing and makes no backup. Writing the config drops `//` comments, as with every other AOS config write.
46
+ - Schema evidence: the OpenCode 1.18.30 binary accepts a string or a pattern record for `external_directory`, and the permissions docs show `~` and `$HOME` expansion in patterns. Whether the `**` globs match the AOS paths on your machine was not run against a live OpenCode.
47
+ - Uninstall: AOS does not record this key, so it stays in place as your config. Remove it by hand.
48
+ - Nothing else is touched: no other `permission` key and no `mcp` entry.
49
+
50
+ ## Known limits
51
+
52
+ - **`/loop-shell` and the go-gate (unverified).** `opencode-loop` can run shell commands as child processes. `tool.execute.before`, where the AOS go-gate sits, may never see them. Do not schedule `git push`, publish or other gated commands through them. The installer prints this warning whenever `opencode-loop` is in `plugin[]`.
53
+ - **Machine prompts are never human.** Every prompt the plugin sends itself (loop nudge, bus wake) is `synthetic` and carries `aos_loop` or `aos_bus` metadata, so it cannot count as a GO. A test scans the plugin source for this.
54
+ - **Double loading of `bdb-aos.js`.** OpenCode auto-loads `plugins/*.{ts,js}` and also loads paths in `plugin[]`. From the 1.18.30 binary strings: both lists are merged through one de-duplication keyed on the `file://` URL, so the same absolute path loads once (read from the binary, not observed by running OpenCode). A differently spelled second path (checkout path, symlinked config dir) would load twice, giving two gates and two loop keepers. The installer registers exactly one path, `<config>/plugins/bdb-aos.js`, and warns when `plugin[]` holds another spelling.
@@ -0,0 +1,61 @@
1
+ # Plugin registration and loose-copy migration
2
+
3
+ The installer registers the `bdb-aos` plugin for Claude Code, then removes only its own loose skill copies there. Hooks, MCP servers, `trail-autostart` and the bus stay in the installer, so disabling the plugin never disables the go-gate.
4
+
5
+ | Harness | Loose copies | Why |
6
+ |---|---|---|
7
+ | Claude Code | **removed** from `~/.claude/skills` only after registration **and** evidence that Claude Code installed the plugin | the plugin bundles the skills |
8
+ | Codex | stay (`~/.codex/skills`) | the Codex plugin bundles only the command wrapper skills; nested skill scanning is unverified |
9
+ | agy | stay (`~/.gemini/config/skills`) | skill bundling is unverified (`agy plugin validate` processed 9 skills) |
10
+ | OpenCode | stay | plugins cannot bundle skills |
11
+ | all | `~/.agents/skills` always stays as the shared store | |
12
+
13
+ ## Rules
14
+
15
+ - **Registration first, evidence second.** Registration means `settings.json` holds the marketplace and `enabledPlugins` keys; that alone proves nothing about an installed plugin. Copies are removed only when Claude's plugin state shows the install: an entry for `bdb-aos@bdb-marketplace` in `~/.claude/plugins/installed_plugins.json`, or a cache directory `~/.claude/plugins/cache/bdb-marketplace/bdb-aos/<version>`. Either way the directory must resolve (realpath) under `~/.claude/plugins`, must not be cached from another (older external) marketplace, and must contain `skills/<name>/SKILL.md` for a skill the install manifest lists for `~/.claude/skills`. `installPath: "/"`, an empty `skills` dir or a path elsewhere do not count. The `installed_plugins.json` shape (`{version, plugins: {"<name>@<marketplace>": [{installPath, ...}]}}`) is verified against other plugins on a local machine; that `bdb-aos` writes the same shape and the cache layout fallback are **inferred**, not observed.
16
+ - **Not verifiable yet.** The installer registers the plugin, keeps every copy and prints "restart Claude Code, then run the installer again to retire the loose copies". The retirement happens on a later run once the evidence exists. Until then the installer keeps writing `~/.claude/skills` as before.
17
+ - **Ordering.** The migration runs before the install target loop. Once Claude is covered, `~/.claude/skills` is not written again, so a rerun changes nothing and creates no backup.
18
+ - **Merge, never overwrite.** Other keys survive. `settings.json` is backed up (`settings.json.<ts>.bak`) before a change; an unchanged file is not rewritten. A symlinked `settings.json` is written through to its real file and stays a link.
19
+ - **Opt-out.** `"bdb-aos@bdb-marketplace": false` in `enabledPlugins` (or `bdb-aos@<old external key>: false`): nothing is registered, nothing is removed.
20
+ - **Own copies only, safely resolved.** A file is removed when the install manifest lists it and its bytes still match the recorded hash. Keys with `..` or relative paths are rejected; each file and the root are resolved with `path.resolve` and `fs.realpathSync`, the real file must be a regular file under the real root. If `~/.claude/skills` itself is a symlink, nothing is removed. Edited files and files not in the manifest stay.
21
+ - **All or nothing.** If any listed copy is edited or unsafe, nothing is removed, Claude is not treated as covered, the installer names the skills involved and keeps updating the copies it owns. Move your edits out and run the installer again to retire them.
22
+ - **OpenWiki daemon.** `openwiki-skill/scripts/` is never retired, and the daemon is installed and run from the installer-owned `~/.agents/skills/openwiki-skill/scripts` (copied there when missing), so scheduled jobs never point into `~/.claude/skills`.
23
+ - **Malformed settings.** If `enabledPlugins` or `extraKnownMarketplaces` exists but is not a plain object, registration is refused and nothing is written.
24
+ - **One at a time.** A lock file (`~/.agents/.bdb-plugin-migration.lock`, stale after ten minutes or a dead pid) keeps two migrations apart; a file that vanishes mid-run is skipped.
25
+ - **Backup before removal.** Removed files are copied to `~/.agents/backups/plugin-migration-<timestamp>/` keeping their path relative to `$HOME`.
26
+ - **External marketplace.** An entry pointing at `hybridlabor-api/bdb-marketplace` is replaced by this repo's marketplace (`hybridlabor-api/aos`) only when no other plugin id uses it. Only `bdb-aos@<oldkey>` is renamed to `bdb-aos@bdb-marketplace`; other plugins' ids are never renamed. A foreign marketplace that also lists other plugins stays in place. If the name `bdb-marketplace` itself is that external marketplace with other plugins, or points at another source, registration is refused with a message and nothing changes. Nothing on GitHub is changed.
27
+ - **Old command files.** Command files from earlier versions that are no longer in the generated table are not touched by the migration; they are neither removed nor backed up. Only the generated `commands/` set is kept in sync by `scripts/build-plugin-manifest.mjs`.
28
+ - **State.** `~/.agents/.bdb-plugin-migration.json` records each change: `addedMarketplace`, `addedEnabled`, `replaced`, `renames`, `keptForeign`. Deregistering reverses exactly those.
29
+
30
+ ## Packaging
31
+
32
+ The npm package ships `plugins/bdb-aos-codex/` (a real directory) and the root manifests (`plugin.json`, `.codex-plugin/`, `.agents/plugins/marketplace.json`, `commands/`, `agy-commands/`). `plugins/bdb-aos/` is built from symlinks and is **not** in the npm package. The Claude Code plugin directory (`.claude-plugin/` and `plugins/bdb-aos/`) is git-only: Claude installs it from the GitHub marketplace `hybridlabor-api/aos`, not from npm. `.agents/plugins` (the Codex marketplace file) is excluded from the `.agents` copies into `~/.agents` and project directories.
33
+
34
+ The root `.codex-plugin/.mcp.json` is no longer referenced: the previous manifest pointed at it through an `mcp_config` key, which real Codex plugins do not use (they use `mcpServers`). It stays unreferenced on purpose, because the installer already registers the MCP servers in Codex's config and the plugin would register them twice. The plugin therefore delivers no MCP servers.
35
+
36
+ ## Opt out and preview
37
+
38
+ ```bash
39
+ AOS_PLUGIN_MIGRATION=off npx -y @hybridlabor-api/aos@latest # skip entirely
40
+ AOS_PLUGIN_MIGRATION=check npx -y @hybridlabor-api/aos@latest # report only
41
+ npx -y @hybridlabor-api/aos@latest --plugin-migration=off|check
42
+ ```
43
+
44
+ `--dry-run` implies `check`. Default is on.
45
+
46
+ ## Undo
47
+
48
+ ```bash
49
+ aos-uninstall --restore-plugin-backup # puts removed files back, never overwrites an existing file
50
+ aos-uninstall # also removes the plugin registration it added and restores a replaced external marketplace
51
+ ```
52
+
53
+ ## Known limits
54
+
55
+ - The lock guards migrations only. An installer copy running at the same moment in another process is not serialized; a file removed under it is skipped, and the next run reconciles.
56
+ - Until Claude Code shows the plugin as installed, both copies exist; skills may then appear twice after the plugin loads and before the next installer run retires the copies.
57
+ - `aos-doctor` accepts the plugin evidence as Claude having the skills.
58
+ - A deregister that reverses a marketplace rename keeps the content of `enabledPlugins` but may reorder its keys (cosmetic).
59
+ - Restoring a backup after an uninstall creates a new install manifest and puts the legacy `~/.claude/skills/startcycle` marker back, so AOS is detected as installed again.
60
+
61
+ Backups survive uninstall (the state keeps its backup index and `~/.agents/backups/plugin-migration-*` is scanned), so `--restore-plugin-backup` also works afterwards. Restored files are recorded in the install manifest, and the restore deregisters the plugin so skills are not loaded twice; the restore also sets `bdb-aos@bdb-marketplace` to `false` in `settings.json` (the opt-out), so the next installer run does not register the plugin or retire the restored files. Set it back to `true` to migrate again.