Command Palette

Search for a command to run...

Back to skills
skill № 41334

zaofu-bug-fix-cycle

Operator playbook for resuming cangjie work after zaofu.bug.detected — stash, fix in ZaoFu repo, restart watcher, resume.

FreeNo executable scripts
uisee-aiby uisee-ai★ 36 GitHub stars

Install zaofu-bug-fix-cycle in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

zaofu-bug-fix-cycle

When cangjie's events.jsonl periodic scan emits zaofu.bug.detected, an operator-mediated fix cycle takes over. The cangjie task state is paused; zaofu kernel is patched + pushed; watcher restarts pick up the new code; cangjie resumes with no work loss.

Important: zaofu must not modify itself. The fix cycle is an operator activity (or a separate sprint-card-driven zaofu repo activity), not an in-flight kernel patch.

分层边界(先判断该不该用本技能)

补救分四层,逐层升级,本技能只占最后一层:

  1. worker 排错 — yoke/debugging-triage。任务途中测试挂/构建断/行为不符, worker 自己 Stop-the-Line 分诊。属任务内部,不升级。
  2. Tier-2 诊断 — yoke/diagnosis(kernel: diagnosis.requested / diagnosis.completed / diagnosis.failed,src/zf/runtime/diagnosis.py, task tasks/2026-07-06-0930-P0-tier2-diagnostic-intervention.md)。同一 stall 指纹 K≥3 不收敛时按需 spawn 诊断者 attach 读现场,产结构化 next_action (propose-only)。仍在目标项目自身的运行闭环内。
  3. 授权自愈 — zf-self-repair。autoresearch/supervisor 点名一个 harness 自 bug 且操作员已授权(ZF_AUTORESEARCH_AUTO_REPAIR=authorized), Claude/Codex 在隔离 worktree 里 backlog→修→按成功判据验→带 commit hash 标 done,红则不合、升级。
  4. 本技能(操作员中介的内核修复) — zaofu.bug.detected 命中一个 zaofu 内核自 bug 且没有授权自愈接管时,操作员手动介入:暂停目标项目、在 zaofu 仓 patch+push、重启 watcher、resume。

移交:1/2 停在项目运行闭环;确认根因在 zaofu 内核后升到 3(有授权)或 4(操作 员手动)。3 与 4 互斥——同一 bug 要么走授权自愈的自动 loop,要么走本技能的 操作员 loop,不要两条同时跑。

Triggers

zaofu.bug.detected event payload structure (β-1 output). This event type is registered in known_types and is a wake_pattern, so it wakes the watcher on emit:

{
  "type": "zaofu.bug.detected",
  "actor": "zf-cli",
  "payload": {
    "signature": "ship_block_loop | respawn_failure_cascade | judge_failure_loop",
    "confidence": "high | medium | low",
    "evidence_event_ids": ["evt-...", "evt-..."],
    "suggested_fix_area": "src/zf/runtime/<module>.py",
    "run_state_snapshot": { /* 形状随 signature 变,见下表 */ }
  }
}
  • run_state_snapshot 是当前字段名(orchestrator.py _run_zaofu_bug_scan 铸造)。旧名 cangjie_state_snapshot 保留为 legacy alias(SignatureMatch 上的只读 property;zf bug-fix-cycle 也向后兼容读 both keys),新代码只写 run_state_snapshot。

  • snapshot 字段随 signature 不同,不存在同时含 pdd_id+task_id 的组合 (核实源 src/zf/runtime/zaofu_bug_signatures.py):

    signature run_state_snapshot 字段
    ship_block_loop pdd_id, blockers, occurrence_count
    respawn_failure_cascade instance_id, occurrence_count
    judge_failure_loop task_id, occurrence_count, rejection_summaries

Cycle (step 0 诊断 + 4 步手动)

0. 诊断(zf bug-fix-cycle — 已落地,只读)

zf bug-fix-cycle [--state-dir DIR] [--signature <name>] [--json] 读目标项目 .zf/events.jsonl 里最近一条 zaofu.bug.detected(可按 signature 过滤),打印 证据事件、suggested_fix_area、run_state_snapshot,并回显下面 4 步剧本。这是 只读诊断助手——不 stash、不重启、不 emit。剩余自动化仍规划中(见文末 「β-3 自动化」)。

cd /path/to/project
zf bug-fix-cycle --signature ship_block_loop              # human 诊断
zf bug-fix-cycle --json | jq .payload.run_state_snapshot  # 机读

拿到诊断后,手动走下面 4 步。

1. Stash cangjie task state

Cangjie's git working tree may be partially mid-task. Snapshot it:

cd /path/to/project
git stash push -u -m "zaofu-fix-pause-<bug-signature>"

# Record the bookmark so resume knows the precise return point.
mkdir -p .zf/tmp
echo "stashed_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)" > .zf/tmp/fix-cycle-bookmark
echo "feature_id=<F-id from payload>" >> .zf/tmp/fix-cycle-bookmark
echo "task_id=<TASK-id from payload>" >> .zf/tmp/fix-cycle-bookmark
echo "branch=$(git branch --show-current)" >> .zf/tmp/fix-cycle-bookmark
echo "head=$(git rev-parse HEAD)" >> .zf/tmp/fix-cycle-bookmark

2. Fix zaofu (in /path/to/zaofu)

Read the evidence events to confirm the failure pattern, then patch the suggested fix area:

cd /path/to/zaofu

# Read the evidence
for ev_id in <evidence_event_ids from payload>; do
    grep "\"id\":\"$ev_id\"" /path/to/project/.zf/events.jsonl
done

# Implement the fix in suggested_fix_area
# Validate-First Discipline: confirm the bug still reproduces against
# the current zaofu HEAD before writing the fix (see zaofu/CLAUDE.md §
# "Validate-First Discipline").

# TDD: add a regression test that replays the evidence events.
# 方法见 yoke/tdd-evidence(bug 先复现、测试即证据)。
.venv/bin/python -m pytest tests/test_<area>.py --no-cov -q

# Full suite
.venv/bin/python -m pytest --no-cov -q

# Commit + push
git add ...
GIT_AUTHOR_NAME="..." GIT_AUTHOR_EMAIL="..." \
GIT_COMMITTER_NAME="..." GIT_COMMITTER_EMAIL="..." \
  git commit -m "fix: <bug-sig> — <one-line>"
git push origin dev

3. Restart cangjie watcher

In-process zaofu instance is on pre-fix code. Restart to load the new kernel:

cd /path/to/project
/path/to/zaofu/.venv/bin/python -m zf.cli.main stop
/path/to/zaofu/.venv/bin/python -m zf.cli.main start &

Wait for session.started + loop.started in .zf/events.jsonl.

4. Resume cangjie task

cd /path/to/project
git stash p
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the zaofu-bug-fix-cycle skill do?

Operator playbook for resuming cangjie work after zaofu.bug.detected — stash, fix in ZaoFu repo, restart watcher, resume.

How do I install the zaofu-bug-fix-cycle skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the zaofu-bug-fix-cycle skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare zaofu-bug-fix-cycle with