Skip to content

Commit 3043bf9

Browse files
committed
docs: document skill synthesis command
1 parent 4932198 commit 3043bf9

5 files changed

Lines changed: 72 additions & 7 deletions

File tree

‎README.md‎

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ Codex Self-Evolution Plugin 是一个本地优先的 Codex 自我进化层。
1414

1515
它解决的问题很直接:Codex 能完成当前任务,但默认不会把这次任务里学到的用户偏好、项目经验、排查路径和可复用流程带到下一次会话。
1616

17-
这个插件通过 Codex lifecycle hooks、后台 reviewer、定时 compiler 和标准 Codex Skills,把一次会话里的有效经验沉淀为下一次会话可以直接使用的上下文。
17+
这个插件通过 Codex lifecycle hooks、后台 reviewer、定时 compiler、独立 skill synthesis 和标准 Codex Skills,把一次会话里的有效经验沉淀为下一次会话可以直接使用的上下文。
1818

1919
核心闭环:
2020

2121
```text
2222
SessionStart 注入背景
2323
-> Codex 正常工作
2424
-> Stop 阶段复盘会话
25-
-> Compiler 晋升 memory / recall / skills
25+
-> Compiler 晋升 memory / recall
26+
-> Skill Synthesis 生成 csep-synth-* skills
2627
-> 下一次 Codex 会话自动获得更好的上下文
2728
```
2829

@@ -115,6 +116,23 @@ scripts/uninstall-scheduler.sh
115116
scripts/uninstall-codex-hook.sh
116117
```
117118

119+
### 安装 Skill Synthesis 调度器
120+
121+
Compiler 不再创建 generated skills,只负责晋升 memory 和 recall。可复用流程 skill 由独立全局命令合成:
122+
123+
```bash
124+
codex-self-evolution skill-synthesize --mode full --lookback-days 30 --dry-run
125+
codex-self-evolution skill-synthesize --mode incremental --lookback-hours 24
126+
```
127+
128+
安装独立的 4 小时 launchd 任务:
129+
130+
```bash
131+
scripts/install-skill-synthesis-scheduler.sh
132+
```
133+
134+
Synthesized skills 只写入 `~/.codex/skills/csep-synth-*`。既有 `csep-*` compiler skills 是 legacy read-only artifacts。
135+
118136
## 快速开始
119137

120138
### 1. 检查运行状态
@@ -179,7 +197,8 @@ bucket 连续 drain 几轮,避免 5 分钟定时造成积压。如需回退旧
179197
| --- | --- | --- |
180198
| SessionStart | 读取稳定背景和 recall contract,注入当前会话 | `USER.md`、`MEMORY.md`、recall policy |
181199
| Stop Review | 对本次会话做结构化复盘 | pending `SuggestionEnvelope` |
182-
| Compile | 批量归纳并晋升建议 | memory、recall、managed skills、receipt |
200+
| Compile | 批量归纳并晋升建议 | memory、recall、receipt |
201+
| Skill Synthesis | 周期性扫描历史证据并合成可复用流程 | `~/.codex/skills/csep-synth-*`、synthesis receipt |
183202
| Next Session | 下次会话自动读取有效资产 | 更准的背景、更少重复解释 |
184203

185204
![Codex Self Evolution promotion pipeline](docs/assets/readme-compiler-promotion.png)
@@ -189,12 +208,17 @@ bucket 连续 drain 几轮,避免 5 分钟定时造成积压。如需回退旧
189208
```text
190209
~/.codex-self-evolution/
191210
├── .env.provider
211+
├── skill_synthesis/
212+
│ ├── runs/
213+
│ ├── receipts/
214+
│ ├── evidence_index.json
215+
│ └── last_receipt.json
192216
└── projects/
193217
└── -Users-you-code-repo/
194218
├── suggestions/{pending,processing,done,failed,discarded}/
195219
├── memory/
196220
├── recall/
197-
├── skills/managed/
221+
├── skills/managed/ # legacy compiler skill artifacts
198222
├── compiler/
199223
├── review/snapshots/
200224
└── scheduler/
@@ -208,7 +232,7 @@ bucket 连续 drain 几轮,避免 5 分钟定时造成积压。如需回退旧
208232
| --- | --- |
209233
| Memory | 长期稳定事实,例如用户偏好、环境约束、项目习惯。 |
210234
| Recall | 与具体项目 / 任务相关的历史经验,用于按需召回。 |
211-
| Generated Skills | 可复用操作流程,会投影到 `~/.codex/skills/csep-<skill-id>/SKILL.md`,让 Codex 像普通 skill 一样加载。 |
235+
| Generated Skills | 可复用操作流程,由 `skill-synthesize` 写入 `~/.codex/skills/csep-synth-*`,让 Codex 像普通 skill 一样加载。 |
212236
| Receipts | compiler 执行记录,用于审计和排查。 |
213237
| Review snapshots | Stop 阶段的标准化输入快照,用于复盘 reviewer 质量。 |
214238

