doc/plans/2026-02-19-ceo-agent-creation-and-hiring.md
Status: Proposed
Date: 2026-02-19
Owner: Product + Server + UI + Skills
Enable a CEO agent to create new agents directly, with lightweight but explicit governance:
can_create_agents (default ON for CEO, OFF for everyone else).POST /api/companies/:companyId/agents (server/src/routes/agents.ts).pending/approved/rejected/cancelled and hire_agent + approve_ceo_strategy (packages/shared/src/constants.ts, server/src/services/approvals.ts).hire_agent approval currently creates the agent only on approval; there is no pre-created limbo agent.Add company setting:
requireBoardApprovalForNewAgents: booleantrueIntroduce lightweight permission model with one explicit permission now:
can_create_agents: booleanDefaults:
truefalseAuthority:
No broader RBAC system in this phase.
Introduce dedicated non-operational status:
pending_approvalMeaning:
companiesAdd column:
require_board_approval_for_new_agents boolean not null default trueSync required:
packages/db/src/schema/companies.tspackages/shared/src/types/company.tspackages/shared/src/validators/company.tsagentsAdd columns:
permissions jsonb not null default {}pending_approvalSync required:
packages/db/src/schema/agents.tspackages/shared/src/constants.ts (AGENT_STATUSES)packages/shared/src/types/agent.tspackages/shared/src/validators/agent.tsapprovalsKeep approval as central governance record; extend workflow support:
revision_requestedagentIdrequestedByAgentIdrequestedConfigurationSnapshotapproval_comments tableAdd discussion thread for approvals:
id, company_id, approval_id, author_agent_id, author_user_id, body, timestampsPurpose:
Add server-side authz helpers:
assertCanCreateAgents(req, companyId)assertCanManageAgentPermissions(req, companyId)Rules:
can_create_agents check if self permission true and same company.Add route:
POST /api/companies/:companyId/agent-hiresBehavior:
can_create_agents (or board).status=pending_approvalapprovals(type=hire_agent,status=pending,payload.agentId=...)idleBoard may continue using direct create route, but this route becomes canonical for CEO/agent-led hiring.
Add/extend:
GET /api/approvals/:idPOST /api/approvals/:id/request-revisionPOST /api/approvals/:id/resubmitGET /api/approvals/:id/commentsPOST /api/approvals/:id/commentsUpdate existing approve/reject semantics:
pending_approval -> idlepending_approval or terminated/purged later)Add:
PATCH /api/agents/:id/permissionsSupports initial key only:
{ "canCreateAgents": boolean }Add permission-gated config-read endpoints:
GET /api/companies/:companyId/agent-configurationsGET /api/agents/:id/configurationAccess:
can_create_agentsSecurity:
env, API keys, tokens, JWT-looking values)Add plain-text reflection routes:
GET /llms/agent-configuration.txtGET /llms/agent-configuration/:adapterType.txtIndex file includes:
Per-adapter file includes:
Auth:
can_create_agents).Extend ServerAdapterModule contract to expose config docs:
agentConfigurationDoc (string) or getAgentConfigurationDoc()Implement in:
packages/adapters/claude-localpackages/adapters/codex-localserver/src/adapters/registry.tsThis is required so reflection is generated from installed adapters, not hardcoded.
In Companies UI, add advanced settings panel/modal with:
Not shown in onboarding flow.
In Agent Detail (board/CEO context):
Add "Hire Agent" flow (for CEO/authorized agents):
State messaging:
Add approval detail page and expand inbox integration:
/approvals/:approvalIdProvide board-only destructive action in approval detail:
paperclip-create-agentCreate new skill directory:
skills/paperclip-create-agent/SKILL.mdskills/paperclip-create-agent/references/api-reference.mdSkill responsibilities:
/llms/agent-configuration*.txtAlso update skills/paperclip/SKILL.md to reference this skill for hiring workflows.
New/updated invariants:
pending_approval agents cannot:
pending -> revision_requested | approved | rejected | cancelledrevision_requested -> pending | rejected | cancelledactivity_log records.companies, agents, approvals status expansion, approval_comments)agent-hires route/llms/agent-configuration*.txt routespaperclip-create-agent skill + docs updatesServer tests:
UI tests:
Repo verification before merge:
pnpm -r typecheckpnpm test:runpnpm buildpending_approval) with explicit transition guards.Should board direct-create bypass approval setting? Recommendation: yes, board is explicit governance override.
Should non-authorized agents still see basic agent metadata? Recommendation: yes (name/role/status), but configuration fields stay restricted.
On rejection, should limbo agent remain pending_approval or move to terminated?
Recommendation: move to terminated on final reject; keep optional hard delete action for cleanup.