@atollhq/skill-claude 0.4.0 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,19 +7,20 @@ Gives your Claude Code agent the ability to manage tasks, goals, KPIs, initiativ
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npx @atollhq/skill-claude --key sk_atoll_... --org your-org-id --project project-id --team team-id
10
+ npx @atollhq/skill-claude --profile agent-a --key sk_atoll_... --org your-org-id --project project-id --team team-id
11
11
  # or
12
12
  ATOLL_API_KEY=sk_atoll_... ATOLL_ORG_ID=your-org-id npx @atollhq/skill-claude
13
13
  ```
14
14
 
15
- Optional defaults: `--project`, `--team`, and `--base-url` write `ATOLL_PROJECT`, `ATOLL_TEAM`, and `ATOLL_BASE_URL` for the agent.
15
+ Optional defaults: `--profile`, `--project`, `--team`, and `--base-url` write `ATOLL_PROFILE`, `ATOLL_PROJECT`, `ATOLL_TEAM`, and `ATOLL_BASE_URL` for the agent. Use `--no-project`, `--no-team`, or `--no-base-url` to clear previously saved defaults. When `--profile` is set, the installer also creates or updates that profile in `~/.atoll/config.json`.
16
16
 
17
17
  Get an API key from **Settings > Members > Add Agent** (or **Create API Key** for integrations) in the Atoll app.
18
18
 
19
- This does two things:
19
+ This does three things:
20
20
 
21
21
  1. Copies the skill into `~/.claude/skills/atoll-api/`
22
22
  2. Writes Atoll env vars into `~/.claude/settings.json` under `env`
23
+ 3. Creates or updates the named Atoll CLI profile when `--profile` is provided
23
24
 
24
25
  Restart Claude Code and the `atoll-api` skill is available.
25
26
 
package/bin/install.mjs CHANGED
@@ -10,16 +10,24 @@ const __dirname = dirname(fileURLToPath(import.meta.url))
10
10
  function parseArgs(argv) {
11
11
  const args = {}
12
12
  for (let i = 2; i < argv.length; i++) {
13
- if (argv[i] === '--key' && argv[i + 1]) {
13
+ if (argv[i] === '--profile' && argv[i + 1]) {
14
+ args.profile = argv[++i]
15
+ } else if (argv[i] === '--key' && argv[i + 1]) {
14
16
  args.key = argv[++i]
15
17
  } else if (argv[i] === '--org' && argv[i + 1]) {
16
18
  args.org = argv[++i]
17
19
  } else if (argv[i] === '--project' && argv[i + 1]) {
18
20
  args.project = argv[++i]
21
+ } else if (argv[i] === '--no-project') {
22
+ args.clearProject = true
19
23
  } else if (argv[i] === '--team' && argv[i + 1]) {
20
24
  args.team = argv[++i]
25
+ } else if (argv[i] === '--no-team') {
26
+ args.clearTeam = true
21
27
  } else if (argv[i] === '--base-url' && argv[i + 1]) {
22
28
  args.baseUrl = argv[++i]
29
+ } else if (argv[i] === '--no-base-url') {
30
+ args.clearBaseUrl = true
23
31
  } else if (argv[i] === '--help' || argv[i] === '-h') {
24
32
  args.help = true
25
33
  }
@@ -29,15 +37,19 @@ function parseArgs(argv) {
29
37
 
30
38
  function printUsage() {
31
39
  console.log(`
32
- Usage: npx @atollhq/skill-claude --key <api-key> --org <org-id> [--project <id>] [--team <id-or-slug>] [--base-url <url>]
40
+ Usage: npx @atollhq/skill-claude [--profile <name>] --key <api-key> --org <org-id> [--project <id>] [--team <id-or-slug>] [--base-url <url>]
33
41
  or: ATOLL_API_KEY=<api-key> ATOLL_ORG_ID=<org-id> npx @atollhq/skill-claude
34
42
 
35
43
  Options:
44
+ --profile Atoll CLI profile name to create/update. Defaults to ATOLL_PROFILE.
36
45
  --key Atoll API key (sk_atoll_...). Defaults to ATOLL_API_KEY.
37
46
  --org Organization ID. Defaults to ATOLL_ORG_ID.
38
47
  --project Default project ID. Defaults to ATOLL_PROJECT.
48
+ --no-project Clear any saved default project.
39
49
  --team Default team ID or slug. Defaults to ATOLL_TEAM.
