refactor: drop the data-qa agent, make analyst the data-question agent
Issue for this PR
Closes #
Follow-up to #1217 (merged to main), acting on the post-merge review decision to drop the data-qa agent it introduced.
Type of change
- Refactor / code improvement
- Documentation
What does this PR do?
Removes the opt-in data-qa agent added in #1217 and makes the existing analyst agent the documented data-question agent instead.
Why drop data-qa:
- Misleading name. In a data tool, "QA" reads as quality-assurance, not question-answering.
- Overlaps
analyst, but unsafely.analystis already described as "Read-only data exploration and analysis. Cannot modify files or run destructive SQL."data-qacovered the same use case (asking questions about data) but shipped with full read/writebuilderpermissions — a slim-prompt agent that can still run destructive SQL. That is the exact safety concern that got PR #1215 closed. There's no reason to carry a second, less-safe path to the same jobanalystalready does safely. - The insight behind it needed no new agent. #1217's basis for
data-qawas an internal ablation showing that dropping the dbt-build packs is score-neutral on read-only data-QA workloads. I readanalyst.txt(packages/opencode/src/altimate/prompts/analyst.txt) to check whether it needed the same trim — it's already lean: no dbt build/finish-protocol content, no Pre-Execution Protocol pack, nothing the ablation targeted.analystalready embodies the insight. I leftanalyst.txtunchanged — the safe default the task called for when the prompt has no removable weight.
What's kept: #1217's real contribution — splitting the monolithic builder.txt into an invariant core.txt + named packs under builder/packs/, assembled byte-identically by profiles.ts — is untouched. BUILDER_PROFILE, PROMPT_BUILDER, assemble, and FRAGMENTS are unmodified, and the builder byte-identity pin (sha256 17663410dd9a… in test/altimate/prompt-identity.ts) stays green.
Changes:
packages/opencode/src/agent/agent.ts— removed the conditionaldata-qaregistration block (theALTIMATE_DATA_QA_PROFILEenv flag,cfg.agent["data-qa"]config-entry opt-in, andcfg.default_agent === "data-qa"gate), and the now-unusedFlagimport.packages/opencode/src/altimate/prompts/profiles.ts— removedDATA_QA_PROFILEandPROMPT_DATA_QA.BUILDER_PROFILE/PROMPT_BUILDER/assemble/FRAGMENTSare untouched.packages/opencode/src/session/termination.ts— removeddata-qafromCOMPLETION_CONTRACT_AGENTS(now{"builder"}only).- Deleted
packages/opencode/test/agent/data-qa-profile.test.ts. packages/opencode/test/altimate/prompt-profiles.test.ts— removed the "data-qa profile composition"describeblock and theDATA_QA_PROFILE/PROMPT_DATA_QAimports; kept the builder byte-identity and cross-process determinism tests.packages/opencode/test/session/termination.test.ts— removed thedata-qaassertions from the completion-contract test.packages/opencode/test/altimate/prompt-identity.ts— updated a stale doc comment referencing the deleted test file.- Docs — no page ever documented
data-qaorALTIMATE_DATA_QA_PROFILE(that landed only in code in #1217), so there was nothing to remove. Updateddocs/docs/configure/agents.md,docs/docs/data-engineering/agent-modes.md,docs/docs/getting-started.md, anddocs/docs/getting-started/quickstart.mdto explicitly describeanalystas the agent for asking questions about your data (in addition to its existing "read-only exploration" framing), so the safe choice for "just ask questions about my data" is unambiguous.builder(full read/write) andplan(planning-only) descriptions were left as-is; they were already accurate.
A repo-wide grep for data-qa, DATA_QA, ALTIMATE_DATA_QA_PROFILE, and PROMPT_DATA_QA after these changes returns no results.
Review-round follow-up (upgrade-safety on the two legacy-config paths): codex and cubic flagged what happens to a config that still references the removed agent after an upgrade. Traced both paths and handled each on its actual behavior:
- Leftover
agent: {"data-qa": {...}}config entry — traced the config→agent registration path inagent.ts: it falls through to the existing generic custom-agent path (already covered by"custom agent from config creates new agent"), producing a fully-formed, non-crashing agent (mode: "all",native: false). No migration code needed — verified with a new regression test ("a leftover config agent.data-qa entry resolves as a harmless generic custom agent, not a crash") rather than adding a special case for a key that was never in a release. - Persisted
default_agent: "data-qa"with no matchingagent.data-qaentry — this one did need a fix. #1217 explicitly special-cased this exact configuration to register the native profile, sodefaultInfo()would otherwise throwdefault agent "data-qa" not foundand strand every call site that resolves the default agent (session/prompt.ts, session HTTP routes, ACP). Fixed by falling back toanalyst— the documented replacement — with a one-time warning, scoped to the literal name"data-qa"(a generic invalid/typo'ddefault_agentstill throws, unchanged). Two new tests cover the fallback and the case where a user's ownagent.data-qaentry should win over the migration.
How did you verify your code works?
bun run typecheck(repo root, via turbo) — clean.bun test test/agent/ test/altimate/ test/session/(packages/opencode) — 6119 pass, 0 fail from this change. Twotest/session/prompt.test.tstests (loop calls LLM and returns assistant message,loop surfaces content-filter finishes as session errors) are flaky/timeout-prone against the mocked LLM harness and reference agent"build"(the pre-existingbuilderalias) — nothing to do withdata-qa; the adjacent test in that file already carries a standingBUG: REGRESSIONcomment about this exact flakiness. Reproduces identically before and after this change.bun test test/altimate/prompt-profiles.test.tsspecifically — 4/4 pass, including the builder byte-identity assertion against the pinnedsha256 17663410dd9a….bun run script/upstream/analyze.ts --markers --base origin/main --strict— clean (All custom code in upstream-shared files is properly marked); removing thedata-qablock shrank the markedaltimate_changeregion inagent.ts, it did not need a new one.- Repo-wide grep for
data-qa/DATA_QA/ALTIMATE_DATA_QA_PROFILE/PROMPT_DATA_QA— zero remaining references. - Follow-up commits (
f61cd61a16,e3e47bc6ca,b6392fdb3d) address the review round above:bun test test/agent/ test/altimate/prompt-profiles.test.ts test/altimate/prompt-identity.ts test/session/termination.test.ts— 92/93 pass, 1 pre-existing todo, 0 fail (includes the 3 new regression tests for the legacy-config paths);bun run typecheckclean;bun run script/upstream/analyze.ts --markers --base origin/main --strictclean. - CI: pushed and watching for settle before requesting review; will not merge/approve this PR myself.
Screenshots / recordings
N/A — no UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
[!NOTE]
Medium Risk
Changes default-agent resolution for users who still have default_agent: "data-qa" in config; migration to analyst is intentional and tested, but it alters which permissions and prompt users get on upgrade.
Overview
Removes the opt-in data-qa native agent (env flag, config registration, and slim PROMPT_DATA_QA profile) and positions analyst as the supported read-only path for asking questions about data.
Runtime behavior: default_agent: "data-qa" with no matching agent.data-qa block now resolves to analyst with a one-time log warning instead of failing startup; a leftover agent.data-qa config entry becomes a generic custom agent. Run-mode DONE completion instructions apply only to builder ( data-qa dropped from the completion contract).
Docs: Agent and getting-started pages now describe Analyst explicitly for data Q&A. Builder prompt assembly and byte-identity pins are unchanged.
Tests: Deletes data-qa-profile tests and adds regressions for the migration paths above.
Reviewed by Cursor Bugbot for commit b6392fdb3de256b291a0bb2565917999c1a8634d. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Removes the opt-in data-qa agent and makes the existing analyst agent the documented agent for asking questions about your data.
data-qa duplicated analyst's purpose while shipping with full read/write builder permissions, and its insight was already embodied in analyst's lean prompt. The builder prompt split into core + named packs is untouched.
Changes
- Drops the
data-qaregistration, its env-flag/config opt-ins,DATA_QA_PROFILE, and the completion-contract entry. - A persisted
default_agent: "data-qa"now resolves toanalystwith a one-time warning instead of stranding default-agent sessions; an explicitagent.data-qaconfig entry still wins. - A leftover
agent.data-qaconfig entry resolves as a harmless generic custom agent. - Updates docs to describe
analystas the agent for asking questions about your data.
Summary by CodeRabbit
-
Documentation
- Clarified that Analyst mode supports asking questions about data, safe exploration, and analysis while preventing SQL writes.
- Updated Analyst descriptions across agent configuration and getting-started guides.
-
Changes
- Removed the built-in opt-in data-qa agent profile and its associated completion behavior.
- The builder agent remains responsible for run-mode completion instructions.
- Persisted configurations referencing data-qa now fall back to Analyst, while user-defined data-qa configurations continue to take precedence.