How peterskoett/self-improving-agent works
1. This repository is an OpenClaw “skill” package for self-improvement. Its purpose is not an application runtime, but a knowledge-capture system that records learnings, errors, and feature requests so future sessions can behave better.
2. The core of the repo is SKILL.md. That file is the main skill definition consumed by OpenClaw. The README explicitly points to it as the primary entrypoint, so the rest of the repository supports authoring, activating, and extending that skill.
3. The assets/ directory is the content store for the skill’s structured memory. It contains separate files for LEARNINGS.md, ERRORS.md, and FEATURE_REQUESTS.md, plus template and guidance files such as SKILL-TEMPLATE.md. These files likely serve as durable, human-editable records and canonical formats for what the skill should capture.
4. The hooks/openclaw/ directory is the runtime integration boundary. It contains handler.js and handler.ts, indicating the hook logic is implemented in TypeScript and/or compiled to JavaScript for OpenClaw’s hook system. HOOK.md documents how that hook behaves and how it should be wired into the platform.
5. The hook layer is probably responsible for observing session events and routing them into the skill’s persistent knowledge files. In architecture terms, this is the “event capture” path: OpenClaw emits events, the hook handler processes them, and the results are written into the asset files or used to update the active skill content.
6. The scripts/ directory contains operational utilities that support the lifecycle of the skill rather than user-facing behavior. activator.sh likely installs or enables the skill, extract-skill.sh likely packages content out of the repository into a usable skill artifact, and error-detector.sh suggests automated detection or classification of failures for logging into ERRORS.md.
7. The references/ directory is documentation and onboarding support. Files like hooks-setup.md, openclaw-integration.md, and examples.md provide the architectural glue between the skill content and the OpenClaw platform, showing how hooks, activation, and example usage fit together.
8. Data flows through the repository in a simple loop: OpenClaw activity is observed by the hook, relevant events are categorized by the scripts or handler logic, and the resulting knowledge is appended to the corresponding assets. That stored knowledge then informs future sessions via SKILL.md and the supporting markdown files.
9. The main boundary in this repo is between static knowledge artifacts and executable integration code. The markdown files define policy, memory, and examples; the hook and shell scripts implement the automation that captures and surfaces that information.
10. Another important boundary is platform integration. Nothing here suggests a standalone server or UI; instead, this repository is designed to be embedded into OpenClaw’s extension/hook mechanism, with the handler and scripts acting as the adapter between platform events and persisted skill state.
11. For an architecture diagram, the central nodes should be: OpenClaw platform, hook handler (hooks/openclaw), skill definition (SKILL.md), structured memory assets (assets/), and operational scripts (scripts/). The references/ folder should be shown as documentation/support rather than runtime logic.
12. In summary, this repo is a self-improvement knowledge pipeline for OpenClaw: observe, classify, store, and reuse. Its architecture is intentionally lightweight, markdown-centric, and hook-driven, with minimal executable code around a core set of persistent skill documents.
Main entry points: SKILL.md SKILL · handler.ts Hook handler · ERRORS.md Errors · LEARNINGS.md Learnings
Components 17
Platform
OpenClaw runtime boundary that emits events into the skill package.
- OpenClaw · Host platform that triggers hooks and consumes the skill package.
Core skill
Primary skill definition and its persistent knowledge store.
- README · Repository overview that points to the main skill definition.
README.md - SKILL · Primary OpenClaw skill entrypoint.
SKILL.md - Learnings · Persistent record of useful learnings.
assets/LEARNINGS.md - Errors · Persistent record of failures and mistakes.
assets/ERRORS.md - Requests · Persistent record of feature requests and ideas.
assets/FEATURE_REQUESTS.md - Template · Canonical markdown template for skill content.
assets/SKILL-TEMPLATE.md
Integration
Hook entrypoint and supporting automation that connect the skill to the platform.
- Hook handler · OpenClaw hook implementation that captures and routes events.
hooks/openclaw/handler.ts - Handler JS · JavaScript variant of the hook entrypoint.
hooks/openclaw/handler.js - Hook guide · Documentation for the hook behavior and wiring.
hooks/openclaw/HOOK.md - Activator · Installs or enables the skill in the platform.
scripts/activator.sh - Extractor · Packages skill content out of the repository.
scripts/extract-skill.sh - Error detector · Identifies failures for capture into error memory.
scripts/error-detector.sh
Docs
Guidance and examples for wiring and using the skill.
- References · Onboarding and integration notes supporting the skill.
- Examples · Example usage and patterns for the skill.
references/examples.md - Setup · Hook setup instructions.
references/hooks-setup.md - Integration · OpenClaw integration guide.
references/openclaw-integration.md
Connections 20
- README → SKILL: points to · README identifies the skill definition as the main entrypoint.
- OpenClaw → Hook handler: emits events to · Platform activity is observed through the hook boundary.
- Hook handler → Learnings: captures learnings · Relevant events are appended to durable learning memory.
- Hook handler → Errors: captures errors · Failures and mistakes are routed into error memory.
- Hook handler → Requests: captures requests · Feature ideas are stored as persistent requests.
- Hook handler → SKILL: updates skill · Hook results inform the active skill content.
- Activator → SKILL: activates · Operational script enables the skill artifact.
- Extractor → SKILL: packages · Script extracts skill content for reuse or distribution.
- Error detector → Errors: feeds · Automated detection produces error records.
- SKILL → Template: uses template · Skill structure is guided by the canonical template.
- Hook guide → Hook handler: documents · Hook documentation explains the runtime adapter.
- References → Setup: includes · References section collects setup guidance.
- References → Integration: includes · References section collects platform integration guidance.
- References → Examples: includes · References section collects example usage.
- Setup → Hook handler: supports · Setup guidance helps wire the hook into OpenClaw.
- Integration → OpenClaw: explains · Integration guide describes the platform boundary.
- Examples → SKILL: illustrates · Examples show how the skill should be used.
- Learnings → SKILL: informs future sessions · Captured learning feeds back into later behavior.
- Errors → SKILL: prevents repeats · Error history helps avoid recurring mistakes.
- Requests → SKILL: guides extensions · Requested improvements shape future skill evolution.