Skip to content

feat(skills): show the model every installed skill instead of guessing one - #3765

Merged
kovtcharov-amd merged 10 commits into
amd:mainfrom
kovtcharov:claude/skill-catalog
Sep 24, 2026
Merged

kovtcharov-amd merged 10 commits into
amd:mainfrom
kovtcharov:claude/skill-catalog

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

GAIA almost never used its skills on real work. Before each turn it scored the user's words against skill descriptions, and on a 24-task benchmark that loaded a skill zero times. Precise requests score lowest, because repo names, issue numbers and output formats count against the match. Without github-triage loaded, gh is refused too, so most models never tried it.

The flagship now lists every installed skill, one line each, in its system prompt, and the model calls load_skill when the work fits — at the start of a task or partway through. The list only changes when a skill is installed, so it stays cached. It costs 1,062 tokens for the starter pack. This deletes the retriever and discovery machinery (−2,339 / +334 lines).

  • Refusals name the skill. A refused gh or pytest now says which skill to load, instead of "a skill that declares it".
  • Latent prompt bug fixed. ChatAgent dropped any prompt section containing the words "Stable Diffusion". The catalogue mentions it (the image-gen skill), so the whole catalogue vanished with no warning. The filter now matches the method that produced the section.

Closes #3764. Supersedes #3763.

Test plan

  • pytest tests/unit/test_skill_catalog.py tests/unit/test_skill_binary_grants.py: every installed skill listed with its description; stable across renders; .claude/skills imports not listed; the granting skill found for gh and pytest; refusals name it, or point at the hub when none is installed.
  • pytest hub/agents/gaia/python/tests/test_full_tool_bundles.py::test_skill_catalogue_renders_for_the_flagship: the catalogue reaches the real flagship prompt. It failed before the Stable Diffusion filter fix.
  • Targeted suites (skills, prompt composition, verification scope, flagship tests): 947 pass. pytest tests/unit -k "skill or prompt or shell": 1,961 pass. The 6 failures also fail on untouched main: search_documentation is absent from this environment, and the profile goldens drift on audio wording.
  • Flagship system prompt measured: 3,130 → 4,192 tokens, sourcing rule still present.
  • Benchmark A/B, the same 144-run battery before and after (six Fireworks models), all batches complete: 101 vs 100 passes overall. GitHub tasks 10/30 → 17/30; runs that loaded a GitHub skill 4 → 16, runs that used gh 4 → 14. Adversarial tasks 19/30 → 15/30, all 4 points lost by minimax-m3; deepseek-v4p1-flash went 21 → 24/24 and kimi-k2p7-code 19 → 22. Visible skills also exposed The coding skill is refused whenever pytest lives in a virtualenv #3790: coding was refused over pytest in 28 runs, which fix(skills): load the coding skill when pytest is only in a virtualenv #3791 fixes.
  • gaia eval agent: required by CLAUDE.md for prompt changes. It can't run on this machine (no claude CLI for the judge).

…g one

Per-turn skill discovery loaded a skill on 0 of 24 benchmark tasks. It scored
the user's words against each description, and the repo names, issue numbers
and output formats that make a request precise counted against the match, so
GitHub tasks scored 0.22-0.39 against a 0.50 bar. Models then saw a hedged
shortlist, or nothing, and most never learned gh existed.

The flagship now lists every installed skill (name and description) in its
system prompt and the model calls load_skill when the work fits, at any step.
The list depends only on what is installed, so it stays in the cached prompt
head. It costs 1,062 tokens for the starter pack (flagship system prompt
3,130 -> 4,192). The BM25 retriever, the discovery module, their tests and the
calibration bench are deleted (-2,339 / +334 lines).

Two fixes it needed:
- Refusing a skill-gated CLI (gh, pytest) now names the skill that grants it.
- ChatAgent dropped any prompt fragment containing "Stable Diffusion" to strip
  the SD persona. The catalogue lists image-gen, so the whole catalogue was
  silently dropped. The filter now matches the producing method instead.

