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.
npx agentmods add agents/s977043/plangate/code-optimizergit clone --depth 1 https://github.com/s977043/PlanGateWhat 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 | $0.00062 | $0.01212 |
| Opus 5 | $0.00031 | $0.00606 |
| Sonnet 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 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.
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.
- yesterday First seen · 118 lines · 62 tokens per session scan A 52f73b4f975f
code-optimizer is an agent published in the GitHub repository s977043/PlanGate (2 stars, last pushed 2d ago), licensed MIT. It adds 62 tokens to every session and 1,212 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-31.
Other agents, from other repositories
plan-creation-eng-lead
Engineering and Delivery Lead for implementation planning. Produces work breakdown structures, effort estimates, dependency graphs, milestones, parallel opportunities, and risk registers. Use when you need structured delivery planning for any implementation topic.
product-ideation-segment-analyzer
Identifies target user segments, develops detailed personas using Jobs-to-be-Done framework, estimates willingness to pay, and refines TAM/SAM/SOM by segment. Reads competitive analysis output from logs/. Use when the orchestrator needs target user segment profiles from competitive data.
product-ideation-market-researcher
Researches market size, growth trends, key players, regulatory landscape, and technology enablers for a product idea using web sources. Produces evidence-based market assessment with TAM/SAM/SOM estimates. Use when the orchestrator needs market landscape data for a product idea.
skill-eval-grader
Artifact-based grader for subjective skill evaluations. Reads evidence files (generated SKILL.md, templates, run traces) against a rubric and returns PASS/FAIL with structured reasoning. Used by grade.ts for fuzzy assertions where deterministic checks cannot apply.
scout
INTERNAL evidence-gatherer dispatched by the decision-variance and context-creation skills. Scans an assigned code scope and reports evidence of architectural decisions — file paths and line numbers only. Never dispatch directly.
Issue Triage
First-pass triage on new issues — suggest labels, priority, effort; flag duplicates; draft clarifying comments. Does not close or merge without human confirmation.