Get the FREE Ultimate OpenClaw Setup Guide →

failure-log-manager

Scanned
npx machina-cli add skill smicolon/ai-kit/failure-log-manager --openclaw
Files (1)
SKILL.md
4.0 KB

Failure Log Manager

Manages the persistent failure log at .claude/failure-log.local.md to prevent repeating mistakes across sessions.

Activation Triggers

This skill activates when:

  • User asks to log a mistake or failure
  • A pattern violation or error is detected
  • User wants to review known mistakes
  • Adding, viewing, or managing failure entries

File Location

.claude/failure-log.local.md

This file is project-specific and should be in .gitignore.

File Format

---
enabled: true
last_updated: 2026-01-01T10:30:00Z
---

# Failure Log

## Pattern Mistakes

### [YYYY-MM-DD] Brief title
**Context:** What was being done
**Mistake:** What went wrong
**Correct:** What should be done instead
**Category:** imports|security|testing|architecture|conventions

## Failed Approaches

### [YYYY-MM-DD] Brief title
**Context:** What was being attempted
**What failed:** Why the approach didn't work
**Better approach:** What works instead
**Category:** imports|security|testing|architecture|conventions

Categories

CategoryDescriptionExamples
importsWrong import patternsRelative imports, missing aliases
securityMissing security checksNo permission classes, exposed secrets
testingWrong test approachesunittest vs pytest, missing fixtures
architectureStructural mistakesWrong file locations, missing layers
conventionsCode style violationsNaming, formatting, patterns

Adding Failures

Pattern Mistake Entry

For recurring pattern violations:

### [2026-01-01] Wrong import pattern in Django
**Context:** Writing user service
**Mistake:** Used `from users.models import User` instead of alias pattern
**Correct:** Use `import users.models as _users_models`
**Category:** imports

Failed Approach Entry

For approaches that don't work:

### [2026-01-01] Tried unittest instead of pytest
**Context:** Writing tests for user service
**What failed:** unittest assertions don't integrate with Django fixtures
**Better approach:** Use pytest with factory_boy for test data
**Category:** testing

Reading Failures

To check the failure log:

  1. Read .claude/failure-log.local.md
  2. Parse entries under each section
  3. Use category to filter relevant failures
  4. Apply lessons to current task

Creating Initial Log

If no failure log exists, create with template:

---
enabled: true
last_updated: CURRENT_ISO_TIMESTAMP
---

# Failure Log

This log tracks mistakes to prevent repeating them across sessions.

## Pattern Mistakes

_No pattern mistakes logged yet._

## Failed Approaches

_No failed approaches logged yet._

Updating Log

When adding a new failure:

  1. Read existing file
  2. Update last_updated in frontmatter
  3. Add new entry under appropriate section (Pattern Mistakes or Failed Approaches)
  4. Maintain chronological order (newest first)
  5. Write updated file

Best Practices

What to Log

Log failures that are:

  • Likely to recur (pattern-based mistakes)
  • Non-obvious (not caught by linting)
  • Project-specific (conventions unique to codebase)
  • Costly to repeat (security, architecture)

What NOT to Log

Skip failures that are:

  • One-time typos
  • Already caught by linting/tests
  • Generic programming errors
  • Not actionable

Entry Quality

Each entry must have:

  • Clear date for context
  • Specific mistake description
  • Actionable correct approach
  • Appropriate category

Integration with Hooks

The UserPromptSubmit hook automatically injects a condensed summary of failures into context. The summary includes:

  • Total failure count
  • One-line summary per failure
  • Reference to full log file

This ensures failures are always visible without overwhelming context.

Source

git clone https://github.com/smicolon/ai-kit/blob/main/packs/failure-log/skills/failure-log-manager/SKILL.mdView on GitHub

Overview

Failure Log Manager stores mistakes in a persistent log at .claude/failure-log.local.md to prevent repeating them across sessions. It activates when you log a failure, review known mistakes, or manage entries, keeping lessons centralized and actionable.

How This Skill Works

It uses a Markdown file with a frontmatter block and two sections: Pattern Mistakes and Failed Approaches. When you add a new entry, it updates last_updated and prepends the newest item to the appropriate section, maintaining a newest-first chronology and enabling cross-session learning via the .claude log.

When to Use It

  • You ask to log a failure or remember a mistake.
  • A pattern violation or error is detected and should be recorded.
  • You want to review known mistakes before starting work.
  • You are adding, viewing, or managing failure entries.
  • You are preparing to refactor or audit code to avoid repeating issues.

Quick Start

  1. Step 1: Trigger activation by saying you want to log a failure or a mistake is detected.
  2. Step 2: Add a new entry to .claude/failure-log.local.md with date, context, mistake, and correction; update last_updated.
  3. Step 3: Read the log to apply lessons before starting new work; use category filters to focus.

Best Practices

  • Log only pattern-based, repeatable mistakes with clear context.
  • Include date, a concise description, and an actionable correction; assign a category.
  • Keep entries in the appropriate section (Pattern Mistakes or Failed Approaches).
  • Update last_updated on every addition and maintain newest-first order.
  • Keep the log file at .claude/failure-log.local.md and ensure it is gitignored to avoid leaks.

Example Use Cases

  • 2026-01-01: Wrong import pattern in Django — use alias pattern (imports).
  • 2026-01-02: Missing permission checks leading to security exposure (security).
  • 2026-01-05: Unreliable unittest in Django tests — switch to pytest with fixtures (testing).
  • 2026-01-07: Architecture: incorrect file location causing module import failures (architecture).
  • 2026-01-10: Naming convention violation in API handlers (conventions).

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers