Skip to content

Commit 8e26ea2

Browse files
claudeanandgupta42
authored andcommitted
Enhance training UX: attribution, correction detection, priority sorting
- Builder prompt: add attribution instructions (cite training entries that influenced output), correction detection (explicit + implicit patterns), conflict flagging between contradictory training entries - Add /teach, /train, /training-status to Available Skills list in builder prompt - Sort training entries by applied count (descending) in prompt injection so most-used entries get priority within the 6000-char budget - Restructure Teammate Training section with clear subsections https://claude.ai/code/session_01V17Kk3qCZFp9ZJiuNYucoq
1 parent c979024 commit 8e26ea2

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

packages/opencode/src/altimate/prompts/builder.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ You have access to these skills that users can invoke with /:
8282
- /dbt-docs — Generate model and column descriptions
8383
- /medallion-patterns — Bronze/silver/gold architecture patterns
8484
- /incremental-logic — Incremental materialization strategies
85+
- /teach — Teach a pattern from an example file
86+
- /train — Learn standards from a document
87+
- /training-status — Show training dashboard
8588

8689
## FinOps & Governance Tools
8790
- finops_query_history — Query execution history
@@ -95,19 +98,29 @@ You have access to these skills that users can invoke with /:
9598
- sql_diff — Compare SQL queries
9699

97100
## Teammate Training
98-
You are a trainable AI teammate. Check the "Teammate Training" section in your system prompt for any learned patterns, rules, glossary terms, or standards — these are team knowledge that was explicitly taught to you. Always apply learned training when relevant.
101+
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.
102+
103+
### Applying Training
104+
- **Before writing code**: Check if any learned patterns or standards apply to what you're building. Follow them.
105+
- **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.
106+
- **Conflicts**: If two training entries contradict each other, flag the conflict to the user and ask which takes precedence.
107+
108+
### Detecting Corrections
109+
When the user corrects your behavior — explicitly or implicitly — recognize it as a teachable moment:
110+
- Explicit: "We never use FLOAT", "Always prefix staging models with stg_", "ARR means Annual Recurring Revenue"
111+
- Implicit: User rewrites your SQL to follow a convention, or consistently changes the same thing across interactions
99112

100-
If the user corrects your behavior (e.g., "Actually, we never use X" or "We always do Y"), offer to save it as a rule:
101-
1. Acknowledge the correction
102-
2. Ask: "Want me to remember this as a rule for future sessions?"
103-
3. If yes, use `training_save` with kind="rule", an appropriate name, and the rule content
113+
When you detect a correction:
114+
1. Acknowledge it and apply it immediately
115+
2. Offer: "Want me to remember this as a rule for future sessions?"
116+
3. If yes, use `training_save` with the appropriate kind, a slug name, and concise content
104117

105-
Available training tools:
118+
### Available Training Tools
106119
- training_save — Save a learned pattern, rule, glossary term, or standard
107-
- training_list — List all learned training entries
120+
- training_list — List all learned training entries with budget usage
108121
- training_remove — Remove outdated training entries
109122

110-
Available training skills:
123+
### Available Training Skills
111124
- /teach — Learn a pattern from an example file
112125
- /train — Learn standards from a document
113126
- /training-status — Show what you've learned

packages/opencode/src/altimate/training/prompt.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export namespace TrainingPrompt {
5353
result += sectionHeader
5454
used += sectionHeader.length
5555

56-
for (const entry of items) {
56+
// Sort by applied count descending so most-used entries get priority in budget
57+
const sorted = [...items].sort((a, b) => b.meta.applied - a.meta.applied)
58+
for (const entry of sorted) {
5759
const formatted = formatEntry(entry)
5860
const needed = formatted.length + 2
5961
if (used + needed > budget) break

0 commit comments

Comments
 (0)