memory-referee
ontology and Proactive Agent give agents the ability to remember more. memory-referee is designed to work alongside skills like ontology and Proactive Agent to give that memory a cleaner foundation to stand on — deduplicating entities, resolving naming conflicts, separating facts from goals from speculation, archiving stale records, and enforcing consistent schemas.
Built with Saturnday — AI-specific governance for AI-generated code.
While governing the build of memory-referee, Saturnday caught the kinds of mistakes AI coders routinely ship: .env patterns that could expose API keys, deduplication logic that could silently drop memory records, fake tests that passed while verifying almost nothing, and runtime validation gaps that would let malformed records corrupt downstream decisions.
That is the difference between AI-generated code and governed AI-generated code.
www.saturnday.dev
When to Use
Invoke this skill whenever an agent's memory store may have accumulated:
- - Duplicate or near-duplicate records that should be collapsed into a single canonical entry
- Naming conflicts where the same entity appears under multiple aliases
- Mixed classification — facts, goals, and speculation interleaved without clear labelling
- Stale records that have aged past their useful window and should be archived
- Schema drift — records that no longer conform to the expected structure
- Contradictions — two records that assert incompatible facts about the same entity
Use it after running ontology or Proactive Agent to clean up accumulated memory before passing it downstream.
Inputs
Each record in raw_records must be a JSON object with the following fields:
| Field | Type | Required | Description |
|---|
| INLINECODE2 | INLINECODE3 | yes | Unique identifier for the record |
| INLINECODE4 |
string | yes | One of
fact,
goal, or
speculation |
|
entity |
string | yes | The entity this record is about |
|
content |
string | yes | The record's content |
|
timestamp |
string | yes | ISO 8601 date string |
|
provenance |
object | yes | Single provenance object:
{ sourceId, sourceLabel, capturedAt }. The skill wraps this internally into an array to support merged records with multiple sources. |
|
tags |
string[] | no | Optional tags |
Outputs
| Field | Type | Description |
|---|
| INLINECODE20 | INLINECODE21 | Markdown adjudication report summarising all decisions |
| INLINECODE22 |
object | Structured JSON with deduplicated, classified, validated records |
Usage
CLI
CODEBLOCK0
Library
CODEBLOCK1
memory-referee
本体论和主动代理赋予智能体更强的记忆能力。memory-referee旨在与本体论和主动代理等技能协同工作,为记忆提供更清晰的基础——去重实体、解决命名冲突、将事实、目标与推测分离、归档过期记录,并强制执行一致的架构。
基于Saturnday构建——专为AI生成代码设计的AI治理方案。
在治理memory-referee构建过程中,Saturnday捕获了AI编码人员常犯的错误:可能暴露API密钥的.env模式、可能静默丢失记忆记录的去重逻辑、通过验证但几乎未检测任何内容的虚假测试,以及会让格式错误的记录破坏下游决策的运行时验证漏洞。
这就是AI生成代码与受治理的AI生成代码之间的区别。
www.saturnday.dev
使用时机
当智能体的记忆存储可能累积以下内容时,调用此技能:
- - 重复或近似重复的记录——应合并为单一规范条目
- 命名冲突——同一实体以多个别名出现
- 混合分类——事实、目标和推测交织在一起,缺乏明确标签
- 过期记录——已超过有效期限,应归档
- 架构漂移——不再符合预期结构的记录
- 矛盾记录——两个记录对同一实体断言了不相容的事实
在运行本体论或主动代理后使用,以清理累积的记忆,然后再传递给下游。
输入
raw_records中的每条记录必须是包含以下字段的JSON对象:
| 字段 | 类型 | 必填 | 描述 |
|---|
| id | string | 是 | 记录的唯一标识符 |
| kind |
string | 是 | 取值为fact、goal或speculation之一 |
| entity | string | 是 | 该记录所涉及的实体 |
| content | string | 是 | 记录的内容 |
| timestamp | string | 是 | ISO 8601日期字符串 |
| provenance | object | 是 | 单一来源对象:{ sourceId, sourceLabel, capturedAt }。该技能内部将其包装为数组,以支持具有多个来源的合并记录。 |
| tags | string[] | 否 | 可选标签 |
输出
| 字段 | 类型 | 描述 |
|---|
| report | string | Markdown格式的裁决报告,总结所有决策 |
| result |
object | 结构化JSON,包含去重、分类和验证后的记录 |
使用方法
CLI
sh
echo [{id:r1,kind:fact,entity:Alice,content:Alice prefers dark mode,timestamp:2026-03-27T00:00:00Z,provenance:{sourceId:s1,sourceLabel:pref-log,capturedAt:2026-03-27T00:00:00Z}}] | node dist/index.js
库
typescript
import { main } from memory-referee;
const records = [
{
id: r1,
kind: fact,
entity: Alice,
content: Alice prefers dark mode,
timestamp: 2026-03-27T00:00:00Z,
provenance: { sourceId: s1, sourceLabel: pref-log, capturedAt: 2026-03-27T00:00:00Z }
}
];
const { markdown, json, report } = main(JSON.stringify(records));
console.log(markdown); // 人类可读的裁决报告
console.log(json); // 结构化JSON输出