AT-1: Schema + builtin-sync for agent_type tables #743
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#743
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?
Bundle directive
This story ships in one PR with #750 (SVC-1) and #754 (LBL-1) — the foundation layer that introduces the three new resolver entry points (
getAgentType,getServiceConfig,getLabelCatalogForRepo), the three matching builtin-sync passes, and the three migration files. They share a single round of edits todomain/agent-config/resolver.tsanddomain/agent-config/builtin-sync.ts, so bundling avoids merge conflicts and lets one review pass cover the whole layer.The PR closes all three issues (
Closes #743 #750 #754).As a platform engineer, I want the per-kind tables that hold per-type identity, container, and routing config plus a builtin-sync pass that mirrors
config/agents.json::types{}into them on boot, so that runtime reads can move off the in-memorycfg.types[…]map onto a DB-backed scope ladder consistent with skills / prompts / plugins.Acceptance criteria
Schema
migrations/<n>-agent-type.tscreatesagent_type,agent_type_container, andagent_type_routingwith the columns, scope checks (builtin → global → agent_type → instanceper table — service-wide tables onlybuiltin/global), and unique constraints listed inspecs/config-to-db.md§ Architecture.agent_type.token_secret_idcolumn exists as a forward placeholder for TOK-1; nullable.Builtin sync
domain/agent-config/builtin-sync.tsgrowssyncAgentTypeBuiltins(agentsJsonPath)that walkstypes{}and upserts one row per type atscope='builtin'plus a joined container row + routing row per type.{ inserted: 0, updated: 0 }.scope='builtin'row getsenabled=false(mirrors the plugin-binding shadow pattern) so existing instances keep resolving.Resolver
domain/agent-config/resolver.tsgrowsgetAgentType(name): ResolvedAgentType | nullthat joins the most-specificagent_type+agent_type_container+agent_type_routingrows across the scope ladder.ResolvedAgentTypeshape matches today'scfg.types[name](same field names, same JSON-decoded shapes) so AT-2's call-site swap is mechanical.Tests
agents.jsonboot syncs new rows; an existingagent_type-scope override is preserved across restart (operator-editedgit_emailfordevsurvives a re-sync that updates the builtin'sdefault_system_prompt).Out of scope
References
specs/config-to-db.md§ Architecture, § Story AT-1.