learn

A command that turns a finished agent conversation into suggested knowledge entries or a proposal for a new skill. It does not save changes without confirmation.

In plain words
What is it for?
Use it after a conversation to review what should be remembered and whether a repeated workflow deserves its own reusable skill.
Why use it?
It prevents useful decisions from being lost while keeping uncertain or unwanted information out of persistent memory.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/komluk/scaffolding/learn
Clone the repo
git clone --depth 1 https://github.com/komluk/scaffolding
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,331 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01331
Opus 5 $0.00000 $0.00665
Sonnet 5 $0.00000 $0.00266
Haiku 4.5 $0.00000 $0.00133

Measured 2d ago against content hash 24c9253d0f6c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

learn scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/learn.md · 149 lines

How it starts

The opening of the file, as written. The whole thing — 149 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/learn Command

Distill a finished conversation into classified knowledge candidates and propose (never auto-apply) memory writes or a new-skill hand-off. Closes the loop between a completed agent chain and the persistent memory system.

Usage

/learn [conversation_id]

conversation_id is optional — when omitted, the active conversation is used. It MUST be a UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

What It Does

  1. Resolves the conversation_id
  2. Locates context.md, the design ## Decisions section, and drains any low-confidence candidates queued in .scaffolding/.ingest-queue
  3. Exits cleanly if there is nothing to distill
  4. Distills the conversation into knowledge candidates
  5. Classifies each candidate: memory entry vs new-skill proposal
  6. Dry-run proposes the changes; applies only on explicit confirmation

Apply the distill skill (Conversation-Scoped Distillation + Skill Promotion Criterion) and the agent-memory skill (Learning Loop) throughout.

Steps

Follow these steps exactly.

1. Resolve the conversation_id

CONV_ID="$1"

if [ -z "$CONV_ID" ]; then
  # Default: most recently modified conversation directory.
  CONV_ID=$(ls -1dt .scaffolding/conversations/*/ 2>/dev/null | head -1 | xargs -r basename)
fi

UUID_RE='^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
if ! echo "$CONV_ID" | grep -qE "$UUID_RE"; then
  echo "ABORT: '$CONV_ID' is not a valid conversation UUID."
  exit 1
fi

echo "Conversation: $CONV_ID"

2. Locate the input files

CONV_DIR=".scaffolding/conversations/$CONV_ID"
CONTEXT_FILE="$CONV_DIR/agent-memory/context.md"
DESIGN_FILE="$CONV_DIR/specs/design.md"

if [ ! -f "$CONTEXT_FILE" ]; then
  echo "Nothing to distill: $CONTEXT_FILE does not exist."
  echo "The /learn command exits cleanly — no conversation memory to process."
  exit 0
fi

echo "Found context: $CONTEXT_FILE"
if [ -f "$DESIGN_FILE" ]; then
  echo "Found design:  $DESIGN_FILE"
else
  echo "No design.md — distilling from context.md only."
fi

# Drain low-confidence candidates queued by the memory-ingest Stop hook.
INGEST_QUEUE=".scaffolding/.ingest-queue"
if [ -s "$INGEST_QUEUE" ]; then
  echo "Found ingest queue: $INGEST_QUEUE ($(wc -l < "$INGEST_QUEUE") lines)"
fi

Read the full file on GitHub · 149 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 149 lines · 0 tokens per session scan A 24c9253d0f6c

Subscribe to this mod's changes

learn is a command published in the GitHub repository komluk/scaffolding (15 stars, last pushed 27d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,331 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.