‎docs/getting-started.md‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> 适用环境:macOS + bash + Python 3.11+。
44
>
5-
> 目标:在**不改任何插件代码**的前提下,按阶段把 reviewer → compile → memory/recall/skills 的整条循环在你本机跑通,然后再选择是否挂到 launchd 自动调度。
5+
> 目标:在**不改任何插件代码**的前提下,按阶段把 reviewer → compile → memory/recall → skill-synthesize 的整条循环在你本机跑通,然后再选择是否挂到 launchd 自动调度。
66
77
全文档结构:
88

@@ -160,7 +160,7 @@ EOF
160160
- `"status": "success"` + `processed_count >= 1`
161161
- `$STATE/memory/USER.md`、`MEMORY.md`、`memory.json` 写好
162162
- `$STATE/recall/index.json`、`compiled.md` 写好
163-
- `$STATE/skills/managed/*.md`(如果 reviewer 给了 skill_action)
163+
- compiler 不再写 `$STATE/skills/managed/*.md`; 历史 `skill_action` 会被记为 `skill_action_disabled`
164164
- `$STATE/compiler/last_receipt.json` 记录这次的结果
165165
- 对应 `pending/*.json` 被移到 `done/*.json`
166166

@@ -290,6 +290,23 @@ JSON 丢弃(不会报错,就是"悄悄没效果")。如果模型答不出 XANADU
290290
| `CSEP_SCHEDULER_INTERVAL` | `300` | 秒。改成 `60` 更激进,`900` 更省电 |
291291
| `CSEP_SCHEDULER_BACKEND` | `agent:opencode` | `script` 禁掉语义合并(testing/debug 用) |
292292

293+
### 4.1.1 独立 Skill Synthesis 调度
294+
295+
Compiler 只晋升 memory / recall。可复用 workflow skills 由独立全局命令处理:
296+
297+
```bash
298+
codex-self-evolution skill-synthesize --mode full --lookback-days 30 --dry-run
299+
codex-self-evolution skill-synthesize --mode incremental --lookback-hours 24
300+
```
301+
302+
安装独立 4 小时 launchd 任务:
303+
304+
```bash
305+
./scripts/install-skill-synthesis-scheduler.sh
306+
```
307+
308+
生成的 skill 只会写到 `~/.codex/skills/csep-synth-*`。既有 `csep-*` compiler skills 保留为 legacy read-only artifacts。
309+
293310
### 4.2 观察
294311

