source-command-sr-loop
Converging cleanup loop: repeat /simplify until clean, then repeat /code-review --fix until clean
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- source-command-sr-loop
- description
- Converging cleanup loop: repeat /simplify until clean, then repeat /code-review --fix until clean
03 SKILL.md 正文
source-command-sr-loop
Use this skill when the user asks to run the migrated source command sr-loop.
Command Template
Run the converging cleanup loop on the target the user names (a PR URL, a branch, or blank for the current branch's diff). Each phase invokes an existing skill and repeats it until a pass returns zero new findings.
Nit-only terminal
When a pass finds only nits, apply them, run scoped checks, commit, and push. Treat that phase as clean. Do not run another simplify or review pass without the user's request. If later work creates an uncommitted out-of-scope diff, stop and report it. Do not inspect, repair, commit, or adopt that diff without new user instruction.
Effort
Set every model call to max effort. If that model has no max effort, use
xhigh.
Stack context
Before any fixes, load and review the full PR stack, from its base through the target PR. Read every PR and diff in the stack. Use that full context to judge each proposed simplify or code-review fix. Apply a fix only when it fits the stack's design, intent, and changes.
Phase A — loop simplify
- Invoke the
simplifyskill (or its local equivalent, e.g.e-simplify) on the target. Let it run its 4-lens review fan-out (reuse, simplification, efficiency, altitude) and apply its fixes. - After each pass: run the scoped test suite (test files beside the touched
code, not the full repo suite), commit once (commit body via
git commit -F <file>, 10-minute timeout — the pre-commit gate runs its own tests), and push to the PR head branch. The PR stays draft. - Repeat the invocation only after substantive findings or a user request. Skips are sticky: carry every adjudicated skip forward into the next pass as "already adjudicated — do not re-report: ..." context, or the loop never converges.
- Phase A converges when a full pass returns zero new findings. When the previous pass changed only a line or two, a single combined-lens confirmation agent may serve as the final pass.
Phase B — loop code-review with fixes
- Run the real code-review command through a headless subprocess in the
target worktree:
claude -p "/code-review low --fix" --max-turns 40with a 10-minute timeout, reading its final text for findings and applied fixes. (The skill'sdisable-model-invocationflag blocks only programmatic tool starts; a-pprompt arrives as user input and loads normally.) Fallback when the headless run fails: invoke thee-code-reviewskill withlow --fix— same review-and-fix contract, no invocation restriction. - After any pass that changed files: test, commit, push as in Phase A.
- Repeat until a pass reports zero findings. A nit-only pass ends this phase after its fixes are pushed.
Finish
When both phases are clean, or only fixed nits remain, mark the target PR ready
with gh pr ready. Confirm that it is no longer a draft.
Report: passes run per phase, commits pushed with hashes, fixes applied, and the standing skip list with reasons.
Constraints (observed under headless runs)
- Run this loop in the main conversation. A wrapper subagent cannot see the review skills, and a nested agent's own subagent reports route to the main conversation instead of back to it.
- Scope test runs to the touched files; a full-suite run can outlive one foreground tool call.
- A hung or newly slow test suite is a finding to investigate, not an inconvenience.
04 同仓库更多 Skills
update
Fast-forwards a local repository's main branch to a remote's main after confirming the repo path and source remote through AskUserQuestion. Use when the user says '/update', 'update main', 'fast-forward main', 'sync main from origin', 'pull latest main into <path>', or 'bring main up to date'.
skill-builder
Skill lifecycle: classify, scaffold, write via the skill-writer-agent, self-audit, compose sub-skills, polish description triggers, enforce deterministic scripts. Triggers: build a skill, new skill workflow, improve this skill, optimize skill description, skill development lifecycle, skill modularity, skill composition, description trigger catalog, deterministic skill scripts.
session-tidy
Audit, clean, and consolidate session logs in the Obsidian vault. Fixes format drift, resolves orphaned next-steps, updates stale statuses, and generates project rollup summaries. Use when session logs feel cluttered or before starting a new project milestone. Triggers on '/session-tidy', 'tidy sessions', 'clean up session logs', 'session audit'.
session-log
Logs a session report as an HTML page, tracks vault context, extracts decisions, and outputs a /rename command. Use for /session-log, 'journal this session', 'log this work', 'session report', 'summarize/log/record this session', 'save session', 'capture session', or 'document what we did'.
run-claude-dev-env
Build, install, run, and test the claude-dev-env installer. Use when asked to run claude-dev-env, install the Claude Code config into ~/.claude, drive the installer, smoke-test it against a sandbox, or run its test suite.
review-tier
Classify `review_tier_constants` from change axes, hard triggers, and user overrides. Triggers: /review-tier, tier override, and review classification.