clawq-ultra-maintenance
暂无简介
- License 许可
- Unlicense
- 最近更新
- 2026-11-12
- Stars
- ★ 0
- Forks
- 0
02 资源文件 2
- 参考文档references/methodology.md5.8 KB
- 参考文档references/prompt-pack.md4.4 KB
03 SKILL.md 正文
clawq-ultra-maintenance
A maintenance workflow built by hand out of files + subagents — no Workflow tool required. A gitignored
.maint/<run-id>/ directory is the journal: it holds all state so the run is resumable, and each phase reads
the prior phase's files (handoff) while a claims dir gives fixers mutual exclusion (sync).
You are the coordinator (this main session). You drive phase transitions and maintain the ledger; subagents do the per-unit work and report by writing files, never by messaging you.
Core principle: parallelism = several subagent dispatches in one message (they return when all finish). Files are
durable state + handoff + inter-agent sync — not a polling channel. Treat a missing/incomplete output file exactly
as a workflow treats a null agent result: re-dispatch that unit; never advance a phase on partial output.
Inputs
focus-path(optional arg): restrict scope to a path/component (e.g.src/discord.ml,src/). Default: wholesrc/+test/.- On invoke, detect resume: if the newest
.maint/*/ledger.jsonhasphase != "done"and a matching scope, resume it (start at the first incomplete phase). Otherwise mint a freshrun_id=date +%Y%m%d-%H%M%S.
State layout
.maint/<run-id>/
ledger.json # phase + per-phase status + run config; the resume anchor (you maintain it with Write/Edit)
partition.md # P1: every target file assigned to exactly one finder bucket
findings/<finder>.md # P2: append-only; entries = file:line · bug|maint · sev(H/M/L) · desc · suggested direction
backlog.md # P3: deduped master list, grouped into mostly-disjoint conceptual areas
groups/<g>.plan.md # P4: concrete fix plan per group (what / where / why / which test suites)
claims/<g>.lock/ # P5: atomic claim dir (mkdir) → one fixer per group; survives resume
reports/<g>.md # P5/6: files changed, tests run, gate result, ending with `=== DONE ===`
LOG.md # your human-readable narrator log of phase transitions and any dropped/skipped items
DONE marker: every finder/fixer output file MUST end with a line === DONE ===. A file lacking it = incomplete =
re-dispatch.
ledger.json shape:
{ "run_id": "...", "scope": "src/ test/", "mode": "both", "concurrency": 3,
"phase": "find",
"phases": {"init":"done","partition":"done","find":"in_progress","triage":"todo","plan":"todo","fix":"todo","gate":"todo","final":"todo"},
"finders": ["..."], "groups": ["..."] }
Workflow
Run phases in order. After each, set its status done in ledger.json and advance phase. Append a one-line entry
to LOG.md at every transition.
P0 — Init
- Create
.maint/<run-id>/and subdirs (findings/ groups/ claims/ reports/). - Ensure
.maint/is gitignored (it is NOT by default) — append.maint/to.gitignoreand.dockerignoreif absent. (.worktrees/is already ignored.) - Write the initial
ledger.json.
P1 — Survey & partition
- List target files (
*.ml/*.mliunder scope, plustest/). Bucket them by component/directory so coverage is complete — every file in exactly one bucket. Scale finder count to size (~1 finder per 15–25 files or per cohesive component; sensible cap ~8–10). - Write
partition.md(bucket → file list) and recordfindersin the ledger.
P2 — Find (parallel)
- Dispatch one subagent per bucket in a single message. Each gets the finder prompt (see
references/prompt-pack.md→ Finder), its file list, and its output pathfindings/<finder>.md. - Validate on return: every dispatched finder's file exists and ends with
=== DONE ===. Re-dispatch any missing/incomplete before advancing. Log any finder that produced nothing.
P3 — Triage & group
- Read all
findings/*.md. Dedupe, drop false-positives and low-value noise, keep legitimate bug + maintainability items. (Large finding set → dispatch one triage subagent with the Triage prompt; otherwise do it yourself.) - Write
backlog.md: master list, each itemfile:line · bug|maint · sev · description, organized into mostly disjoint conceptual groups (so groups can be fixed as independent batches without colliding). Recordgroups.
P4 — Plan per group
- For each group write
groups/<g>.plan.md: concrete plan — what changes, where (file:line), why, and the exact test suites to run (make test-run ARGS="test <regex>"). Respect file-size limits (split >1000 LoC files). - This is the handoff that informs P5.
P5 — Fix (parallel, isolated, capped)
- Dispatch fixers in waves of
concurrency(default 3) — system-load norm; each fixer builds/tests in its own worktree. Give each the Fixer prompt, the group plan path, andbacklog.md. - Each fixer:
mkdir .maint/<run-id>/claims/<g>.lock(atomic — if it fails, the group is already claimed → skip) → create worktree.worktrees/maint-<g>on branchmaint-<run-id>-<g>→ implement the plan → run only the named test suites (nevermake test-all; never rundunein parallel within a worktree) → commit at intervals → runreview-and-fixover its own diff (usepirflfor hard/multi-step items) → writereports/<g>.mdending=== DONE ===. The fixer does not merge. - Validate each wave's reports (DONE marker) before the next wave.
P6 — Gate + merge (sequential per group)
- Merges must be serialized (one branch into master at a time). For each group with a DONE report:
- Run an external review: invoke
ccc-review-cxover the group's diff +groups/<g>.plan.md+ relevantbacklog.mdrows. (Ifccc-review-cxis unavailable, fall back to a secondreview-and-fixpass with the reviewer modelopenai-codex:gpt-5.5; if no external reviewer at all, a selfreview-and-fixpass.) - PASS → merge
maint-<run-id>-<g>into master, then remove the worktree (first inspectgit status --porcelain --ignoredand rescue any untracked/gitignored scratch — never blindrm -rf/--force). - FAIL → dispatch a follow-up fixer to address the review findings in the same worktree, then re-gate.
- Run an external review: invoke
- Append the gate result to
reports/<g>.mdand mark the group merged in the ledger.
P7 — Final pass
- Run
review-and-fixover the whole merged diff. Run accc-review-cxreview ofbacklog.mdfor completeness (was every legitimate item actually fixed?). Fix gaps via a fixer agent; re-gate. - When the review PASSes, run
/carmto commit-all + rebase master. Write a final summary toLOG.mdand setphase: done.
Cross-cutting rules
- Resumability: on every invoke, read the ledger and resume at the first incomplete phase. Claimed/merged groups are skipped (claims dir + ledger). Persist artifacts to disk as each unit finishes, not only at the end.
- Validate, never silently truncate: missing output / absent
=== DONE ===⇒ re-dispatch. If you intentionally drop or defer anything (a finding, a group, a file), record it inLOG.md— no silent gaps. - Subagents must NEVER use
attn. Put this line in every dispatch prompt. Agents report by writing their file. - Dune/tests: never two
dunecommands at once in the same checkout; run only the focused suites a change touches; nevermake test-allin a subagent; if you must run broad tests, capture output to a temp file. - Dependency floor: the orchestration needs only bash + subagent dispatch.
review-and-fix,pirfl,ccc-review-cx,carmare invoked by agents and degrade gracefully if absent (fall back to self-review).
Agent prompts
Verbatim, reusable prompt templates (Finder / Triage / Fixer / Gate, plus the boilerplate every dispatch must carry)
live in references/prompt-pack.md. Design rationale and constraints are in
references/methodology.md.
Every dispatch prompt MUST include: the output file path + === DONE === contract; "report by writing your file, not
by messaging"; "never use attn"; and the relevant dune/test rules above.
Done checklist
- [ ]
.maint/+.worktrees/gitignored; ledger reachesphase: done. - [ ] Every target file covered by exactly one finder bucket (P1) and every finder validated (DONE).
- [ ]
backlog.mddeduped and grouped; every legitimate item lands in a group. - [ ] Each group fixed in its own worktree, focused tests green, self-reviewed, gated (external review PASS), merged, worktree removed.
- [ ] Final
review-and-fix+ completeness review PASS;/carmrun; summary inLOG.md.
04 同仓库更多 Skills
run-task
Runs a backlog item (bug, feature, task, epic, milestone, phase) end-to-end by gathering context, constructing a startup prompt, spawning a worktree-backed subagent, and managing the claim/done/review cycle. Use when the user wants to execute a backlog target like B123, F456, P2.M4.E3, etc.
pipeline-designer
Design and create structured output pipelines. Gathers requirements, designs step sequences with output schemas, generates valid YAML pipeline definitions, and validates them.
idea
Log a planning idea to the backlog. Use when the user has a feature idea, enhancement suggestion, or brainstorm they want tracked.
feature
Automate the creation of a new feature for clawq. Gathers requirements, discovers existing capabilities, decomposes into implementation layers, gates risky work behind approval, and delegates implementation. Prefers skills/rigs/cron/templates over OCaml code changes.
telegram-formatting
Telegram HTML and MarkdownV2 formatting reference for clawq message code
pag-review-via-team
review work using teams + review-and-fix