SR-1 agent_skill table + Drizzle store + apply_caveman/apply_artifact_style columns #869
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#869
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a platform engineer, I want a single
agent_skilltable that stores per-agent_typeand per-agent instanceskill bodies, plus two boolean columns onagent_typeto gate the caveman / artifact-style appendices, so that the rest of the rework has a clear schema to build on.Foundational ticket. No call-site changes here — that follows in SR-4.
Acceptance criteria
Schema
agent_skilltable with columns(scope TEXT NOT NULL CHECK (scope IN ('type','instance')), agent_type TEXT NOT NULL, instance_id INTEGER NULL, name TEXT NOT NULL, body TEXT NOT NULL, updated_at INTEGER NOT NULL).instance_id REFERENCES agents(id) ON DELETE CASCADE.(scope='type' AND instance_id IS NULL) OR (scope='instance' AND instance_id IS NOT NULL).ux_agent_skill_type ON agent_skill(agent_type, name) WHERE scope='type'.ux_agent_skill_instance ON agent_skill(instance_id, name) WHERE scope='instance'.BEFORE INSERTandBEFORE UPDATEtriggers onagent_skillraise whenscope='instance'andagent_type != (SELECT type FROM agents WHERE id = NEW.instance_id). Test fixture proves the trigger fires on mismatch.agent_type:apply_caveman INTEGER DEFAULT 0,apply_artifact_style INTEGER DEFAULT 1.Drizzle module
apps/server/src/infrastructure/database/agent-skill-store.tsmodule exposesgetAgentTypeSkill(agentType, name),getAgentInstanceSkill(instanceId, name),listAgentTypeSkills(agentType),listAgentInstanceSkills(instanceId),upsertAgentTypeSkill(agentType, name, body),upsertAgentInstanceSkill(instanceId, agentType, name, body),deleteAgentTypeSkill(agentType, name),deleteAgentInstanceSkill(instanceId, name).bun:sqliteimports outside this module (just sql-layer-checkpasses).apps/server/src/infrastructure/database/schema/agent-skill.ts; migration generated viadrizzle-kitand committed underapps/server/src/infrastructure/database/drizzle/.Tests
agent-skill-store.test.tscovers: round-trip CRUD per scope, partial-unique-index conflict on duplicate insert, cascade-delete clears instance rows whenagentsrow is deleted, consistency trigger fires on mismatch and rolls back the transaction.Out of scope
skilltable (covered in SR-3).skilltable orskill_overrides_jsoncolumn — both stay live in parallel until SR-11.References
specs/skills-rework.md§Schema, §Tests.apps/server/src/infrastructure/database/schema/agent-config-scope.ts(skill).docs/database.md.