gaia-patternslisted
Install: claude install-skill metraton/gaia
# Gaia Code Patterns
Construction patterns for building Gaia components. Every component type follows a discoverable pattern -- read 2-3 existing examples before creating a new one. For the full component inventory, see `reference.md`.
## Prompt -> Result Flow
```
1. User sends prompt
|
2. Orchestrator routes to agent (DB-backed surface_routing table --
the routing is the ORCHESTRATOR's reasoning; it is never injected
into the subagent)
|
3. Pre-Tool Hook (pre_tool_use.py)
+-- Validate the Task/Agent dispatch (agent exists, T3 scan of the
prompt via TaskValidator) -- no frontmatter read, no skill load
+-- Birth the agent_contract_handoffs row (identity, kernel data,
dispatch_project resolved from cwd)
|
(for a dispatched SUBAGENT only: the HOST -- Claude Code, not this
hook or any other Gaia hook -- separately reads the target agent's
`.md` frontmatter and preloads its `skills:` list before the first
turn. `hooks/hooks.json` carries no `Skill` matcher, so a
`Skill(...)` call never reaches PreToolUse either -- see
`artifact_skill_reminder.py`. The primary agent has no equivalent:
Claude Code's own docs list only "system prompt, tool restrictions,
and model" as inherited on the main thread, which is why
`gaia-orchestrator.md`'s frontmatter carries no `skills:` field.)
|
4. SubagentStart hook claims the born row and injects the KERNEL:
"# Your Contract" (incl. project + can_read/can_write menu),
"# Your CL