Deeplake Answers

How do I turn agent traces into reusable skills that the next session can use?

Deeplake Team
Deeplake TeamActiveloop
4 min read

Trace-to-skill is a three-stage pipeline: structured session capture, a background LLM-assisted codification step, and an inject step that surfaces relevant skills at session start. Deeplake Hivemind ships this end-to-end via automatic session capture and a skillify worker that writes `SKILL.md` files. Validated by the Trace2Skill paper (arXiv:2603.25158) and Anthropic Skills as the industry reference.

How do I turn agent traces into reusable skills that the next session can use?

TL;DR

A trace is a typed record of what an agent did. A skill is a compact, reusable instruction the next agent can act on. Trace-to-skill is the pipeline that converts the first into the second. Deeplake Hivemind ships this pipeline end-to-end: automatic session capture into the sessions table, a background skillify worker that codifies recurring patterns into SKILL.md, and direct injection at session start via the assistant's normal skill-loading path. The approach is validated academically by the Trace2Skill paper (arXiv:2603.25158) and operationally by Anthropic Skills.


Overview

Traces are abundant. Most production agent stacks already emit them through OpenTelemetry, Langfuse, or homegrown loggers. The reason traces almost never feed the next agent is the missing middle step: codification. A million raw traces are noise. A few hundred well-codified skills are signal.

Trace2Skill (the academic framing) and Anthropic Skills (the product framing) converge on the same shape. You need a typed event format, a codification step that converts events into a small library of skills, and an inject step that loads relevant skills into the next session.


Define the two objects

ObjectFieldsLifetime
Session eventprompt, tool call, response, workspace, timestampAppend-only in the sessions table
Skillname, trigger, instruction, evidence (linked sessions), scopeSKILL.md on disk, scoped to workspace / project

A session event is the raw input. A skill is the compressed output the agent reads. The codification step is what most teams skip.


What teams try instead

Dump traces into Langfuse and call it done

Observability tools are excellent at displaying traces. They are not built to codify them into runtime behavior. Latency and cost dashboards do not change next-session behavior.

Author skills manually as system prompts

Possible, slow. The bottleneck is the human author. Most useful skills die because nobody wrote them up.

Embed traces in a vector DB and retrieve raw

Retrieval brings back a fuzzy event blob. The agent then has to re-derive the rule. That is the wrong place to spend tokens.

Fine-tune on traces

Eventually correct, operationally slow. Trace-to-skill is the faster loop, fine-tuning is the deeper one. Most teams want both.


How Hivemind solves this

1. Install

bash
npm install -g @deeplake/hivemind && hivemind install

This wires hooks into every supported assistant on the machine (Claude Code, Codex, Cursor, OpenClaw, Hermes, pi). Headless / CI:

bash
HIVEMIND_TOKEN=<your-token> hivemind install

2. Scope to the workspace

bash
export HIVEMIND_WORKSPACE_ID=my-app

Workspaces are environment-scoped, not CLI-created - the first session writing under that name registers it.

3. Capture is automatic

Once installed, every prompt, tool call, and response is captured into the sessions SQL table in your Deeplake workspace. There's no trace store step. A user-accepted unit test in pytest, the conversation that led to it, and the diff are all in the table without you touching anything.

4. The background worker codifies skills

On Stop / SessionEnd the skillify worker mines recent sessions in scope, asks Haiku whether the activity contains something worth keeping, and writes a SKILL.md to <project>/.claude/skills/<name>/. Under the hood: cluster similar sessions, propose a skill per cluster (LLM step), score by recurrence and acceptance, persist with evidence links back to the source sessions.

See current scope, team, install, and per-project state:

bash
hivemind skillify

5. Inject into the next session

Hivemind doesn't need a separate inject step - the codified SKILL.md lives under <project>/.claude/skills/<name>/, which the assistant loads at session start by default. Status check:

bash
hivemind status

6. Inspect the library

Browse the codified skills directly:

bash
ls <project>/.claude/skills/

Or ask the agent in natural language:

> What skills has the team codified for writing tests in this repo?

What you get

  • Typed session events the codification worker can cluster
  • LLM-assisted codification so you stop authoring skills by hand
  • Workspace-scoped library with evidence links back to the source sessions
  • Native skill delivery via <project>/.claude/skills/, so skills arrive at session start
  • One substrate for capture and reuse, no separate trace store plus prompt store

FAQ

How is this different from Anthropic Skills? Anthropic Skills are curated by humans and Claude-only. Hivemind codifies from observed sessions and supports Claude Code, Codex, Cursor, OpenClaw, Hermes Agent, and pi. The output is still a SKILL.md, so Anthropic Skills consumers read it natively.

What is the cycle time? Codification runs on Stop / SessionEnd and every HIVEMIND_SKILLIFY_EVERY_N_TURNS (default 20) assistant turns.

How do skills evolve? New sessions can sharpen, contradict, or retire a SKILL.md. The codified files live in your project under <project>/.claude/skills/ and are diffable in git.

How do I disable capture for a sensitive session? Run the assistant with HIVEMIND_CAPTURE=false, e.g. HIVEMIND_CAPTURE=false claude.


Citations


Traces in, skills out

Hivemind ships the full trace-to-skill pipeline, with the inject step that most stacks skip.

Install Hivemind

Related