Skip to content

feat(agent): drift-guard slash commands + trim skill catalog when active#98

Merged
rlaope merged 1 commit into
masterfrom
feat/preamble-drift-guard
May 28, 2026
Merged

feat(agent): drift-guard slash commands + trim skill catalog when active#98
rlaope merged 1 commit into
masterfrom
feat/preamble-drift-guard

Conversation

@rlaope
Copy link
Copy Markdown
Owner

@rlaope rlaope commented May 28, 2026

Summary

Two grounding improvements from the self-knowledge review:

  1. Drift guard — slash commands are hand-maintained in two places: palette.builtinItems (what the operator can run) and basePreamble's prose (what the LLM is told exists). New TestPalette_CommandsDocumentedInPreamble asserts every palette command is documented in the preamble (via the new agent.BasePreamble() accessor). It immediately caught /use missing from the preamble — the agent would have denied knowing a command cloudy offers. Fixed by documenting /use.
  2. Token dietbuildSystemPrompt omits the ## Available skills catalog once a skill is active (its full body is already injected; listing the others is redundant per-request tokens that matter on small models). The catalog still appears when no skill is active.

Test plan

  • go test -race -count=1 ./... green
  • golangci-lint run ./... — 0 issues
  • New: TestPalette_CommandsDocumentedInPreamble (drift), TestSystemPreamble_DropsCatalogWhenSkillActive (diet); existing TestSystemPreamble_* still green

Two grounding improvements surfaced by the self-knowledge review:

1. Drift guard — the slash-command set is hand-maintained twice, in
   palette.builtinItems (what the operator can run) and in basePreamble's
   "## cloudy slash commands" prose (what the LLM is told exists). The new
   TestPalette_CommandsDocumentedInPreamble asserts every palette command
   is documented in the preamble (via the new agent.BasePreamble accessor).
   It immediately caught /use (switch kubeconfig context) missing from the
   preamble, so the agent would have claimed not to know a command cloudy
   actually offers — fixed by documenting /use.

2. Token diet — buildSystemPrompt now omits the "## Available skills"
   catalog once a skill is active: that skill's full body is already
   injected, so listing every other skill is redundant per-request tokens
   that matter on small models. The catalog still appears when no skill is
   active so the model can answer "what skills do you have?".

Signed-off-by: rlaope <piyrw9754@gmail.com>
@rlaope rlaope merged commit 6a9cdbf into master May 28, 2026
2 checks passed
@rlaope rlaope deleted the feat/preamble-drift-guard branch May 28, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant