Skip to content

feat(skills): serve the index on-demand via search_skills/list_skills (#50)#52

Merged
mattmezza merged 5 commits into
mainfrom
feat/skills-on-demand
Jun 29, 2026
Merged

feat(skills): serve the index on-demand via search_skills/list_skills (#50)#52
mattmezza merged 5 commits into
mainfrom
feat/skills-on-demand

Conversation

@mattmezza

Copy link
Copy Markdown
Owner

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-lazy load_skill (which loads bodies on demand).

How

  • Config flag agent.skills_index_mode"inject" (default, behaviour unchanged) or "on_demand". Any other value falls back to "inject".
  • search_skills(query, limit?) — top keyword-ranked name + summary matches (name hit outranks summary hit). list_skills() — the full index as name + summary. Both reuse the persona allowlist scoping that load_skill already enforces, so a persona never discovers a skill it can't load.
  • Preamble: in on-demand mode the <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.
  • Tool gating: search_skills/list_skills are 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, like load_skill.
  • Engine refactor: get_index_block now shares index_entries with the new search/list paths.
  • Admin prompt-preview reflects the active mode.

Tests

  • Engine: index_entries scoping; search_index ranking, empty-query browse, no-match, allowlist.
  • Agent: preamble swaps the full index for the pointer in on-demand mode (and dedups it); feature gate offers the discovery tools only on-demand; dispatch returns allowlist-scoped matches with load_skill still working end-to-end.
  • Full suite green (483 passed), ruff clean.

Docs

skills.mdx (new "Serving the index on-demand" section), architecture.mdx, configuration.mdx.

mattmezza and others added 5 commits June 29, 2026 13:58
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>
@mattmezza mattmezza force-pushed the feat/skills-on-demand branch from 9119842 to 23e09d1 Compare June 29, 2026 12:03
@mattmezza mattmezza merged commit a8c4a21 into main Jun 29, 2026
1 check passed
@mattmezza mattmezza deleted the feat/skills-on-demand branch June 29, 2026 12:41
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.

Skills: serve the index on-demand via a search/list tool instead of always injecting it

1 participant