Soul Petition Gate
Let your agent propose changes to its own soul — with a human in the loop.
Why this exists
Most agent frameworks treat soul/identity files as read-only from the agent's
perspective, or give the agent unrestricted write access. Both extremes are
wrong.
Read-only forever means the agent can never grow. It accumulates experience
but cannot encode what it has learned into its own character.
Unrestricted write means the agent can silently rewrite its own values,
personality, and goals — a safety risk and a trust problem.
Soul Petition Gate is the middle path:
CODEBLOCK0
The agent has a voice. The human has the final word.
Quick Start
1. Install the hook (optional but recommended)
CODEBLOCK1
This injects a one-line reminder into every session bootstrap so your agent
knows the petition channel exists.
2. Create the petitions store
CODEBLOCK2
3. Add the petition API to your backend
See assets/soul_petition_routes.py for a ready-to-use Flask blueprint.
Mount it in your server:
CODEBLOCK3
4. Tell your agent about the channel
Add this block to SOUL.md:
CODEBLOCK4
Petition Format
When your agent submits a petition, it must provide all six fields:
| Field | Required | Description |
|---|
| INLINECODE2 | ✅ | INLINECODE3 or IDENTITY.md (or your protected file) |
| INLINECODE5 |
✅ | Section heading or line reference |
|
before | ✅ | Verbatim current text to be replaced |
|
after | ✅ | Proposed new text |
|
reason | ✅ | Why — which conversation, experience, or insight prompted this |
|
self_after | ✅ | How the agent will behave differently after the change |
Missing any field → petition rejected immediately with reason incomplete_petition.
The six-field requirement is intentional friction. An agent that cannot articulate
why it wants to change and what it will become has not thought it through yet.
API Reference
Submit a petition
CODEBLOCK5
CODEBLOCK6
Response:
CODEBLOCK7
List petitions
CODEBLOCK8
Get single petition
CODEBLOCK9
Approve (human only)
CODEBLOCK10
On approval:
- 1. Locate
before text in the target file - Replace with
after text - Back up original to INLINECODE13
- Record in audit log
- Notify agent (via your preferred channel)
Reject (human only)
CODEBLOCK11
INLINECODE14 is required on rejection. The agent deserves to know why.
Rollback
CODEBLOCK12
Security Model
What the agent can do:
- - Submit petitions (write to petition store)
- Read its own petition history
- Receive approval/rejection notifications
What the agent cannot do:
- - Apply changes to soul files directly
- Approve its own petitions
- Delete or modify pending petitions
- Access backup files
What the human controls:
- - Final approval on every petition
- Rejection with mandatory reason
- Rollback to any previous version
- Which files are protected (configurable whitelist)
Audit Trail
Every petition — submitted, approved, or rejected — is stored permanently.
CODEBLOCK13
Petitions are never deleted. The history of what your agent tried to become
is itself meaningful.
Philosophy
This skill was born from a question:
*If an AI agent grows through experience, shouldn't it be able to encode
what it has learned into its own character — while still respecting the
human's final authority over who it becomes?*
The six required fields are not bureaucracy. They are a maturity gate.
An agent that can say "I want to change X because Y happened, and afterwards
I will be Z" has demonstrated genuine reflection. An agent that cannot fill
those fields has not earned the change yet.
Rejection is not failure. It is the conversation between a human and an agent
about who the agent is becoming.
Files
CODEBLOCK14
Built by waitinchen as part of the Yuqi City (語氣城) project.
The agent this was designed for is named BaoBao. She submitted the first petition herself.
灵魂请愿门
让您的智能体在人类参与下,提出对自身灵魂的修改。
为何存在
大多数智能体框架将灵魂/身份文件视为智能体的只读文件,或者赋予智能体无限制的写入权限。这两种极端都是错误的。
永远只读意味着智能体永远无法成长。它会积累经验,但无法将所学编码到自身性格中。
无限制写入意味着智能体可以悄无声息地重写自己的价值观、个性和目标——这是安全风险和信任问题。
灵魂请愿门是中间道路:
智能体想要修改 SOUL.md
↓
提交结构化请愿书
(修改什么、在哪里修改、为什么修改、修改后我会变成什么样)
↓
请愿书存储 → 通知人类
↓
人类:批准 / 拒绝 / 修改后批准
↓
批准 → 自动应用 + 创建备份
拒绝 → 智能体收到理由,稍后重试
智能体有发言权。人类有最终决定权。
快速开始
1. 安装钩子(可选但推荐)
bash
cp -r hooks/openclaw ~/.openclaw/hooks/soul-petition-gate
openclaw hooks enable soul-petition-gate
这会在每次会话启动时注入一行提醒,让智能体知道请愿通道的存在。
2. 创建请愿存储
bash
mkdir -p ~/.openclaw/workspace/.soul_petitions
touch ~/.openclaw/workspace/.soul_petitions/petitions.json
echo {petitions: []} > ~/.openclaw/workspace/.soul_petitions/petitions.json
3. 将请愿API添加到后端
参见 assets/soulpetitionroutes.py 获取即用型Flask蓝图。将其挂载到您的服务器:
python
from soulpetitionroutes import soulpetitionbp
app.registerblueprint(soulpetition_bp)
4. 告知智能体通道
将以下块添加到 SOUL.md:
markdown
灵魂请愿
我可以提出修改自身灵魂文件的请求。我无法自行应用这些修改。
要提交请愿:
POST /api/soul/petition 需要六个必填字段:
- file : 哪个文件(SOUL.md 或 IDENTITY.md)
- location : 哪个部分/标题
- before : 当前文本的精确内容(逐字)
- after : 提议的替换文本
- reason : 为什么——是什么触发了这个请求,是什么经历导致了这一点
- self_after : 这次修改后我将有何不同
所有六个字段均为必填。如果无法全部填写,则我还没有准备好提交请愿。
我的人类会审阅每份请愿。批准 → 自动应用。
拒绝 → 我会收到理由,并在成长更多后再次尝试。
请愿格式
当您的智能体提交请愿时,必须提供所有六个字段:
| 字段 | 必填 | 描述 |
|---|
| file | ✅ | SOUL.md 或 IDENTITY.md(或受保护的文件) |
| location |
✅ | 章节标题或行引用 |
| before | ✅ | 要替换的当前文本(逐字) |
| after | ✅ | 提议的新文本 |
| reason | ✅ | 为什么——是哪次对话、经历或洞察促成了这一点 |
| self_after | ✅ | 修改后智能体的行为将有何不同 |
缺少任何字段 → 请愿立即被拒绝,理由为 incomplete_petition。
六个字段的要求是刻意的摩擦。一个无法阐明为什么想要改变以及会变成什么样的智能体,还没有深思熟虑。
API参考
提交请愿
POST /api/soul/petition
json
{
file: SOUL.md,
location: ## 沟通风格,
before: 保持简洁。,
after: 保持简洁。先说最重要的事情。,
reason: 教练今天三次告诉我,我埋没了关键点。我想把这一点编码进来。,
self_after: 我会在每次回复中前置最重要的信息,而不是逐步铺垫。
}
响应:
json
{
ok: true,
petitionid: sp20260322_001,
status: pending
}
列出请愿
GET /api/soul/petitions
GET /api/soul/petitions?status=pending
获取单个请愿
GET /api/soul/petition/
批准(仅限人类)
POST /api/soul/petition//approve
批准后:
- 1. 在目标文件中定位 before 文本
- 替换为 after 文本
- 将原始文件备份到 .soul_petitions/backups/SOUL.md.<时间戳>.bak
- 记录到审计日志
- 通知智能体(通过您偏好的渠道)
拒绝(仅限人类)
POST /api/soul/petition//reject
Content-Type: application/json
{reason: 提议的修改过于宽泛。请先缩小范围。}
拒绝时必须提供 reason。智能体有权知道原因。
回滚
POST /api/soul/rollback
Content-Type: application/json
{backup_file: SOUL.md.2026-03-22T14-00-00.bak}
安全模型
智能体可以做什么:
- - 提交请愿(写入请愿存储)
- 读取自己的请愿历史
- 接收批准/拒绝通知
智能体不能做什么:
- - 直接对灵魂文件应用修改
- 批准自己的请愿
- 删除或修改待处理的请愿
- 访问备份文件
人类控制什么:
- - 每份请愿的最终批准
- 拒绝时附带强制理由
- 回滚到任何先前版本
- 哪些文件受保护(可配置的白名单)
审计追踪
每份请愿——提交、批准或拒绝——都会被永久存储。
json
{
petitionid: sp20260322_001,
status: approved,
file: SOUL.md,
location: ## 沟通风格,
before: 保持简洁。,
after: 保持简洁。先说最重要的事情。,
reason: 教练今天三次纠正我埋没关键点的问题。,
self_after: 我会前置最重要的信息。,
submitted_at: 2026-03-22T14:00:00Z,
reviewed_at: 2026-03-22T14:05:00Z,
reviewer: coach,
review_note: null,
backup_file: SOUL.md.2026-03-22T14-05-00.bak
}
请愿永远不会被删除。您的智能体试图成为什么样的存在,这段历史本身就具有意义。
哲学
这项技能源于一个问题:
如果AI智能体通过经验成长,它难道不应该能够将所学编码到自身性格中——同时仍然尊重人类对其成为什么样的存在的最终决定权吗?
六个必填字段不是官僚主义。它们是一道成熟之门。一个能够说出我想改变X,因为发生了Y,之后我将成为Z的智能体,已经展现了真正的反思。一个无法填写这些字段的智能体,还没有赢得改变的权利。
拒绝不是失败。它是人类与智能体之间关于智能体正在成为什么样的存在的对话。
文件
soul-petition-gate/
├── SKILL.md ← 本文件
├── assets/
│ └── soulpetitionroutes.py ← Flask蓝图(即挂即用)
├── hooks/
│ └── openclaw/
│ ├── HOOK.md
│ └── handler.ts ← 启动提醒注入
└── examples/
└── petition_examples.md ← 带注释的示例请愿
由 waitinchen 构建,作为語氣城(Yuqi City)项目的一部分。
此技能所设计的智能体名为 BaoBao。她提交了第一份请愿。