VibeGuard: Learn

VibeGuard: Learn is a command for Claude Code from majiayu000/vibeguard. It costs 31 tokens per session (3,651 once invoked), scanned A, original, MIT.

A learning tool that turns an agent's mistakes into prevention rules and turns useful discoveries into reusable skills. It chooses between these two types of learning based on the situation or the user's request.

In plain words
What is it for?
Use it to analyse errors, create guards or hooks for problems such as duplicate files or hard-coded settings, and extract discoveries into reusable SKILL.md files.
Why use it?
It helps prevent the same coding mistakes from recurring and preserves solutions that might otherwise be forgotten after a session. It can also run automatically when a session stops.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; names the AskUserQuestion tool.

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

Made for: Claude Code.

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 VibeGuard: Learn

README.md
[![agentmods](https://agentmods.dev/badge/commands/majiayu000/vibeguard/learn.svg)](https://agentmods.dev/commands/majiayu000/vibeguard/learn)
Your own site
<a href="https://agentmods.dev/commands/majiayu000/vibeguard/learn"><img src="https://agentmods.dev/badge/commands/majiayu000/vibeguard/learn.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,651 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.00031 $0.03651
Opus 5 $0.00015 $0.01826
Sonnet 5 $0.00006 $0.00730
Haiku 4.5 $0.00003 $0.00365

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

Security

Grade A, and why

VibeGuard: 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 6d 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.

.claude/commands/vibeguard/learn.md · 376 lines

How it starts

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

Core Concept

  • Agent's mistakes are not the end, but a signal to improve the defense system.
  • When the Agent discovers non-obvious solutions, it should be extracted into reusable knowledge
  • Goal: Mistakes will no longer be repeated + Experience will no longer be forgotten

Pattern routing

Automatically select a mode based on parameters and context:

input mode
User describes error/bug/guard failure Mode A: error analysis → output guard/hook/rule
User said "extract" / "Extract experience" / "What was learned" Mode B: Experience extraction → Output SKILL.md
Stop hook automatically triggered (no parameters) Evaluate first → select A or B as needed
Session with both bug fixes and non-obvious findings A + B both executed

Mode A: Error analysis (defense-oriented)

Learn from mistakes and generate guard rules or hooks to prevent similar mistakes from happening again.

Trigger scene

  • Agent created duplicate files/types (L1 failed)
  • Agent hard-coded path/port/URL (L4 failure)
  • Agent introduces data splitting (multiple entries are inconsistent)
  • Agent is unnecessarily over-designed (L5 failure)
  • The guard script has false positives or false negatives
  • Any recurring Agent error patterns

Guardrails

  • No direct fixes to the business code — only improvements to VibeGuard itself
  • New rules must be verifiable (can write scripts to detect or test assertions)
  • Don’t overgeneralize — one error pattern corresponds to one precise rule

Steps

  1. Automatic pattern recognition (extracted from events.jsonl + learn-digest.jsonl)
    • Read ~/.vibeguard/projects/<hash>/events.jsonl and analyze recent event records
    • Read ~/.vibeguard/learn-digest.jsonl to obtain the cross-session signals recognized by GC regular learning (repeated_warn / chronic_block / hot_files / slow_sessions / warn_escalation)
    • For a bounded current-project preview, resolve the VibeGuard checkout before running the analyzer:
      VIBEGUARD_REPO_DIR="${VIBEGUARD_REPO_DIR:-$(cat "$HOME/.vibeguard/repo-path" 2>/dev/null)}"
      test -f "$VIBEGUARD_REPO_DIR/scripts/gc/learn_digest.py" || { echo "VibeGuard repo path missing; rerun setup.sh from a VibeGuard checkout" >&2; exit 1; }
      python3 "$VIBEGUARD_REPO_DIR/scripts/gc/learn_digest.py" --scope current --project-root "$PWD" --dry-run --format json --no-code-scan
      
    • Preview mode reads only the resolved current project log directory and does not append learn-digest.jsonl or update .learn-watermark
    • Extract high-frequency warn patterns: similar problems that have been warned many times but still reoccur
    • Extract similar operations that are repeatedly blocked: identify the operation patterns in which the agent repeatedly hits the wall
    • Group by hook + reason to output top 5 high-frequency problems
    • Use recognized patterns as input for subsequent analysis (no longer relying solely on user descriptions)

Read the full file on GitHub · 376 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. 6d ago First seen · 376 lines · 31 tokens per session scan A c58b3f272376

Subscribe to this mod's changes

VibeGuard: Learn is a command published in the GitHub repository majiayu000/vibeguard (41 stars, last pushed yesterday), licensed MIT. It adds 31 tokens to every session and 3,651 once invoked, about $0.0002 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.