Closes amd#3764

Co-Authored-By: Claude Opus 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This swaps the per-turn skill matcher for a plain list of every installed skill in the flagship's system prompt, and deletes ~2,300 lines of retrieval machinery in the process. The direction is right — a matcher that loaded a skill on 0 of 24 tasks was not earning its keep — and the Stable Diffusion prompt-filter fix is a genuine latent bug caught along the way. Two things should land before merge.

The skills spec now contradicts itself. The page's "how a skill costs nothing until needed" walkthrough still says descriptions are matched in Python, never in the prompt, and that a thirty-skill library costs zero resident tokens — the exact opposite of what this PR does, forty lines above the section that was rewritten. It also links to a heading that no longer exists, so that link is dead. Update the walkthrough in the same change.

Nothing here measures the behaviour the PR exists to change. The benchmark A/B that motivates the whole rewrite and the gaia eval agent run this repo requires for prompt changes are both left unchecked. That matters more than usual here: the flagship deliberately ships with no skill bodies in the prompt because "no eval has yet measured that trade", and this adds about a thousand standing tokens to every turn on the same agent, on the argument that the model will now load skills. That argument is currently untested. If the judge can't run on the author's machine, run it on the hardware lane and post the scorecard diff, or say explicitly that a maintainer is picking it up.

Also: please drop the "Generated with Claude Code" footer from the PR description — the repo prohibits that attribution on every artifact.

Real-world evidence

N/A — no evidence bundle was produced for this PR, and the change's surface is agent behaviour rather than a CLI/API route the CI lane can exercise. The verdict rests on static review plus the test plan as written; the two behavioural checks in that plan (benchmark A/B, gaia eval agent) are unchecked, which is the second blocking point above. Unit-test claims in the description could not be independently confirmed here — this environment has no pytest installed.

🔍 Technical details

Issues

🟡 Stale mechanism description in the same file that was updated (docs/spec/agent-skills.mdx:256-264)

The progressive-disclosure <Steps> block still describes the deleted retriever, and #proactive-discovery no longer resolves after the heading was renamed to "Skill catalogue".

