Procedural Memory (Skill Library)
A library of successful prompt/tool sequences the agent can replay for recurring tasks.
Procedural Memory (Skill Library) is a free AI Agents lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Agents learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is Procedural Memory?
Procedural memory stores "how to do things" — reusable sequences of actions that succeeded. Think of it as a library of mini-recipes the agent can replay.
Examples:
- "To file an expense report, do A, then B, then C."
- "To deploy the staging build, run X, wait for Y, then Z."
Why Procedural Memory?
Without it, the agent re-derives the same plan from scratch every time — slow, expensive, and inconsistent. With a skill library, recurring tasks are solved instantly.
Storage Format
CREATE TABLE skills (
id UUID PRIMARY KEY,
name TEXT NOT NULL,
description TEXT NOT NULL,
embedding vector(1536),
steps JSONB NOT NULL, -- list of tool calls
success_rate REAL DEFAULT 1.0,
use_count INT DEFAULT 0,
created_at TIMESTAMPTZ
);Capturing a New Skill
After a successful run, ask the LLM to extract the recipe:
extract_prompt = '''
The agent successfully completed: {user_request}
The trace was:
{trace}
Write this as a reusable skill with name, description, and step list.
Return JSON: {name, description, steps: [{tool, args_template}]}
'''
print(extract_prompt.strip())
Storing the Skill
skill = json.loads(llm.invoke(extract_prompt).content)
vec = embed(skill['description'])
conn.execute('''
INSERT INTO skills (id, name, description, embedding, steps)
VALUES (%s, %s, %s, %s, %s::jsonb)
''', (str(uuid.uuid4()), skill['name'], skill['description'], vec, json.dumps(skill['steps'])))Retrieving a Relevant Skill
When a new user request comes in, search the skill library:
def find_skill(query):
qvec = embed(query)
rows = conn.execute('''
SELECT name, steps FROM skills
ORDER BY embedding <=> %s LIMIT 3
''', (qvec,))
return rowsSkill Templates
Skills are templates with parameter slots. The agent fills in actual values per run:
skill = {
'name': 'file_expense_report',
'steps': [
{'tool': 'open_form', 'args': {'form_id': 'expense'}},
{'tool': 'fill_field', 'args': {'field': 'amount', 'value': '{amount}'}},
{'tool': 'fill_field', 'args': {'field': 'category', 'value': '{category}'}},
{'tool': 'submit'}
]
}
import json
print(json.dumps(skill, indent=2))
Suggesting Skills to the LLM
Inject candidate skills into the system prompt and let the LLM decide which to use:
candidates = find_skill(user_request)
prompt = f'''
You can use these existing skills if applicable:
{json.dumps(candidates, indent=2)}
Or you can plan a new sequence.
'''Tracking Skill Success
After each use, update the skill stats:
UPDATE skills
SET use_count = use_count + 1,
success_rate = (success_rate * use_count + (CASE WHEN %s THEN 1 ELSE 0 END)) / (use_count + 1)
WHERE id = %s;Pruning Bad Skills
Skills with low success_rate or low use_count should be removed:
DELETE FROM skills
WHERE (success_rate < 0.5 AND use_count >= 5)
OR (use_count = 0 AND created_at < NOW() - INTERVAL '30 days');Voyager: A Famous Example
Voyager (Wang et al. 2023) is a Minecraft-playing agent that builds a "skill library" of code snippets — a landmark paper on procedural memory.
Skill Composition
Skills can call other skills. The agent learns increasingly abstract procedures:
low_level_skill = {'name': 'open_email', 'steps': [...]}
high_level_skill = {'name': 'process_inbox', 'steps': [
{'skill': 'open_email'},
{'skill': 'reply_or_archive'}
]}
print(low_level_skill)
print(high_level_skill)
Privacy of Skills
Skills are usually generic enough to be shared across users. But check — some "skills" leak user-specific details (a specific account number). Anonymise before storing in a shared library.
Procedural Definition
What does procedural memory store?
Recap
Procedural memory = skill library. Extract recipes from successful runs, retrieve relevant ones for new requests, track success rates, prune the dead ones.
Frequently asked questions
Is the “Procedural Memory (Skill Library)” lesson free?
Yes — the full text of “Procedural Memory (Skill Library)” is free to read here on the web, and the AI Agents course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Agents course, upgrade to CoddyKit PRO.
What will I learn in “Procedural Memory (Skill Library)”?
A library of successful prompt/tool sequences the agent can replay for recurring tasks. You practise AI Agents with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AI Agents?
No prior experience is required. AI Agents on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Procedural Memory (Skill Library)” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AI Agents lesson?
Yes. Every AI Agents lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Episodic Memory (Per-Session History)
- Semantic Memory (Vectorised Facts)
- Procedural Memory (Skill Library)
- Memory Decay and Garbage Collection