lavra-learn

lavra-learn is a command for coding agents from roberto-mello/lavra. It costs 22 tokens per session (1,767 once invoked), scanned A, original, MIT.

A command that turns raw work comments into organized, tagged knowledge entries for later automatic recall. It can process one or more completed Beads tasks, where Beads are tracked units of work.

In plain words
What is it for?
Use it after work sessions to curate comments from completed tasks, add accurate titles and tags, and identify related patterns.
Why use it?
It removes terse, scattered notes and duplicate entries from the project’s knowledge store.

Command

Part of the lavra plugin — 23 skills, 18 commands, 1 hook, 1 MCP server shipped together

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/roberto-mello/lavra/lavra-learn
Clone the repo
git clone --depth 1 https://github.com/roberto-mello/lavra

Or install lavra, the plugin that ships this one along with the rest of its 23 skills, 18 commands, 1 hook, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lavra-learn

README.md
[![agentmods](https://agentmods.dev/badge/commands/roberto-mello/lavra/lavra-learn.svg)](https://agentmods.dev/commands/roberto-mello/lavra/lavra-learn)
Your own site
<a href="https://agentmods.dev/commands/roberto-mello/lavra/lavra-learn"><img src="https://agentmods.dev/badge/commands/roberto-mello/lavra/lavra-learn.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 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,767 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.1 $0.00022 $0.01767
Opus 5 $0.00011 $0.00883
Sonnet 5 $0.00004 $0.00353
Haiku 4.5 $0.00002 $0.00177

Measured 5d ago against content hash 6ed277445bc2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

lavra-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 5d 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.

plugins/lavra/commands/lavra-learn.md · 192 lines

How it starts

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

<project_root>

All .lavra/ paths are relative to the project root. If you cd into a subdirectory during work, resolve the project root first:

PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")

Then prefix all .lavra/ paths with "$PROJECT_ROOT/" when invoking them via Bash.

</project_root>

Knowledge flow:

Work session -> inline bd comments (raw) -> /lavra-learn (structured) -> auto-recall (future sessions)

Raw comments logged during work are often terse, context-dependent, and untagged beyond auto-detection. This command reviews them with full context, produces well-titled entries with accurate tags, deduplicates against existing knowledge, and synthesizes higher-level patterns where entries connect.

This command improves capture quality. It does not perform shared-memory history cleanup or rewrite older entries in knowledge.jsonl. Any future shared curation workflow is separate and review-gated.

Usage:

/lavra-learn                       # Process all beads closed today
/lavra-learn BD-042                # Process specific bead
/lavra-learn BD-042 BD-043 BD-044  # Process multiple beads

Step 1: Gather Raw Entries

Collect all knowledge comments from the target beads.

If bead IDs provided:

bd show {BEAD_ID} --json
# Extract comments matching LEARNED:|DECISION:|FACT:|PATTERN:|INVESTIGATION: prefixes

If no bead IDs, find beads closed today:

bd list --status=closed --json | jq '[.[] | select(.updated_at >= "'$(date +%Y-%m-%d)'")]'

For each bead, collect:

  • All comments with knowledge prefixes
  • Bead title and description (for context)
  • Related bead IDs from dependencies

If no knowledge comments are found in the target beads, report that and exit.

Read the full file on GitHub · 192 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. 5d ago First seen · 192 lines · 22 tokens per session scan A 6ed277445bc2

Subscribe to this mod's changes

lavra-learn is a command published in the GitHub repository roberto-mello/lavra (50 stars, last pushed 2mo ago), licensed MIT. It adds 22 tokens to every session and 1,767 once invoked, about $0.0001 per session on Opus 5. 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.