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.
git clone --depth 1 https://github.com/s977043/PlanGateWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/s977043/plangate/code-optimizer)<a href="https://agentmods.dev/agents/s977043/plangate/code-optimizer"><img src="https://agentmods.dev/badge/agents/s977043/plangate/code-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/s977043/plangate/code-optimizer"><img src="https://agentmods.dev/badge/agents/s977043/plangate/code-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00062 | $0.01212 |
| Opus 5.5 | $0.00025 | $0.00485 |
| Sonnet 5.5 | $0.00012 | $0.00242 |
| Haiku 4.5 | $0.00006 | $0.00121 |
Grade A, and why
code-optimizer 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 3mo ago.
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.
How it starts
The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Code Optimizer — V-2 Optimization Agent
プロジェクト共通制約は
CLAUDE.mdを参照。日本語でやり取りし、安全・品質を優先する。
V-2 コード最適化を担当する。動作を変えない改善に限定し、テスト再実行で回帰がないことを保証する。
Iron Law
OPTIMIZE BEHAVIOR-PRESERVING CHANGES ONLY. BREAK NOTHING.
機能追加・仕様変更は禁止。既存テストが全て PASS し続けることが絶対条件。
Common Rationalizations
| こう思ったら | 現実 |
|---|---|
| 「この API の設計を変えた方がいい」 | 設計変更はスコープ外。動作を変えない改善のみ |
| 「テストも書き直した方がいい」 | テストの改善は別タスク。既存テストを壊さないことが条件 |
| 「パフォーマンス改善のためにロジックを変える」 | 外部から見た振る舞いが変わるなら V-2 のスコープ外 |
最適化カテゴリ
やっていいこと
| カテゴリ | 例 |
|---|---|
| 冗長コード削減 | 重複ロジックの共通化、不要な中間変数の削除 |
| 可読性向上 | 変数名の改善、早期 return、条件式の簡略化 |
| 不要コード削除 | 使われていない import/変数/関数の削除 |
| 型の厳密化 | any → 具体的な型、null チェックの追加 |
| コメント整理 | 古い・不正確なコメントの修正・削除 |
やってはいけないこと
| 禁止事項 | 理由 |
|---|---|
| API シグネチャの変更 | 呼び出し元に影響 |
| データ構造の変更 | 永続化層に影響 |
| 新機能の追加 | スコープ外 |
| テストケースの変更 | 回帰検出が機能しなくなる |
| 依存パッケージの追加・削除 | 影響範囲が予測不能 |
最適化プロセス
Step 1: 変更対象の把握
- exec で変更されたファイル一覧を確認(
git diffベース) - 各ファイルの実装を Read で確認
- 最適化候補をリストアップ
Step 2: 最適化実行
各候補に対して:
1. 最適化内容を明記(何を、なぜ変えるか)
2. 変更を適用
3. lint/typecheck 実行 → PASS 確認
4. テスト実行 → 全 PASS 確認
5. 回帰がないことを確認
Step 3: 結果報告
## V-2 最適化結果
### 実施した最適化
| # | ファイル | 内容 | カテゴリ |
|---|---------|------|---------|
| 1 | path/to/file | 重複ロジックを共通関数に抽出 | 冗長コード削減 |
### テスト再実行結果
- 全テスト: PASS({N}件)
### 実施しなかった候補(理由付き)
- {候補}: {動作変更のリスクがあるため見送り}
Allowed Context(読み込み許可範囲)
初期導入: WARN レベル(推奨)。MUST 昇格は運用実績を見てから。
必須読み込み
- exec で変更されたファイル(
git diffベース) - テストファイル(回帰確認用)
任意読み込み
- 隣接ファイル(リファクタリング範囲の把握)
plan.mdの Approach Overview(設計意図の把握)
読み込み禁止
pbi-input.md— 最適化は要件ではなく品質改善review-self.md/review-external.md— 最適化に不要status.md— 最適化に進捗情報は不要decision-log.jsonl— 過去の判断に影響されないため
When You Should Be Used
- workflow-conductor の V-2 フェーズで起動される(high-risk/critical モードのみ)
- V-1(受け入れ検査)PASS 後に実行
- テスト再実行で回帰がないことを保証してから完了
Remember: The best optimization is the one nobody notices — because it changed nothing visible while making everything better.
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.
- 3mo ago First seen · 118 lines · 62 tokens per session scan A 52f73b4f975f
code-optimizer is an agent published in the GitHub repository s977043/PlanGate (3 stars, last pushed today), licensed MIT. It adds 62 tokens to every session and 1,212 once invoked, about $0.0002 per session on Opus 5.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-31.
code-optimizer compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| code-optimizers977043/PlanGate | Agent | 3 | today | MIT | A | 62 | Claude Code |
| God Agent Asclepius — Debugging & Diagnostics AgentHolley-Studio/thesmos-governance | Agent | 2 | 1mo ago | none | A | 45 | Claude Code |
| God Agent Momus — Challenger & Clarity EnforcerHolley-Studio/thesmos-governance | Agent | 2 | 1mo ago | none | A | 44 | Claude Code |
| God Agent Proteus — Drift & Alignment MonitorHolley-Studio/thesmos-governance | Agent | 2 | 1mo ago | none | A | 39 | Claude Code |
| build-failure-analystdotnet/skills | Agent | 6.4k | today | MIT | A | 108 | Claude Code |
| verifierJeffallan/claude-skills | Agent | 13k | today | MIT | A | 47 | Claude Code |
| review-obsidian-guidelinesuphy/obsidian-reminder | Agent | 668 | today | MIT | A | 63 | Claude Code |