Files
clawmates/migrations/0010_teams.sql
T
Omar SobhandClaude Opus 4.8 8123a27bcf Teams (deploy ladder rung 1): schema + provisioning + API
A team = a baseline topology staffed with real claws. Migration 0010 (teams +
team_members node→claw bindings) + cm-db repo/teams.rs. runtime_provision.rs
turns a claw into a live runtime agent claw_<id> via the synced gateway config
API (#7468): create agent + bind model_provider (mapped from chosen model) +
risk_profile=toolfree + clawmates_door bundle — atomic, immediately drivable.

routes/teams.rs: POST /api/teams (create claws + provision + build(kind,roles)
+ bind node.attrs["agent"]=claw_<id> + persist), GET /api/teams[/{id}],
POST /api/teams/{id}/run (enqueue a durable run of the team graph — reuses the
topology worker + SSE). v1 persona = topology role via the prompt builder; the
claw's system_prompt stays its chat identity.

Spike confirmed: runtime agent provisioning works; IDENTITY.md persona works
for API models (Gemini/Groq), masked by CLI models (Claude/Kimi Code). 16
cm-api tests + provision unit tests pass, clippy clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-18 13:13:14 -07:00

25 lines
1.2 KiB
SQL

-- Teams: a deployed multi-agent unit = a baseline TOPOLOGY staffed with real
-- workspace claws. The first rung of the deploy ladder (single → team → company
-- → org). `graph` is the TopologyGraph whose nodes carry attrs["agent"] = the
-- claw's runtime alias (claw_<id>); team_members is the durable node→claw
-- binding (each claw is also a normal agents-table row, individually chattable).
CREATE TABLE teams (
id UUID PRIMARY KEY,
workspace_id UUID NOT NULL REFERENCES workspaces (id) ON DELETE CASCADE,
name TEXT NOT NULL,
kind TEXT NOT NULL, -- TopologyKind (snake_case)
graph JSONB NOT NULL, -- TopologyGraph (nodes/edges)
status TEXT NOT NULL DEFAULT 'active',
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX teams_workspace_idx ON teams (workspace_id, created_at DESC);
CREATE TABLE team_members (
team_id UUID NOT NULL REFERENCES teams (id) ON DELETE CASCADE,
node_id TEXT NOT NULL, -- topology node id
claw_id UUID NOT NULL REFERENCES agents (id) ON DELETE CASCADE,
role TEXT NOT NULL,
PRIMARY KEY (team_id, node_id)
);