Skill Libraries and Lifelong Learning (Voyager)
Voyager (Wang et al., TMLR 2024) treats executable code as a skill: named, retrievable, composable, and refined by environment feedback. It is the reference architecture for Claude Agent SDK skills, skillkit, and the 2026 skill-library pattern.
Learning Objectives
- Name Voyager's three components — automatic curriculum, skill library, iterative prompting — and the role of each.
- Explain why Voyager makes the action space code, not primitive commands.
- Implement a stdlib skill library with registration, retrieval, composition, and failure-driven refinement.
- Map Voyager's pattern onto the 2026 Claude Agent SDK skills and the skillkit ecosystem.
The Problem
An agent that rebuilds every capability from scratch each session fails in three ways:
- It wastes tokens. Every task re-elicits the same reasoning.
- It loses progress. A correction learned in session A never reaches session B.
- It fails at long-horizon composition. Complex tasks need hierarchies of capabilities, and a one-shot prompt cannot express them.
Voyager's answer is to treat each reusable capability as a named chunk of code in a library. The library retrieves skills by similarity, composes them with other skills, and refines them from execution feedback.
The Concept
A skill library is a persistent store of named, executable code that an agent can search, compose, and refine. Voyager (arXiv:2305.16291) builds an entire agent around one.
Three components
Voyager structures an agent around three pieces:
- Automatic curriculum. A curiosity-driven proposer picks the next task based on the agent's current skill set and the environment state. Exploration is bottom-up.
- Skill library. Each skill is executable code, added when a task succeeds. Retrieval matches the query against skill descriptions by similarity.
- Iterative prompting mechanism. When a skill fails, the agent gets execution errors, environment feedback, and self-verification output, then refines the skill.
In the Minecraft evaluation (Wang et al., 2024), Voyager got 3.3x more unique items, reached stone tools 8.5x faster and iron tools 6.4x faster, and traversed 2.3x more map than the baselines. Those numbers are specific to Minecraft, but the pattern transfers.
Action space = code
Most agents emit primitive commands. Voyager emits JavaScript functions. A skill looks like this:
async function craftIronPickaxe(bot) {
await mineIron(bot, 3);
await mineStick(bot, 2);
await placeCraftingTable(bot);
await craft(bot, 'iron_pickaxe');
}
It is composed from sub-skills, stored keyed on its description and embedding, and retrieved as a program rather than a prompt. Voyager's skills are JavaScript; the Build It toy below keeps its code as Python strings next to plain Python callables.
The 2026 Claude Agent SDK skill is the same idea: a named, retrievable chunk of code plus instructions that the agent loads on demand.
Skill retrieval
Say the new task is "make a diamond pickaxe." The agent:
- Embeds the task description.
- Queries the skill library for the top-k similar skills.
- Retrieves
craftIronPickaxe,mineDiamond,placeCraftingTable, and so on. - Composes the new skill from the retrieved pieces plus whatever new logic it needs.
MCP resources (Phase 13) and Agent SDK skills implement this same pattern: retrieval over a knowledge or code surface, scoped to the current task.
Iterative refinement
The feedback loop runs like this:
- The agent writes a skill.
- The skill runs against the environment.
- One of three signals comes back:
success,error(with a stack trace), orself-verification failure. - The agent rewrites the skill using that signal as context.
- The loop repeats until success or a maximum number of rounds.
This is Self-Refine (Lesson 05) applied to code generation, with the environment doing the verifying. CRITIC (Lesson 05) is the same pattern with external tools as the verifier.
Curriculum and exploration
The curriculum module proposes tasks like "build a shelter near the lake" based on what the agent has and what it hasn't done yet. It reads the environment state and the skill inventory, then picks a task just above current capability, which is the exploration sweet spot.
For a production agent, this becomes a "what's missing" operator: given the current library and a domain, which skills aren't covered yet? Teams typically run this by hand as a curriculum review.
Where this pattern goes wrong
- Skill library rot. The same skill gets added ten times under slightly different descriptions. Deduplicate on write so retrieval returns one.
- Composed-skill drift. A parent skill depends on a child that was later refined. Version your skills. A parent pinned to v1 does not pick up v3 on its own.
- Retrieval quality. Vector retrieval over skill descriptions degrades once the library grows past a few hundred skills. Supplement it with tag filters and hard constraints ("only skills with
category=tooling").
Build It
code/main.py implements a stdlib skill library with these pieces:
Skill: name, description, code (as a string), a callablefn, version, tags,depends_on, and a history of earlier code.SkillLibrary:register,search(token overlap),topo_orderandexecute(composition by topological sort of dependencies), and refinement via re-registering a name, which bumps the version.- A scripted agent that registers three primitive skills, composes a fourth, hits a failure, and refines it.
The Concept section describes retrieval by embedding similarity. The toy uses token overlap (Jaccard score on description words) so it stays stdlib-only; Exercise 3 swaps in real embeddings. Two other simplifications: "dedup on write" here means exact name match (a second registration of the same name becomes a version bump, not a new entry), and the toy has no cycle detection or version pinning. Exercises 1 and 2 add those.
Run it:
python3 code/main.py
The trace shows library writes, retrieval, composition, a failed execution, and a v2 refinement. That is Voyager's loop end to end.
Use It
- Claude Agent SDK skills (Anthropic): the 2026 reference. Each skill has a description, code, and instructions, and is loaded on demand during an agent session.
- skillkit (npm: skillkit): cross-agent skill management for 32+ AI coding agents.
- Custom skill libraries: domain-specific ones, like SQL skills for data agents or Terraform skills for infra agents. The Voyager pattern scales down well.
- OpenAI Agents SDK
tools: the low end of the spectrum, where each tool is a lightweight skill.
Ship It
outputs/skill-skill-library.md generates a Voyager-shaped skill library for any target runtime, with registration, retrieval, versioning, and refinement wired in.
Spend your effort on library hygiene before anything else. The curriculum module is the glamorous part of Voyager, but the three failure modes in this lesson (duplicate skills, drifting parents, retrieval that degrades as the library grows) are all about keeping the library clean, and none of them need a curriculum to show up. Deduplicate on write, pin versions from the first day a skill depends on another, and put tag filters next to your similarity search before the library gets big. The lesson also says most teams run the curriculum step by hand, and I'd start there too. A library you can trust is worth more than a clever proposer feeding a messy one.
Exercises
- Add a dependency-cycle detector to
topo_order(). Today its visited set stops an infinite loop but silently returns an order. What should happen when skill A depends on B and B depends on A? Should that be an error or a warning? - Implement per-skill version pinning (
depends_oncurrently holds bare names, so a parent always runs the latest child). When a parent skill composes childcrafting@1, a refinement tocrafting@2must not silently upgrade the parent. - Replace token-overlap retrieval with sentence-transformers embeddings (or a stdlib BM25 implementation). Measure retrieval@5 on a 50-skill toy library.
- Add a "curriculum" agent: given the current library and a domain description, propose 5 missing skills. Run it weekly.
- Read Anthropic's Claude Agent SDK skill docs and port the toy library to the SDK's skill schema. What changes about discoverability?
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| Skill | "Reusable capability" | Named chunk of code + description, retrievable by similarity |
| Skill library | "Agent memory of how-to" | Persistent store of skills, searchable and composable |
| Curriculum | "Task proposer" | Bottom-up goal generator driven by current capability gap |
| Composition | "Skill DAG" | Skills invoking skills; topologically sorted on execution |
| Iterative refinement | "Self-correcting loop" | Env feedback + errors + self-verification fold back into the next version |
| Action-space-as-code | "Programmatic actions" | Emit functions, not primitive commands, for temporally extended behavior |
| Dedup on write | "Skill collapse" | Near-duplicate descriptions collapse to one canonical skill |
Further Reading
- Wang et al., Voyager (arXiv:2305.16291): the original skill-library paper
- Claude Agent SDK overview: skills as the 2026 productization
- Anthropic, Building agents with the Claude Agent SDK: skills and subagents in practice
- Madaan et al., Self-Refine (arXiv:2303.17651): the refinement loop underneath Voyager
Code
- main.py (python, 242 lines)