overlord-cli 0.2606090710.0 → 0.2607081118.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 (160) hide show
  1. package/README.md +263 -142
  2. package/bin/ovld.mjs +3 -8
  3. package/dist/connectors/AGENTS.md +148 -0
  4. package/dist/connectors/README.md +73 -0
  5. package/dist/connectors/VERSION +1 -0
  6. package/dist/connectors/adapters/antigravity/README.md +91 -0
  7. package/dist/connectors/adapters/antigravity/conformance-manifest.yaml +41 -0
  8. package/dist/connectors/adapters/antigravity/hooks.json +30 -0
  9. package/dist/connectors/adapters/antigravity/mcp_config.json +9 -0
  10. package/dist/connectors/adapters/antigravity/plugin.json +22 -0
  11. package/dist/connectors/adapters/antigravity/prompt-wrapper.md +17 -0
  12. package/dist/connectors/adapters/antigravity/scripts/overlord-mcp.mjs +175 -0
  13. package/dist/connectors/adapters/antigravity/scripts/pre-invocation-hook.sh +79 -0
  14. package/dist/connectors/adapters/antigravity/scripts/pre-tool-use-hook.sh +25 -0
  15. package/dist/connectors/adapters/antigravity/skills/add-objectives.md +12 -0
  16. package/dist/connectors/adapters/antigravity/skills/attach.md +16 -0
  17. package/dist/connectors/adapters/antigravity/skills/connect.md +16 -0
  18. package/dist/connectors/adapters/antigravity/skills/create.md +14 -0
  19. package/dist/connectors/adapters/antigravity/skills/discuss-objective.md +16 -0
  20. package/dist/connectors/adapters/antigravity/skills/load.md +16 -0
  21. package/dist/connectors/adapters/antigravity/skills/overlord-mission/SKILL.md +29 -0
  22. package/dist/connectors/adapters/antigravity/skills/prompt.md +14 -0
  23. package/{plugins/antigravity/commands → dist/connectors/adapters/antigravity/skills}/record-work.md +8 -9
  24. package/dist/connectors/adapters/antigravity/skills/spawn.md +16 -0
  25. package/dist/connectors/adapters/claude/.claude-plugin/plugin.json +34 -0
  26. package/dist/connectors/adapters/claude/README.md +93 -0
  27. package/dist/connectors/adapters/claude/commands/add-objectives.md +15 -0
  28. package/dist/connectors/adapters/claude/commands/attach.md +18 -0
  29. package/dist/connectors/adapters/claude/commands/connect.md +21 -0
  30. package/{plugins → dist/connectors/adapters}/claude/commands/create.md +4 -5
  31. package/dist/connectors/adapters/claude/commands/discuss-objective.md +18 -0
  32. package/dist/connectors/adapters/claude/commands/load.md +22 -0
  33. package/{plugins → dist/connectors/adapters}/claude/commands/prompt.md +4 -5
  34. package/{plugins → dist/connectors/adapters}/claude/commands/record-work.md +3 -3
  35. package/{plugins → dist/connectors/adapters}/claude/commands/spawn.md +4 -5
  36. package/dist/connectors/adapters/claude/conformance-manifest.yaml +48 -0
  37. package/{plugins → dist/connectors/adapters}/claude/hooks/hooks.json +11 -0
  38. package/dist/connectors/adapters/claude/prompt-wrapper.md +17 -0
  39. package/dist/connectors/adapters/claude/scripts/permission-hook.sh +21 -0
  40. package/dist/connectors/adapters/claude/scripts/post-tool-use-hook.sh +40 -0
  41. package/{plugins → dist/connectors/adapters}/claude/scripts/stop-hook.sh +14 -16
  42. package/{plugins → dist/connectors/adapters}/claude/scripts/user-prompt-submit-hook.sh +46 -42
  43. package/dist/connectors/adapters/claude/skills/overlord-mission/SKILL.md +26 -0
  44. package/{plugins/overlord → dist/connectors/adapters/codex}/.codex-plugin/hooks.json +0 -1
  45. package/dist/connectors/adapters/codex/.codex-plugin/plugin.json +49 -0
  46. package/dist/connectors/adapters/codex/.mcp.json +9 -0
  47. package/dist/connectors/adapters/codex/README.md +78 -0
  48. package/dist/connectors/adapters/codex/conformance-manifest.yaml +38 -0
  49. package/dist/connectors/adapters/codex/prompt-wrapper.md +18 -0
  50. package/dist/connectors/adapters/codex/scripts/overlord-mcp.mjs +175 -0
  51. package/dist/connectors/adapters/codex/scripts/permission-hook.sh +21 -0
  52. package/dist/connectors/adapters/codex/scripts/user-prompt-submit-hook.sh +226 -0
  53. package/dist/connectors/adapters/codex/skills/overlord-mission/SKILL.md +27 -0
  54. package/dist/connectors/adapters/cursor/.cursor-plugin/plugin.json +36 -0
  55. package/dist/connectors/adapters/cursor/README.md +84 -0
  56. package/dist/connectors/adapters/cursor/commands/add-objectives.md +8 -0
  57. package/dist/connectors/adapters/cursor/commands/attach.md +12 -0
  58. package/dist/connectors/adapters/cursor/commands/connect.md +6 -0
  59. package/dist/connectors/adapters/cursor/commands/create.md +13 -0
  60. package/dist/connectors/adapters/cursor/commands/discuss-objective.md +11 -0
  61. package/dist/connectors/adapters/cursor/commands/load.md +9 -0
  62. package/dist/connectors/adapters/cursor/commands/prompt.md +13 -0
  63. package/{plugins → dist/connectors/adapters}/cursor/commands/record-work.md +2 -4
  64. package/dist/connectors/adapters/cursor/commands/spawn.md +11 -0
  65. package/dist/connectors/adapters/cursor/conformance-manifest.yaml +39 -0
  66. package/dist/connectors/adapters/cursor/hooks/overlord-user-prompt-submit.sh +125 -0
  67. package/dist/connectors/adapters/cursor/prompt-wrapper.md +16 -0
  68. package/dist/connectors/adapters/cursor/rules/overlord-local.mdc +14 -0
  69. package/{plugins → dist/connectors/adapters}/cursor/scripts/overlord-mcp.mjs +32 -12
  70. package/dist/connectors/adapters/cursor/skills/overlord-mission/SKILL.md +25 -0
  71. package/dist/connectors/core/README.md +52 -0
  72. package/dist/connectors/core/overlord-mission/SKILL.md +386 -0
  73. package/dist/connectors/core/overlord-mission/reference/cli.md +243 -0
  74. package/dist/connectors/core/overlord-mission/reference/context.md +22 -0
  75. package/dist/connectors/core/overlord-mission/reference/devices.md +20 -0
  76. package/{plugins/claude/skills/overlord-ticket → dist/connectors/core/overlord-mission}/reference/mcp.md +5 -6
  77. package/dist/connectors/core/overlord-mission/reference/shell-escaping.md +30 -0
  78. package/dist/connectors/docs/05-connectors-and-agent-plugins.md +211 -0
  79. package/dist/connectors/docs/agent-harness-configuration-architecture.md +433 -0
  80. package/dist/connectors/docs/testing.md +110 -0
  81. package/dist/index.js +9426 -0
  82. package/dist/index.js.map +7 -0
  83. package/package.json +35 -16
  84. package/scripts/postinstall.mjs +1 -0
  85. package/bin/_cli/add-cwd.mjs +0 -182
  86. package/bin/_cli/attach.mjs +0 -345
  87. package/bin/_cli/auth.mjs +0 -795
  88. package/bin/_cli/cli-update.mjs +0 -159
  89. package/bin/_cli/credentials.mjs +0 -952
  90. package/bin/_cli/device-identity.d.mts +0 -12
  91. package/bin/_cli/device-identity.mjs +0 -92
  92. package/bin/_cli/direct-launch.mjs +0 -370
  93. package/bin/_cli/index.mjs +0 -215
  94. package/bin/_cli/launcher.mjs +0 -876
  95. package/bin/_cli/local-config.mjs +0 -134
  96. package/bin/_cli/new-ticket.mjs +0 -452
  97. package/bin/_cli/onboard.mjs +0 -346
  98. package/bin/_cli/postinstall.mjs +0 -43
  99. package/bin/_cli/protocol.mjs +0 -4087
  100. package/bin/_cli/runner.mjs +0 -664
  101. package/bin/_cli/setup.mjs +0 -2162
  102. package/bin/_cli/signup.mjs +0 -392
  103. package/bin/_cli/ticket.mjs +0 -55
  104. package/bin/_cli/tickets.mjs +0 -106
  105. package/bin/_cli/version.mjs +0 -7
  106. package/plugins/antigravity/README.md +0 -53
  107. package/plugins/antigravity/commands/add-objectives.md +0 -13
  108. package/plugins/antigravity/commands/attach.md +0 -17
  109. package/plugins/antigravity/commands/connect.md +0 -17
  110. package/plugins/antigravity/commands/create.md +0 -15
  111. package/plugins/antigravity/commands/discuss-objective.md +0 -17
  112. package/plugins/antigravity/commands/load.md +0 -17
  113. package/plugins/antigravity/commands/prompt.md +0 -15
  114. package/plugins/antigravity/hooks/hooks.json +0 -15
  115. package/plugins/antigravity/plugin.json +0 -22
  116. package/plugins/antigravity/scripts/overlord-mcp.mjs +0 -1386
  117. package/plugins/antigravity/scripts/user-prompt-submit-hook.sh +0 -127
  118. package/plugins/antigravity/skills/overlord-ticket/SKILL.md +0 -279
  119. package/plugins/claude/.claude-plugin/plugin.json +0 -27
  120. package/plugins/claude/README.md +0 -58
  121. package/plugins/claude/commands/add-objectives.md +0 -15
  122. package/plugins/claude/commands/connect.md +0 -21
  123. package/plugins/claude/commands/load.md +0 -22
  124. package/plugins/claude/scripts/permission-hook.sh +0 -21
  125. package/plugins/claude/skills/overlord-ticket/SKILL.md +0 -118
  126. package/plugins/claude/skills/overlord-ticket/reference/cli.md +0 -197
  127. package/plugins/claude/skills/overlord-ticket/reference/context.md +0 -22
  128. package/plugins/claude/skills/overlord-ticket/reference/devices.md +0 -20
  129. package/plugins/claude/skills/overlord-ticket/reference/shell-escaping.md +0 -16
  130. package/plugins/cursor/.cursor-plugin/plugin.json +0 -26
  131. package/plugins/cursor/commands/add-objectives.md +0 -9
  132. package/plugins/cursor/commands/connect.md +0 -10
  133. package/plugins/cursor/commands/create.md +0 -12
  134. package/plugins/cursor/commands/load.md +0 -11
  135. package/plugins/cursor/commands/prompt.md +0 -12
  136. package/plugins/cursor/commands/spawn.md +0 -13
  137. package/plugins/cursor/hooks/overlord-user-prompt-submit.sh +0 -87
  138. package/plugins/cursor/rules/overlord-local.mdc +0 -12
  139. package/plugins/cursor/skills/overlord-ticket/SKILL.md +0 -118
  140. package/plugins/cursor/skills/overlord-ticket/reference/cli.md +0 -197
  141. package/plugins/cursor/skills/overlord-ticket/reference/context.md +0 -22
  142. package/plugins/cursor/skills/overlord-ticket/reference/devices.md +0 -20
  143. package/plugins/cursor/skills/overlord-ticket/reference/mcp.md +0 -11
  144. package/plugins/cursor/skills/overlord-ticket/reference/shell-escaping.md +0 -16
  145. package/plugins/overlord/.codex-plugin/plugin.json +0 -36
  146. package/plugins/overlord/.mcp.json +0 -11
  147. package/plugins/overlord/README.md +0 -64
  148. package/plugins/overlord/scripts/overlord-mcp.mjs +0 -1442
  149. package/plugins/overlord/scripts/permission-hook.sh +0 -26
  150. package/plugins/overlord/scripts/user-prompt-submit-hook.sh +0 -153
  151. package/plugins/overlord/skills/overlord-ticket/SKILL.md +0 -119
  152. package/plugins/overlord/skills/overlord-ticket/reference/cli.md +0 -197
  153. package/plugins/overlord/skills/overlord-ticket/reference/context.md +0 -22
  154. package/plugins/overlord/skills/overlord-ticket/reference/devices.md +0 -20
  155. package/plugins/overlord/skills/overlord-ticket/reference/mcp.md +0 -11
  156. package/plugins/overlord/skills/overlord-ticket/reference/shell-escaping.md +0 -16
  157. /package/{plugins/overlord → dist/connectors/adapters/codex}/assets/icon.png +0 -0
  158. /package/{plugins/overlord → dist/connectors/adapters/codex}/assets/logo.png +0 -0
  159. /package/{plugins/overlord → dist/connectors/adapters/codex}/assets/screenshot.svg +0 -0
  160. /package/{plugins → dist/connectors/adapters}/cursor/mcp.json +0 -0
