# pskoett/self-improving-agent architecture

> Architecture diagram of the GitHub repository pskoett/self-improving-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pskoett/self-improving-agent
- Repository: https://github.com/pskoett/self-improving-agent

## Overview

This OpenClaw-only skill helps an agent record learnings, errors, and feature requests across sessions. Its main runtime path is OpenClaw hook events: bootstrap adds a reminder, while new/reset commands can scan the prior transcript and append redacted, pending errors for later triage. The skill instructions and learning templates provide the broader capture and promotion practices. The README identifies the skill entry point and hook; handler excerpts support the event and error-sweep flow. Other skill-document relationships are not shown in the supplied excerpts.

Main entry points: [`self-improving-agent/hooks/openclaw/handler.js`](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/hooks/openclaw/handler.js) (Hook runtime), [`self-improving-agent/hooks/openclaw/handler.ts`](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/hooks/openclaw/handler.ts) (Hook TypeScript), [`self-improving-agent/assets/ERRORS.md`](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/ERRORS.md) (Errors log)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guidance["Skill guidance"]
  node_skill["Skill instructions<br/>[SKILL.md]"]
end

subgraph group_hook["OpenClaw hook"]
  node_handler_js["Hook runtime<br/>[handler.js]"]
  node_handler_ts["Hook TypeScript<br/>[handler.ts]"]
  node_transcript["Session transcript"]
end

subgraph group_learning["Learning records"]
  node_templates["Learning templates"]
  node_learnings["Learnings log<br/>[LEARNINGS.md]"]
  node_errors["Errors log<br/>[ERRORS.md]"]
  node_features["Feature requests"]
end

node_openclaw(("OpenClaw"))

node_openclaw -->|"dispatches events"| node_handler_js
node_handler_js -->|"scans transcript"| node_transcript
node_handler_js -->|"appends pending errors"| node_errors
node_handler_js -->|"counts pending entries"| node_errors
node_handler_js -->|"injects reminder"| node_openclaw
node_openclaw -->|"dispatches events"| node_handler_ts
node_handler_ts -->|"scans transcript"| node_transcript
node_handler_ts -->|"appends pending errors"| node_errors
node_handler_ts -->|"counts pending entries"| node_errors
node_handler_ts -->|"injects reminder"| node_openclaw

click node_skill "https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/SKILL.md"
click node_templates "https://github.com/pskoett/self-improving-agent/tree/master/self-improving-agent/assets"
click node_learnings "https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/LEARNINGS.md"
click node_errors "https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/ERRORS.md"
click node_features "https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/FEATURE_REQUESTS.md"
click node_handler_js "https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/hooks/openclaw/handler.js"
click node_handler_ts "https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/hooks/openclaw/handler.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_skill toneBlue
class node_handler_js,node_handler_ts,node_transcript toneAmber
class node_templates,node_learnings,node_errors,node_features toneMint
class node_openclaw toneIndigo
```

## Components

### Skill guidance

- [Skill instructions](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/SKILL.md): `self-improving-agent/SKILL.md`

### OpenClaw hook

- [Hook runtime](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/hooks/openclaw/handler.js): `self-improving-agent/hooks/openclaw/handler.js`
- [Hook TypeScript](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/hooks/openclaw/handler.ts): `self-improving-agent/hooks/openclaw/handler.ts`
- **Session transcript**

### Learning records

- [Learning templates](https://github.com/pskoett/self-improving-agent/tree/master/self-improving-agent/assets): `self-improving-agent/assets`
- [Learnings log](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/LEARNINGS.md): `self-improving-agent/assets/LEARNINGS.md`
- [Errors log](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/ERRORS.md): `self-improving-agent/assets/ERRORS.md`
- [Feature requests](https://github.com/pskoett/self-improving-agent/blob/master/self-improving-agent/assets/FEATURE_REQUESTS.md): `self-improving-agent/assets/FEATURE_REQUESTS.md`

### Other components

- **OpenClaw**

## Connections

- OpenClaw → Hook runtime: dispatches events (evidence: `README.md`)
- Hook runtime → Session transcript: scans transcript (evidence: `self-improving-agent/hooks/openclaw/handler.js`)
- Hook runtime → Errors log: appends pending errors (evidence: `self-improving-agent/hooks/openclaw/handler.js`)
- Hook runtime → Errors log: counts pending entries (evidence: `self-improving-agent/hooks/openclaw/handler.js`)
- Hook runtime → OpenClaw: injects reminder (evidence: `self-improving-agent/hooks/openclaw/handler.js`)
- OpenClaw → Hook TypeScript: dispatches events (evidence: `self-improving-agent/hooks/openclaw/handler.ts`)
- Hook TypeScript → Session transcript: scans transcript (evidence: `self-improving-agent/hooks/openclaw/handler.ts`)
- Hook TypeScript → Errors log: appends pending errors (evidence: `self-improving-agent/hooks/openclaw/handler.ts`)
- Hook TypeScript → Errors log: counts pending entries (evidence: `self-improving-agent/hooks/openclaw/handler.ts`)
- Hook TypeScript → OpenClaw: injects reminder (evidence: `self-improving-agent/hooks/openclaw/handler.ts`)
