refine-execute

A command that carries out a planned code change from a plan file. It checks the plan and tests, applies the listed implementation or documentation changes, then performs the specified checks.

In plain words
What is it for?
Use it with a plan file to inspect the scope, update tests when needed, apply approved changes, build the project, run tests, and review the differences.
Why use it?
It provides a defined sequence for reviewing a planned change before implementation and checking the result afterward.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/classmethod/tsumiki/refine-execute
Clone the repo
git clone --depth 1 https://github.com/classmethod/tsumiki
Per session 63 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,248 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.02248
Opus 5 $0.00032 $0.01124
Sonnet 5 $0.00013 $0.00450
Haiku 4.5 $0.00006 $0.00225

Measured yesterday against content hash 325d2b643379, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refine-execute scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/refine-execute.md · 173 lines

How it starts

The opening of the file, as written. The whole thing — 173 lines — stays where its author put it; the contents beside it link to each section on GitHub.

refine-planで作成したplanファイルを読み込み、修正・検証・確認を順番に実施します。テストケースの修正・実装修正・ビルド確認・テスト実行・セキュリティーチェック・差分レビューをすべて完了させます。

context

planファイルパス=$1 ベースディレクトリ="" 修正種別="" 修正対象ファイルリスト=[] テストファイルリスト=[]

steps

  • $1 が指定されていない場合はエラーメッセージを表示して終了する
    • 「planファイルのパスを引数に指定してください。例: /refine-execute .dcs/20260224_refine_xxx/plan.md
  • ベースディレクトリ = $1 のディレクトリ部分(plan.md の親ディレクトリ)
  • step1 を実行する

step1: planファイルの確認

  • $1 を Read で読み込む
  • 修正概要・修正種別・対象ファイル・影響範囲・確認手順を把握する
  • 対象ファイルリストとテストファイルリストを context に設定する
  • 修正内容をユーザーに要約して報告し、続行の確認を求める(AskUserQuestion は使わず、テキストで確認を求める)
  • ユーザーが承認した場合のみ step2 を実行する

step2: テストケースの確認・修正

  • 修正種別がコードの場合(常に実施):
    • テストファイルリストの各ファイルを Read で確認する
    • 修正内容に合わせてテストケースの変更が必要かを判断する
    • 変更が必要な場合: Edit ツールでテストケースを修正する
    • 修正内容に対する新規テストケースが必要かを判断し、必要であれば追加する
  • 修正種別がドキュメント・設定ファイルのみの場合:
    • 「テストケース確認: 対象なし(ドキュメント・設定ファイルのみの修正)」と報告してスキップする
  • step3 を実行する

step3: 実装・ドキュメントの修正

  • planファイルの「修正対象ファイル」セクションの内容に従い、各ファイルを修正する
    • Edit ツールを使って修正前→修正後の変更を適用する
    • 修正箇所が複数ファイルにわたる場合は順番に処理する
    • planの範囲外の変更は行わない(追加変更が必要と気づいた場合はユーザーに報告して確認を求める)
  • 修正が完了したら修正ファイルの一覧をユーザーに報告する
  • step4 を実行する

step4: ビルド確認

  • 修正種別がコードまたは設定ファイルの場合:
    • planファイルの「確認手順 > ビルド確認」に記載のコマンドを Bash で実行する
    • コマンドが記載されていない場合: プロジェクトの構成(package.json, Makefile, go.mod 等)から推測して実行する
    • ビルドエラーが発生した場合: エラー内容をユーザーに報告し、修正してから再実行する
    • 3回以上同じエラーが続く場合は作業を中断してユーザーに報告する
  • 修正種別がドキュメントのみの場合:
    • 「ビルド確認: スキップ(ドキュメントのみの修正)」と報告してスキップする
  • step5 を実行する

step5: テスト実行

  • 修正種別がコードの場合(常に実施):
    • planファイルの「確認手順 > テスト実行」に記載のコマンドを Bash で実行する
    • コマンドが記載されていない場合: プロジェクトの構成から推測して実行する
    • テストが失敗した場合: 失敗内容をユーザーに報告し、実装またはテストを修正してから再実行する
    • 3回以上同じ失敗が続く場合は作業を中断してユーザーに報告する
  • 修正種別がドキュメント・設定ファイルのみの場合:
    • 「テスト実行: スキップ(ドキュメント・設定ファイルのみの修正)」と報告してスキップする
  • step6 を実行する

step6: セキュリティーチェック

  • 修正したファイルの内容を Read で確認し、以下の観点でチェックする:
    • 入力バリデーション: ユーザー入力を受け取る箇所で適切な検証が行われているか
    • 認証・認可: 認証・認可ロジックに変更がある場合、意図しないアクセスが生じないか
    • インジェクション: SQLインジェクション・XSS・コマンドインジェクション等のリスクがないか
    • 機密情報: シークレット・パスワード・トークン等がハードコードされていないか
    • 依存関係: 新たに追加した外部ライブラリに既知の脆弱性がないか
  • 問題が見つかった場合: 内容をユーザーに報告し、修正案を提示して承認を得てから対応する
  • 問題がない場合: 「セキュリティーチェック: 問題なし」と報告する
  • step7 を実行する

Read the full file on GitHub · 173 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 173 lines · 63 tokens per session scan A 325d2b643379

Subscribe to this mod's changes

refine-execute is a command published in the GitHub repository classmethod/tsumiki (974 stars, last pushed 25d ago), licensed MIT. It adds 63 tokens to every session and 2,248 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.