返回顶部
c

correction-memory修正记忆

Makes agent corrections persistent and reusable. When you override, reject, or correct an agent's output, this skill logs the correction and automatically injects it into future spawns of the same agent type. Solves "agent keeps making the same mistake across sessions." Installs correction-tracker lib + injection hook into agent-context-loader. Works standalone or alongside intent-engineering skill.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
439
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

correction-memory

修正记忆

问题

当你纠正一个代理时,该修正会在会话结束后消失。下次你生成同一类型的代理时,它会犯同样的错误。你教过它的内容没有任何记忆。

此技能安装的内容

  • - lib/correction-tracker.js — 按代理类型将修正记录到 memory/corrections/[AgentType].jsonl
  • agent-context-loader.js 的钩子 — 自动在生成时添加修正前言(如果同时安装了意图工程)

安装

步骤 1 — 安装修正追踪器

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

验证其运行:

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

步骤 2 — 连接 agent-context-loader(如果使用意图工程)

如果已安装 lib/agent-context-loader.js(来自意图工程技能),修正注入是自动的——无需连接。加载器在启动时检查 correction-tracker.js,如果存在则加载。

如果你没有使用意图工程,请手动将其添加到你的生成逻辑中:

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

const agentType = CoderAgent; // 或你正在生成的任何代理
const corrections = buildCorrectionPreamble(agentType, workspaceRoot);
const fullTask = corrections ? corrections + \n\n---\n\n + originalTask : originalTask;

记录修正

编程方式

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

logCorrection(
CoderAgent, // 代理类型
使用了 ESM import 而不是 require(), // 错误行为
始终对 Node.js 标准库模块使用 require(), // 正确行为
workspaceRoot,
{ session_channel: discord } // 可选元数据
);

通过主代理(自然语言)

只需告诉主代理:

注意 [AgentType]: [它做错了什么] — [正确行为]

主代理将以编程方式记录它。

修正如何重放

在每次子代理生成时,agent-context-loader 从任务描述中检测代理类型,并添加前言:

来自之前会话的修正

以下修正已为 CoderAgent 记录。请应用这些行为:

  1. 1. [2026-03-01] 问题: 使用了 ESM import 而不是 require()
修正: 始终对 Node.js 标准库模块使用 require()

仅注入最近 30 天内的修正。较旧的修正会自动过期——过时的规则不会累积。

查看修正

bash

查看某个代理类型的所有修正


cat $OPENCLAW_WORKSPACE/memory/corrections/CoderAgent.jsonl | jq .

列出所有有修正的代理类型

ls $OPENCLAW_WORKSPACE/memory/corrections/

统计每个代理的修正数量

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

代理类型检测

加载器从任务描述中自动检测代理类型。默认规则:

任务关键词代理类型
code, coder, impl, debugCoderAgent
writ, author, novel, chapter
AuthorAgent |
| world, build | WorldbuilderAgent |
| (其他) | general |

要添加自定义代理类型,请编辑 agent-context-loader.js 中的 detectAgentType()。

参考

  • - references/correction-tracker-template.js — correction-tracker.js 的完整实现

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 correction-memory-1776304996 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 correction-memory-1776304996 技能

通过命令行安装

skillhub install correction-memory-1776304996

下载

⬇ 下载 correction-memory v1.1.0(免费)

文件大小: 5.94 KB | 发布时间: 2026-4-16 18:34

v1.1.0 最新 2026-4-16 18:34
Security fix: agentType path traversal prevention (allowlist sanitization + path.resolve confinement), input length limits, control char stripping on correction content

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部