package/README.md CHANGED
@@ -1,194 +1,315 @@
1
- # Overlord CLI
1
+ # CLI Module
2
2
 
3
- `overlord-cli` is the packaged command-line interface for Overlord. It lets you launch agents on tickets, create new tickets, and manage the ticket lifecycle from the terminal.
3
+ The `ovld` command-line surface — Overlord's primary, CLI-first product.
4
+ This module is the home for everything a user or agent invokes as `ovld …`.
4
5
 
5
- Website: [ovld.ai](https://ovld.ai)
6
+ ## Table of Contents
6
7
 
7
- ## Install
8
+ - [For Users](#for-users)
9
+ - [Setup](#setup)
10
+ - [First run](#first-run)
11
+ - [How the published CLI works](#how-the-published-cli-works)
12
+ - [Point the CLI at a backend](#point-the-cli-at-a-backend)
13
+ - [Headless / container setup](#headless--container-setup)
14
+ - [What requires the backend](#what-requires-the-backend)
15
+ - [For Developers](#for-developers)
16
+ - [Contract Components](#contract-components)
17
+ - [Documentation](#documentation)
18
+ - [Code & Tests](#code--tests)
19
+ - [In-repo build vs installed CLI](#in-repo-build-vs-installed-cli)
20
+ - [Interaction Boundaries](#interaction-boundaries)
8
21
 
9
- Note: Use Node.js 20 or newer for every CLI install or update.
22
+ ## For Users
10
23
 
11
- Install it globally so the `ovld` and `overlord` commands are available on your `PATH`:
24
+ ### Setup
12
25
 
13
- ```bash
14
- npm install -g overlord-cli
15
-
16
- #After installing, run
17
- ovld setup all #to configure every supported connector (`ovld setup` alone is interactive)
26
+ The CLI is **client-only**. Management commands, protocol sessions, and runner
27
+ queue operations all reach persistence through the backend URL you configure — only
28
+ `help` and `version` work without one. First-time setup is about **pointing
29
+ `ovld` at a backend** and verifying it is reachable.
18
30
 
19
- #for individual connectors, run `ovld setup <connector>`.
20
- ovld setup cursor
21
- ovld setup claude
22
- ovld setup codex
23
- ovld setup all
24
- ```
31
+ ### First run
25
32
 
33
+ Install the published package:
26
34
  ```bash
27
- # To update the CLI to the latest release, run:
28
- ovld update
35
+ npm install -g --no-fund overlord-cli
29
36
  ```
30
37
 
31
- ## Usage
38
+ After installing the published package:
32
39
 
33
40
  ```bash
34
- ovld help
35
- overlord help
41
+ ovld auth login
36
42
  ```
37
43
 
38
- ### Auth
44
+ Login verifies that a backend is configured. If none is set yet, it walks through
45
+ `ovld config` first — local setup offers `http://127.0.0.1:4310` as the default
46
+ backend URL; cloud setup accepts a hosted backend URL.
47
+
48
+ Then confirm the connection and continue with projects, missions, and agents:
39
49
 
40
50
  ```bash
41
- # No account yet? Create one entirely from the terminal with just an email.
42
- ovld auth signup --email agent@example.com --name "Build Agent" # emails an 8-digit code, then mints a durable oat_ agent token by default
43
- ovld onboard --email agent@example.com --project-name Repo # same signup, plus org/project/cwd setup
44
-
45
- # Repair shared credentials first when a session already exists
46
- ovld auth repair # mirror and chmod shared Desktop/CLI credentials when possible
47
-
48
- # Login to Overlord if repair does not restore access
49
- ovld auth login #opens a browser when possible and also prints a verification URL/code so login can be completed from another machine over SSH.
50
- ovld auth login --email agent@example.com # log back in after logout with an emailed code (no browser)
51
- ovld auth status # show current login status (use --verbose for redacted diagnostics)
52
- ovld auth logout # remove stored credentials
51
+ ovld doctor
52
+ ovld config list
53
53
  ```
54
54
 
55
- #### Terminal-native account creation
55
+ See [Getting Started](https://github.com/cooperativ-labs/OpenOverlord/blob/main/docs/getting-started.md) for the full walkthrough from
56
+ install through first delivered mission.
56
57
 
57
- `ovld auth signup` creates an Overlord account without a browser: it emails an
58
- 8-digit confirmation code, you enter it in the terminal, and the CLI stores valid
59
- credentials. Pass `--password` to set a password-manager-generated password;
60
- without one, signup is passwordless and you log back in later with
61
- `ovld auth login --email`. By default a durable `oat_…` agent token is minted and
62
- saved for headless use — pass `--no-agent-token` to skip it. For agents that read
63
- email out of band, the split flow is available:
58
+ ### How the published CLI works
64
59
 
65
- ```bash
66
- ovld auth signup request --email agent@example.com --name "Build Agent" --json
67
- ovld auth signup verify --email agent@example.com --code 12345678 --json
68
- ovld onboard --use-current-auth --project-name Repo --directory "$PWD" --yes
60
+ The npm package ships command parsing, config/auth onboarding, connector setup,
61
+ an HTTP backend client, and the local runner/agent launcher. Production builds
62
+ bundle the shared `@overlord/core` runtime into `dist/index.js`, so the tarball
63
+ does not depend on other Overlord packages at install time. It still does **not**
64
+ ship SQLite, `better-sqlite3`, migrations, or the service-layer database runtime.
65
+
66
+ ```mermaid
67
+ flowchart LR
68
+ cli["ovld npm CLI"] -->|"HTTP /api/*"| local["Desktop or local backend"]
69
+ cli -->|"HTTP /api/*"| cloud["Hosted backend"]
70
+ local --> sqlite["SQLite"]
71
+ cloud --> postgres["Postgres"]
72
+ cli -->|"spawn"| agent["Local agent CLI"]
69
73
  ```
70
74
 
71
- Desktop-installed wrappers default `OVERLORD_URL` to `https://www.ovld.ai` unless you override it explicitly.
72
- For local dev against the web app on port 3000, export the override before running auth or protocol commands:
75
+ Local mode means `ovld` talks to a backend already running on your machine,
76
+ normally Desktop or a future db-only local backend. Cloud mode means `ovld`
77
+ talks to a hosted Overlord backend. In both modes, the backend owns persistence
78
+ and migrations; the CLI is a client of that backend.
79
+
80
+ ### Point the CLI at a backend
81
+
82
+ Configuration lives in `overlord.toml` — a per-instance, uncommitted file
83
+ (gitignored; generate it with `ovld init`, or copy `overlord.toml.example`),
84
+ discovered from the current directory upward, or in `~/.ovld/overlord.toml` for a
85
+ global install.
86
+
87
+ | Mode | Config key | How to set it |
88
+ | ---- | ---------- | ------------- |
89
+ | **Local backend** | `backend_url` | `ovld config set local [url]` — defaults to `http://127.0.0.1:4310` |
90
+ | **Hosted backend** | `backend_url` | `ovld config set cloud <url>` |
91
+
92
+ `ovld config set` without arguments opens the interactive backend selector.
93
+ `ovld config list` shows the resolved target; `ovld doctor` checks that the
94
+ backend is reachable.
95
+
96
+ Environment overrides (useful in scripts and CI):
97
+
98
+ - `OVLD_HOME` — relocate the entire global `~/.ovld` data directory (SQLite, object storage, VCS baselines, native-session caches)
99
+ - `OVERLORD_BACKEND_URL` — production/global backend target; an *explicit* runtime value (shell export, container/launcher injection) takes precedence over the resolved `overlord.toml` `backend_url`
100
+ - `OVERLORD_BACKEND_URL_DEV` — **development-only** backend target, read solely by the in-repo source build and the dev/test tooling that runs it (`yarn dev`, the test harness). An installed/published `ovld` never reads it, and nothing aliases it into the production `OVERLORD_BACKEND_URL`
101
+ - `OVERLORD_WEB_PORT` — port the local backend binds when launched
102
+ - `OVERLORD_USER_TOKEN` / `OVLD_USER_TOKEN` / `USER_TOKEN` — bearer token sent to the backend when set (checked in that order; takes precedence over stored credentials)
103
+ - `DATABASE_URL` — Postgres connection string read by a backend you run yourself (service layer + Better Auth); the client-only CLI does not open it
104
+
105
+ Each `ovld` invocation resolves its own config and backend target
106
+ independently — it is **not** a single shared connection. Resolution order,
107
+ highest precedence first: an explicit runtime export of the channel variable
108
+ (`OVERLORD_BACKEND_URL`, or `OVERLORD_BACKEND_URL_DEV` for the dev build) set
109
+ before the CLI loads any env file → the per-instance `overlord.toml` `backend_url`
110
+ (what `ovld config set` writes) → the env-file default next to that `overlord.toml`
111
+ (`OVERLORD_BACKEND_URL_DEV` from `.env.local` for the source/dev build,
112
+ `OVERLORD_BACKEND_URL` from `.env.prod` for production/package builds) → a
113
+ hardcoded fallback. `overlord.toml` is a per-instance, **uncommitted** file
114
+ (gitignored like `.env.*`; generate it with `ovld init` / `ovld config set`, see
115
+ `overlord.toml.example`), so there is no shared config file to keep host-neutral.
116
+ A context-specific target — a Docker-internal host alias, another machine's
117
+ address — belongs in an explicit `OVERLORD_BACKEND_URL` set when that process is
118
+ launched. The dev-only `OVERLORD_BACKEND_URL_DEV` is read **only** by the source
119
+ build; an installed `ovld` resolves as production and ignores it (and `.env.local`)
120
+ even inside a dev checkout.
121
+
122
+ The local backend/Desktop package owns SQLite and migrations. The published npm
123
+ CLI only stores the backend URL and sends HTTP requests.
124
+
125
+ ### Desktop and CLI authentication
126
+
127
+ Both the desktop app and the CLI authenticate to `/api/*` with a bearer token:
128
+
129
+ - **Session bearer** — from `ovld auth login` (email/password) or a desktop
130
+ sign-in on the **local** backend. Stored in `~/.ovld/auth.json` for the CLI
131
+ and in the desktop shell's encrypted settings for each backend profile.
132
+ - **USER_TOKEN** (`out_…`) — long-lived token from Settings → Tokens. Works for
133
+ headless/CI use via `OVERLORD_USER_TOKEN` or `ovld auth login --token`. On
134
+ cloud backends, interactive email/password login creates and stores a full
135
+ `USER_TOKEN` automatically so runner/protocol CLI surfaces can authenticate.
136
+
137
+ For the **local** backend, desktop and CLI share `~/.ovld/auth.json`:
138
+
139
+ - Signing in through the desktop app writes the session bearer to `auth.json`, so
140
+ `ovld` can use the same credentials without a second login.
141
+ - Running `ovld auth login` for the local backend writes `auth.json`; the desktop
142
+ app imports that token on the next launch (or when switching back to Local) if
143
+ it has no saved session for that profile.
144
+
145
+ **Cloud backends are separate.** Adding or switching to a cloud backend in the
146
+ desktop app updates `~/.ovld/overlord.toml` with the new `backend_url`, but it
147
+ does **not** update CLI auth. After switching backends in either surface, run
148
+ `ovld auth status` to confirm the CLI is pointed at the same URL and still
149
+ logged in. If `credentialSource` is `stored_mismatch` or `loggedIn` is false, run
150
+ `ovld config set cloud <url>` (if needed) and `ovld auth login`. Email/password
151
+ login on a cloud backend uses the session only once to create a 90-day full
152
+ `USER_TOKEN`, then stores that token in `auth.json`.
153
+
154
+ When a stored CLI credential is rejected with HTTP 401, `ovld` clears
155
+ `auth.json` and tells you to run `ovld auth login` again.
156
+
157
+ ### Headless / container setup
158
+
159
+ In a container, CI job, or any non-TTY environment, configure `ovld` entirely
160
+ through environment variables and non-interactive flags — no interactive prompts
161
+ are required. Each item below is a single command:
73
162
 
74
163
  ```bash
75
- export OVERLORD_URL=http://localhost:3000
164
+ # 1. Database URL — Postgres persistence for a backend you run in the same
165
+ # container (consumed by the service layer + Better Auth). Omit if the CLI
166
+ # only talks to an already-running remote backend.
167
+ export DATABASE_URL="postgres://user:password@host:5432/overlord"
168
+
169
+ # 2. Backend URL — where the CLI sends HTTP /api/* requests.
170
+ export OVERLORD_BACKEND_URL="https://overlord.example.com"
171
+
172
+ # 3. Auth token — bearer USER_TOKEN sent with every backend request.
173
+ # Generate one in Overlord Desktop: Settings > Tokens.
174
+ export OVERLORD_USER_TOKEN="out_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
175
+
176
+ # 4. Agent connector — write the local agent connector config (non-interactive).
177
+ ovld agent-setup claude # one of: claude | codex | cursor | all
76
178
  ```
77
179
 
78
- Common commands:
180
+ Then verify the backend is reachable and authenticated:
79
181
 
80
182
  ```bash
81
- ovld auth login
82
- ovld auth status
83
- ovld attach
84
- ovld claude "Refactor the auth middleware" --model opus --thinking high
85
- ovld codex "Investigate the memory leak" -- --search --full-auto
86
- ovld create "Investigate the failing build" --agent codex
87
- ovld prompt "Draft a fix for the onboarding flow"
88
- ovld version
89
- ovld update
90
- ovld protocol discover-project
91
- ovld protocol discover-project --project-id <project-id>
92
- ovld protocol discover-project --working-directory /path/to/repo --device-fingerprint "$OVERLORD_DEVICE_FINGERPRINT"
93
- ovld protocol attach --ticket-id <ticket_id>
94
- ovld protocol search-tickets --query "auth refactor" --status next-up,execute
95
- ovld protocol update --session-key <session-key> --ticket-id <ticket_id> --summary "Working on it" --phase execute
96
- ovld protocol heartbeat --session-key <session-key> --ticket-id <ticket_id> --phase execute --percent 50 --note "Running tests"
97
- ovld runner start
98
- ovld runner status
99
- ovld runner clear <objective_id>
100
- ovld runner clear-all
101
- ovld setup
102
- ovld setup codex
103
- ovld setup claude
104
- ovld setup cursor
105
- ovld setup antigravity
106
- ovld setup all
107
- ovld launch antigravity --ticket-id <ticket_id>
108
183
  ovld doctor
109
184
  ```
110
185
 
111
- **Antigravity:** Gemini CLI is deprecated. Use `ovld setup antigravity` and `ovld launch antigravity --ticket-id <ticket_id>`. Antigravity manages model selection internally.
186
+ Notes for headless use:
187
+
188
+ - **No `ovld auth login` needed.** The token env vars (`OVERLORD_USER_TOKEN`,
189
+ `OVLD_USER_TOKEN`, or `USER_TOKEN`) are read directly and take precedence over
190
+ stored credentials. To persist a token to `~/.ovld/auth.json` instead, run the
191
+ non-interactive `ovld auth login --token out_...` (works without a TTY).
192
+ - `ovld agent-setup` accepts `--home <dir>` to target a specific `OVLD_HOME`,
193
+ `--dry-run` to preview, and `--json` for machine-readable output. List
194
+ installable connectors with `ovld agent-setup --json`.
195
+ - Set `OVLD_HOME=/some/writable/dir` if the default `~/.ovld` is not writable in
196
+ your container; it relocates the entire CLI data directory.
197
+ - Interactive `ovld auth login` / `ovld config set` (no args) and `ovld setup`
198
+ require a TTY; use the env vars and explicit flags above in their place.
112
199
 
113
- The CLI is organization-agnostic: `ovld auth login` stores your identity only and never a default organization. Your identity (OAuth session or agent token) resolves to the list of organizations you belong to — see `ovld auth status --verbose`. Each command resolves its organization from the `ticket_id` (values such as `1:899` carry the organization id), then an explicit `--organization-id`, otherwise from your membership. Commands that browse or search — `ovld add-cwd`, `ovld create`/`ovld prompt`, `ovld tickets list`, and `ovld protocol search-tickets` — span every organization you belong to. Actions against an organization you are not a member of return a clear permission error rather than silently falling back to another org.
200
+ ### What requires the backend
114
201
 
115
- When `ovld launch` has an explicit `--working-directory`, or when you run it from a registered project directory containing `.overlord/project.json`, it exports `TMPDIR`, `TMP`, `TEMP`, and `OVERLORD_TMPDIR` to that project's `.overlord/tmp/` directory before spawning the agent. Otherwise it falls back to the system temp directory.
202
+ These commands work without a backend: `ovld help`, `ovld version`,
203
+ `ovld update`, `ovld config ...`, `ovld prune`, and connector setup/inspection commands that only touch local
204
+ files. `ovld update --check` compares the installed package version with the latest
205
+ published npm version, and `ovld update` upgrades the global `overlord-cli`
206
+ install through npm. Commands that read or mutate Overlord state — projects, missions,
207
+ protocol calls, runner queue operations, and launch context assembly — call the
208
+ configured backend URL.
116
209
 
117
- ## Requirements
210
+ `ovld runner` is still local in the important sense: it claims work through the
211
+ backend API, then spawns the selected agent process on your machine in the
212
+ resolved project directory. The queue state remains in the backend.
118
213
 
119
- - Node.js 20 or newer
120
- - Access to an Overlord instance when using authenticated commands
214
+ ## For Developers
121
215
 
122
- ## Commands for Humans
216
+ ### Contract Components
123
217
 
124
- Find full CLI docs here: https://www.ovld.ai/docs/surfaces/cli
218
+ This module is the developer-facing home for three components defined in
219
+ [`CONTRACT.md`](https://github.com/cooperativ-labs/OpenOverlord/blob/main/CONTRACT.md):
125
220
 
126
- Top-level commands (see `ovld help`):
221
+ | Component | Stable id | What it owns |
222
+ | -------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
223
+ | CLI Layer | `cli` | Management command names/shapes, project linking & discovery, config file locations (`overlord.toml`, `.overlord/project.json`), human-readable output conventions |
224
+ | Protocol Layer | `protocol` | `ovld protocol` subcommands and flags, session lifecycle (`attach → (update\|heartbeat)* → (ask\|deliver)`), context-assembly format, delivery payload + change-rationale recording |
225
+ | Runner Layer | `runner` | `execution_requests` queue claiming and launch, working-directory resolution, `ovld runner` commands, execution-target selection |
127
226
 
128
- - `<agent> "<prompt>"` - create a ticket from the prompt (project inferred from the current directory) and launch the agent on it in one step, e.g. `ovld claude "fix the flaky login test" --model opus`. Built-in agents need an installed connector (`ovld setup <agent>`, override with `--allow-uninstalled`); your custom agents launch by id. Flags after a standalone `--` pass through to the agent binary.
129
- - `attach` - search tickets and launch an agent interactively (`ovld attach [ticketId] [agent]`)
130
- - `create` - create a ticket with numbered project selection; supports `--agent`, `--model`, `--delegate` (same delegate flags as `ovld protocol create`)
131
- - `create-project` - create a project, registering the current directory (or `--directory`) as its primary resource in one step; `--no-directory` makes a bare project (alias for `ovld protocol create-project`)
132
- - `prompt` - create a ticket, then launch an agent on it
133
- - `auth` - `login`, `status`, `repair` (shared Desktop/CLI credentials), or `logout`
134
- - `tickets` - `create` or `list` (optional `--status`)
135
- - `ticket` - `context <ticketId>` to print context for one ticket
136
- - `launch`, `restart` - launch or resume an agent session
137
- - `runner` - claim queued execution requests and launch assigned agents with `ovld launch`
138
- - `connect`, `run`, `resume` - legacy aliases for `launch` and `restart`
139
- - `setup` - install the Overlord connector for an agent; `ovld setup [agent|all]` (interactive with no args). `ovld setup claude` also performs the one-time v3.25.0 to v4 Claude plugin migration
140
- - `update` - install the latest CLI release from npm
141
- - `doctor` - validate installed connectors and check for CLI updates
142
- - `version` - print the installed CLI version
227
+ These stay distinct components in the contract (separate interaction surfaces
228
+ and ownership). They are grouped into one developer module because they are all
229
+ the `ovld` command surface and tend to be worked on together.
143
230
 
144
- ## Commands for agents
231
+ ### Documentation
145
232
 
146
- Agents can find docs here: https://www.ovld.ai/docs/for-agents
233
+ Requirements and behavior specs are colocated in this module's
234
+ [`docs/`](https://github.com/cooperativ-labs/OpenOverlord/tree/main/cli/docs) folder (see the root [README](https://github.com/cooperativ-labs/OpenOverlord/blob/main/README.md#modules) for the
235
+ colocation convention):
147
236
 
148
- `ovld protocol <subcommand>` is the surface agents and hooks use for ticket lifecycle work. Run `ovld protocol help` for flags, env fallbacks, and examples.
237
+ - [01 — Command Reference](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/01-command-reference.md): exhaustive tables of `ovld` commands, subcommands, and flags.
238
+ - [02 — CLI-First Product Surface](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/02-cli-first-product-surface.md): management commands, configuration, project linking, output contracts.
239
+ - [03 — Agent Protocol](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/03-agent-protocol.md): `ovld protocol` lifecycle, context assembly, updates, delivery, attachments.
240
+ - [04 — Runner and Launch Execution](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/04-runner-and-launch-execution.md): execution requests, local runner, launch command generation, auto-advance.
241
+ - [06 — Core Domain and Lifecycle](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/06-core-domain-and-lifecycle.md): projects, missions, objectives, sessions, events, statuses, state transitions.
242
+ - [11 — Review, Artifacts, and Change Tracking](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/11-review-artifacts-and-change-tracking.md): delivery review records, artifacts, rationale coverage, local diff support.
243
+ - [Test Plan](https://github.com/cooperativ-labs/OpenOverlord/blob/main/cli/docs/testing.md): test plan for the `cli`, `protocol`, and `runner` components — management commands, protocol lifecycle/attach-shape/validation conformance, runner queue atomicity, and surface smoke tests. Part of the root [TEST_PLAN.md](https://github.com/cooperativ-labs/OpenOverlord/blob/main/TEST_PLAN.md).
149
244
 
150
- - `auth-status` - return machine-readable auth status for agent runtimes
151
- - `discover-project` - resolve a project from the current (or given) working directory
152
- - `attach` - start a ticket session, create a local git checkpoint per executing objective, and return full working context
153
- - `connect` - start a lightweight session without full context
154
- - `load-context` - read ticket context without creating a session
155
- - `revert` - restore the local working tree to an objective checkpoint after fetching its checkpoint row
156
- - `search-tickets` - find tickets by keyword, status, project, creator, or update date
157
- - `add-objectives` - append ordered objectives to an existing ticket (`--objectives-json` / `--objectives-file`)
158
- - `create` - create a draft ticket without attaching (standalone or follow-up; `--project-id` can override the inherited project during follow-up creation)
159
- - `prompt` - create a ticket and attach to it immediately (`spawn` is a backward-compatible alias)
160
- - `record-work` - record already-completed chat work as a ticket in review with a completed objective and trigger feed-post generation
161
- - `update` - post progress, discussion/decision events, optional change rationales, and explicit `--begin-follow-up-work` transitions
162
- - `heartbeat` - send a lightweight liveness ping plus optional transient `phase` / `percent` / `note` telemetry without creating a ticket event
163
- - `record-change-rationales` - persist structured change rationales without a normal progress update
164
- - `ask` - post a blocking question and move the ticket to review
165
- - `permission-request` - notify Overlord that the agent is requesting tool permission
166
- - `hook-event` - record lifecycle hook events such as `UserPromptSubmit` / Cursor `beforeSubmitPrompt` without a session key; optionally persist a native resume/session id onto the active Overlord session
167
- - `read-context` - read shared persistent context for this ticket
168
- - `write-context` - write shared persistent context for future sessions
169
- - `deliver` - send artifacts/rationales and move the ticket to review
170
- - `attachment-prepare-upload` - get a signed upload URL for an objective attachment
171
- - `attachment-finalize-upload` - finalize an uploaded objective attachment row after storage upload
172
- - `attachment-download-url` - get a signed download URL for an existing objective attachment
173
- - `attachment-upload-file` - prepare, upload, and finalize a local objective attachment in one command
174
- - `get-device` / `update-device` - register the caller machine (per organization + user + fingerprint) and rename its label
175
- - `create-project` - create a project and, when a `--directory` + `--device-fingerprint` are given, register it as the project's primary resource in one step
176
- - `list-project-resources` / `add-project-resource` / `update-project-resource` - manage filesystem directories tied to a project device
177
- - `request-execution` / `claim-execution` / `list-execution-requests` / `clear-execution-requests` / `complete-execution-launch` / `fail-execution-launch` - durable runner queue operations used by auto-advance and manual Run
178
- - `list-organizations` - list every organization the authenticated user (or agent token) belongs to; the runner uses this to poll all of your organizations, not just the one stored at login
245
+ ### Code & Tests
179
246
 
180
- Devices are keyed by **(organization, user, fingerprint)** so the same physical workstation can appear once per org session.
247
+ The packaged CLI lives in this module as a self-contained Yarn sub-project:
181
248
 
182
- `ovld runner start` keeps a foreground runner alive for CLI-only or remote hosts. It claims compatible execution requests for the current device and launches the assigned agent/model with `ovld launch`; `ovld runner once` claims at most one request and exits. `ovld runner status` now prints the local device record plus the active queue visible to that runner. `ovld runner clear <objective_id>` clears one queued objective, and `ovld runner clear-all` clears every active queue row visible to the caller. By default a single runner drains queued requests from **every organization you belong to**, so you do not need one runner per org. Pin it to a single org with `--organization-id <id>` or `OVERLORD_ORGANIZATION_ID`.
249
+ ```bash
250
+ yarn build:cli:prod # tsc emit + esbuild bundle to cli/dist/index.js
251
+ yarn test:cli # unit + subprocess smoke tests
252
+ yarn pack:cli:prod # produce an installable tarball
253
+ node cli/bin/ovld.mjs version
254
+ ```
255
+
256
+ Layout:
257
+
258
+ ```
259
+ cli/
260
+ bin/ovld.mjs # published bin entry (imports bundled dist/index.js)
261
+ src/ # TypeScript implementation
262
+ scripts/build.mjs # tsc emit for tests + esbuild bundle for runtime
263
+ dist/ # build output (gitignored; index.js is self-contained)
264
+ test/ # colocated tests, including cli/test/e2e/
265
+ package.json # bin map, build scripts, pack metadata
266
+ ```
267
+
268
+ The CLI ships command parsing, config/auth onboarding, connector setup, backend
269
+ client calls, and local runner/agent launch logic. Run `yarn build:cli:prod` before using
270
+ the compiled CLI (`node cli/bin/ovld.mjs …`).
183
271
 
184
- If you are troubleshooting "why is `ovld runner` randomly executing", the runner is usually claiming a request that was already queued by manual Run or auto-advance. Inspect the queue with `ovld runner status`, then clear the specific objective with `ovld runner clear 8974e557-bec4-4984-b12c-be46bd63207c` or `ovld protocol clear-execution-requests --objective-id 8974e557-bec4-4984-b12c-be46bd63207c`.
272
+ ### In-repo build vs installed CLI
185
273
 
186
- Use `create` for future work you want to track, `prompt` for work that should start immediately, and `record-work` for work that was already completed in chat and now needs a review ticket plus feed post. Use multiple tickets when prompts represent different features or goals; use `add-objectives` or `--objectives-json '[{"objective":"Step one"},{"objective":"Step two"}]'` when prompts are sequential steps toward the same feature or goal.
274
+ Project-management work (`ovld protocol attach/update/deliver`, mission creation,
275
+ launching) uses the **installed** `ovld` so those calls hit the installed
276
+ Desktop instance and real mission data. Bare `ovld` on `PATH` always resolves to
277
+ the global install — keep it that way.
187
278
 
188
- `ovld protocol deliver` accepts either discrete flags like `--summary` / `--artifacts-json`, an inline full payload with `--payload-json '{"summary":"...","artifacts":[...],"changeRationales":[...]}'`, or a file/stdin payload with `--payload-file <path|->`.
279
+ The two builds also choose their env profile by origin (`detectCliEnvProfile`):
280
+ the **installed** CLI (under `node_modules`) runs as **production** — it never
281
+ auto-loads `.env.local` or reads `OVERLORD_BACKEND_URL_DEV`, even when invoked
282
+ inside this repo — while the **source** build (`node cli/bin/ovld.mjs`, `yarn
283
+ ovld:dev`, the test harness) runs as **development** and reads `.env.local`. So
284
+ in-repo dev work must go through the source build, never bare `ovld`.
285
+
286
+ Testing in-repo CLI/Desktop changes must never touch the installed instance
287
+ (`~/.ovld`, `:4310`). Copy `.env.local.example` to `.env.local` so source
288
+ workflows use a repo-local dev home (`database/.local/dev-home`) and API on
289
+ `:4320` while Desktop keeps `~/.ovld` and `:4310`.
290
+
291
+ - `yarn dev` / `yarn db:*` / `yarn ovld:dev` read `.env.local` and share the
292
+ persistent in-repo dev instance.
293
+ - `yarn test` runs under `scripts/with-ovld-home.mjs` with a throwaway temp
294
+ home so tests never read or write `~/.ovld` or the dev-home database.
295
+
296
+ For a one-off isolated shell without `.env.local`:
297
+
298
+ ```bash
299
+ export OVLD_HOME="$(mktemp -d)"
300
+ export OVERLORD_WEB_PORT=4320
301
+ export OVERLORD_BACKEND_URL_DEV=http://127.0.0.1:4320
302
+ yarn workspace @overlord/webapp start
303
+ node cli/bin/ovld.mjs doctor
304
+ ```
189
305
 
190
- After delivery, follow-up messages are recorded as discussion by default. To start implementation again on a delivered/review ticket, call `ovld protocol update --begin-follow-up-work --follow-up-intent execution --summary "Beginning follow-up work."` before moving back to `--phase execute`. Use `--event-type discussion_summary` or `--event-type decision` for important non-file outcomes. Once follow-up execution records a real work signal, such as an execution update, git snapshot, change rationales, deliverables, or explicit `pending_delivery` intent, Overlord marks the objective `pending_delivery` so redelivery is only required for actual post-delivery work. Use `ovld protocol heartbeat` during long-running mechanical work when you need liveness without adding activity-feed noise.
306
+ **Never `yarn link` / `npm link` the workspace CLI** (there is deliberately no
307
+ `load:cli` script): linking shadows the global `ovld`, so `ovld protocol` calls
308
+ would run untested working-tree code against your real mission data.
191
309
 
192
- ## License
310
+ ### Interaction Boundaries
193
311
 
194
- Permission is granted to use this software for any purpose, free of charge. You may not modify, distribute, sublicense, or sell copies of the software without explicit permission from the author.
312
+ Per the contract, the CLI/protocol/runner surfaces reach persistence only
313
+ through the configured **REST/backend API** — never direct table writes.
314
+ See the Interaction Surfaces section of [`CONTRACT.md`](https://github.com/cooperativ-labs/OpenOverlord/blob/main/CONTRACT.md) before
315
+ making any cross-module change.
package/bin/ovld.mjs CHANGED
@@ -1,13 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- /**
4
- * Canonical CLI entrypoint. Used by both the npm package and the Electron app.
5
- * All CLI source files live in _cli/ alongside this file.
6
- */
3
+ import { redactSecrets, runCli } from '../dist/index.js';
7
4
 
8
- import { runCli } from './_cli/index.mjs';
9
-
10
- runCli({ primaryCommand: 'ovld' }).catch((error) => {
11
- console.error(error instanceof Error ? error.message : error);
5
+ runCli({ primaryCommand: 'ovld' }).catch(error => {
6
+ console.error(redactSecrets(error instanceof Error ? error.message : error));
12
7
  process.exit(1);
13
8
  });
@@ -0,0 +1,148 @@
1
+ # Connectors Module — Agent Extension Guide
2
+
3
+ This file tells agents how to extend the Connectors module to add new agent harness connectors for users. Read [`CONTRACT.md`](../CONTRACT.md) and the [component-contract skill](../.claude/skills/component-contract/SKILL.md) before making any cross-module change.
4
+
5
+ ---
6
+
7
+ ## What "extending connectors" means
8
+
9
+ A connector lets an AI coding harness (Claude Code, Codex, Cursor, etc.) speak the `ovld protocol` and inherit mission context. Extensions in this module fall into four categories:
10
+
11
+ | Extension type | Example user request |
12
+ | --- | --- |
13
+ | New agent connector | "Add a connector for OpenCode / Windsurf / Zed" |
14
+ | New hook type | "Add a Stop hook for pending-delivery checks" |
15
+ | Extend connector core | "Add a new canonical instruction to all connectors" |
16
+ | New capability flag | "Connectors can now declare `supports-multi-session`" |
17
+
18
+ Each type has a different procedure below.
19
+
20
+ ---
21
+
22
+ ## Before You Start
23
+
24
+ 1. Read `CONTRACT.md` — Connector Layer section (stable id: `connector`).
25
+ 2. Read [`connectors/docs/05-connectors-and-agent-plugins.md`](docs/05-connectors-and-agent-plugins.md) for the four-layer model: connector core, plugins, adapters, and prompt wrappers.
26
+ 3. Read [`connectors/docs/agent-harness-configuration-architecture.md`](docs/agent-harness-configuration-architecture.md) for ownership boundaries.
27
+ 4. Check `contract/extension-points.yaml` for approved capability flags and hook types before adding new ones.
28
+ 5. After connector edits, follow the [connector-versions skill](../.claude/skills/connector-versions/SKILL.md) and run `yarn connectors:version:bump`.
29
+
30
+ ---
31
+
32
+ ## Adding a New Agent Connector
33
+
34
+ A new connector is the primary sanctioned extension point for this module. It requires a conformance manifest but does not require a contract version bump unless it introduces new capability flags or hook types.
35
+
36
+ **Steps:**
37
+
38
+ 1. **Create the connector directory**: `connectors/adapters/<agent-name>/`.
39
+
40
+ 2. **Write the connector plugin** — a Markdown (or native plugin format) file that extends the connector core. Adapter `skills/overlord-mission/SKILL.md` templates must include `<!-- @connector-core -->`; `ovld agent-setup` interpolates `connectors/core/overlord-mission/SKILL.md` at that marker. Required canonical instructions (from the core):
41
+ - Attach first (`ovld protocol attach`)
42
+ - Treat the mission prompt as authoritative
43
+ - Post meaningful progress updates
44
+ - Use heartbeat during long work with no meaningful update
45
+ - Ask exactly one blocking question and stop when blocked
46
+ - Deliver last with summary, artifacts, and change rationales
47
+ - Record all meaningful file changes as structured rationales
48
+ - Use stdin/file flags for shell-special content
49
+ - Do not continue after delivery unless explicitly asked
50
+ - Run local repair before asking the user to fix setup
51
+
52
+ 3. **Write the plugin adapter** — packaging/install glue for the agent's native plugin system. Adapters must:
53
+ - Be idempotent (re-running setup produces the same result)
54
+ - Not clobber existing user settings
55
+ - Be detectable by `ovld doctor` as stale, missing, or partially installed
56
+
57
+ 4. **List managed files** in the adapter's manifest so `ovld doctor` can verify them.
58
+
59
+ 5. **Write a prompt wrapper** if the agent needs mission context prepended at launch time. The wrapper receives a context file path and emits the final prompt text.
60
+
61
+ 6. **Create `connectors/adapters/<agent-name>/conformance-manifest.yaml`** declaring:
62
+ ```yaml
63
+ contractVersion: "0"
64
+ componentType: connector
65
+ componentKey: <agent-name>
66
+ capabilities:
67
+ - <only approved flags from contract/extension-points.yaml>
68
+ hookTypes:
69
+ - <only approved types from contract/extension-points.yaml>
70
+ ```
71
+
72
+ 7. **Validate**: run `ovld contract check connectors/adapters/<agent-name>/conformance-manifest.yaml`.
73
+
74
+ 8. **Document** the connector's launch flags, managed files, and hook scripts in `connectors/adapters/<agent-name>/README.md`.
75
+
76
+ ---
77
+
78
+ ## Adding a New Hook Type
79
+
80
+ Hook types (`UserPromptSubmit`, `PermissionRequest`, `Stop`) are **stable interfaces** listed in `contract/extension-points.yaml`. Adding a new type requires a contract update first.
81
+
82
+ **Steps:**
83
+
84
+ 1. **Update `contract/extension-points.yaml`**: add the new hook name to `approvedHookTypes`.
85
+ 2. **Update `CONTRACT.md`** Connector Layer section with the new hook's event contract.
86
+ 3. **Increment the contract version** in `contract/components.yaml` and add a changelog entry to `CONTRACT.md`.
87
+ 4. **Implement the hook script** in `connectors/adapters/<agent-name>/hooks/` (or the connector-specific hook location).
88
+ 5. **Hook scripts must not write to the database directly** — use `ovld protocol hook-event` or `ovld protocol update` only.
89
+ 6. **Update affected conformance manifests** to declare the new hook type.
90
+
91
+ ---
92
+
93
+ ## Extending the Connector Core
94
+
95
+ The connector core is the set of canonical Markdown workflow instructions every plugin extends. Changes to the core affect all connectors.
96
+
97
+ **Steps:**
98
+
99
+ 1. **Check `connectors/docs/05-connectors-and-agent-plugins.md`** to confirm the instruction belongs in the core (universal to all agents) rather than a per-agent plugin.
100
+ 2. **Draft the new canonical instruction** following the imperative, agent-readable style of the existing core instructions.
101
+ 3. **Update all existing connector plugins** that extend the core if the new instruction changes agent behavior at session start/end.
102
+ 4. **Document the change** in `connectors/docs/05-connectors-and-agent-plugins.md` under "Canonical Connector Core."
103
+
104
+ ---
105
+
106
+ ## Adding a New Capability Flag
107
+
108
+ Capability flags (e.g. `supports-checkpointing`, `supports-multi-session`) are listed in `contract/extension-points.yaml` under `approvedConnectorCapabilities`. New flags require a contract update.
109
+
110
+ **Steps:**
111
+
112
+ 1. **Add the flag** to `approvedConnectorCapabilities` in `contract/extension-points.yaml`.
113
+ 2. **Add a description** of what the flag means in `CONTRACT.md` Connector Layer section.
114
+ 3. **Increment contract version** if the flag represents a breaking stable-interface change.
115
+ 4. **Declare the flag** in the conformance manifests of connectors that support it.
116
+
117
+ ---
118
+
119
+ ## File Placement Convention
120
+
121
+ ```
122
+ connectors/
123
+ adapters/
124
+ claude/ ← Claude Code adapter (reference implementation)
125
+ conformance-manifest.yaml
126
+ README.md
127
+ hooks/
128
+ user-prompt-submit.sh
129
+ permission-request.sh
130
+ codex/ ← Codex adapter
131
+ cursor/ ← Cursor adapter
132
+ <new-agent>/ ← New connector goes here
133
+ docs/ ← Module-level specs
134
+ AGENTS.md ← this file
135
+ README.md ← architectural overview
136
+ ```
137
+
138
+ No adapter implementations have landed yet. When they do, the Claude and Codex adapters serve as the reference implementations.
139
+
140
+ ---
141
+
142
+ ## Cross-Module Checklist
143
+
144
+ - [ ] Read `CONTRACT.md` Connector Layer section
145
+ - [ ] New hook type or capability flag → update `contract/extension-points.yaml` first
146
+ - [ ] Hook scripts → use `ovld protocol` commands only, no direct DB writes
147
+ - [ ] Conformance manifest created and validated for every new connector
148
+ - [ ] `ovld agent-setup <agent>` and `ovld doctor` behavior documented