doc/plans/2026-02-19-agent-mgmt-followup-plan.md
Status: Proposed
Date: 2026-02-19
Context: Follow-up from run faeab00e-7857-4acc-b2b2-86f6d078adb4
Root cause is explicit route logic:
server/src/routes/agents.ts currently blocks any agent patching another agent:
if (req.actor.type === "agent" && req.actor.agentId !== id) { ... "Agent can only modify itself" }So even though the CEO has hire permission, the route still enforces old self-only patch behavior.
skills/paperclip/SKILL.md and skills/paperclip/references/api-reference.md do not currently require markdown formatting quality for status comments (links, structure, readable updates).Target behavior:
Note:
Every config-affecting mutation must create a revision record with:
Rollback must be one API call that restores a prior revision atomically.
Skill guidance should require:
Summary, Actions, Next)Implement canonical join model so one issue can link many approvals and one approval can link many issues.
agent_config_revisionsColumns:
id uuid pkcompany_id uuid fkagent_id uuid fkrevision_number int (monotonic per agent)reason text nullchanged_by_agent_id uuid nullchanged_by_user_id text nullrun_id uuid nullbefore_snapshot jsonb not nullafter_snapshot jsonb not nullIndexes:
(company_id, agent_id, revision_number desc)(agent_id, created_at desc)issue_approvalsColumns:
id uuid pkcompany_id uuid fkissue_id uuid fkapproval_id uuid fkrelationship text default contextlinked_by_agent_id uuid nulllinked_by_user_id text nullConstraints:
(company_id, issue_id, approval_id)Indexes:
(company_id, issue_id)(company_id, approval_id)Update PATCH /api/agents/:id authz matrix:
ceo in same company: allowProtect these from generic PATCH by non-board/non-ceo:
permissionsstatus transitions outside allowed scope(Continue using dedicated permission route for permission edits.)
Add:
GET /api/agents/:id/config-revisionsGET /api/agents/:id/config-revisions/:revisionIdPOST /api/agents/:id/config-revisions/:revisionId/rollbackBehavior:
Add:
GET /api/issues/:id/approvalsPOST /api/issues/:id/approvals (link existing approval)DELETE /api/issues/:id/approvals/:approvalIdGET /api/approvals/:id/issuesExtend create payloads to optionally include issue context:
POST /api/companies/:companyId/approvals supports issueId or issueIdsPOST /api/companies/:companyId/agent-hires supports sourceIssueId or sourceIssueIdsServer behavior:
issue_approvalsAdd configuration history panel on AgentDetail:
No hard editor enforcement initially; update helper text and templates to encourage linked markdown updates.
skills/paperclip/SKILL.mdAdd comment standard:
/approvals/{id}/agents/{id}/issues/{id}skills/paperclip-create-agent/SKILL.mdRequire:
sourceIssueId when hire is created from an issueagent_config_revisionsissue_approvals