roberto-mello/lavra/lavra-knowledge
Claude Code and agent skill by roberto-mello/lavra
- community
Checking that the SKILL.md file is still in the repository.
Capture solved problems as knowledge entries for fast recall. Use when a solution should be preserved for future sessions.
Install
npx vskill@latest install roberto-mello/lavra/lavra-knowledgeSKILL.md
lavra-knowledge Skill
Purpose: Capture solved problems as structured JSONL entries in .lavra/memory/knowledge.jsonl and as bead comments, building a searchable knowledge base that auto-recall injects into future sessions.
Overview
Captures problem solutions immediately after confirmation, creating structured knowledge entries stored in .lavra/memory/knowledge.jsonl for auto-recall search and logged as bead comments for traceability. Uses the five knowledge prefixes: LEARNED, DECISION, FACT, PATTERN, INVESTIGATION.
Organization: Append-only JSONL file. Each solved problem produces one or more entries. The auto-recall hook (auto-recall.sh) searches by keyword and injects relevant entries at session start.
<project_root>
All .lavra/ paths are relative to the project root. If you cd into a subdirectory during work, resolve the project root first:
Then prefix all .lavra/ paths with "$PROJECT_ROOT/" when invoking them via Bash.
</project_root>
<critical_sequence name="knowledge-capture" enforce_order="strict">
7-Step Process
<step number="1" required="true">
Step 1: Detect Confirmation
Auto-invoke after phrases:
- "that worked"
- "it's fixed"
- "working now"
- "problem solved"
- "that did it"
OR manual invocation.
Non-trivial problems only: multiple investigation attempts, tricky debugging, non-obvious solution, or future sessions would benefit.
Skip for: simple typos, obvious syntax errors, trivial fixes. </step>
<step number="2" required="true" depends_on="1">
Step 2: Gather Context
Extract from conversation history:
Required:
- Area/module: Which part of the codebase had the problem
- Symptom: Observable error/behavior (exact error messages)
- Investigation attempts: What didn't work and why
- Root cause: Technical explanation of actual problem
- Solution: What fixed it (code/config changes)
- Prevention: How to avoid in future
BLOCKING REQUIREMENT: If critical context is missing (area, exact error, or resolution steps), ask and WAIT before proceeding to Step 3:
</step>
<step number="3" required="false" depends_on="2">
Step 3: Check Existing Knowledge
Search knowledge.jsonl for similar issues:
IF similar knowledge found:
Present decision options:
WAIT for user response.
ELSE (no similar knowledge found):
Proceed directly to Step 4. </step>
<step number="4" required="true" depends_on="2">
Step 4: Determine Knowledge Type
Classify the solution into one or more knowledge prefixes:
| Prefix | Use When | Example | |
|---|---|---|---|
| LEARNED | Discovered something non-obvious through debugging | "LEARNED: OAuth redirect URI must match exactly including trailing slash" | |
| DECISION | Made an architectural or implementation choice | "DECISION: Use connection pooling instead of per-request connections because..." | |
| FACT | Confirmed a factual constraint or requirement | "FACT: PostgreSQL JSONB columns require explicit casting for array operations" | |
| PATTERN | Identified a recurring pattern (good or bad) | "PATTERN: Always check for nil before accessing nested hash keys in API responses" | |
| INVESTIGATION | Documented an investigation path for future reference | "INVESTIGATION: Debugged memory leak - profiler showed retained objects from..." |
Most solved problems produce 1-3 entries. A complex debugging session might produce 1 LEARNED (key insight), 1 PATTERN (prevention rule), 1 INVESTIGATION (debugging path for future reference). </step>
<step number="5" required="true" depends_on="4" blocking="true">
Step 5: Validate JSONL Entry
CRITICAL: All knowledge entries must conform to the JSONL schema.
<validation_gate name="jsonl-schema" blocking="true">
Required fields for each entry:
Validation rules:
- key: Must be lowercase, hyphen-separated, unique, descriptive (e.g.,
learned-oauth-redirect-must-match-exactly) - type: Must be one of:
learned,decision,fact,pattern,investigation - content: Must be specific and searchable (no vague descriptions)
- source: Must be
user,agent, orsubagent - tags: Array of lowercase keywords for search (auto-detected from content where possible)
- ts: Unix timestamp (current time)
- bead: Bead ID if working on a specific bead, or empty string if none
Auto-tagging: Extract keywords from content matching known domains:
- auth, oauth, jwt, session -> "auth"
- database, postgres, sql, migration -> "database"
- react, component, hook, state -> "react"
- api, endpoint, request, response -> "api"
- test, spec, fixture, mock -> "testing"
- performance, memory, cache, query -> "performance"
- deploy, ci, docker, build -> "devops"
- config, env, settings -> "config"
BLOCK if validation fails:
GATE ENFORCEMENT: Do not proceed to Step 6 until all entries pass validation.
</validation_gate> </step>
<step number="6" required="true" depends_on="5">
Step 6: Write Knowledge Entries
Append entries to `knowledge.jsonl`:
Log as bead comments (if bead ID available):
For each entry, log a bead comment using the appropriate prefix:
Rotation: If knowledge.jsonl exceeds 1000 lines after appending, move first 500 lines to knowledge.archive.jsonl and keep remaining lines as new knowledge.jsonl.
</step>
<step number="7" required="false" depends_on="6">
Step 7: Cross-Reference & Pattern Detection
If similar knowledge found in Step 3:
Add cross-reference tag: include the key of the related entry in the tags array (e.g., "tags": ["auth", "see-also:learned-oauth-token-expiry"]).
Detect recurring patterns: if 3+ entries share the same tags or describe similar issues, suggest creating a PATTERN entry that synthesizes the recurring theme:
</step>
</critical_sequence>
<decision_gate name="post-capture" wait_for_user="true">
Decision Menu After Capture
After successful capture, present options and WAIT for user response:
Handle responses:
Option 1: Return to calling skill/workflow. Capture is complete.
Option 2: Display the JSONL entries written. Present menu again.
Option 3: Run recall search with the new entry tags. Display related knowledge. Present menu again.
Option 4: Return to Step 4 to classify additional knowledge. Useful when the solution reveals multiple insights.
Option 5: Ask what they'd like to do.
</decision_gate>
<integration_protocol>
Integration Points
Invoked by: manual invocation after solution confirmed, confirmation phrases ("that worked", "it's fixed"), or called from /lavra-work and /lavra-review workflows.
Works with:
auto-recall.sh— readsknowledge.jsonlat session startmemory-capture.sh— captures knowledge frombd comments addcommandsrecall.sh— manual search
Data flow:
- Writes structured entries to
.lavra/memory/knowledge.jsonl - Logs comments via
bd comments add(triggersmemory-capture.sh) - At next session start,
auto-recall.shsearches and injects relevant entries
</integration_protocol>
<success_criteria>
Success Criteria
Capture is successful when ALL of the following are true:
- All JSONL entries have valid schema (required fields, correct types)
- Entries appended to
.lavra/memory/knowledge.jsonl - Bead comments logged via
bd comments add(if bead ID available) - Content is specific and searchable
- Tags are appropriate for future recall
- User presented with decision menu and action confirmed
</success_criteria>
Error Handling
Missing context: ask for missing details. Do not proceed until critical info is provided.
JSONL validation failure: show specific errors, present retry with corrected values. BLOCK until valid.
Missing bead ID: knowledge can still be captured to knowledge.jsonl. Skip bd comments add. Warn: "No active bead - knowledge saved to JSONL only, not linked to a bead."
`knowledge.jsonl` doesn't exist: create it with touch .lavra/memory/knowledge.jsonl and continue.
Execution Guidelines
MUST do:
- Validate JSONL entries (BLOCK if invalid per Step 5 gate)
- Extract exact error messages from conversation
- Include specific, searchable content
- Use
bd comments addwith knowledge prefixes when bead ID is available - Auto-tag based on content keywords
MUST NOT do:
- Skip JSONL validation
- Use vague descriptions
- Create markdown files in
docs/solutions/(this is not compound-docs) - Write entries with missing required fields
Quality Guidelines
Good entries have: specific, searchable content (exact error messages, specific techniques); appropriate type classification; relevant tags; clear cause-and-effect; prevention guidance where applicable.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/lavra/skills/lavra-knowledge/SKILL.md
Popularity
- Repository stars
- 47
- Repository forks
- 2
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/roberto-mello/lavra/lavra-knowledge)