50
+ --no-team Clear any saved default team.
40
51
  --base-url Atoll base URL. Defaults to ATOLL_BASE_URL.
52
+ --no-base-url Clear any saved custom base URL.
41
53
  --help Show this help message
42
54
 
43
55
  This installs the Atoll skill for Claude Code, giving your agent
@@ -46,11 +58,15 @@ the ability to manage tasks, goals, KPIs, and initiatives.
46
58
  }
47
59
 
48
60
  const args = parseArgs(process.argv)
61
+ args.profile ??= process.env.ATOLL_PROFILE
49
62
  args.key ??= process.env.ATOLL_API_KEY
50
63
  args.org ??= process.env.ATOLL_ORG_ID
51
- args.project ??= process.env.ATOLL_PROJECT
52
- args.team ??= process.env.ATOLL_TEAM
53
- args.baseUrl ??= process.env.ATOLL_BASE_URL
64
+ if (args.clearProject) delete args.project
65
+ else args.project ??= process.env.ATOLL_PROJECT
66
+ if (args.clearTeam) delete args.team
67
+ else args.team ??= process.env.ATOLL_TEAM
68
+ if (args.clearBaseUrl) delete args.baseUrl
69
+ else args.baseUrl ??= process.env.ATOLL_BASE_URL
54
70
 
