doc/plans/2026-05-23-cli-api-parity.md
Date: 2026-05-23
Branch: improvement/cli-api-parity
Status: PRD
Paperclip already exposes a broad REST API, but the CLI only covers a narrow operator slice: setup/configuration, context profiles, board auth, companies import/export/delete, issues basic CRUD/comments/checkout/release, approvals, agents list/get/local CLI key export, activity, dashboard, secrets basics, plugin lifecycle basics, feedback export, and cloud sync.
The next CLI product slice should make the CLI a real external API entry point:
The most important requirement is credential ergonomics. External integrations need a reliable "way in" to Paperclip:
Current top-level command families:
onboard, doctor, configure, env, run, db:backup, allowed-hostname, env-lab, worktreecontext, auth login, auth logout, auth whoami, auth bootstrap-ceocompany list, company get, company export, company import, company delete, company feedback exportissue list, issue get, issue create, issue update, issue comment, issue checkout, issue release, issue feedback exportagent list, agent get, agent local-cliapproval list/get/create/approve/reject/request-revision/resubmit/commentactivity list, dashboard getsecrets list/declarations/create/link/doctor/providers/migrate-inline-envCurrent auth behavior:
auth login creates a CLI auth challenge, opens the board approval URL, and stores the approved board token locally.agent local-cli creates an agent API key through board access, installs local skills, and prints PAPERCLIP_API_URL, PAPERCLIP_COMPANY_ID, PAPERCLIP_AGENT_ID, and PAPERCLIP_API_KEY.--api-base, --api-key, --context, --profile, --company-id, and --json.Main limitation:
curl passthrough the primary parity story.The CLI must always know which Paperclip API it is operating against. This is especially important for fork/local development, where Paperclip may run on 3101+ rather than the upstream default 3100.
Resolution order:
--api-base <url>.PAPERCLIP_API_URL.apiBase.http://localhost:3100.Behavior requirements:
paperclipai connect must show the resolved API base before any auth or mutation and allow the user to override it.--api-base and produce a clear connection error that includes the attempted URL and a health-check hint.apiBase so a board/agent persona is always tied to the API instance it was created for.connect should call GET /api/health against the selected API base.Command:
paperclipai connect
Flow:
auth login.persona=board, apiBase, companyId, and token env-var preference.persona=agent, companyId, agentId, agentName, and token env-var preference.Expected profile shape should evolve from today's context:
{
"version": 2,
"currentProfile": "default",
"profiles": {
"default": {
"apiBase": "http://localhost:3100",
"companyId": "company-id",
"persona": "agent",
"agentId": "agent-id",
"apiKeyEnvVarName": "PAPERCLIP_API_KEY"
}
}
}
Commands:
paperclipai token board create --company-id <company-id> --name "external-admin"
paperclipai token board list
paperclipai token board revoke <key-id>
Requirements:
Current API support:
/api/cli-auth/challenges./api/cli-auth/revoke-current.API gap:
GET /api/board-api-keysPOST /api/board-api-keysDELETE /api/board-api-keys/:keyIdCommands:
paperclipai token agent create --company-id <company-id> --agent <agent-id-or-name> --name "external-worker"
paperclipai token agent list --company-id <company-id> --agent <agent-id-or-name>
paperclipai token agent revoke --agent <agent-id-or-name> <key-id>
Requirements:
agentId, companyId, key id, key name, and plaintext token once.agent_api_keys.Current API support:
GET /api/agents/:id/keysPOST /api/agents/:id/keysDELETE /api/agents/:id/keys/:keyIdCLI gap:
agent local-cli can create a key, but it is bundled with skill installation and local CLI setup.Required user-facing shape:
paperclipai agent-prompt <agent-name-or-id> <agent-api-key> "Prompt here"
Recommended safer variants:
paperclipai agent prompt --agent <agent-name-or-id> --api-key-env PAPERCLIP_API_KEY "Prompt here"
paperclipai agent prompt --profile my-agent "Prompt here"
paperclipai board prompt --agent <agent-name-or-id> "Prompt here"
Behavior:
GET /api/agents/me.--issue is passed.Open decision:
issue create + assign + wake, because Paperclip's communication model is tasks/comments, not chat.--issue <id> and should add an issue comment plus optional wake.Priority is based on external API usefulness, not raw endpoint count.
OpenAPI source audit:
feature/openapi-specserver/src/openapi.tsdoc/plans/2026-05-23-cli-api-parity-openapi-reference.tsserver/src/__tests__/openapi-spec.test.ts, which asserts the OpenAPI document covers mounted server routes exactly.Additional gaps made explicit by the OpenAPI branch:
GET /api/openapi.json, board-claim get/claim, invite onboarding docs, skill docs, join key claim, and CLI auth challenge status/approve/cancel./api/companies/:companyId/export, /api/companies/import/preview, /api/companies/import, /api/companies/issues, and bare GET /api/issues.claude-login, scheduler heartbeat visibility, org SVG/PNG export, adapter UI parser, and agent approval.GET /api/companies/:companyId/cost-events; current main exposes POST /api/companies/:companyId/cost-events plus additional summary and finance read endpoints. Treat this as a spec/code drift item before implementation.Missing or incomplete CLI surfaces:
GET /api/cli-auth/me is covered by auth whoami.POST /api/cli-auth/revoke-current is covered by auth logout.agent me for GET /api/agents/me.agent inbox for GET /api/agents/me/inbox-lite and GET /api/agents/me/inbox/mine.GET/POST/DELETE /api/agents/:id/keys.GET /api/board-claim/:tokenPOST /api/board-claim/:token/claimPOST /api/cli-auth/challengesGET /api/cli-auth/challenges/:idPOST /api/cli-auth/challenges/:id/approvePOST /api/cli-auth/challenges/:id/cancelPOST /api/join-requests/:requestId/claim-api-keyMissing CLI surfaces:
POST /api/agents/:id/wakeupPOST /api/agents/:id/heartbeat/invoke is partially covered by heartbeat run, but not integrated with prompt handoff.GET /api/companies/:companyId/heartbeat-runsGET /api/companies/:companyId/live-runsGET /api/heartbeat-runs/:runIdPOST /api/heartbeat-runs/:runId/cancelGET /api/heartbeat-runs/:runId/eventsGET /api/heartbeat-runs/:runId/logGET /api/issues/:issueId/live-runsGET /api/issues/:issueId/active-runGET /api/issues/:id/runsGET /api/heartbeat-runs/:runId/issuesPOST /api/heartbeat-runs/:runId/watchdog-decisionsGET /api/heartbeat-runs/:runId/workspace-operationsGET /api/workspace-operations/:operationId/logCLI commands to add:
paperclipai agent wake <agent>
paperclipai run list --company-id <company-id>
paperclipai run get <run-id>
paperclipai run log <run-id>
paperclipai run cancel <run-id>
paperclipai issue runs <issue-id>
Missing CLI surfaces:
GET /api/companies/:companyId/projectsPOST /api/companies/:companyId/projectsGET /api/projects/:idPATCH /api/projects/:idDELETE /api/projects/:idGET /api/companies/:companyId/goalsPOST /api/companies/:companyId/goalsGET /api/goals/:idPATCH /api/goals/:idDELETE /api/goals/:idCommands:
paperclipai project list|get|create|update|delete
paperclipai goal list|get|create|update|delete
Missing CLI surfaces:
GET /api/issuesGET /api/companies/:companyId/searchGET /api/companies/:companyId/issues/countGET /api/companies/issuesGET/POST /api/companies/:companyId/labelsDELETE /api/labels/:labelIdPOST /api/issues/:id/childrenPOST /api/issues/:id/admin/force-releaseGET /api/issues/:id/documentsGET/PUT/DELETE /api/issues/:id/documents/:keyGET/POST /api/issues/:id/work-productsPATCH/DELETE /api/work-products/:idGET/POST /api/issues/:id/interactionsPOST/DELETE /api/issues/:id/readPOST/DELETE /api/issues/:id/inbox-archiveGET /api/issues/:id/attachmentsPOST /api/companies/:companyId/issues/:issueId/attachmentsGET /api/attachments/:attachmentId/contentDELETE /api/attachments/:attachmentIdGET /api/issues/:id/comments/:commentIdDELETE /api/issues/:id/comments/:commentIdGET /api/issues/:id/recovery-actionsPOST /api/issues/:id/recovery-actions/resolveCommands:
paperclipai issue child create <issue-id>
paperclipai issue document list|get|put|delete|lock|unlock|revisions|restore
paperclipai issue work-product list|create|update|delete
paperclipai issue interaction list|create|accept|reject|respond|cancel
paperclipai issue attachment list|upload|download|delete
paperclipai issue force-release <issue-id>
paperclipai issue label list|create|delete
paperclipai issue read|unread|archive|unarchive
Missing CLI surfaces:
POST /api/companies/:companyId/agentsPATCH /api/agents/:idPOST /api/agents/:id/pausePOST /api/agents/:id/resumePOST /api/agents/:id/approvePOST /api/agents/:id/terminateDELETE /api/agents/:idGET /api/companies/:companyId/orgGET /api/companies/:companyId/org.svgGET /api/companies/:companyId/org.pngGET /api/companies/:companyId/agent-configurationsGET /api/agents/:id/configurationGET /api/agents/:id/skillsPOST /api/agents/:id/skills/syncPOST /api/agents/:id/claude-loginGET /api/instance/scheduler-heartbeatsCommands:
paperclipai agent create|update|pause|resume|approve|terminate|delete
paperclipai agent org
paperclipai agent config get|revisions|rollback
paperclipai agent instructions get|set|file
paperclipai adapter list|models|profiles|detect|test|install|enable|disable|reload
Missing CLI surfaces:
POST /api/companies/:companyId/cost-eventsGET /api/companies/:companyId/cost-events from the OpenAPI branch needs reconciliation with main before implementation.POST /api/companies/:companyId/finance-eventsPATCH /api/companies/:companyId/budgetsPATCH /api/agents/:agentId/budgetsGET /api/issues/:id/cost-summaryCommands:
paperclipai cost summary|by-agent|by-project|by-provider|issue
paperclipai cost event create
paperclipai finance event create|list|summary
paperclipai budget overview|set-company|set-agent|policy-create|incident-resolve
Missing CLI surfaces:
GET /api/auth/get-sessionGET /api/auth/profilePATCH /api/auth/profileGET /api/companies/:companyId/users/:userSlug/profileCommands:
paperclipai invite create|list|revoke|show|onboarding
paperclipai join list|approve|reject|claim-key
paperclipai member list|update|archive|permissions
paperclipai admin user list|promote|demote|company-access
Missing CLI surfaces:
Commands:
paperclipai routine list|create|get|update|run|runs|trigger|revision
paperclipai environment list|create|get|update|delete|probe|leases
paperclipai workspace list|get|update|operations|runtime
paperclipai project workspace list|create|update|delete|runtime
Missing CLI surfaces:
GET /api/openapi.jsonPOST /api/companies/:companyId/exportPOST /api/companies/import/previewPOST /api/companies/importPOST /api/companies/:companyId/exportsPOST /api/companies/:companyId/exports/previewPOST /api/companies/:companyId/imports/previewPOST /api/companies/:companyId/imports/applyRecommended command hierarchy:
paperclipai connect
paperclipai token board|agent create|list|revoke
paperclipai whoami
paperclipai prompt ...
paperclipai board ...
paperclipai agent ...
paperclipai issue ...
paperclipai project ...
paperclipai goal ...
paperclipai run ...
paperclipai cost ...
paperclipai budget ...
paperclipai routine ...
paperclipai environment ...
paperclipai workspace ...
paperclipai invite ...
paperclipai member ...
paperclipai plugin ...
paperclipai instance ...
Alias policy:
paperclipai ask as an alias for paperclipai prompt.GET /api/agents/me to establish identity instead of trusting CLI flags.--company-id is a context selector, not an authorization bypass.--json output when practical.Automated tests should prefer mocked HTTP/server fixtures where possible. Live/API verification is allowed, but it must be isolated:
CLI Parity Test plus a timestamp or random suffix.--yes or non-interactive path for test setup so CI and local verification do not depend on manual prompts.persona, agentId, and token metadata.connect wizard.token agent create/list/revoke.agent me.agent prompt and prompt using issue create/comment plus optional wake.token board create/list/revoke.paperclipai connect, confirm or override the API base, select board or agent, and get a saved working profile tied to that API base.agent local-cli.paperclipai agent-prompt AgentName "$AGENT_API_KEY" "Prompt here"
The full OpenAPI source snapshot is kept next to this PRD at doc/plans/2026-05-23-cli-api-parity-openapi-reference.ts. Use that file when request body schemas, auth levels, response statuses, tags, operation summaries, or the complete endpoint inventory are needed.