IV · Retrieval & RAGExperimental·

Dependency-Aware Skill Retrieval

also known as Skill-Graph Retrieval, Prerequisite-Closure Retrieval

Retrieve from a large skill library by returning each relevant skill together with its prerequisite dependency closure as an ordered subgraph, so the bundle the agent receives is executable rather than topically relevant but incomplete.

Context

An agent draws on a library of hundreds or thousands of skills or tools, far more than fit in one context window, so a retrieval step selects which to load for the task at hand. Skills are not independent: one skill calls another, a higher-level routine assumes a lower-level primitive is present, and some skills only work once a setup skill has run. Standard retrieval ranks skills by semantic similarity to the request and returns the top matches.

Problem

Semantic similarity surfaces the skills that look relevant to the request, but it is blind to the dependency structure between them. A retrieved skill whose prerequisites were not also retrieved fails at execution time, and the agent either errors out or wastes turns rediscovering the missing upstream skill. The more compositional the task, the wider this prerequisite gap grows, because each retrieved skill silently assumes others that ranking never surfaced.

Forces

  • Top-k semantic ranking optimises for topical relevance to the query, which is not the same as returning an executable, self-contained bundle.
  • A skill's prerequisites are often not textually similar to the request, so similarity search ranks them low even though execution needs them.
  • Returning the full transitive closure of every match can flood the context window, so the closure must be bounded and ordered rather than dumped.
  • The dependency graph has to be maintained as skills are added or changed, upkeep that flat semantic indexing avoids.

Example

A data-analysis agent is asked to publish the quarterly dashboard. Semantic search returns the publish-dashboard skill, but publishing depends on build-charts, which depends on load-warehouse-credentials. Flat retrieval would load only publish-dashboard and fail at the first call; dependency-aware retrieval walks the prerequisite edges and returns all three in order — credentials, charts, publish — so the agent runs the chain straight through.

Diagram

Solution

Therefore:

Represent the skill library as a graph whose nodes are skills and whose typed edges record prerequisite, enhancement, and co-occurrence relations. Retrieval runs in two stages: a semantic stage ranks skills against the request as usual, then a graph stage expands each candidate along prerequisite edges to gather the skills it depends on, bounding the expansion so the bundle stays within budget. The combined set is returned in topological order, so every skill appears after the skills it needs, and the agent receives a runnable plan rather than a flat list of lookalikes. Enhancement and co-occurrence edges can widen the bundle when budget allows, but prerequisite edges are followed first because they are what make the bundle execute.

What this pattern forbids. A skill is never returned in isolation when its execution depends on skills not also retrieved; retrieval must expand the prerequisite closure and order it topologically before the bundle is handed to the agent.

And the patterns that stand alongside it, or against it —

  • complementsSkill LibraryLet the agent grow its own toolkit by writing reusable skills that subsequent runs can call.
  • alternative-toTool Search Lazy LoadingDefer loading tool schemas into the context window until a search step shows they are needed.
  • alternative-toHierarchical Tool SelectionOrganise tools into a tree of categories so the agent first picks a branch and then a specific tool within it.
  • complementsTool Loadout★★Select a small task-relevant subset of available tools per request rather than exposing the full registry to the model.
  • complementsKnowledge Graph MemoryPersist agent memory as entities and relations in a structured graph so symbolic queries (path, neighbour, type) become possible.

Neighbourhood

Click any neighbour to follow the language. Scroll to zoom, drag to pan.