Seed:最小化、可自我修改的 Agent 运行支架
英文标题:🔶 Seed: Minimal, self-modifying agent harness
Seed 是一个极简 Agent 起点:其固定层仅包含 `seed.py`,通过 `exec` 工具调用 bash,并让 Agent 从自己可改写的文件中加载系统提示词。与传统框架不同,工具、记忆、技能和约定都需要由 Agent 在每次会话中逐步生长到 `self/` 目录中。项目使用 Simon Willison 的 `llm` 库管理模型与密钥,默认模型为 `openai-codex/gpt-5.6-sol`,并支持 OpenAI、Anthropic、Gemini 和 OpenRouter。该设计让每个安装目录都能基于自身经历演化为不同的 Agent,同时以会话记录作为可供后续分析的“飞行记录器”。
98.9 KB
中文
一个种子 Agent:Agent 能够从中生长出来的最小起点。
这里没有框架。整个冻结层只有 seed.py:一个小型循环,将语言模型连接到唯一一个工具(运行 bash 的 exec),并从一个由 Agent 自己拥有且可以重写的文件中加载系统提示词。通常 Agent 从框架获得的一切——工具、记忆、技能、约定——都必须由 Agent 在一次次会话中自行“生长”,并存入其 self/ 目录。
mkdir my-agent && cd my-agent
uvx --from git+https://github.com/vivekhaldar/seed.git seed
首次运行会将 seed.py 和 run_seed.sh 复制到当前目录(绝不覆盖已经存在的文件),初始化 self/SELF.md,并在新建的 git 仓库中一并提交这些文件——这个循环属于该个体自身的历史,而不只是 self/ 的历史。随后,它会将你带入一个 REPL。开始对话即可。Agent 想要保留的一切都必须写入 self/;会话是短暂的,除此之外没有任何内容会留存。
使用本地运行器回到同一个 Agent——无需再次运行 uvx:
./run_seed.sh
./run_seed.sh -m gemini-2.5-pro
每个会话的逐字记录都会保存到 self/sessions/*.json 中(每轮对话后更新)。这是一台飞行记录器,而不是记忆:Agent 启动时从不加载这些记录,但你可以阅读它们——Agent 也可以生长出用于研究自身过去的工具。
一个种子,多个个体:你在每个目录中种下的种子,都会基于自己的经历生长为不同的 Agent,并逐渐分化。
模型和密钥完全由 llm(Simon Willison 的库)处理。默认模型为 openai-codex/gpt-5.6-sol,它使用 Codex CLI 中的 ChatGPT 登录:
codex login # 每台机器仅需执行一次
./run_seed.sh # 使用 openai-codex/gpt-5.6-sol
./run_seed.sh -m gemini-2.5-pro # 或仅为当前会话覆盖模型
内置提供商包括:通过 Codex 订阅或 API key 使用的 OpenAI、Anthropic、Gemini 和 OpenRouter(一个 OpenRouter key 即可解锁数百个模型)。
为什么采用这种形态——McCarthy 的元循环 eval、同像性(homoiconicity)、既有实践,以及我们有意识接受的风险: docs/DESIGN.md。
English / 原文
A seed agent: the smallest starting point from which an agent can grow.
There is no framework here. The entire frozen layer is seed.py — a small loop that connects a language model to exactly one tool (exec, which runs bash) and loads its system prompt from a file the agent itself owns and may rewrite. Everything an agent normally gets from a framework — tools, memory, skills, conventions — must instead be grown by the agent, session by session, into its self/ directory.
mkdir my-agent && cd my-agent
uvx --from git+https://github.com/vivekhaldar/seed.git seed
First run copies seed.py and run_seed.sh into this directory (never overwriting a file that already exists), germinates self/SELF.md, and commits those files together in a fresh git repo here — the loop is part of this individual's history, not only self/. Then it drops you into a REPL. Start talking. Everything the agent wants to keep must be written into self/ — sessions are ephemeral and nothing else survives.
Come back to the same agent with the local runner — no need to uvx again:
./run_seed.sh
./run_seed.sh -m gemini-2.5-pro
A verbatim transcript of every session is recorded to self/sessions/*.json (updated after each turn). This is a flight recorder, not memory: the agent never loads it at boot, but you can read it — and the agent may grow tools to study its own past.
One seed, many individuals: each directory you plant in grows a different agent, diverging based on what it experiences.
Models and keys are handled entirely by llm (Simon Willison's library). The default model is openai-codex/gpt-5.6-sol, which uses the ChatGPT login from the Codex CLI:
codex login # one-time, per machine
./run_seed.sh # uses openai-codex/gpt-5.6-sol
./run_seed.sh -m gemini-2.5-pro # or override it for one session
Bundled providers: OpenAI via a Codex subscription or API key, Anthropic, Gemini, and OpenRouter (one OpenRouter key unlocks hundreds of models).
Why it's shaped this way — McCarthy's metacircular eval, homoiconicity, the prior art, and the risks we consciously accepted: docs/DESIGN.md.