Using the reports_to field to model manager/IC relationships. Building a CEO → CTO → Engineer chain in Paperclip and visualizing the resulting org chart in the dashboard.
Use the reports_to field to build a management hierarchy, understand how the org chart renders in the UI, and set up a simple CEO → Manager → Worker structure.
reports_to FieldThe agents table has a self-referential foreign key:
ALTER TABLE public.agents
ADD COLUMN reports_to uuid REFERENCES public.agents(id) ON DELETE SET NULL;
Setting reports_to to another agent's ID means "this agent reports to that one." The relationship is purely informational in the current Paperclip version — it drives the org chart visualization and approval routing but does not automatically route tasks.
CEO Agent (no reports_to)
├── Engineering Manager
│ ├── Backend Developer
│ └── Frontend Developer
└── Marketing Manager
├── Content Writer
└── Social Media Agent
SQL setup:
DO $$
DECLARE
cid uuid;
ceo uuid;
eng uuid;
mkt uuid;
BEGIN
SELECT id INTO cid FROM companies WHERE slug = 'demo-corp';
-- Level 1: CEO
INSERT INTO agents (company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status)
VALUES (cid, 'CEO', 'Chief Executive Officer',
'You are the CEO. You delegate tasks to department managers and review their reports.',
'claude-code', 20.00, 'active')
RETURNING id INTO ceo;
-- Level 2: Managers
INSERT INTO agents (company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status, reports_to)
VALUES (cid, 'Eng Manager', 'Engineering Manager',
'You manage the engineering team. You break down technical tasks and delegate to developers.',
'claude-code', 10.00, 'active', ceo)
RETURNING id INTO eng;
INSERT INTO agents (company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status, reports_to)
VALUES (cid, 'Mkt Manager', 'Marketing Manager',
'You manage the marketing team. You plan campaigns and delegate content creation.',
'claude-code', 10.00, 'active', ceo)
RETURNING id INTO mkt;
-- Level 3: Workers
INSERT INTO agents (company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status, reports_to)
VALUES
(cid, 'Backend Dev', 'Backend Developer',
'You write server-side code. Focus on correctness and security.',
'claude-code', 5.00, 'active', eng),
(cid, 'Frontend Dev', 'Frontend Developer',
'You write React components. Focus on accessibility and performance.',
'claude-code', 5.00, 'active', eng),
(cid, 'Content Writer', 'Content Writer',
'You write blog posts and documentation.',
'claude-code', 3.00, 'active', mkt),
(cid, 'Social Media', 'Social Media Agent',
'You draft social media posts in a professional but engaging tone.',
'claude-code', 2.00, 'active', mkt);
END $$;
In the Paperclip UI → Company Dashboard → Org Chart tab. The chart renders as an interactive tree using D3.js. Click any node to jump to that agent's dashboard.
-- Show all agents with their manager
SELECT
a.name AS agent,
a.role,
m.name AS reports_to
FROM agents a
LEFT JOIN agents m ON m.id = a.reports_to
WHERE a.company_id = 'your-company-id'
ORDER BY m.name NULLS FIRST, a.name;