The split
The boundary is enforced at the database engine, not in the prompt. The Analyst’s connection physically cannot write, and the Engineer’s writes physically cannot touch
public. These hold even if the model goes off-script.
How a question flows
- User: “What’s our MRR trend by plan?”
- Leader retrieves shared learnings (error patterns, gotchas) and routes to Analyst.
- Analyst retrieves table metadata + matching query patterns from knowledge.
- Analyst writes SQL grounded in the retrieved patterns.
- Analyst executes against
public(read-only). - Analyst interprets results, returns insight.
- Leader synthesizes and replies.
dash.monthly_mrr_by_plan as a view, records it in knowledge, the Analyst prefers it next time.
The self-learning loop
When the Analyst hits a SQL error and finds a fix, it saves the pattern viaLearningMachine:
- Knowledge holds the validated query library, table descriptions, business rules.
- Learnings holds the error patterns and fixes the team has discovered.
- The Analyst writes correct SQL faster because both are in context.
Why coordinate mode
TeamMode.coordinate means the leader decides who handles each request. Other modes:
For text-to-SQL,
coordinate is the right shape. One question maps to one specialist (Analyst for queries, Engineer for schema work). The leader picks based on the user’s intent.
What runs where
See it in action
agents/dash/