| title | ADR 0002: CLI invocation as Drover Code integration | ||
|---|---|---|---|
| description | sqlforge plan/apply as the v1 integration surface for Drover Code agents. | ||
| product | drover-sqlforge | ||
| audience |
|
||
| doc_type | adr | ||
| topics |
|
||
| surface | repo-docs |
Status: Accepted
Date: 2026-05-22
Contexts: CONTEXT.md, drover-code/CONTEXT.md, CONTEXT-MAP.md
The Drover ecosystem describes agents using Drover SQLForge for warehouse schema and model work (DROVER_ECOSYSTEM.md step 9). SQLForge also ships an HTTP SQLForge MCP server with tools such as list_metrics, query_metric, and deferred plan_change / apply_change.
Integration options for Drover Code (BYOC or hosted agent jobs):
- CLI invocation — agent runs
sqlforge plan/sqlforge apply/sqlforge queryas subprocesses in the checked-out Git tree. - Sidecar MCP — SQLForge MCP server colocated with the agent; reached via Drover Gateway MCP routing.
- Hosted SQLForge tenancy — platform maps customers to warehouses and credentials (not v1).
- Muster-resolved MCP only — agents discover SQLForge exclusively through Drover Muster (deferred gate).
Without a decision, implementers might block agent jobs on unfinished MCP mutation tools or conflate Brain MCP (repository knowledge) with SQLForge (metrics/warehouse).
SQLForge runs only when the agent’s checkout is a workspace-bound data project: sqlforge.yml at the project root (or config_dir in CI). No platform-provisioned SQLForge service in v1.
Drover Code integrates with SQLForge in v1 via CLI invocation:
| Operation | Command | Mutation |
|---|---|---|
| Diff | sqlforge plan [environment] |
No |
| Deploy | sqlforge apply [environment] |
Yes |
| Analytics SQL | sqlforge query [metric] [environment] |
No (compile only) |
- Same semantics as a local data engineer; non-TTY apply skips TUI (CI-friendly).
- Agents use bash/tooling in
/workspace; Drover Wardenscope: sqlforgepolicies apply to generated SQL and destructive operations. - Apply is never implicit on fingerprint change; human or CI gate required.
Sidecar MCP is supported for read-heavy flows when Gateway routing is configured:
- Agent-safe MCP tools (v1):
list_metrics,query_metric; optionallylist_models(metadata only). get_model: restricted to data engineer / debugging; not default agent path.plan_change/apply_change: implemented with an ephemeral in-memory plan store (plan_id, 2h TTL); agents should review diffs before callingapply_change.
| Capability | Status |
|---|---|
| Muster tool discovery for SQLForge MCP | Deferred (Muster integration gate) |
| Guard approval for destructive apply | Deferred (Guard gate) |
| Hosted SQLForge tenancy | Deferred |
| Brain vs SQLForge | Always separate MCP servers — Brain for code knowledge, SQLForge for metrics / model DAG / warehouse plan |
Positive
- Agent jobs can use SQLForge today without waiting for MCP mutation APIs.
- Clear split: Brain answers “how is auth implemented”; SQLForge answers “what is
daily_revenue”. - CI and local dev share one invocation model.
Negative
- Subprocess CLI lacks fine-grained MCP streaming until sidecar MCP matures.
- Operators must inject warehouse credentials via
.env/ secrets in the workspace—no Cloud-managed warehouse binding yet. - Dual documentation burden (CLI + MCP) until deferred tools ship.
Follow-ups
- Implement
plan_change/apply_changewith explicit approval handshake (align with CI apply gate in ADR 0003). - Register SQLForge MCP in Muster when integration gate opens.
Document exampleDone:drover-codeskill/preset for workspace-bound data project detection.drover-code/internal/integrations/sqlforge, system injection ininternal/config/loader.go,docs/how-to/sqlforge-from-drover-code.md,.drover/commands/sqlforge-plan.md/sqlforge-apply.md.
- Glossary:
CONTEXT.md— § Ecosystem integration, § Agent integration (MCP) - ADR 0003: Preview environment CI pattern
- Drover Code:
drover-code/CONTEXT.md - Warden sqlforge policies:
drover-warden/beads/policies.jsonl