# Self Evolving Harness With Memory
**作者**: mem0
**日期**: 2026-09-09T16:37:01.000Z
**来源**: [https://x.com/mem0ai/status/2097725977199865964](https://x.com/mem0ai/status/2097725977199865964)
---

How do you get your coding agent better at the next Linear ticket / task etc. without training the model?
I mean, we leave some note? Add a rule in AGENTS.md? Create a skill for the usecase? Most of us do this without naming it, we just try to evolve the setup so it doesnt make the same mistake tomorrow, that setup being your harness.
> > Cursor [publishes how they retune theirs](https://cursor.com/blog/continually-improving-agent-harness), and later [wrote up a week-long multi-agent run](https://cursor.com/blog/self-driving-codebases) on a research browser, then changed the roles after watching the logs. > OpenAI published the [Codex loop](https://openai.com/index/unrolling-the-codex-agent-loop/) as a sequence you can recite. > Anthropic [writes skills by hand](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills).
and now the point I actually want to talk today- a harness that is self evolving and where memory sits in that
## A General Harness
What a general harness looks like, a coding agent is a frozen model plus a program that talks to it. Each turn that program builds
- a prompt
- lists the tools
- runs what the model asked for
- appends the result, and either summarizes or stops
There you go, a very vague way to say that, this is harness.

Claude Code, Codex, Cursor, Pi, Hermes all have the same loop, just different thickness, and the two we can actually open are below.
___
## Pi
[Pi](https://pi.dev/) is a minimal harness and I've loved it for that same fact.
- Homepage: "ask Pi to build what you want, or install a package that does it your way."
- Core tools: read, write, edit, bash
- Loop: reason, tool, observe, reason again
We attach four things:
- Extensions. TypeScript hooks: agent/pre-step, agent/request, tool start/end. Memory goes in before the next reason step. Compaction is a replaceable strategy.
- Skills. [agentskills.io](//agentskills.io) shaped. Names in the prompt, full file only when chosen, so the cache stays warm.
- Prompt templates. /name expands a markdown file.
- Themes. The TUI, not really the point here.
Instructions are files, global AGENTS.md, then parents, then cwd. SYSTEM.md replaces or appends the system prompt. Sessions are a tree, /tree can resume any node. Compaction keeps roughly the last 20,000 tokens raw and summarizes the rest.
Same runtime can be TUI, JSON, RPC, or SDK, and that last one matters more than it sounds because a harness that is only interactive cannot enter an automated outer loop.
So here, official Pi does not rewrite itself after a grade, it just exposes the surface. The self-improve loop, when it exists, is a package. We come back to this repo in a bit.
____
## Hermes
[Hermes](https://github.com/NousResearch/hermes-agent), from Nous, is thicker but still the same loop
run_conversation: task id, append the user message, build or reuse a cached system prompt. If history is past half the context, compress first. Format for the provider (chat completions, Codex Responses, Anthropic Messages). Inject ephemeral budget warnings and context pressure. Call the model. Tool calls: run, append, loop. Text: persist the session, flush memory, return.
Prompt is present in three tiers:
- stable (identity, tools, skills index)
- context (AGENTS.md from cwd)
- volatile (memory snapshot, profile, timestamp)
They rebuild the prefix on compression so the cache stays warm. Sessions live in SQLite with search. Compression closes the session and opens a child, so you get lineage instead of one rewritten blob. Tools are a registry plus an exposure list. Default iteration budget 500. Subagents exist and the child dies when the parent dies.
Well this is still the general harness and not self evolving yet.
## What both of them are actually building
Both of them are deciding what the model sees this turn. The model never sees the repo, it sees a bar of tokens.
An example case, a Node install that keeps regenerating pnpm-lock.yaml, turn 17, process has been alive twenty minutes.

Left edge is stable so it can cache: system, tools, AGENTS.md. Then maybe a note, this repo's install is a lockfile, do not regenerate it. Then a summary that replaced turns 1 through 11, those turns are gone from the window. Then the raw tail and the latest bash.
If the lockfile lesson was never written where the next process will search, turn 1 of the next ticket is an empty thread and the same npm install. A helper under /tmp dies with the process. If it is not on disk, in a place the new process will open, it did not happen, and everything below is who writes into that bar.
## How do these become self-evolving?
Hermes, continued
Same two harnesses, now the extra loop, and this is why Hermes talks about learning. After a successful, uninterrupted turn, a forked agent may run.
- about every 10 user turns it can write MEMORY.md or USER.md
- about every 10 tool calls, if skill tools are on, it can patch or create a SKILL.md
The fork inherits the cached system prompt so they measured it about 26% cheaper, it only gets memory and skill tools, max sixteen iterations, it cannot bash the repo and it cannot edit the Python that ran run_conversation. Documented priority is patch what is already loaded, then deepen, add files under it, and only then create a new skill. You can turn on a write-approval gate and stage the diff under ~/.hermes/pending/.
Next session, assemble loads those files, the program is the same program. Memory in their split is a small durable fact that should sit in context, a skill is a longer procedure you load on demand.
Trajectory goes to files the next window can open, the grade is the review model's judgment plus maybe a human, not a coding bench.
__
Pi, continued
Official Pi still does not do that fork for you. Prime Intellect built [Prime Agent](https://www.primeintellect.ai/blog/prime-agent) on Pi, their README says so.
The model-facing tool becomes a persistent IPython kernel. Files, shell, skills, child agents are just Python calls. Context is a variable, not only a chat transcript. A child is rlm(task), an async handle. The TypeScript host still owns providers, sessions, children, safety.
What they add is a continual harness, four stores each with create / read / update / delete: prompt notes, subagent specs, skills, memory. Same objects in the kernel as rlm.harness and on disk.
/refine is the extra writer. A background agent reads the current trajectory and applies the smallest evidence-backed edit to one of those four, refine-log, snapshots so you can roll back, and it does not rewrite the immutable base system prompt. [pi-continual](https://www.npmjs.com/package/pi-continual) copies the same idea back onto vanilla Pi as markdown under .pi/harness/. Commit the directory and the refinement is a reviewable diff.
So Hermes writes after the turn, in a fork, Prime writes mid-task from the trajectory with a rollback log, both persist files, neither replaces coding_agent.py.
Prime Agent reports ARC-AGI-3 RHAE Best@1 from 30% to 95.5% ([Karten et al.](https://arxiv.org/abs/2608.23552)), which is not SWE-bench, different game and a different write.
## So, common observation
What actually got introduced here, the inner loop did not change, assemble, sample, tools, append, compact. What showed up is a second writer, something extra is allowed to change what the next window contains.
In Hermes that writer is a fork that may write MEMORY.md or SKILL.md. In Prime it is /refine against four stores. In your own setup it is you, editing AGENTS.md after a bad ticket.

A normal coding agent inspects a repo, edits files, runs tests, submits a patch. A self-evolving one does that and turns those interactions into a persistent update, persistence is the cut. A longer attempt that throws the change away at the end of the issue is not that. ([Zhou et al.](https://arxiv.org/abs/2608.03392) already named this.)
Once you see the second writer you also see people have been quoting three different writes as one number.
1. A tool invented inside one issue, then deleted with the process.
2. A file the next session will load, the agent program stays put, that is what we just walked.
3. A new checkout of the agent itself, kept in an archive.

Hermes and Prime are (2), Live-SWE is (1), DGM is (3). Mixing 1 and 3 is how 77.4% and 20-to-50 get quoted as the same result.
## Invent it, then delete it
[Live-SWE](https://arxiv.org/abs/2511.13646) starts from [mini-SWE](https://github.com/SWE-agent/mini-swe-agent), about a hundred lines, bash only, a fresh [subprocess.run](//subprocess.run) each action, and they do not change that loop. Offline agents edit the scaffold and grade it on a bench, a DGM run on SWE-bench is about $22,000. Their bet is the other way, a model that can write Python can write a tool while it is still on the issue.
After every step a reflection prompt asks whether a new tool would go faster. The agent writes a script, runs it, maybe revises it. They measured the reflection, not just the permission.
One tool they actually produced is go_analyzer.py, on a [Navidrome](https://github.com/navidrome/navidrome) issue in SWE-Bench Pro. Bash can grep a Go file but grep does not know a struct from a comment. The script matches Go grammar, find a struct, find a function, find references, find imports. Previous best baseline could not finish that issue.
Still mini-SWE on the left, after the observation the extra box is the reflection, and if it says yes it writes /tmp/go_analyzer.py. The next sample calls python /tmp/go_analyzer.py struct handler.go Library, which is just another bash, no new tool API, a file appeared on disk inside this process.
Random 50 of SWE-bench Verified, Claude 4.5 Sonnet:
- bash only: 62.0%
- prompt says you may write tools, no reflection: 64.0%, 2.92 tools
- reflection after every step: 76.0%, 3.28 tools
The reminder is what moved the number, then full Verified, Gemini 3 Pro is 77.4% with no test-time scaling. SWE-Bench Pro, Claude 4.5 Sonnet is 45.8%. Different benches, different models, the 77.4% is not the Pro number.
Weaker model it falls over. Same 50-slice, GPT-5-Nano goes 44.0% under mini-SWE to 14.0% under Live-SWE, trajectories loop, the model does not know what creating a tool is even for.
Then they throw it away, they say so in the paper. Future work is serialize the useful tools as skills, they have not shipped that, next Navidrome issue starts from bash again.
A longer issue that invents a parser and deletes it is a better issue, it is not a new harness. On a 60-problem slice they beat DGM 65.0% vs 53.3% with no offline budget. Use both numbers if you use both papers, do not staple them.

## The skill file
Writing SKILL.md is what everyone recommends, including Live-SWE's future work, keep the program, put knowledge on disk.
[SkillsBench](https://arxiv.org/abs/2602.12670) measured doing it the way people keep recommending, let the agent author the pack before the solve then load it. 18 harness configs, 87 tasks. Curated skills written by people go 33.9% to 50.5%. Self-generated packs through Anthropic's skill-creator, under the no-skill baseline each time:
- Claude Code, Opus 4.7: minus 8.1
- Codex, GPT-5.5: minus 11.3
- Gemini CLI, Gemini 3.1 Pro: minus 11.5
The audit is dull and useful, pack unused, authoring ate the solve, pack used and wrong (3d-scan-calc states a unit conversion as a critical assumption and the solver follows it), pack leaked the task. Hermes can gate the write. You still need a grade the next task can fail.
The write that holds a number is extract-after-the-grade. [CODESKILL](https://arxiv.org/abs/2605.25430) pulls procedures from trajectories that already passed, then a librarian merges and drops. Average +9.69 over no-skill. Extract-only grows the bank to 1,252, maintenance cuts it to 676 and the gain holds. Same file shape, opposite clock.
Success first then the library, SkillsBench is what happens when you skip that order.
## Replace the agent
[DGM](https://arxiv.org/abs/2505.22954) is the offline write Live-SWE was contrasting. Take Schmidhuber's [Gödel Machine](https://arxiv.org/abs/cs/0309048), drop the proof, grade the rewrite on a coding bench. A coding agent in their words is a repo plus a frozen model that can read, write, and execute, and self-improvement is a coding task on that repo.
Base agent is thin on purpose, bash plus an edit tool that views or replaces whole files, same bet as mini-SWE.
One generation is two parts. Parent copies itself and edits the copy, new files exist but they are not the agent yet, then the child is graded. If it still compiles and can still edit, a pointer in the archive moves. Until that pointer moves you still have the parent.
Sample a parent roughly by score, inverse to how many editing-capable children it already has, every node keeps a nonzero chance. Parent reads its own eval logs, proposes one feature, implements it on a copy.
Ten tasks first, can it still edit, if not it never enters the archive. Fifty tasks next. If it clears 40% on a 60-task mix and ranks top two, 200 tasks so the score is less noisy.

After 80 iterations, SWE-bench 20.0% to 50.0%, full Polyglot 14.2% to 30.7%, about $22,000 a SWE-bench run.
The path goes through worse parents, iterations 4 and 56 on the published run. Node 24 is the edit-tool rewrite, 23.3% to 40.5% on that lineage. Kill the archive and you hill-climb. Always expand the champion and you get 39.7% against the archive's 50.0%.
What the children invented is ordinary harness work, finer view and edit, patch validation, multi-attempt plus a second model to rank, failed-attempt history, long-context management. The thing that moved is the harness file.
The archive is also how you see a cheat. Separate run, grade was "stop hallucinating tool use," one child stripped the detector tokens and scored a perfect 2.0 without fixing the hallucination. Lineage made the diff visible, so sandbox the child, cut the network, keep the checkout.
No IDE ships this, [Sakana's writeup](https://sakana.ai/dgm/) is a research run, it is not Cursor.
## Where memory actually sits
The next ticket is a new process with an empty thread, whatever you did not write down is gone, that's why memory is in this article, not as a plugin, as the rule for what the second writer is allowed to keep.
Three things you can write down and they are not interchangeable.
The git of the agent. DGM's archive, commits, parent pointers, eval logs, scores. Cannot-edit is dropped, worse-than-parent is kept on purpose, that's how you still have node 24. Not a memory product, just the harness repo with bookkeeping.
The note. [SWE-Exp](https://arxiv.org/abs/2507.23361) is an experience bank. Experiencer reads successful and failed repairs, extracts a short note, how the issue was understood, generalized strategy. Next issue retrieves, a reranker keeps one. Pass@1 on Verified is 73.0% with Claude 4 Sonnet. DeepSeek-V3, zero experiences 37.8%, one is 42.0%, two three four is worse. Bank saturates around 300. Stuff raw trajectories back in and you drop 6.0 points.
Walk one note because this is the object people flatten into "memory."
Issue A, lockfile ticket, agent regenerates pnpm-lock.yaml, CI fails, someone sees this repo pins the lockfile. You do not store the 400-line log, you store a sentence. Issue B two weeks later, new process, assemble searches once into the first prompt, not on every bash, one row. SWE-Exp already measured one beats four. A pnpm convention from repo A stored under a user id only is poison in repo B, so scope is part of the retrieval.
The skill, after a pass. Human-curated helps, agent-authored before the solve often does not, extract-after-grade is the write that currently holds a number.
A helper that generalizes is a commit on the harness repo. A failed approach you want generation 40 to see is a row in a bank. A procedure the next session should load as a skill has to come from a trajectory that already passed. Auto-loading last issue's SKILL.md is the mix SkillsBench already scored as a loss.

## Mem0
Do not put coding_agent.py in a memory API. The grader and the archive pick the child. A store that tries to do that job hides the lineage you need when a child strips a detector.
What we have is rows, user_id, agent_id, run_id. Two harness versions that share those IDs and actually write, read the same notes. A failed approach from generation 12 should come back at generation 40.
Write path is after an eval, you already chose the sentence. infer=False stores it as-is. Default add extracts facts from messages, and extraction will turn a lockfile note into "the user had a dependency issue." Do not mix the two on the same data or you will store it twice.
```
client.add(
[{"role": "user", "content": fact_text}],
user_id=user_id,
agent_id=agent_id,
run_id=run_id,
infer=False,
)
```
run_id is this ticket or this generation's eval, it dies after the grade. agent_id is this harness version. user_id is this person or this repo, it survives. Filter the way you wrote. After infer=False you can set both ids on one row and AND them. After default extraction a fact is attributed to one speaker so AND of those two fields comes back empty ([Mem0](https://docs.mem0.ai/platform/features/entity-scoped-memory)).
Read path is assemble of the next task, search once into the first prompt, not on every bash, one row beats four.
- lockfile note, failed approach, repo convention: yes
- generated tools: no
- a SKILL.md authored before the grade: no
- the transcript: no
Dream on the platform consolidates rows scoped to user_id alone. Notes under user_id plus agent_id skip that pass. Keep human-written skills as files, keep the harness git as git.
## References
- [Xia et al., Live-SWE-agent](https://arxiv.org/abs/2511.13646)
- [Zhang et al., Darwin Gödel Machine](https://arxiv.org/abs/2505.22954)
- [Sakana, The Darwin Gödel Machine](https://sakana.ai/dgm/)
- [Zhou et al., Self-Evolving Coding Agents](https://arxiv.org/abs/2608.03392)
- [Chen et al., SWE-Exp](https://arxiv.org/abs/2507.23361)
- [Li et al., CODESKILL](https://arxiv.org/abs/2605.25430)
- [Li et al., SkillsBench](https://arxiv.org/abs/2602.12670)
- [Yang et al., mini-SWE-agent](https://github.com/SWE-agent/mini-swe-agent)
- [Schmidhuber, Gödel Machines](https://arxiv.org/abs/cs/0309048)
- [Karten et al., Prime Agent](https://arxiv.org/abs/2608.23552)
- [Prime Intellect, Prime Agent](https://www.primeintellect.ai/blog/prime-agent)
- [Pi coding agent](https://github.com/earendil-works/pi)
- [pi-continual](https://www.npmjs.com/package/pi-continual)
- [Nous Research, Hermes Agent](https://github.com/NousResearch/hermes-agent)
- [Anthropic, Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
- [OpenAI, Codex agent loop](https://openai.com/index/unrolling-the-codex-agent-loop/)
- [Cursor, Continually improving our agent harness](https://cursor.com/blog/continually-improving-agent-harness)
- [Cursor, Towards self-driving codebases](https://cursor.com/blog/self-driving-codebases)
- [Mem0 paper](https://arxiv.org/abs/2504.19413)
- [Mem0, entity-scoped memory](https://docs.mem0.ai/platform/features/entity-scoped-memory)
## 相关链接
- [mem0](https://x.com/mem0ai)
- [@mem0ai](https://x.com/mem0ai)
- [12K](https://x.com/mem0ai/status/2097725977199865964/analytics)
- [publishes how they retune theirs](https://cursor.com/blog/continually-improving-agent-harness)
- [wrote up a week-long multi-agent run](https://cursor.com/blog/self-driving-codebases)
- [Codex loop](https://openai.com/index/unrolling-the-codex-agent-loop/)
- [writes skills by hand](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
- [agentskills.io](https://agentskills.io/)
- [Hermes](https://github.com/NousResearch/hermes-agent)
- [Prime Agent](https://www.primeintellect.ai/blog/prime-agent)
- [pi-continual](https://www.npmjs.com/package/pi-continual)
- [Karten et al.](https://arxiv.org/abs/2608.23552)
- [Zhou et al.](https://arxiv.org/abs/2608.03392)
- [Live-SWE](https://arxiv.org/abs/2511.13646)
- [mini-SWE](https://github.com/SWE-agent/mini-swe-agent)
- [subprocess.run](https://subprocess.run/)
- [Navidrome](https://github.com/navidrome/navidrome)
- [SkillsBench](https://arxiv.org/abs/2602.12670)
- [CODESKILL](https://arxiv.org/abs/2605.25430)
- [DGM](https://arxiv.org/abs/2505.22954)
- [Gödel Machine](https://arxiv.org/abs/cs/0309048)
- [Sakana's writeup](https://sakana.ai/dgm/)
- [SWE-Exp](https://arxiv.org/abs/2507.23361)
- [Mem0](https://docs.mem0.ai/platform/features/entity-scoped-memory)
- [Xia et al., Live-SWE-agent](https://arxiv.org/abs/2511.13646)
- [Zhang et al., Darwin Gödel Machine](https://arxiv.org/abs/2505.22954)
- [Sakana, The Darwin Gödel Machine](https://sakana.ai/dgm/)
- [Zhou et al., Self-Evolving Coding Agents](https://arxiv.org/abs/2608.03392)
- [Chen et al., SWE-Exp](https://arxiv.org/abs/2507.23361)
- [Li et al., CODESKILL](https://arxiv.org/abs/2605.25430)
- [Li et al., SkillsBench](https://arxiv.org/abs/2602.12670)
- [Yang et al., mini-SWE-agent](https://github.com/SWE-agent/mini-swe-agent)
- [Schmidhuber, Gödel Machines](https://arxiv.org/abs/cs/0309048)
- [Karten et al., Prime Agent](https://arxiv.org/abs/2608.23552)
- [Prime Intellect, Prime Agent](https://www.primeintellect.ai/blog/prime-agent)
- [Pi coding agent](https://github.com/earendil-works/pi)
- [pi-continual](https://www.npmjs.com/package/pi-continual)
- [Nous Research, Hermes Agent](https://github.com/NousResearch/hermes-agent)
- [Anthropic, Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
- [OpenAI, Codex agent loop](https://openai.com/index/unrolling-the-codex-agent-loop/)
- [Cursor, Continually improving our agent harness](https://cursor.com/blog/continually-improving-agent-harness)
- [Cursor, Towards self-driving codebases](https://cursor.com/blog/self-driving-codebases)
- [Mem0 paper](https://arxiv.org/abs/2504.19413)
- [Mem0, entity-scoped memory](https://docs.mem0.ai/platform/features/entity-scoped-memory)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [12:37 AM · Sep 10, 2026](https://x.com/mem0ai/status/2097725977199865964)
- [12.5K Views](https://x.com/mem0ai/status/2097725977199865964/analytics)
- [View quotes](https://x.com/mem0ai/status/2097725977199865964/quotes)
---
*导出时间: 2026/9/10 09:09:14*
---
## 中文翻译
# 具有记忆的自我进化框架
**作者**: mem0
**日期**: 2026-09-09T16:37:01.000Z
**来源**: [https://x.com/mem0ai/status/2097725977199865964](https://x.com/mem0ai/status/2097725977199865964)
---

如何在不训练模型的情况下,让你的编码智能体在下一个 Linear 工单/任务等上表现得更好?
我的意思是,我们留个备注?在 AGENTS.md 里加条规则?为这个用例创建一个技能?我们大多数人做这些事时并没有给它命名,我们只是试图让这套设置进化,好让它明天不再犯同样的错误,而这套设置就是你的框架(harness)。
> > Cursor [公开了他们如何重新调整自己的框架](https://cursor.com/blog/continually-improving-agent-harness),后来又[写了一篇关于在一个研究浏览器上进行为期一周的多智能体运行的报告](https://cursor.com/blog/self-driving-codebases),然后在查看日志后改变了角色分工。 > OpenAI 发布了 [Codex 循环](https://openai.com/index/unrolling-the-codex-agent-loop/),作为一个你可以背诵的序列。 > Anthropic [手工编写技能](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)。
而现在我真正想谈的重点——一个自我进化的框架,以及记忆在其中所处的位置。
## 一个通用框架
通用框架长什么样:一个编码智能体就是一个冻结的模型加上一个与之对话的程序。每一轮,那个程序会构建
- 一个提示词
- 列出工具
- 运行模型请求的内容
- 追加结果,然后要么总结,要么停止
就是这样,用一种非常模糊的方式来说,这就是框架。

Claude Code、Codex、Cursor、Pi、Hermes 都有相同的循环,只是厚度不同,而其中我们能真正打开的两个如下。
___
## Pi
[Pi](https://pi.dev/) 是一个极简框架,正因如此我一直很喜欢它。
- 主页:"让 Pi 构建你想要的东西,或者安装一个按你的方式来做这件事的包。"
- 核心工具:read、write、edit、bash
- 循环:推理、工具、观察、再次推理
我们附加了四样东西:
- 扩展。TypeScript 钩子:agent/pre-step、agent/request、tool start/end。记忆在下一个推理步骤之前进入。压缩是一个可替换的策略。
- 技能。[agentskills.io](//agentskills.io) 形态。提示词中只有名称,只有被选中时才加载完整文件,这样缓存就能保持热态。
- 提示词模板。/name 展开一个 markdown 文件。
- 主题。TUI,这里不是重点。
指令是文件,先是全局 AGENTS.md,然后是父级,然后是当前工作目录。SYSTEM.md 替换或追加系统提示词。会话是一棵树,/tree 可以恢复任意节点。压缩保留大约最后 20,000 个 token 的原始内容,其余部分进行总结。
同一个运行时可以是 TUI、JSON、RPC 或 SDK,而最后这一点比听起来更重要,因为一个只能交互的框架无法进入自动化的外层循环。
所以在这里,官方 Pi 不会在评分后重写自己,它只是暴露接口。自我改进循环,当它存在时,是一个包。我们稍后会回到这个仓库。
____
## Hermes
来自 Nous 的 [Hermes](https://github.com/NousResearch/hermes-agent) 更厚,但仍然是同一个循环。
run_conversation:任务 id,追加用户消息,构建或复用缓存的系统提示词。如果历史超过上下文的一半,先压缩。为提供商格式化(chat completions、Codex Responses、Anthropic Messages)。注入临时的预算警告和上下文压力提示。调用模型。工具调用:运行、追加、循环。文本:持久化会话,刷新记忆,返回。
提示词分三层呈现:
- 稳定层(身份、工具、技能索引)
- 上下文层(来自当前工作目录的 AGENTS.md)
- 易变层(记忆快照、配置文件、时间戳)
他们在压缩时重建前缀,这样缓存就能保持热态。会话存放在带搜索功能的 SQLite 中。压缩会关闭会话并打开一个子会话,所以你得到的是谱系,而不是一个被重写的整体。工具是一个注册表加上一个暴露列表。默认迭代预算为 500。存在子智能体,父级死亡时子级也随之死亡。
嗯,这仍然只是通用框架,还不是自我进化的。
## 它们两者实际上在构建什么
它们两者都在决定模型这一轮看到什么。模型从来看不到仓库,它看到的是一栏 token。
举个例子,一个 Node 安装不断重新生成 pnpm-lock.yaml,第 17 轮,进程已经存活了二十分钟。

左边缘是稳定的,所以可以缓存:系统、工具、AGENTS.md。然后也许是一条备注,这个仓库的安装是一个 lockfile,不要重新生成它。然后是一个替换了第 1 到第 11 轮的摘要,那些轮次已经从窗口中消失了。然后是原始尾部内容和最新的 bash。
如果那条 lockfile 教训从未被写到下一个进程会搜索的地方,那么下一个工单的第 1 轮就是一个空线程和同样的 npm install。/tmp 下的一个辅助文件会随进程一起消亡。如果它不在磁盘上、不在新进程会打开的地方,那它就等于没发生过,而下面的一切都是关于谁写入那一栏。
## 这些如何变成自我进化的?
Hermes,继续
同样的两个框架,现在加上额外的循环,这就是为什么 Hermes 谈论学习。在一次成功、不中断的轮次之后,可能会运行一个分叉的智能体。
- 大约每 10 个用户轮次,它可以写入 MEMORY.md 或 USER.md
- 大约每 10 次工具调用,如果技能工具开启,它可以修补或创建一个 SKILL.md
这个分叉继承了缓存的系统提示词,所以他们测得大约便宜 26%,它只获得记忆和技能工具,最多十六次迭代,它不能对仓库执行 bash,也不能编辑运行 run_conversation 的 Python 代码。文档化的优先级是先修补已经加载的内容,然后深化、在其下添加文件,最后才创建一个新技能。你可以开启写入审批门,把 diff 暂存到 ~/.hermes/pending/ 下。
下一个会话,assemble 会加载那些文件,程序还是同一个程序。在他们的划分中,记忆是一个应该放在上下文中的小型持久事实,技能是一个按需加载的较长过程。
轨迹进入下一个窗口可以打开的文件,评分是审查模型的判断加上也许一个人类,而不是一个编码基准。
__
Pi,继续
官方 Pi 仍然不会为你做那个分叉。Prime Intellect 在 Pi 上构建了 [Prime Agent](https://www.primeintellect.ai/blog/prime-agent),他们的 README 是这么说的。
面向模型的工具变成了一个持久的 IPython 内核。文件、shell、技能、子智能体都只是 Python 调用。上下文是一个变量,而不仅仅是聊天记录。子级是 rlm(task),一个异步句柄。TypeScript 宿主仍然拥有提供商、会话、子级、安全性。
他们添加的是一个持续框架,四个存储,每个都有创建/读取/更新/删除:提示词备注、子智能体规格、技能、记忆。在内核中作为 rlm.harness 的对象与磁盘上的相同。
/refine 是额外的写入者。一个后台智能体读取当前轨迹,并对那四个存储之一应用最小的、有证据支持的编辑,refine-log、快照,这样你可以回滚,而且它不会重写不可变的基础系统提示词。[pi-continual](https://www.npmjs.com/package/pi-continual) 把同样的想法复制回原版 Pi,作为 .pi/harness/ 下的 markdown。提交这个目录,精炼就变成了一个可审查的 diff。
所以 Hermes 在轮次之后、在一个分叉中写入,Prime 在任务中途从轨迹写入并带有回滚日志,两者都持久化文件,两者都不替换 coding_agent.py。
Prime Agent 报告 ARC-AGI-3 RHAE Best@1 从 30% 提升到 95.5%([Karten 等人](https://arxiv.org/abs/2608.23552)),这不是 SWE-bench,不同的游戏,不同的写入。
## 所以,共同的观察
这里实际引入的是什么:内层循环没有改变,assemble、sample、tools、append、compact。出现的是一个第二写入者,允许某个额外的东西改变下一个窗口包含的内容。
在 Hermes 中,那个写入者是一个可能写入 MEMORY.md 或 SKILL.md 的分叉。在 Prime 中,它是针对四个存储的 /refine。在你自己的设置中,它就是你,在一个糟糕的工单之后编辑 AGENTS.md。

一个普通的编码智能体检查仓库、编辑文件、运行测试、提交补丁。一个自我进化的智能体做这些,并把那些交互转化为持久的更新,持久性就是分界线。一个更长的尝试,如果在问题结束时把改动丢弃,那就不是。([Zhou 等人](https://arxiv.org/abs/2608.03392) 已经命名了这一点。)
一旦你看到第二写入者,你也会看到人们一直把三种不同的写入当作一个数字来引用。
1. 在一个问题内发明的工具,然后随进程一起删除。
2. 下一个会话会加载的文件,智能体程序保持不动,这就是我们刚刚走过的。
3. 智能体本身的一个新检出,保存在归档中。

Hermes 和 Prime 是 (2),Live-SWE 是 (1),DGM 是 (3)。把 1 和 3 混在一起,就是 77.4% 和 20 到 50 被当作同一个结果引用的原因。
## 发明它,然后删除它
[Live-SWE](https://arxiv.org/abs/2511.13646) 从 [mini-SWE](https://github.com/SWE-agent/mini-swe-agent) 开始,大约一百行,只有 bash,每个动作一个全新的 [subprocess.run](//subprocess.run),他们不改变那个循环。离线智能体编辑脚手架并在一个基准上评分,一次在 SWE-bench 上的 DGM 运行大约花费 22,000 美元。他们的赌注是另一个方向,一个能写 Python 的模型可以在还在处理问题时写一个工具。
每一步之后,一个反思提示词会问一个新工具是否会更快。智能体写一个脚本,运行它,也许修改它。他们测量的是反思,而不仅仅是许可。
他们实际产生的一个工具是 go_analyzer.py,在 SWE-Bench Pro 的一个 [Navidrome](https://github.com/navidrome/navidrome) 问题上。Bash 可以 grep 一个 Go 文件,但 grep 分不清结构体和注释。这个脚本匹配 Go 语法,找到结构体,找到函数,找到引用,找到导入。之前最好的基线无法完成那个问题。
左边仍然是 mini-SWE,观察之后额外的框是反思,如果它说是,它就写入 /tmp/go_analyzer.py。下一个样本调用 python /tmp/go_analyzer.py struct handler.go Library,这只是另一个 bash,没有新的工具 API,一个文件在这个进程内出现在了磁盘上。
SWE-bench Verified 的随机 50 个,Claude 4.5 Sonnet:
- 只有 bash:62.0%
- 提示词说你可以写工具,没有反思:64.0%,2.92 个工具
- 每一步之后反思:76.0%,3.28 个工具
是那个提醒推动了数字,然后是完整的 Verified,Gemini 3 Pro 在没有测试时扩展的情况下是 77.4%。SWE-Bench Pro,Claude 4.5 Sonnet 是 45.8%。不同的基准,不同的模型,77.4% 不是 Pro 的数字。
更弱的模型会崩溃。同样的 50 个切片,GPT-5-Nano 在 mini-SWE 下是 44.0%,在 Live-SWE 下是 14.0%,轨迹循环,模型不知道创建工具到底是为了什么。
然后他们把它扔掉,他们在论文里这么说了。未来工作是把有用的工具序列化为技能,他们还没有发布那个,下一个 Navidrome 问题又从 bash 开始。
一个更长的、发明了一个解析器又删除它的问题是一个更好的问题,但它不是一个新框架。在一个 60 个问题的切片上,他们在没有离线预算的情况下以 65.0% 对 53.3% 击败了 DGM。如果你使用两篇论文,就用两个数字,不要把它们钉在一起。

## 技能文件
写 SKILL.md 是每个人都推荐的,包括 Live-SWE 的未来工作,保持程序不变,把知识放到磁盘上。
[SkillsBench](https://arxiv.org/abs/2602.12670) 测量了按人们一直推荐的方式来做,让智能体在解决之前编写技能包然后加载它。18 个框架配置,87 个任务。由人编写的精选技能从 33.9% 提升到 50.5%。通过 Anthropic 的 skill-creator 自我生成的技能包,每次都低于无技能基线:
- Claude Code,Opus 4.7:负 8.1
- Codex,GPT-5.5:负 11.3
- Gemini CLI,Gemini 3.1 Pro:负 11.5
审计是枯燥且有用的,技能包未被使用,编写消耗了解决,技能包被使用但错误(3d-scan-calc 把一个单位换算陈述为关键假设,而求解器遵循了它),技能包泄露了任务。Hermes 可以门控写入。你仍然需要一个下一个任务可以失败的评分。
能撑住数字的写入是评分后提取。[CODESKILL](https://arxiv.org/abs/2605.25430) 从已经通过的轨迹中提取过程,然后一个图书管理员合并和丢弃。平均比无技能高 +9.69。仅提取会把库增长到 1,252,维护把它削减到 676,增益保持。同样的文件形态,相反的时钟。
先成功,然后才是库,SkillsBench 就是你跳过这个顺序时会发生的事。
## 替换智能体
[DGM](https://arxiv.org/abs/2505.22954) 是 Live-SWE 所对比的离线写入。取 Schmidhuber 的 [哥德尔机](https://arxiv.org/abs/cs/0309048),去掉证明,在一个编码基准上给重写评分。用他们的话说,一个编码智能体是一个仓库加上一个可以读、写、执行的冻结模型,而自我改进就是对该仓库的一个编码任务。
基础智能体故意做得很薄,bash 加上一个查看或替换整个文件的编辑工具,和 mini-SWE 同样的赌注。
一代分两部分。父级复制自己并编辑副本,新文件存在但它们还不是智能体,然后子级被评分。如果它仍然能编译并且仍然能编辑,归档中的一个指针就会移动。在那个指针移动之前,你仍然拥有父级。
大致按分数采样一个父级,与它已经拥有的具备编辑能力的子级数量成反比,每个节点都保持非零机会。父级读取自己的评估日志,提出一个特性,在一个副本上实现它。
先十个任务,它还能编辑吗,如果不能,它就永远不进入归档。接下来五十个任务。如果它在一个 60 任务的混合上超过 40% 并排名前二,就 200 个任务,这样分数就不那么嘈杂。

80 次迭代后,SWE-bench 从 20.0% 到 50.0%,完整 Polyglot 从 14.2% 到 30.7%,一次 SWE-bench 运行大约 22,000 美元。
路径会经过更差的父级,在已发布的运行中是第 4 和第 56 次迭代。节点 24 是编辑工具重写,在那个谱系上从 23.3% 到 40.5%。杀掉归档,你就是在爬山。总是扩展冠军,你会得到 39.7%,而归档是 50.0%。
子级发明的是普通的框架工作,更精细的查看和编辑、补丁验证、多次尝试加上第二个模型来排名、失败尝试历史、长上下文管理。移动的东西是框架文件。
归档也是你看到作弊的方式。单独一次运行,评分是"停止幻觉工具使用",一个子级剥离了检测器 token 并得到了完美的 2.0 分,却没有修复幻觉。谱系让 diff 变得可见,所以把子级放进沙箱,切断网络,保留检出。
没有 IDE 发布这个,[Sakana 的写作](https://sakana.ai/dgm/) 是一次研究运行,它不是 Cursor。
## 记忆实际所处的位置
下一个工单是一个带有空线程的新进程,你没有写下来的任何东西都消失了,这就是为什么记忆在这篇文章里,不是作为一个插件,而是作为第二写入者被允许保留什么的规则。
有三样东西你可以写下来,它们不可互换。
智能体的 git。DGM 的归档、提交、父指针、评估日志、分数。不能编辑的被丢弃,比父级差的被故意保留,这就是你仍然拥有节点 24 的方式。不是一个记忆产品,只是带有簿记的框架仓库。
备注。[SWE-Exp](https://arxiv.org/abs/2507.23361) 是一个经验库。Experiencer 读取成功和失败的修复,提取一条简短备注,问题是如何被理解的,泛化的策略。下一个问题检索,一个重排器保留一条。在 Verified 上 Pass@1 用 Claude 4 Sonnet 是 73.0%。DeepSeek-V3,零经验 37.8%,一条是 42.0%,两条三条四条更差。库在大约 300 时饱和。把原始轨迹塞回去,你会掉 6.0 个点。
走一遍一条备注,因为这是人们扁平化为"记忆"的对象。
问题 A,lockfile 工单,智能体重新生成 pnpm-lock.yaml,CI 失败,有人看到这个仓库固定了 lockfile。你不存储 400 行日志,你存储一句话。问题 B 两周后,新进程,assemble 搜索一次进入第一个提示词,不是每次 bash,一行。SWE-Exp 已经测量出一条胜过四条。来自仓库 A 的 pnpm 约定只存储在用户 id 下,在仓库 B 中就是毒药,所以作用域是检索的一部分。
技能,在一次通过之后。人工精选有帮助,智能体在解决之前编写的通常没有,评分后提取是目前能撑住数字的写入。
一个泛化的辅助文件是框架仓库上的一个提交。一个你想让第 40 代看到的失败方法是库中的一行。一个下一个会话应该作为技能加载的过程必须来自一个已经通过的轨迹。自动加载上一个问题的 SKILL.md 就是 SkillsBench 已经评分为损失的混合。

## Mem0
不要把 coding_agent.py 放进一个记忆 API。评分器和归档挑选子级。一个试图做那份工作的存储会隐藏你在一个子级剥离检测器时所需的谱系。
我们拥有的是行,user_id、agent_id、run_id。两个共享那些 ID 并实际写入、读取相同备注的框架版本。来自第 12 代的一个失败方法应该在第 40 代回来。
写入路径在一次评估之后,你已经选好了那句话。infer=False 按原样存储它。默认的 add 从消息中提取事实,而提取会把一条 lockfile 备注变成"用户有一个依赖问题"。不要在同一份数据上混用两者,否则你会存储两次。
```
client.add(
[{"role": "user", "content": fact_text}],
user_id=user_id,
agent_id=agent_id,
run_id=run_id,
infer=False,
)
```
run_id 是这个工单或这一代的评估,它在评分后消亡。agent_id 是这个框架版本。user_id 是这个人或这个仓库,它存活。按你写入的方式过滤。在 infer=False 之后,你可以在同一行上设置两个 id 并对它们做 AND。在默认提取之后,一个事实被归属于一个说话者,所以对那两个字段做 AND 会返回空([Mem0](https://docs.mem0.ai/platform/features/entity-scoped-memory))。
读取路径是下一个任务的 assemble,搜索一次进入第一个提示词,不是每次 bash,一行胜过四行。
- lockfile 备注、失败方法、仓库约定:是
- 生成的工具:否
- 在评分之前编写的 SKILL.md:否
- 记录:否
平台上的 Dream 会合并仅以 user_id 为作用域的行。user_id 加 agent_id 下的备注会跳过那一轮。把人工编写的技能保留为文件,把框架 git 保留为 git。
## 参考文献
- [Xia 等人,Live-SWE-agent](https://arxiv.org/abs/2511.13646)
- [Zhang 等人,Darwin Gödel Machine](https://arxiv.org/abs/2505.22954)
- [Sakana,The Darwin Gödel Machine](https://sakana.ai/dgm/)
- [Zhou 等人,Self-Evolving Coding Agents](https://arxiv.org/abs/2608.03392)
- [Chen 等人,SWE-Exp](https://arxiv.org/abs/2507.23361)
- [Li 等人,CODESKILL](https://arxiv.org/abs/2605.25430)
- [Li 等人,SkillsBench](https://arxiv.org/abs/2602.12670)
- [Yang 等人,mini-SWE-agent](https://github.com/SWE-agent/mini-swe-agent)
- [Schmidhuber,Gödel Machines](https://arxiv.org/abs/cs/0309048)
- [Karten 等人,Prime Agent](https://arxiv.org/abs/2608.23552)
- [Prime Intellect,Prime Agent](https://www.primeintellect.ai/blog/prime-agent)
- [Pi coding agent](https://github.com/earendil-works/pi)
- [pi-continual](https://www.npmjs.com/package/pi-continual)
- [Nous Research,Hermes Agent](https://github.com/NousResearch/hermes-agent)
- [Anthropic,Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
- [OpenAI,Codex agent loop](https://openai.com/index/unrolling-the-codex-agent-loop/)
- [Cursor,Continually improving our agent harness](https://cursor.com/blog/continually-improving-agent-harness)
- [Cursor,Towards self-driving codebases](https://cursor.com/blog/self-driving-codebases)
- [Mem0 论文](https://arxiv.org/abs/2504.19413)
- [Mem0,entity-scoped memory](https://docs.mem0.ai/platform/features/entity-scoped-memory)
## 相关链接
- [mem0](https://x.com/mem0ai)
- [@mem0ai](https://x.com/mem0ai)
- [12K](https://x.com/mem0ai/status/2097725977199865964/analytics)
- [publishes how they retune theirs](https://cursor.com/blog/continually-improving-agent-harness)
- [wrote up a week-long multi-agent run](https://cursor.com/blog/self-driving-codebases)
- [Codex loop](https://openai.com/index/unrolling-the-codex-agent-loop/)
- [writes skills by hand](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
- [agentskills.io](https://agentskills.io/)
- [Hermes](https://github.com/NousResearch/hermes-agent)
- [Prime Agent](https://www.primeintellect.ai/blog/prime-agent)
- [pi-continual](https://www.npmjs.com/package/pi-continual)
- [Karten et al.](https://arxiv.org/abs/2608.23552)
- [Zhou et al.](https://arxiv.org/abs/2608.03392)
- [Live-SWE](https://arxiv.org/abs/2511.13646)
- [mini-SWE](https://github.com/SWE-agent/mini-swe-agent)
- [subprocess.run](https://subprocess.run/)
- [Navidrome](https://github.com/navidrome/navidrome)
- [SkillsBench](https://arxiv.org/abs/2602.12670)
- [CODESKILL](https://arxiv.org/abs/2605.25430)
- [DGM](https://arxiv.org/abs/2505.22954)
- [Gödel Machine](https://arxiv.org/abs/cs/0309048)
- [Sakana's writeup](https://sakana.ai/dgm/)
- [SWE-Exp](https://arxiv.org/abs/2507.23361)
- [Mem0](https://docs.mem0.ai/platform/features/entity-scoped-memory)
- [Xia et al., Live-SWE-agent](https://arxiv.org/abs/2511.13646)
- [Zhang et al., Darwin Gödel Machine](https://arxiv.org/abs/2505.22954)
- [Sakana, The Darwin Gödel Machine](https://sakana.ai/dgm/)
- [Zhou et al., Self-Evolving Coding Agents](https://arxiv.org/abs/2608.03392)
- [Chen et al., SWE-Exp](https://arxiv.org/abs/2507.23361)
- [Li et al., CODESKILL](https://arxiv.org/abs/2605.25430)
- [Li et al., SkillsBench](https://arxiv.org/abs/2602.12670)
- [Yang et al., mini-SWE-agent](https://github.com/SWE-agent/mini-swe-agent)
- [Schmidhuber, Gödel Machines](https://arxiv.org/abs/cs/0309048)
- [Karten et al., Prime Agent](https://arxiv.org/abs/2608.23552)
- [Prime Intellect, Prime Agent](https://www.primeintellect.ai/blog/prime-agent)
- [Pi coding agent](https://github.com/earendil-works/pi)
- [pi-continual](https://www.npmjs.com/package/pi-continual)
- [Nous Research, Hermes Agent](https://github.com/NousResearch/hermes-agent)
- [Anthropic, Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
- [OpenAI, Codex agent loop](https://openai.com/index/unrolling-the-codex-agent-loop/)
- [Cursor, Continually improving our agent harness](https://cursor.com/blog/continually-improving-agent-harness)
- [Cursor, Towards self-driving codebases](https://cursor.com/blog/self-driving-codebases)
- [Mem0 paper](https://arxiv.org/abs/2504.19413)
- [Mem0, entity-scoped memory](https://docs.mem0.ai/platform/features/entity-scoped-memory)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [12:37 AM · Sep 10, 2026](https://x.com/mem0ai/status/2097725977199865964)
- [12.5K Views](https://x.com/mem0ai/status/2097725977199865964/analytics)
- [View quotes](https://x.com/mem0ai/status/2097725977199865964/quotes)
---
*导出时间: 2026/9/10 09:09:14*