feat(skills): serve the index on-demand via search_skills/list_skills (#50)#52
Merged
Conversation
Add skills_index_mode config flag ('inject' default | 'on_demand').
In on-demand mode the per-turn preamble carries a short discovery
pointer instead of the full index, and two scoped function-tools —
search_skills (keyword-ranked) and list_skills — let the model pull
matching name+summary entries lazily, mirroring the secrets vault's
list_secrets pattern. Default behaviour is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Engine: index_entries scoping + search_index ranking/empty/no-match. Agent: preamble swaps full index for the discovery pointer in on-demand mode (and dedups it like the index), feature gate offers search_skills/list_skills only on-demand, and dispatch returns allowlist-scoped matches with load_skill still working end-to-end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
skills.mdx gains a 'Serving the index on-demand' section (config flag + search_skills/list_skills); architecture.mdx and configuration.mdx note the new agent.skills_index_mode flag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
) - cover build_prompt_sections' on-demand branch (backs the admin prompt preview): renders the pointer, never the full index - exercise the LLM-controlled limit at the search_skills dispatch boundary: non-numeric fallback, the max(1, ...) floor, default - extract _tools_for_turn so the skills_index_mode -> advertised-tools seam is unit-tested (catches a typo'd comparison string) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rebased onto main after #44 landed. apply_feature_gates now also gates the skill-discovery tools (skills_on_demand, default False alongside subagents_enabled), and the subagent loop builds its tool set through the shared _tools_for_turn so a subagent in on-demand mode gets search_skills/list_skills to match the pointer its preamble already carries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9119842 to
23e09d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50.
What
Stops always-injecting the full skills index. Adds an opt-in on-demand mode where the per-turn preamble carries only a short discovery pointer and the model pulls matching skills lazily through two new scoped tools — the same lazy pattern the secrets vault uses for
list_secrets, and a level up from the already-lazyload_skill(which loads bodies on demand).How
agent.skills_index_mode—"inject"(default, behaviour unchanged) or"on_demand". Any other value falls back to"inject".search_skills(query, limit?)— top keyword-rankedname + summarymatches (name hit outranks summary hit).list_skills()— the full index asname + summary. Both reuse the persona allowlist scoping thatload_skillalready enforces, so a persona never discovers a skill it can't load.<available_skills>block becomes a static pointer to the two tools; the existing history gate dedups it (sent once per session, re-sent after/new/compaction). The full index is omitted.search_skills/list_skillsare offered only in on-demand mode (in inject mode the full index is already in context, so they'd be redundant). They're always-on w.r.t. persona tool-scope, likeload_skill.get_index_blocknow sharesindex_entrieswith the new search/list paths.Tests
index_entriesscoping;search_indexranking, empty-query browse, no-match, allowlist.load_skillstill working end-to-end.Docs
skills.mdx(new "Serving the index on-demand" section),architecture.mdx,configuration.mdx.