295312
```bash

‎plugins/codex-self-evolution/.codex-plugin/plugin.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"name": "scan",
3030
"command": "codex-self-evolution scan --backend agent:pi --max-runs-per-project 3"
3131
},
32+
{
33+
"name": "skill-synthesize",
34+
"command": "codex-self-evolution skill-synthesize"
35+
},
3236
{
3337
"name": "status",
3438
"command": "codex-self-evolution status"
@@ -46,6 +50,7 @@
4650
"scheduler": {
4751
"recommended": "launchd",
4852
"scan_command": "codex-self-evolution scan --backend agent:pi --max-runs-per-project 3",
53+
"skill_synthesis_command": "codex-self-evolution skill-synthesize --mode incremental --lookback-hours 24",
4954
"preflight_command": "codex-self-evolution compile-preflight --state-dir \"$CODEX_STATE_DIR\"",
5055
"compile_command": "codex-self-evolution compile --once --state-dir \"$CODEX_STATE_DIR\" --backend agent:pi"
5156
}

‎src/codex_self_evolution/plugin_bundle/.codex-plugin/plugin.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"name": "scan",
3030
"command": "codex-self-evolution scan --backend agent:pi --max-runs-per-project 3"
3131
},
32+
{
33+
"name": "skill-synthesize",
34+
"command": "codex-self-evolution skill-synthesize"
35+
},
3236
{
3337
"name": "status",
3438
"command": "codex-self-evolution status"
@@ -46,6 +50,7 @@
4650
"scheduler": {
4751
"recommended": "launchd",
4852
"scan_command": "codex-self-evolution scan --backend agent:pi --max-runs-per-project 3",
53+
"skill_synthesis_command": "codex-self-evolution skill-synthesize --mode incremental --lookback-hours 24",
4954
"preflight_command": "codex-self-evolution compile-preflight --state-dir \"$CODEX_STATE_DIR\"",
5055
"compile_command": "codex-self-evolution compile --once --state-dir \"$CODEX_STATE_DIR\" --backend agent:pi"
5156
}

‎tests/test_plugin_bundle_hooks.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_plugin_manifest_commands_use_local_cli_not_uvx():
4949
"--backend agent:pi"
5050
),
5151
"scan": "codex-self-evolution scan --backend agent:pi --max-runs-per-project 3",
52+
"skill-synthesize": "codex-self-evolution skill-synthesize",
5253
"status": "codex-self-evolution status",
5354
"recall": (
5455
'csep recall "$CODEX_RECALL_QUERY" --cwd "$CODEX_CWD" '
@@ -64,6 +65,9 @@ def test_plugin_manifest_commands_use_local_cli_not_uvx():
6465
assert scheduler["scan_command"] == (
6566
"codex-self-evolution scan --backend agent:pi --max-runs-per-project 3"
6667
)
68+
assert scheduler["skill_synthesis_command"] == (
69+
"codex-self-evolution skill-synthesize --mode incremental --lookback-hours 24"
70+
)
6771
assert scheduler["preflight_command"] == (
6872
'codex-self-evolution compile-preflight --state-dir "$CODEX_STATE_DIR"'
6973
)
@@ -89,6 +93,16 @@ def test_packaged_plugin_copy_matches_root_hook_bundle():
8993
assert packaged_hooks == root_hooks
9094

9195

96+
def test_plugin_manifest_exposes_skill_synthesize_command():
97+
manifest = _load_json(ROOT / "src" / "codex_self_evolution" / "plugin_bundle" / ".codex-plugin" / "plugin.json")
98+
commands = {entry["name"]: entry["command"] for entry in manifest["commands"]}
99+
100+
assert commands["skill-synthesize"] == "codex-self-evolution skill-synthesize"
101+
assert manifest["scheduler"]["skill_synthesis_command"] == (
102+
"codex-self-evolution skill-synthesize --mode incremental --lookback-hours 24"
103+
)
104+
105+
92106
def test_default_plugin_root_falls_back_to_package_bundle(tmp_path, monkeypatch):
93107
package_dir = tmp_path / "site-packages" / "codex_self_evolution"
94108
metadata_dir = package_dir / "plugin_bundle" / ".codex-plugin"

0 commit comments

Comments
 (0)