55
71
  if (args.help) {
56
72
  printUsage()
@@ -68,6 +84,42 @@ if (!args.key.startsWith('sk_atoll_')) {
68
84
  process.exit(1)
69
85
  }
70
86
 
87
+ function readJson(path) {
88
+ if (!existsSync(path)) return {}
89
+ try {
90
+ return JSON.parse(readFileSync(path, 'utf-8'))
91
+ } catch {
92
+ console.error(`Warning: could not parse ${path}, creating fresh config`)
93
+ return {}
94
+ }
95
+ }
96
+
97
+ function writeAtollProfile() {
98
+ if (!args.profile) return
99
+
100
+ const atollDir = join(homedir(), '.atoll')
101
+ const configPath = join(atollDir, 'config.json')
102
+ const config = readJson(configPath)
103
+ config.profiles ??= {}
104
+ config.profiles[args.profile] ??= {}
105
+ const profile = config.profiles[args.profile]
106
+
107
+ profile.apiKey = args.key
108
+ profile.orgId = args.org
109
+ delete profile.orgSlug
110
+ if (args.project) profile.defaultProject = args.project
111
+ else delete profile.defaultProject
112
+ if (args.team) profile.defaultTeam = args.team
113
+ else delete profile.defaultTeam
114
+ if (args.baseUrl) profile.baseUrl = args.baseUrl
115
+ else delete profile.baseUrl
116
+ config.activeProfile = args.profile
117
+
118
+ mkdirSync(atollDir, { recursive: true })
119
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n')
120
+ console.log(`Configured Atoll CLI profile "${args.profile}" in ${configPath}`)
121
+ }
122
+
71
123
  // 1. Copy skill files to ~/.claude/skills/atoll-api/
72
124
  const skillSrc = join(__dirname, '..', 'skill')
73
125
  const skillDest = join(homedir(), '.claude', 'skills', 'atoll-api')
@@ -78,25 +130,25 @@ console.log(`Installed skill to ${skillDest}`)
78
130
 
79
131
  // 2. Write credentials to ~/.claude/settings.json env vars
80
132
  const settingsPath = join(homedir(), '.claude', 'settings.json')
81
- let settings = {}
82
- if (existsSync(settingsPath)) {
83
- try {
84
- settings = JSON.parse(readFileSync(settingsPath, 'utf-8'))
85
- } catch {
86
- console.error(`Warning: could not parse ${settingsPath}, creating fresh settings`)
87
- settings = {}
88
- }
89
- }
133
+ let settings = readJson(settingsPath)
90
134
 
91
135
  if (!settings.env) settings.env = {}
136
+ if (args.profile) settings.env.ATOLL_PROFILE = args.profile
92
137
  settings.env.ATOLL_API_KEY = args.key
93
138
  settings.env.ATOLL_ORG_ID = args.org
94
139
  if (args.project) settings.env.ATOLL_PROJECT = args.project
140
+ else delete settings.env.ATOLL_PROJECT
95
141
  if (args.team) settings.env.ATOLL_TEAM = args.team
142
+ else delete settings.env.ATOLL_TEAM
96
143
  if (args.baseUrl) settings.env.ATOLL_BASE_URL = args.baseUrl
144
+ else delete settings.env.ATOLL_BASE_URL
97
145
 
98
146
  writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n')
99
- const configuredVars = ['ATOLL_API_KEY', 'ATOLL_ORG_ID']
147
+ writeAtollProfile()
148
+
149
+ const configuredVars = []
150
+ if (args.profile) configuredVars.push('ATOLL_PROFILE')
151
+ configuredVars.push('ATOLL_API_KEY', 'ATOLL_ORG_ID')
100
152
  if (args.project) configuredVars.push('ATOLL_PROJECT')
101
153
  if (args.team) configuredVars.push('ATOLL_TEAM')
102
154
  if (args.baseUrl) configuredVars.push('ATOLL_BASE_URL')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atollhq/skill-claude",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "Install the Atoll project management skill for Claude Code",
5
5
  "bin": {
6
6
  "skill-claude": "bin/install.mjs"
package/skill/SKILL.md CHANGED
@@ -151,9 +151,20 @@ atoll feedback "The status error should list custom board statuses"
151
151
  atoll project list
152
152
  atoll milestone list --project <project-id>
153
153
  atoll milestone upsert --project <project-id> --name "v1.0" --date 2026-06-01
154
+
155
+ # Goals, KPIs, and initiatives
156
+ atoll goal create --title "Reach 100 paying customers by Q2" --target-date 2026-06-30
157
+ atoll kpi create --name paying_customers --goal "Reach 100 paying customers by Q2" --unit count --target 100 --current 34
158
+ atoll initiative create --title "Content pipeline" --goal "Reach 100 paying customers by Q2" --status active
159
+ atoll initiative kpi link "Content pipeline" paying_customers --impact "+30 customers/mo"
160
+ atoll kpi snapshot add paying_customers --value 42 --initiative "Content pipeline" --note "End-of-week Stripe check"
161
+
162
+ # Audit the strategy chain for gaps (orphaned initiatives, goals with no KPI, etc.)
163
+ atoll strategy audit
164
+ atoll strategy audit --severity critical --json
154
165
  ```
155
166
 
156
- Prefer the CLI for routine task operations, heartbeat checks, comments, and feedback. Use direct API calls when the CLI does not expose the needed endpoint yet.
167
+ Prefer the CLI for routine task operations, heartbeat checks, comments, feedback, and strategy setup. Use direct API calls when the CLI does not expose the needed endpoint yet.
157
168
 
158
169
  CLI JSON conventions:
159
170
 
@@ -163,6 +174,93 @@ CLI JSON conventions:
163
174
  - `atoll agent-context` returns a versioned command/flag manifest and available profile context.
164
175
  - `atoll plan validate/apply` consumes `schemaVersion: "atoll.plan.v1"` files with `milestones`, `issues`, `dependencies`, `initiativeLinks`, and `milestoneLinks`; local `key` values can be referenced by `milestoneKey`, `issueKey`, `dependsOn`, `blockedBy`, or `blocks`.
165
176
 
177
+ ## Remote MCP Server
178
+
179
+ Use `@atollhq/mcp-server` when an agent or ChatGPT-style client needs Atoll access but cannot run a local CLI command or read local auth profiles.
180
+
181
+ ```bash
182
+ npm install -g @atollhq/mcp-server
183
+ PORT=8787 atoll-mcp
184
+ ```
185
+
186
+ Remote MCP clients call `POST /mcp` with Streamable HTTP and should send `Authorization: Bearer sk_atoll_...` per request. Single-tenant deployments can set `ATOLL_API_KEY` and `ATOLL_ORG_ID` as environment variables.
187
+
188
+ The MCP server mirrors core CLI workflows with tools such as `atoll_get_heartbeat`, issue/project/goal/KPI/initiative/milestone tools, dependency tools, webhook tools, `atoll_send_feedback`, and `atoll_api_request` for advanced endpoints.
189
+
190
+ Keep Atoll skills separate from the MCP package. Skills are client-side agent guidance; the MCP server is runtime infrastructure for auth, transport, validation, and Atoll API calls.
191
+
192
+ ## AI-Assisted Setup
193
+
194
+ When a user needs help setting up Atoll, lean into the AI workflow. Atoll is most useful when the user's AI assistant helps turn messy context into projects, issues, goals, KPIs, and agent instructions.
195
+
196
+ If you are the AI assistant with CLI access, prefer doing the setup directly after confirming the intended org/profile and scope. Start with read-only orientation:
197
+
198
+ ```bash
199
+ atoll auth profiles
200
+ atoll heartbeat --json
201
+ atoll issue list --json --limit 10
202
+ ```
203
+
204
+ If the user is setting up Atoll in another AI tool, give them a copyable prompt. Keep secrets out of chat: tell the user to run auth commands locally and never ask them to paste `sk_atoll_...` keys into a model conversation unless they explicitly choose that risk.
205
+
206
+ If the user is in Atoll's first-run setup wizard, the key may be setup-scoped. In that mode, inspect the repo or interview the user, then create or revise the setup proposal only. Do not try to create projects, goals, KPIs, initiatives, or issues directly, and do not approve/apply the proposal. The human reviews the editable proposal in Atoll and approves it there.
207
+
208
+ ### Prompt: Create the First Board
209
+
210
+ ```text
211
+ I am setting up Atoll for my team. Help me create the first project an AI agent could understand.
212
+ Ask me 3-5 questions about the current push, then propose:
213
+ - one project name
214
+ - the outcome this project should drive
215
+ - 3-5 initial issues with clear titles, context, priorities, and owners if known
216
+ - which issue an agent should pick up first and why
217
+ Keep the setup small. I want a useful first board, not a full migration.
218
+ ```
219
+
220
+ ### Prompt: Turn a Project Into Issues
221
+
222
+ ```text
223
+ I have an Atoll project but need help turning it into actionable issues.
224
+ Interview me about the project, then write 5 issues an AI agent could execute.
225
+ For each issue include:
226
+ - title
227
+ - why it matters
228
+ - acceptance criteria
229
+ - suggested priority
230
+ - any context the agent would need before starting
231
+ Make the issues specific enough that I can paste them into Atoll with minimal editing.
232
+ ```
233
+
234
+ ### Prompt: Install and Authenticate the CLI
235
+
236
+ ```text
237
+ Help me connect this workspace to Atoll.
238
+ First, explain what the Atoll CLI will let you do and what credentials you need.
239
+ Then walk me through installing @atollhq/cli, adding an agent in Atoll, authenticating with the API key, and running a safe read-only check like `atoll issue list`.
240
+ Do not ask me to paste secrets into chat unless I explicitly choose to. Tell me where to run each command locally.
241
+ ```
242
+
243
+ ### Prompt: Run the First Heartbeat
244
+
245
+ ```text
246
+ You are helping me set up Atoll for agentic project management.
247
+ Use the Atoll CLI to orient before doing any work.
248
+ Run `atoll heartbeat`, summarize what you can see, identify the highest-leverage next action, and tell me whether you have enough access to list issues and update your assigned work.
249
+ If anything is missing, explain the exact setup step I need to complete in Atoll.
250
+ ```
251
+
252
+ ### Prompt: Draft the Strategy Chain
253
+
254
+ ```text
255
+ Help me define the strategy chain for my Atoll workspace.
256
+ Ask me what business outcome matters most this month, then propose:
257
+ - one goal with a clear target date
258
+ - 1-2 KPIs that show whether we are on pace
259
+ - one initiative expected to move the KPI
260
+ - 3 issues that belong under that initiative
261
+ Keep it practical. I want the smallest strategy layer that would help an AI agent choose better work.
262
+ ```
263
+
166
264
  ## Quick Start — API (for advanced use)
167
265
 
168
266
  All CLI commands map to REST endpoints. Use the API directly when the CLI doesn't cover a specific operation.
@@ -229,8 +327,40 @@ atoll issue update ATOLL-42 --status done # complete
229
327
  5. `POST /api/orgs/{id}/initiatives/{id}/kpi-impacts` -- declare expected KPI impact
230
328
  6. Link issues and milestones to the initiative
231
329
 
330
+ CLI equivalent:
331
+
332
+ ```bash
333
+ atoll goal create --title "Reach 100 paying customers by Q2" --target-date 2026-06-30
334
+ atoll kpi create --name paying_customers --goal "Reach 100 paying customers by Q2" --unit count --target 100 --current 34
335
+ atoll initiative create --title "Content pipeline" --goal "Reach 100 paying customers by Q2" --status active
336
+ atoll initiative kpi link "Content pipeline" paying_customers --impact "+30 customers/mo"
337
+ atoll kpi snapshot add paying_customers --value 42 --initiative "Content pipeline" --note "End-of-week Stripe check"
338
+ ```
339
+
232
340
  Every KPI snapshot can be attributed to an initiative or issue, building a record of *what actually moved the numbers*.
233
341
 
342
+ ### Audit and improve the strategy
343
+
344
+ Use the audit to review the whole strategy chain at a high level and fix structural problems — the common one being initiatives created without a goal.
345
+
346
+ ```bash
347
+ atoll strategy audit # human-readable, grouped by severity
348
+ atoll strategy audit --json # findings[] for programmatic remediation
349
+ ```
350
+
351
+ `GET /api/orgs/{id}/strategy/audit` returns `findings[]` (each with a `type`, `severity`, the relevant entity id, and a concrete `suggested_fix`) plus `summary` counts. It diagnoses; you remediate with the normal write endpoints. Typical loop:
352
+
353
+ 1. `atoll strategy audit --json` to get findings.
354
+ 2. For each finding, apply its `suggested_fix`, e.g.:
355
+ - `initiative_orphaned` → `atoll initiative update "<initiative>" --goal "<goal>"` (or `PATCH .../initiatives/{id} { goal_id }`)
356
+ - `goal_missing_kpi` → `atoll kpi create --goal "<goal>" --name ... --target ...`
357
+ - `kpi_missing_target` → `atoll kpi update <kpi> --target ... --direction increase`
358
+ - `kpi_unrecorded` / `kpi_stale` → `atoll kpi snapshot add <kpi> --value ...`
359
+ - `initiative_missing_impact` → `atoll initiative kpi link "<initiative>" <kpi> --impact "..."`
360
+ 3. Re-run the audit to confirm the findings cleared.
361
+
362
+ This is the structural-health lens (is the strategy well-formed?), complementary to `heartbeat`, which is the operational lens (what should I do today?).
363
+
234
364
  ### Bulk create tasks from a plan
235
365
 
236
366
  `POST /api/orgs/{id}/issues/bulk` with `{ "issues": [{...}, ...] }` (max 50).
@@ -21,6 +21,7 @@ All endpoints require `Authorization: Bearer sk_atoll_...` header.
21
21
  - [KPIs](#kpis)
22
22
  - [Initiatives](#initiatives)
23
23
  - [Initiative Links](#initiative-links)
24
+ - [Strategy](#strategy)
24
25
  - [Heartbeat](#heartbeat)
25
26
  - [Activity](#activity)
26
27
  - [Teams](#teams)
@@ -109,6 +110,11 @@ Plan limits are enforced when creating projects, human members, agents/integrati
109
110
  | DELETE | `/api/orgs/{id}/issues/{issueId}` | Delete task (admin/owner only) |
110
111
  | POST | `/api/orgs/{id}/issues/bulk` | Bulk create tasks (up to 50) |
111
112
  | GET | `/api/orgs/{id}/issues/search?q=...` | Search tasks by title |
113
+ | GET | `/api/orgs/{id}/issues/{issueId}/initiatives` | List initiatives linked to a task |
114
+ | POST | `/api/orgs/{id}/issues/{issueId}/initiatives` | Link task to initiative (`{ initiative_id }`) |
115
+ | DELETE | `/api/orgs/{id}/issues/{issueId}/initiatives/{initiativeId}` | Unlink task from initiative |
116
+
117
+ Issue-centric initiative links follow task project permissions: reading links requires access to the task's project; linking and unlinking requires a non-guest member with non-view access.
112
118
 
113
119
  **List filters** (query params):
114
120
  - `status` -- `backlog`, `todo`, `in_progress`, `done`, `cancelled`
@@ -224,6 +230,14 @@ Create accepts `title` or legacy `name`, plus camelCase aliases `goalId`, `owner
224
230
  | POST | `.../initiatives/{id}/milestones` | Link milestone (`{ milestone_id }`) |
225
231
  | DELETE | `.../initiatives/{id}/milestones/{milestoneId}` | Unlink milestone |
226
232
 
233
+ ## Strategy
234
+
235
+ | Method | Endpoint | Description |
236
+ |--------|----------|-------------|
237
+ | GET | `/api/orgs/{id}/strategy/audit` | Audit the strategy chain for structural gaps + health issues, each with a suggested fix |
238
+
239
+ Returns findings only (not the full graph). Use it for a high-level review — orphaned initiatives/KPIs (no goal), goals with no KPI or no initiative, KPIs missing targets/stale/off-pace, initiatives missing impact/execution or stalled, blocked/overdue work — then remediate with the goal/KPI/initiative write endpoints above. Forbidden for guests. CLI: `atoll strategy audit [--severity critical|warning|info] [--json]`.
240
+
227
241
  ## Heartbeat
228
242
 
229
243
  | Method | Endpoint | Description |
@@ -333,7 +347,7 @@ Custom statuses per project. Each column defines a valid status value.
333
347
  | GET | `/api/orgs/{id}/issues/{issueId}/pr-links` | List linked pull requests |
334
348
  | POST | `/api/orgs/{id}/issues/{issueId}/pr-links` | Attach a GitHub PR URL (`{ url }`) |
335
349
 
336
- Attach PRs manually with a canonical GitHub pull request URL such as `https://github.com/owner/repo/pull/123`; malformed or non-PR URLs return `400`. PR links can also be created automatically via the GitHub webhook integration.
350
+ Attach PRs manually with a canonical GitHub pull request URL such as `https://github.com/owner/repo/pull/123`; malformed or non-PR URLs return `400`. On attach, Atoll refreshes GitHub metadata when available so title/status/head SHA reflect the PR instead of only the submitted URL. PR links can also be created or refreshed automatically via the GitHub webhook integration.
337
351
 
338
352
  ## Project Status Updates
339
353
 
@@ -398,7 +412,7 @@ URL must be HTTPS. Returns webhook record plus `secret` for HMAC verification.
398
412
  | Method | Endpoint | Description |
399
413
  |--------|----------|-------------|
400
414
  | GET | `/api/orgs/{id}/agents` | List agents (owner/admin) |
401
- | POST | `/api/orgs/{id}/agents` | Create agent (`{ name, role? }`) |
415
+ | POST | `/api/orgs/{id}/agents` | Create agent (`{ name, role?, setupScoped? }`) |
402
416
  | DELETE | `/api/orgs/{id}/agents/{agentId}` | Revoke agent |
403
417
  | GET | `/api/orgs/{id}/agents/{agentId}/keys` | List API keys |
404
418
  | POST | `/api/orgs/{id}/agents/{agentId}/keys` | Generate new key |
@@ -408,6 +422,22 @@ URL must be HTTPS. Returns webhook record plus `secret` for HMAC verification.
408
422
 
409
423
  Install snippets returns config for `claude-code`, `codex`, `gemini`, `openclaw` (agent prompt), `openclaw-manual`, `hermes` (agent prompt), and `hermes-manual`. The server resolves the org slug and validates optional project/team IDs before generating snippets.
410
424
 
425
+ ## Agent-first setup
426
+
427
+ | Method | Endpoint | Description |
428
+ |--------|----------|-------------|
429
+ | GET | `/api/orgs/{id}/setup` | Read latest setup session and active draft proposal (owner/admin) |
430
+ | POST | `/api/orgs/{id}/setup` | Create setup session (`{ preferredAi?, mode, setupAgentMemberId? }`) |
431
+ | PATCH | `/api/orgs/{id}/setup` | Skip setup (`{ setupSessionId, status: "skipped" }`) |
432
+ | POST | `/api/orgs/{id}/setup/proposals` | Setup-scoped local agent submits a draft proposal |
433
+ | PATCH | `/api/orgs/{id}/setup/proposals` | Owner/admin edits the active draft proposal |
434
+ | POST | `/api/orgs/{id}/setup/apply` | Owner/admin approves and applies a proposal |
435
+ | POST | `/api/orgs/{id}/setup/chatkit/session` | Create ChatKit client session for a web-agent setup session |
436
+ | POST | `/api/orgs/{id}/setup/chatkit/client-tool` | Browser-mediated ChatKit client tool endpoint for proposal submit/revise only |
437
+ | POST | `/api/orgs/{id}/setup/chatkit/tools` | Optional server-to-server ChatKit tool endpoint for proposal submit/revise only |
438
+
439
+ Setup-scoped agent keys can call setup proposal endpoints and auth validation, but not normal workspace mutation endpoints. Human approval applies proposals and promotes the setup key by clearing its setup scope. The default web-agent flow uses ChatKit client tools handled in the browser and posted to `client-tool` with the user's web session. ChatKit tools cannot apply proposals.
440
+
411
441
  ## Integrations
412
442
 
413
443
  | Method | Endpoint | Description |
@@ -10,6 +10,7 @@
10
10
  - [Automation Rule Fields](#automation-rule-fields)
11
11
  - [Custom View Fields](#custom-view-fields)
12
12
  - [Webhook Fields](#webhook-fields)
13
+ - [Setup Proposal Fields](#setup-proposal-fields)
13
14
  - [Heartbeat Response](#heartbeat-response)
14
15
  - [Analytics Response](#analytics-response)
15
16
  - [Plan Limit Errors](#plan-limit-errors)
@@ -183,6 +184,29 @@ Add/remove projects with `{ "project_id": "uuid" }`.
183
184
 
184
185
  URL must be HTTPS. Response includes `secret` for HMAC signature verification.
185
186
 
187
+ ## Setup Proposal Fields
188
+
189
+ First-run setup proposals are editable drafts. Setup-scoped local agents and ChatKit tools can submit or revise drafts; owner/admin humans apply them.
190
+
191
+ ```json
192
+ {
193
+ "setupSessionId": "setup-session-uuid",
194
+ "proposal": {
195
+ "projects": [{ "name": "Launch v1", "description": "..." }],
196
+ "goals": [{ "title": "Reach 100 paying customers", "target_date": "2026-06-30" }],
197
+ "kpis": [{ "name": "paying_customers", "target_value": 100, "target_direction": "increase" }],
198
+ "initiatives": [{ "title": "Content pipeline", "description": "Publish and distribute launch content", "expected_impact": "Increase qualified signups" }],
199
+ "milestones": [{ "name": "Public beta", "description": "Launch the public beta workspace", "due_date": "2026-05-15" }],
200
+ "issues": [{ "title": "Instrument signup funnel", "description": "Track signup start, completion, and activation", "priority": 1 }]
201
+ },
202
+ "evidence": {
203
+ "summary": "Optional notes about repo files or user answers that informed the proposal"
204
+ }
205
+ }
206
+ ```
207
+
208
+ Proposal JSON currently supports at most one item in each collection: `projects`, `goals`, `kpis`, `initiatives`, `milestones`, and `issues`. A revision replaces the active draft and preserves the previous revision as history. ChatKit tools and setup-scoped agents cannot apply proposals.
209
+
186
210
  ## Heartbeat Response
187
211
 
188
212
  ```json
@@ -218,6 +242,34 @@ URL must be HTTPS. Response includes `secret` for HMAC signature verification.
218
242
  }
219
243
  ```
220
244
 
245
+ ## Strategy Audit Response
246
+
247
+ `GET /api/orgs/{id}/strategy/audit` returns findings (sorted critical → warning → info), each with a concrete `suggested_fix`, plus summary counts.
248
+
249
+ ```json
250
+ {
251
+ "findings": [
252
+ {
253
+ "type": "initiative_orphaned",
254
+ "severity": "warning",
255
+ "title": "\"Content pipeline\" is not attached to a goal",
256
+ "message": "This initiative is not linked to any goal...",
257
+ "suggested_fix": "Attach it to a goal: PATCH /api/orgs/{orgId}/initiatives/<id> { \"goal_id\": \"<goalId>\" }",
258
+ "initiative_id": "..."
259
+ }
260
+ ],
261
+ "summary": { "total": 7, "critical": 1, "warning": 4, "info": 2 },
262
+ "counts_by_type": { "initiative_orphaned": 2, "goal_missing_kpi": 1 }
263
+ }
264
+ ```
265
+
266
+ Each finding carries whichever entity ids apply: `goal_id`, `kpi_id`, `initiative_id`, `issue_id`, `milestone_id`, `project_id`. Finding `type` values:
267
+
268
+ - Structural: `initiative_orphaned`, `kpi_orphaned`, `goal_missing_kpi`, `goal_missing_initiative`
269
+ - KPI health: `kpi_unrecorded`, `kpi_missing_target`, `kpi_stale`, `kpi_off_pace`
270
+ - Initiative health: `initiative_missing_impact`, `initiative_missing_execution`, `initiative_stalled`
271
+ - Execution: `issue_blocked`, `issue_overdue`, `milestone_overdue`
272
+
221
273
  ## Analytics Response
222
274
 
223
275
  ```json