Skip to content

agent: list available skills in the system prompt - #457

Merged
BaaRai merged 1 commit into
BaaRai:mainfrom
NikolayGusev-astra:feat/skill-index-in-prompt
Nov 22, 2026
Merged

BaaRai merged 1 commit into
BaaRai:mainfrom
NikolayGusev-astra:feat/skill-index-in-prompt

Conversation

@NikolayGusev-astra

Copy link
Copy Markdown

Problem

An agent's skills reach it only as text inside the Skill tool's description (Registry.listing()). A tool description is read when the model decides to open that tool — and a model that hunts with raw Bash never does.

Measured, not theorised: a run against a live target with 36 skills assigned to the agent recorded zero Skill invocations across 485 trace records. The agent probed every class by hand while 36 playbooks sat unread in one tool description. The same agent, given the skill names as a task constraint, invoked the matching skill within minutes (pentest-injection-classes, web-authz-testing) — so the mechanism works, it just needs to be in the prompt rather than behind a tool call.

Changes

  • DeferredInfo.SkillIndex + SkillIndexBlock(names): renders the agent's skill names as a system-prompt block with the rule to invoke the matching skill before hunting a class. Names only (the descriptions stay in the tool), sorted, capped at 1200 bytes with (+N more, all listed in the Skill tool).
  • deferredSystem appends it next to FindingGuidance; assembleWorkerSystem's cached-prefix path appends it in the same order, so the split prompt stays byte-identical to the unsplit one.
  • server/assembly.go fills it from the registry it already builds for the Skill meta-tool.
  • Empty for an agent without skills — its prompt is unchanged.

Verification

  • New agent/skill_index_test.go: names+rule, empty case, cap cuts on a name boundary, index reaches the system prompt, and the split/unsplit prompts stay byte-identical.
  • red/green: with the SkillIndex wiring removed, the index tests fail (index never reaches the prompt); restored, they pass.
  • go test ./agent/ -count=1 with ARTEX_PG_DSN on a local PostgreSQL — ok.
  • go build ./..., gofmt -l agent/ server/ clean.

Alternative considered

Skill-RAG — inject only the top-N skills matching the intent, mirroring ARTEX_TOOL_RAG. Better precision, but it needs a matcher and it can hide the right skill when the intent wording misses. The index is the cheap half and stays correct under any matcher, so it can be the fallback layer if you want RAG on top.


Both this and #453/#455 come from the same live run against a real target.

The Skill tool's description carries the skill listing, but a description is
only read once the model decides to open the tool: on a live run with 36 skills
assigned the agent invoked Skill zero times across 485 trace records, hunting
every class with raw Bash. Put the names where every turn already looks, with
the rule to invoke the matching skill before hunting a class.

Names-only, bounded at 1200 bytes, empty for skill-less agents (prompt stays
byte-identical). The index rides the same seam as FindingGuidance, so the
cached-prefix path keeps its two segments byte-identical to the unsplit prompt.
@BaaRai
BaaRai merged commit ead1a12 into BaaRai:main Nov 22, 2026
6 checks passed
@BaaRai

BaaRai commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Thanks @NikolayGusev-astra. Merged. The names-only index reaches the system prompt for every agent path, stays bounded, and the split-prefix test keeps the cached prefix byte-identical.

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.

2 participants