✓ Verified 💻 Development ✓ Enhanced Data

Correction Memory

Makes agent corrections persistent and reusable.

Rating
4.2 (389 reviews)
Downloads
1,148 downloads
Version
1.0.0

Overview

Makes agent corrections persistent and reusable.

Key Features

1

— Install correction-tracker

2

— Wire agent-context-loader (if using intent-engineering)

Complete Documentation

View Source →

Correction Memory

The Problem

When you correct an agent, that correction evaporates after the session. Next time you spawn the same agent type, it makes the same mistake. There's no memory of what you've already taught it.

What This Skill Installs

  • lib/correction-tracker.js — logs corrections per agent type to memory/corrections/[AgentType].jsonl
  • Hook into agent-context-loader.js — correction preamble prepended to spawns automatically (if intent-engineering is also installed)

Installation

Step 1 — Install correction-tracker

bash
cp references/correction-tracker-template.js $OPENCLAW_WORKSPACE/lib/correction-tracker.js

Verify it runs:

bash
node $OPENCLAW_WORKSPACE/lib/correction-tracker.js

Step 2 — Wire agent-context-loader (if using intent-engineering)

If lib/agent-context-loader.js is installed (from intent-engineering skill), correction injection is automatic — no wiring needed. The loader checks for correction-tracker.js at startup and loads it if present.

If you are NOT using intent-engineering, add this to your spawn logic manually:

javascript
const { buildCorrectionPreamble } = require('./lib/correction-tracker');

const agentType   = 'CoderAgent'; // or whatever agent you're spawning
const corrections = buildCorrectionPreamble(agentType, workspaceRoot);
const fullTask    = corrections ? corrections + '\n\n---\n\n' + originalTask : originalTask;

Logging Corrections

Programmatic

javascript
const { logCorrection } = require('./lib/correction-tracker');

logCorrection(
  'CoderAgent',                                    // agent type
  'Used ESM import instead of require()',          // what was wrong
  'Always use require() for Node.js stdlib modules', // correct behavior
  workspaceRoot,
  { session_channel: 'discord' }                  // optional metadata
);

Via main agent (natural language)

Just tell the main agent:

"Note that [AgentType]: [what it did wrong] — [correct behavior]"

The main agent will log it programmatically.

How Corrections Are Replayed

On every subagent spawn, agent-context-loader detects the agent type from the task description and prepends:

text
## Corrections from Previous Sessions

The following corrections were logged for CoderAgent. Apply these behaviors:

1. **[2026-03-01] Issue:** Used ESM import instead of require()
   **Correction:** Always use require() for Node.js stdlib modules

Only corrections from the last 30 days are injected. Older corrections expire automatically — stale rules don't accumulate.

Viewing Corrections

bash
# All corrections for an agent type
cat $OPENCLAW_WORKSPACE/memory/corrections/CoderAgent.jsonl | jq .

# List all agent types with corrections
ls $OPENCLAW_WORKSPACE/memory/corrections/

# Count corrections per agent
for f in $OPENCLAW_WORKSPACE/memory/corrections/*.jsonl; do
  echo "$(basename $f .jsonl): $(wc -l < $f) corrections"
done

Agent Type Detection

The loader auto-detects agent type from the task description. Default rules:

Task keywordsAgent type
code, coder, impl, debugCoderAgent
writ, author, novel, chapterAuthorAgent
world, buildWorldbuilderAgent
(anything else)general
To add custom agent types, edit detectAgentType() in agent-context-loader.js.

References

  • references/correction-tracker-template.js — Full implementation of correction-tracker.js

Installation

Terminal bash

openclaw install correction-memory
    
Copied!

💻Code Examples

node $OPENCLAW_WORKSPACE/lib/correction-tracker.js

node-openclawworkspacelibcorrection-trackerjs.txt
### Step 2 — Wire agent-context-loader (if using intent-engineering)

If `lib/agent-context-loader.js` is installed (from intent-engineering skill), correction injection is **automatic** — no wiring needed. The loader checks for `correction-tracker.js` at startup and loads it if present.

If you are NOT using intent-engineering, add this to your spawn logic manually:

const fullTask = corrections ? corrections + '\n\n---\n\n' + originalTask : originalTask;

const-fulltask--corrections--corrections--nn---nn--originaltask--originaltask.txt
## Logging Corrections

### Programmatic

);

.txt
### Via main agent (natural language)

Just tell the main agent:

> "Note that [AgentType]: [what it did wrong] — [correct behavior]"

The main agent will log it programmatically.

## How Corrections Are Replayed

On every subagent spawn, `agent-context-loader` detects the agent type from the task description and prepends:

**Correction:** Always use require() for Node.js stdlib modules

-correction-always-use-require-for-nodejs-stdlib-modules.txt
Only corrections from the **last 30 days** are injected. Older corrections expire automatically — stale rules don't accumulate.

## Viewing Corrections
example.js
const { buildCorrectionPreamble } = require('./lib/correction-tracker');

const agentType   = 'CoderAgent'; // or whatever agent you're spawning
const corrections = buildCorrectionPreamble(agentType, workspaceRoot);
const fullTask    = corrections ? corrections + '\n\n---\n\n' + originalTask : originalTask;
example.js
const { logCorrection } = require('./lib/correction-tracker');

logCorrection(
  'CoderAgent',                                    // agent type
  'Used ESM import instead of require()',          // what was wrong
  'Always use require() for Node.js stdlib modules', // correct behavior
  workspaceRoot,
  { session_channel: 'discord' }                  // optional metadata
);
example.txt
## Corrections from Previous Sessions

The following corrections were logged for CoderAgent. Apply these behaviors:

1. **[2026-03-01] Issue:** Used ESM import instead of require()
   **Correction:** Always use require() for Node.js stdlib modules
example.sh
# All corrections for an agent type
cat $OPENCLAW_WORKSPACE/memory/corrections/CoderAgent.jsonl | jq .

# List all agent types with corrections
ls $OPENCLAW_WORKSPACE/memory/corrections/

# Count corrections per agent
for f in $OPENCLAW_WORKSPACE/memory/corrections/*.jsonl; do
  echo "$(basename $f .jsonl): $(wc -l < $f) corrections"
done

Tags

#web_and-frontend-development

Quick Info

Category Development
Model Claude 3.5
Complexity Multi-Agent
Author donovanpankratz-del
Last Updated 3/10/2026
🚀
Optimized for
Claude 3.5
🧠

Ready to Install?

Get started with this skill in seconds

openclaw install correction-memory