Three independently ugly bugs that all fed the same log flood:
* Electron's `WebFrameMain.send` writes every "Render frame was disposed"
to stderr via `console.error`. When the worker fans a second
agent-event past a reloading renderer, we produced thousands of
identical lines and stalled the main loop on stderr I/O. Added a
`mainFrame.detached` guard so the send is short-circuited before
Electron's own catch block fires, and installed a targeted filter in
`suppress-warnings.ts` (now actually imported from the entry point)
so the specific `console.error("Error sending from webFrameMain:"…)`
noise never reaches the terminal. Any other payload still surfaces.
* `dispatchAgentMessage` accepted the human-reader sentinel as a wake
target when an agent replied to `__board__` — `wakeAgentIfPossible`
then called `db.getAgent("__board__")`, threw, and the dispatcher
kept repeating on every send. Strip `HUMAN_SENDER_ID` at
`resolveMessageWakeTargets`, and keep a defense-in-depth guard in the
heartbeat so a stray caller (future automation fan-out) cannot
reintroduce the crash.
* Pi's skills loader rejects any SKILL.md whose frontmatter `name`
diverges from its parent directory. The four bundled `my-writing-style`
copies declared `name: writing-style-skill`, so every install emitted
a warning and dropped the skill. They also lived as orphan gitlinks
(mode 160000 without .gitmodules), and the global `*.md` gitignore
hid every other SKILL.md from version control. Fixed the frontmatter
to match the dir, converted the dangling submodules to plain trees,
and allowlisted `builtin-skills/**/*.md` so a fresh clone carries the
catalogue instead of silently losing it.
72 lines
1.9 KiB
Markdown
72 lines
1.9 KiB
Markdown
# Writing Style Skill
|
||
|
||
可复用的写作风格 Skill 模板。**内置自动学习** — 从你的修改中自动提取规则,SKILL.md 越用越准。
|
||
|
||
兼容 **Claude Code** + **OpenClaw (ClawHub)**。
|
||
|
||
## 原理
|
||
|
||
```
|
||
AI 用 SKILL.md 写初稿 → 你改到满意 → diff 两版 → 提取规则 → 更新 SKILL.md → 下次更准
|
||
```
|
||
|
||
只要两个数据点:**original**(AI 第一版)和 **final**(你最终版)。中间改了多少轮不管。
|
||
|
||
## 安装
|
||
|
||
```bash
|
||
# Claude Code
|
||
git clone https://github.com/jzOcb/writing-style-skill.git
|
||
cp -r writing-style-skill ~/.claude/skills/my-writing-style
|
||
|
||
# OpenClaw / ClawHub
|
||
npx clawhub@latest install jz-writing-style-skill
|
||
```
|
||
|
||
## 快速开始
|
||
|
||
1. **改 SKILL.md** — 把模板里的风格规则改成你自己的(或留空,让自动学习帮你填)
|
||
2. **让 AI 用这个 skill 写内容**
|
||
3. **你改到满意**
|
||
4. 记录:
|
||
```bash
|
||
python3 scripts/observe.py record-original draft.md
|
||
# ... 你修改 ...
|
||
python3 scripts/observe.py record-final final.md
|
||
```
|
||
5. 提取规则:
|
||
```bash
|
||
python3 scripts/improve.py auto --skill .
|
||
```
|
||
|
||
## 文件结构
|
||
|
||
```
|
||
writing-style-skill/
|
||
├── SKILL.md # 你的写作风格(模板,改成你的)
|
||
├── README.md # 本文件
|
||
└── scripts/
|
||
├── observe.py # 记录 original / final(零依赖)
|
||
└── improve.py # 提取 / 应用 / 回滚(需要 LLM CLI)
|
||
```
|
||
|
||
## 自动学习怎么工作
|
||
|
||
- `observe.py` 记录 AI 原稿和你的最终版
|
||
- `improve.py` 用 LLM 分析 diff,提取写作规则
|
||
- 规则按置信度分 P0/P1/P2,P0 自动应用
|
||
- 每次更新前自动备份,一键回滚
|
||
|
||
## LLM 支持
|
||
|
||
`improve.py` 自动检测:
|
||
- `claude` (Claude Code) — 优先
|
||
- `llm` (pip install llm) — 通用
|
||
- `IMPROVE_LLM_CMD` 环境变量 — 自定义
|
||
|
||
`observe.py` 零依赖纯 Python。
|
||
|
||
## License
|
||
|
||
MIT
|