gptme-lessons-extras

v0.1.0 Add your description here packages/gptme-lessons-extras View on GitHub

Lessons Package

Lesson validation, analysis, and management system for persistent learning patterns.

Overview

This package provides tools for managing the lessons system - a meta-learning framework that captures behavioral patterns, prevents known failures, and improves agent reliability over time.

Features

Installation

# From workspace root
uv sync --all-packages

# Or install just this package
cd packages/lessons
uv sync

Dependencies

Usage

Validation

from lessons.validate import validate_lesson_file

# Validate single lesson
errors = validate_lesson_file("path/to/lesson.md")
if errors:
    print(f"Validation errors: {errors}")

CLI Tools

# Validate lessons
./validate.py lessons/workflow/example.md

# Analyze lesson usage
./analytics.py

# Generate new lesson
./generate.py --pattern "error pattern"

# Review lessons
./review.py

Lesson Format

Lessons use YAML frontmatter + Markdown:

---
match:
  keywords: ["keyword1", "keyword2"]
status: active
---

# Lesson Title

## Rule
One-sentence imperative: what to do or avoid.

## Context
When this applies.

## Detection
Observable signals.

## Pattern
Correct approach with example.

## Outcome
What happens when you follow this pattern.

## Related
- Related lessons

Testing

# Run all tests
make test

# Type check
make typecheck

Architecture

Core Modules

Validation Rules

The validator checks:

Integration

Pre-commit Hooks

Lessons are validated automatically:

- id: validate-lessons
  name: Validate lesson files
  entry: ./scripts/lessons/validate.py
  language: system
  files: ^lessons/.*\.md$

gptme Integration

Lessons are automatically included in gptme context when relevant keywords match.

Related Documentation

Development

Adding New Tools

  1. Create tool script in src/lessons/
  2. Use click for CLI interface
  3. Follow existing patterns for validation/analysis
  4. Add tests
  5. Document in this README