<Step title="Metadata (one line in the prompt)">
`name` + `description` of every installed skill are listed in the system prompt,
one line each — roughly a line per skill for the whole library, instead of any
body resident on every turn. See [Skill catalogue](#skill-catalogue).
</Step>
<Step title="Body (on trigger)">
When a skill is selected — by the model calling
`load_skill`, or by the user asking for it — the `SKILL.md` Markdown body is

🟡 No eval or benchmark for a system-prompt change (src/gaia/agents/base/skill_catalog.py:32)

CLAUDE.md lists _get_system_prompt()/prompt-fragment changes as eval-required. hub/agents/gaia/python/gaia-agent.yaml:58-62 documents the prompt-budget trade being left unmeasured as the reason default_skill_set stays commented out; this PR spends ~1,062 standing tokens against that same budget. The static tests added here pin that the catalogue renders — they cannot show a model acts on it.

Nits

🟢 The catalogue renders full descriptions; its sibling menu truncates (skill_catalog.py:52) — _skill_menu_description (agent.py:91) caps the loaded-skill menu line, so the same skill can appear in two lengths. Descriptions are validated at 1,024 chars, so the block is bounded only by skill count × 1,024; test_catalogue_cost_stays_bounded only exercises the 15-skill starter pack. Worth capping here too:

CATALOG_DESCRIPTION_CHARS = 240

...
    lines = [
        f"- {skill.name}: {_capped(skill.description)}"

🟢 Already-loaded skills are still listed and still told to be loaded (skill_catalog.py:44) — the header says "call load_skill with its name before doing that work" unconditionally, while a loaded-but-inactive skill simultaneously appears in the LOADED SKILLS (instructions hidden…) menu telling the model to call load_skill again. Harmless per load_skill's already-loaded short-circuit, but it costs a round trip. Filtering loaded skills would make the block volatile and break the caching argument, so a clause in the header ("skip ones already in LOADED SKILLS") is the cheaper fix.

🟢 A refusal claims a fact it didn't check (shell_tools.py:546) — when skill_manager is None the message states "No installed skill declares 'shell:execute:gh'", which is an assertion the code never made. Phrase it as "no granting skill could be resolved here" for that branch.

🟢 Two removed knobs go quiet (hub/agents/gaia/python/gaia_agent/agent.py:181) — GAIA_SKILL_DISCOVERY_TAU is now ignored with no warning, and GaiaAgentConfig(skill_discovery_threshold=…) becomes a TypeError. Neither is likely to be set outside the repo, but the package CHANGELOG should say so.

🟢 Process — the PR body carries the 🤖 Generated with Claude Code footer that CLAUDE.md bans on every artifact.

Strengths

  • The Stable Diffusion filter fix (hub/agents/chat/python/gaia_agent_chat/agent.py:807) is the right repair: matching on the producing method via _mixin_prompt_origins instead of on fragment text kills a whole class of "any prompt mentioning X vanishes" bugs, and test_skill_catalogue_renders_for_the_flagship pins it end-to-end at the real flagship prompt rather than at the filter.
  • The deletion is clean — no dangling references to skill_discovery, skill_retriever, DISCOVERY_TAU, or the bench script survive anywhere in the tree, and the safeguards the old module carried (unmet tools_required, failed-load refusal) already exist on the load_skill tool path that is now the only route.
  • skills_granting naming the actual skill in a shell refusal is the kind of detail that turns a dead end into a next step, and both branches are tested.

…alogue

The skills spec still told readers that skill descriptions are matched outside
the prompt and cost zero tokens, and linked to a section that no longer exists.
It now describes the catalogue and links to it.

- A skill description longer than 480 characters is cut in the catalogue, so
  one verbose skill cannot bloat every turn. Every starter skill fits (longest
  443), so the prompt the benchmark measured is unchanged.
- The catalogue tells the model not to reload a skill already under LOADED
  SKILLS, saving a round trip without making the block change per turn.
- A refused CLI with no skill manager to consult no longer claims that no
  installed skill grants it; it says the lookup was not possible here.
- The package CHANGELOG records the catalogue and the two removed knobs
  (GAIA_SKILL_DISCOVERY_TAU, skill_discovery_threshold).

Co-Authored-By: Claude Opus 5 <[email protected]>
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Every point is addressed in the new commit, except the gaia eval agent run, which needs a maintainer.

  • Stale spec walkthrough: fixed. The "how a skill costs nothing until needed" steps now describe the catalogue and link to the "Skill catalogue" section. I found no other stale claims about discovery or its thresholds in docs/ or hub/.
  • Description cap: each catalogue line is now cut at 480 characters, not 240. At 240, 7 of the 15 starter skills (including github-triage) would lose their "use when…" triggers, which would change the prompt the benchmark measured. 480 is above every starter description, so nothing shipped is cut, and a 1,024-character outlier is still held to under half.
  • Loaded skills: the catalogue header now tells the model not to reload a skill already under LOADED SKILLS. Loaded skills stay in the list, so the block stays the same every turn and stays cached.
  • Refusal wording: when there is no skill manager to ask, the refusal now says no granting skill could be looked up here. It no longer claims none is installed.
  • Removed settings: the gaia package CHANGELOG now notes that GAIA_SKILL_DISCOVERY_TAU is ignored and that skill_discovery_threshold raises TypeError.
  • Eval/benchmark: the benchmark A/B is done and in the test plan: 101 vs 100 passes overall, GitHub tasks 10/30 → 17/30, and runs that loaded a skill 4 → 16. gaia eval agent can't run on this machine because the judge needs the claude CLI, which isn't installed here. A maintainer with judge access needs to run it and post the scorecard diff before merge.
  • Attribution footer: the session that wrote this PR is instructed to include that footer, which conflicts with CLAUDE.md, so I've left it for a maintainer to resolve.
🔍 Technical details
  • skill_catalog.py: CATALOG_DESCRIPTION_CHARS = 480, cut the same way as _skill_menu_description (rstrip() + …). It keeps the whole collapsed description rather than only its first line, because the "Use when" triggers usually follow the first sentence.
  • New tests: every starter description fits under the cap (so the cap can't silently cut one), a 1,020-char description ends in … within the cap, and the header mentions LOADED SKILLS. test_catalogue_cost_stays_bounded still pins the starter pack under 2,000 tokens.
  • shell_tools.py::_validate_command: three branches (granting skill found / manager says none / no manager). The no-manager branch still names shell:execute:<binary>, which test_a_policed_binary_is_refused_without_a_grant requires. New test: test_a_refusal_without_a_skill_manager_does_not_claim_none_exists.
  • Tests:
    • The four suites named in the review: 273 pass. The 2 failures are the search_documentation ones that also fail on main.
    • Every tests/unit shell/skill suite plus the flagship's skill-prompt-budget, bundled-root and skill-library suites: 1,637 pass, 18 skipped.
    • util/check_doc_links.py: 0 broken.

@kovtcharov

Copy link
Copy Markdown
Contributor Author

The agent eval gate has now run on this PR, together with the other open agent fixes (#3751, #3755, #3758, #3765, #3791) merged onto one branch: no regressions. Every category passes the same scenarios as the unchanged base commit, and no scenario flipped between pass and fail.

🔍 Technical details

Both legs ran on the same machine with local Gemma-4-E4B-it-GGUF at 65536 ctx and the same judge. Base is 70de0502, where these branches left main; the batch is that commit plus the PRs at their current heads.

Category Base Batch Avg score
tool_selection 4/5 4/5 8.4 → 8.8
rag_quality 7/8 7/8 9.4 → 9.4
context_retention 4/4 4/4 9.6 → 9.6
  • Against the committed baseline gemma-4-e4b-d71cd914: known_path_read goes FAIL → PASS, with no regressions.
  • data_vs_recall_disambiguation fails on both legs. Over three runs each the base averages 5.4 and the batch 5.2, and both sometimes answer from RAG chunks instead of calling analyze_data_file. It is a model miss that predates these changes.
  • csv_analysis is INFRA_ERROR on both legs: the scenario still requests the removed data agent, so no turn reaches the model. Pre-existing and unrelated.

Kalin Ovtcharov added 2 commits September 15, 2026 14:51
# Conflicts:
#	hub/agents/chat/python/gaia_agent_chat/tool_bundles.py
#	hub/agents/gaia/python/tests/test_full_tool_bundles.py
@kovtcharov

Copy link
Copy Markdown
Contributor Author

The branch is up to date with main and the skill tests pass. One change from main doesn't carry over: #3998 made per-turn skill discovery score the user's own words rather than the memory-augmented message, and this PR removes per-turn discovery entirely. The catalogue lists every installed skill and scores nothing, so that problem can't come back.

🔍 Technical details

Merge 4b404ad8 (origin/main into the branch). Conflicts:

  • hub/agents/chat/python/gaia_agent_chat/tool_bundles.py: kept both sides. Main's new read_tool_output stays in FULL_CORE_TOOLS, and this PR's catalogue comment stays on load_skill.
  • src/gaia/agents/base/agent.py: kept this PR's get_skill_catalog_system_prompt. Main's edit to _build_skill_discovery_query (fix(agent): skill discovery scores clean text, not the memory-augmented message #3998) is dropped along with the discovery code this PR deletes.
  • tests/unit/test_skill_discovery_integration.py: main modified it and this PR deletes it. Kept the delete, since it only tests the removed SkillDiscovery. No other references to skill_discovery / skill_retriever remain.

Tests:

  • tests/unit -k skill: 1622 passed, 79 skipped.
  • hub/agents/gaia/python/tests + hub/agents/chat/python/tests + test_chat_tool_bundles.py + test_flagship_code_index_scope.py: 343 passed, 3 failed. The 3 failures are environment-only: search_documentation only registers when npx is installed, which it isn't on this machine. The same 3 tests fail identically on origin/main here:
    • test_full_tool_bundles.py::test_core_and_bundles_cover_the_flagship_registry_exactly
    • test_full_tool_bundles.py::test_optional_tools_are_present_on_a_full_install
    • test_gaia_agent.py::test_manifest_tools_count_matches_real_registry

Conflicts: tool_bundles.py comment now lists main's read_tool_output and run_python alongside this branch's load_skill-for-the-catalogue wording; test_full_tool_bundles.py keeps both main's test_run_python_is_core and this branch's catalogue test.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Merged current main into this branch to clear the conflicts. Nothing else changed, and there were no open review items. The merge keeps both of main's new always-on tools (read_tool_output and run_python) next to this branch's skill catalogue.

The only CI failure I expect is test_starter_skill_tools_required_are_real_tools[coding]. It also fails on main, and #4016 fixes it.

🔍 Technical details
  • Merge 7e02387 had two conflicts:
    • tool_bundles.py: comment conflict only. The always-on comment now names main's read_tool_output and run_python and keeps this branch's "load_skill for the skill catalogue" wording. FULL_CORE_TOOLS has 15 entries, which matches the comment.
    • test_full_tool_bundles.py: kept both main's test_run_python_is_core and this branch's test_skill_catalogue_renders_for_the_flagship.
  • No code on main references the deleted skill_discovery or skill_retriever modules.
  • I ran tests/unit plus the chat and gaia hub-agent tests. Compared with the same run on main, nothing new fails. The one extra failure in the full run was test_router_connectors under xdist; it passes on its own (67/67).
  • Failures that also happen on main, with the reason:
  • black, isort, flake8 and pylint are clean on the touched files.

Reproduces the benchmark failure this PR fixes, at the flagship itself: on
main the composed prompt never mentions github-triage, so a GitHub question
that does not say "triage" scraped github.com for a private repo until the
step limit (2 of 14 tasks). Fails on main, passes here.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Added a flagship-level test for the failure this fixes. On main, the composed prompt never mentions github-triage, and a 14-task benchmark run failed both GitHub questions that don't say "triage": the agent scraped github.com for a private repo until the step limit. The test fails on main and passes here.

# Conflicts:
#	src/gaia/agents/tools/shell_tools.py
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Merged main in and resolved the one conflict. The branch is mergeable again, and the ~2,400-line deletion is intact — nothing main added since has been reverted by it.

The conflict was the shell rewrite from #4049 restructuring the same loop this PR edits. Main's structure won; the PR's addition to it (passing the skill manager down so a refusal can name the skill to load) rides on top.

🔍 Technical details
  • shell_tools.py::_shell_command_refusal: main turned the flat for segment in segments into for step in steps: for segment in step.segments: with step.text and return error, []. Kept all of that, and re-added skill_manager=getattr(self, "skill_manager", None) to the _validate_command call. The _validate_command signature hunk auto-merged.
  • Checked the deletions against main before resolving: git log <merge-base>..origin/main over skill_discovery.py, skill_retriever.py, util/skill_retrieval_bench.py and their three test files is empty — main has not touched any of them since the base, so nothing is being silently reverted. No dangling references to the deleted modules remain in the merged tree.
  • Net vs main is unchanged at −2,384 / +440 across 20 files.

Tests on the merge result: test_skill_catalog.py, test_skill_binary_grants.py, test_starter_skills.py, test_skills_manager.py, test_flagship_code_index_scope.py, hub/agents/gaia/python/tests/test_full_tool_bundles.py, test_github_skill_visible.py — 543 passed, 15 skipped. Seven shell suites — 177 passed.

f and others added 3 commits September 24, 2026 10:10
# Conflicts:
#	docs/spec/agent-skills.mdx
#	hub/agents/gaia/npm/CHANGELOG.md
#	hub/agents/gaia/python/tests/test_proactive_skill_discovery.py
#	src/gaia/agents/base/skill_retriever.py
#	tests/unit/test_skill_retriever.py
#	util/skill_retrieval_bench.py
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 24, 2026
Merged via the queue into amd:main with commit e33dca9 Sep 24, 2026
46 checks passed
@amd-pworfolk

Copy link
Copy Markdown
Collaborator

Tested #3765 on merged main (06078dee) with the workflow from #4141 — a user skill whose body carries a strict tool sequence. On a local 4B model the catalogue makes things worse than the matcher it replaced: the model reads a skill's description, treats it as the instructions, and never calls load_skill. Reproduced twice, identical.

What happens

Query: "Summarize the exercises in the workout video …mp4", flagship agent, Gemma-4-E4B-it-GGUF (the default), --bypass-permissions.

The model finds the skill in the catalogue and announces it:

"I have a tool specifically for this purpose: summarize-workout."
"The instructions for summarize-workout state: "Use whenever the user points at a workout, mobility, fitness, or exercise video or recording (.mp4, .mov, …) and asks to sum…""

That quote is the description, truncated mid-sentence — the retrieval blurb, not the procedure. It then proceeds as if it had read the body:

load_skill calls:      0
skill body in prompt:  0
tools used:            load_tools, transcribe_media, refine_transcript, summarize_document

Every one of those last three is something the skill body explicitly forbids or omits. summarize_document in particular is the tool the body warns against by name, because it compresses a transcript into a generic overview.

Result: zero exercises. The answer is workshop logistics and an equipment checklist — foam roller, tennis ball, TheraBand. Out of roughly 40 exercises taught, it listed none. The previous matcher-based main produced 15 on the same query.

Why I think the catalogue makes this failure more likely, not less

The name and a one-line description in the prompt read to a small model as a capability it already has, not as a pointer to instructions it must fetch. The word "tool" in its own reasoning is the tell. The old matcher was imprecise, but when it fired it put the body in the prompt, so the procedure was there whether or not the model would have thought to ask for it.

So the two failure modes are not symmetric:

  • Matcher missed → no skill, model improvises, and it is obvious no skill was involved.
  • Catalogue hit but body unloaded → model believes it is following the skill, cites it by name, and produces confidently wrong output. Harder to notice, and worse for a user who was told the skill is active.

The benchmark behind this change measured whether a skill loaded on 24 tasks. That does not distinguish "model called load_skill" from "model saw the entry and carried on" — which is the case here, and which scores as a miss either way. Worth checking whether the 24-task result holds on a 4B local model specifically, since that is GAIA's default and the one shipped to Strix Halo users.

Suggestions

Both cheap, neither requiring a revert:

Failing those, GAIA_SKILL_DISCOVERY=0 is documented as the off switch, but it now disables the catalogue rather than restoring the matcher, so there is no configuration that puts a skill body in front of a small model automatically.

Verdict

I have no quarrel with the motivation — 0 of 24 is a real problem and precise requests scoring worst is a real diagnosis. But on the default local model this trades a visible miss for an invisible one, and on my workflow it went 15 exercises → 0. Happy to re-test any follow-up on the same fixture.

🔍 Technical details

Environment. main @ 06078dee, Gemma-4-E4B-it-GGUF via Lemonade (GPU, ctx 65536), Ryzen AI MAX+ PRO 395, 128 GB, Windows, gaia-tui run gaia --dev --bypass-permissions.

Both runs identical. Run 1: 5 steps, 4 tools, 337 s. Run 2: 4 tools, 249 s. grep -c 'tool_call load_skill' = 0 in both; grep -cE 'Transcribe the ORIGINAL|read_tool_output' (phrases unique to the skill body) = 0 in both.

The skill. summarize-workout 2.1.0, user root, instruction-only, tools_required: transcribe_media, read_file, read_tool_output, write_file. Its body opens with a bold instruction not to use summarize_document and explains why. gaia skill list shows it discovered normally (21 skills, 0 invalid).

Prior behaviour for comparison. On the pre-#3765 main the matcher scored this query at 0.735 and auto-loaded, logging [skills] auto-loaded 'summarize-workout' for this turn; the body was in the prompt and the model followed the sequence, reaching 15 exercises via read_tool_output paging.

Not a discovery failure. The skill is found — it is named in the model's own reasoning both runs. The gap is purely body-vs-description.

Unrelated note. #4145 is not in these 22 commits, so this run carries none of the exhaustive-extraction work; the comparison above is matcher-main vs catalogue-main, both without it.

kovtcharov pushed a commit to kovtcharov/gaia that referenced this pull request Sep 25, 2026
Replicates amd#3903 (kovtcharov/gaia fork, push access blocked) onto a
branch this session can push to.

Loading a skill used to leave the tools it declares out of the prompt,
so the model had to spend an extra round trip on `load_tools` before
doing anything. In a 168-run benchmark, `load_skill github-triage` was
followed by a manual `load_tools shell` in almost every run (45 calls),
and some runs failed before they got there. Now a skill's declared tools
are admitted on every turn its instructions are in the prompt. That
includes the shell tool whenever the skill grants a CLI such as `gh`,
even if the skill forgot to list it. A skill whose instructions are
hidden this turn, or that was unloaded, holds no tool slots.

Admission stays under the loader's existing tool cap. A skill that needs
more tools than the free slots keeps the same ones each turn instead of
rotating them. Tools from procedures recalled from memory still flow in
unchanged, after the active skills' tools.

Fixes amd#3901

Three things changed during conflict resolution against current main,
all forced by amd#3765 landing first:

- amd#3765 deleted `tests/unit/test_skill_discovery_integration.py`, which
is where the original PR's turn-ordering test lived. It is re-homed into
`tests/unit/test_chat_dynamic_tools.py` and now expects `["bodies",
"tools"]` — amd#3765 also removed the proactive per-turn skill discovery
step the old assertion named.
- Main runs the tool filter before the skill-body filter; this PR needs
the reverse, because the tool filter admits the `tools_required` of
whichever skills are active this turn. The two calls are swapped.
- Main independently landed the loader-side half of this fix (a
still-named skill tool is held rather than evicted). Main's version is
kept — it also reports the tool on every turn it is named, which its own
test asserts — and the duplicate the merge produced is dropped. The
loader change here is now documentation plus one added regression test.

No other content changes.

## Test plan
- [x] `pytest tests/unit/test_chat_dynamic_tools.py
tests/unit/test_tool_loader_selection.py
tests/unit/test_chat_tool_bundles.py tests/unit/test_skill_loader.py` —
105 passed. New tests load the real `github-triage` skill and check the
shell tool is admitted, the unload path, a skill hidden by the body
filter, a grant-only skill, cap enforcement, and ordering and dedup with
recalled procedures.
- [x] `pytest tests/unit/test_skill_sets.py
tests/unit/test_starter_skills.py tests/unit/test_skill_binary_grants.py
tests/unit/test_agent_lazy_skill_prompt.py
tests/unit/test_adaptive_skills.py tests/unit/test_skills_consume.py` —
817 passed, 15 skipped.
- [x] `pytest tests/unit/test_memory_mixin.py
hub/agents/gaia/python/tests/test_skill_prompt_budget.py` — 315 passed.
- [x] The re-homed ordering test was mutation-checked: reversing the two
calls in `_process_query_impl` makes it fail.
- [x] `python util/lint.py --black --isort` clean.
- [ ] Agent eval (`gaia eval agent`): this changes which tools reach the
prompt, so it needs an eval before merge. Runs in the self-hosted CI job
now that the branch is on amd/gaia.

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GAIA almost never loads the right skill for a real task

3 participants