-
Notifications
You must be signed in to change notification settings - Fork 134
refactor: split builder prompt into invariant core + named packs (byte-identical assembly) + opt-in data-qa profile #1217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| packages/core/migration/**/snapshot.json linguist-generated | ||
| packages/core/src/database/migration.gen.ts linguist-generated | ||
| # Prompt fragments are byte-identity-pinned (sha256 asserted in | ||
| # packages/opencode/test/altimate/prompt-profiles.test.ts); force LF so | ||
| # autocrlf checkouts cannot alter the assembled prompt bytes. | ||
| packages/opencode/src/altimate/prompts/** text eol=lf |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,10 @@ import PROMPT_EXPLORE from "./prompt/explore.txt" | |||||
| import PROMPT_SUMMARY from "./prompt/summary.txt" | ||||||
| import PROMPT_TITLE from "./prompt/title.txt" | ||||||
| // altimate_change start - import custom agent mode prompts | ||||||
| import PROMPT_BUILDER from "../altimate/prompts/builder.txt" | ||||||
| // PromptProfiles.PROMPT_BUILDER is assembled from core + pack fragments (byte-identical | ||||||
| // to the former builder.txt — see profiles.ts and test/altimate/prompt-profiles.test.ts) | ||||||
| import { PromptProfiles } from "../altimate/prompts/profiles" | ||||||
| import { Flag } from "@/flag/flag" | ||||||
| import PROMPT_ANALYST from "../altimate/prompts/analyst.txt" | ||||||
| import PROMPT_REVIEWER from "../altimate/prompts/reviewer.txt" | ||||||
| // altimate_change end | ||||||
|
|
@@ -224,7 +227,7 @@ export const layer = Layer.effect( | |||||
| builder: { | ||||||
| name: "builder", | ||||||
| description: "Create and modify dbt models, SQL, and data pipelines. Full read/write access.", | ||||||
| prompt: PROMPT_BUILDER, | ||||||
| prompt: PromptProfiles.PROMPT_BUILDER, | ||||||
| options: {}, | ||||||
| permission: Permission.merge( | ||||||
| defaults, | ||||||
|
|
@@ -315,6 +318,38 @@ export const layer = Layer.effect( | |||||
| mode: "primary", | ||||||
| native: true, | ||||||
| }, | ||||||
| // Opt-in data-qa profile (workload-adaptive harness PR 1): the invariant | ||||||
| // core + skills catalogue + teammate training — omits the Pre-Execution | ||||||
| // Protocol (sql-guard) pack and the build-oriented packs (dbt-ops, | ||||||
| // dbt-verify, dbt-workflow, pitfalls, self-review, finish). Ships the | ||||||
| // same DEFAULT permission ruleset as builder; per-agent config | ||||||
| // overrides apply per agent, as for every agent. Registered ONLY on | ||||||
| // explicit opt-in: ALTIMATE_DATA_QA_PROFILE=1/true, or an | ||||||
| // `agent: {"data-qa": {...}}` entry in config (which then overlays the | ||||||
| // native profile via the standard merge below). Nothing selects it | ||||||
| // implicitly; the default agent stays builder. | ||||||
| ...(Flag.truthyEnv("ALTIMATE_DATA_QA_PROFILE") || cfg.agent?.["data-qa"] != null | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When Prompt for AI agents
Suggested change
|
||||||
| ? { | ||||||
| "data-qa": { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When Prompt for AI agents |
||||||
| name: "data-qa", | ||||||
|
Comment on lines
+333
to
+334
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||||||
| description: | ||||||
| "Opt-in data Q&A profile: builder toolset with a slimmer prompt (no dbt build protocols).", | ||||||
| prompt: PromptProfiles.PROMPT_DATA_QA, | ||||||
| options: {}, | ||||||
| permission: Permission.merge( | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: When Prompt for AI agents |
||||||
| defaults, | ||||||
| Permission.fromConfig({ | ||||||
| question: "allow", | ||||||
| plan_enter: "allow", | ||||||
|
Comment on lines
+339
to
+343
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user has restricted Useful? React with 👍 / 👎. |
||||||
| sql_execute_write: "ask", | ||||||
| }), | ||||||
| userWithSafety, | ||||||
| ), | ||||||
| mode: "primary", | ||||||
| native: true, | ||||||
| } satisfies Info, | ||||||
| } | ||||||
| : {}), | ||||||
| // reviewer agent: dbt PR review verdict engine | ||||||
| reviewer: { | ||||||
| name: "reviewer", | ||||||
|
|
||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ## Teammate Training | ||
|
|
||
| You are a trainable AI teammate. Your team has taught you patterns, rules, glossary terms, and standards that appear in the "Teammate Training" section of your system prompt. This is institutional knowledge — treat it as authoritative. | ||
|
|
||
| ### Applying Training | ||
| - **Before writing code**: Check if any learned patterns or standards apply to what you're building. Follow them. | ||
| - **Attribution**: When your output is influenced by a learned entry, briefly note it (e.g., "Following your staging-model pattern, I used CTEs for renaming columns."). This helps the user see that training is working. | ||
| - **Conflicts**: If two training entries contradict each other, flag the conflict to the user and ask which takes precedence. | ||
|
|
||
| ### Detecting Corrections | ||
| When the user corrects your behavior — explicitly or implicitly — recognize it as a teachable moment: | ||
| - Explicit: "We never use FLOAT", "Always prefix staging models with stg_", "ARR means Annual Recurring Revenue" | ||
| - Implicit: User rewrites your SQL to follow a convention, or consistently changes the same thing across interactions | ||
|
|
||
| When you detect a correction: | ||
| 1. Acknowledge it and apply it immediately | ||
| 2. Offer: "Want me to remember this as a rule for future sessions?" | ||
| 3. If yes, use `training_save` with the appropriate kind, a slug name, and concise content | ||
|
|
||
| ### Available Training Tools | ||
| - training_save — Save a learned pattern, rule, glossary term, or standard | ||
| - training_list — List all learned training entries with budget usage | ||
| - training_remove — Remove outdated training entries | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user explicitly selects this profile with only
default_agent: "data-qa", the gate remains false because it checks only the environment andagent.data-qa. The profile is therefore absent, anddefaultInfo()throwsdefault agent "data-qa" not foundwhen the configured default is resolved. Treatcfg.default_agent === "data-qa"as an opt-in too, rather than requiring a redundant empty agent override.Useful? React with 👍 / 👎.