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 commands/acaprino/daodan/prompt-optimizegit clone --depth 1 https://github.com/acaprino/daodanWrote 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/commands/acaprino/daodan/prompt-optimize)<a href="https://agentmods.dev/commands/acaprino/daodan/prompt-optimize"><img src="https://agentmods.dev/badge/commands/acaprino/daodan/prompt-optimize.svg" alt="Measured on agentmods" 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 | $0.00045 | $0.01796 |
| Opus 5 | $0.00023 | $0.00898 |
| Sonnet 5 | $0.00009 | $0.00359 |
| Haiku 4.5 | $0.00005 | $0.00180 |
Grade A, and why
prompt-optimize 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 5d 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 — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Prompt Optimization
CRITICAL RULES
- Read the prompt first. If
$ARGUMENTSis a file path, read the file. If inline text, use it directly. - Never modify the user's original prompt until they approve a variant.
- Show the frontier. Efficiency vs effectiveness is the user's call, not the optimizer's: present variants along that axis with honest cost labels, and let the user pick.
--optimize-foris the shortcut for users who already know their pole. - Never enter plan mode. Execute immediately.
Step 1: Analysis and variant frontier (single subagent pass)
Execute the full analysis and variant generation in a single prompt-engineer subagent call. The agent analyzes first, natively, and returns only the observable artifacts defined in Phase 2: no explicit reasoning scaffold is imposed on it, per its own anti-pattern rules for reasoning models.
Agent:
subagent_type: "prompt-engineer"
description: "Analyze the prompt and generate the variant frontier"
prompt: |
You are evaluating and optimizing a prompt.
## Input
- Original Prompt: [Insert the prompt from $ARGUMENTS]
- Optimization Target: [--optimize-for flag value, or "frontier" when absent]
- Target Model: [--model flag value, default "claude"]
## Phase 1: Analysis (private)
Analyze the prompt thoroughly before writing any output. Extract its behavioral contract
first, then classify the archetype and score on a 1-5 scale only the rubric dimensions that
archetype wants, marking the rest N/A. Identify ambiguities, missing edge cases, structural
weaknesses, and injection vulnerabilities.
Do not include this working in the response: Phase 2 defines the only output you produce.
Usage-profile check: determine how the prompt is used (one-off, repeated system prompt,
agent loop) and whether prompt caching applies. Which tokens matter follows from this:
output tokens bill at full price and dominate latency; a cached prefix bills ~0.1x on
reads, so shortening it saves ~10% of what it appears to, and cache-breaking edits
re-bill it at 1.25x.
Reasoning-pattern check: first determine the target model class. For reasoning models
(extended thinking, o-series, R1 class), default to NO explicit scaffold: direct
instructions plus precise success criteria; consult the "Reasoning models change the
defaults" section of `${CLAUDE_PLUGIN_ROOT}/references/reasoning-patterns.md` before adding
any pattern. Otherwise, decide whether the task would benefit from a structured
reasoning scaffold beyond plain instructions (CoT, Step-Back, ReAct, Tree-of-Thought,
Self-Consistency, Reflexion, Plan-and-Solve, Least-to-Most, Self-Ask, Skeleton-of-Thought).
If yes, read `${CLAUDE_PLUGIN_ROOT}/references/reasoning-patterns.md`, pick the pattern
that matches the task shape using the selection cheat sheet, and apply it in Phase 2.
For the efficiency variant, always consult that file's token-efficient patterns
(Chain of Draft, Concise CoT, token-budget prompting, Sketch-of-Thought) and its
"Cost-aware selection" section: the efficiency pole is built from those techniques,
not from bare word-deletion.
If the existing prompt already scores 4+ on every dimension, do not add a pattern just
for completeness -- record the decision in the analysis instead.
## Phase 2: Output
Based on your analysis, respond strictly in this format:
### Diagnostic Scorecard (original, predicted)
State the archetype in one line, then one row per applicable dimension. Include the
conditional dimensions (output determinism, tool-use correctness, trust boundaries,
evalability, creative latitude) only when this archetype wants them, and list the ones you
marked N/A with a short reason underneath.
| Dimension | Score (1-5) | Key issue |
|-----------|:---:|-------|
| Intent alignment | X | ... |
| Instruction clarity | X | ... |
| Constraint correctness | X | ... |
| Model fit | X | ... |
| Context efficiency | X | ... |
| Robustness | X | ... |
### Variant Frontier
Produce 3 variants by default:
- **A. Max effectiveness**: prioritize quality, robustness, and output control; token cost is secondary.
- **B. Balanced**: resolve the analysis issues at neutral or lower token cost.
- **C. Max efficiency**: minimum tokens at estimated parity, built with a token-efficient
technique where reasoning is involved.
Collapse to fewer variants only when they would genuinely converge (trivial or already
near-optimal prompts); say that you did and why. Each variant is a fully rewritten,
ready-to-use prompt in its own fenced block. Use XML tags if the target model is Claude
and the prompt mixes instructions, context, or examples; headings suffice for simple prompts.
### Comparison
| Variant | Tokens (est.) | Delta vs original | Technique applied | Predicted effect (unmeasured) | What you give up |
Token estimates: characters/4 on the prompt text, labeled "est.". If a variant also
constrains reasoning or output length, state the expected output-token effect
separately: that is where most of the real savings live.
### Behavioral changes
For each variant, report what changed in behavior rather than in wording: constraints
strengthened or relaxed, behaviors removed or added, interface changes, tool-policy or
reasoning-strategy changes, trust boundaries hardened or weakened. Print only the lines that
are true. If a variant changes nothing behavioral, say so in one line. Lead with any
relaxation or removal instead of burying it under the token saving.
### Honesty note
Close with these caveats, adapted to the case:
- Label every quality claim predicted, measured, or verified. A score this pass assigned is
predicted by definition, including the scorecard above.
- Predicted scores and parity are single-pass estimates by the same model that wrote
the variants, not measurements; small formatting changes alone are known to swing
task accuracy, so treat the deltas as hypotheses.
- To actually verify "fewer tokens, same results": run a paired eval (identical inputs
per variant, pre-declared non-inferiority margin). The prompt-engineer prompt-evals
guidance covers the method; promptfoo fits in CI.
- If the prompt is a cached system prompt, repeat the cache-economics warning from
the analysis.
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.
- 5d ago First seen · 138 lines · 45 tokens per session scan A a5000b9b72f7
prompt-optimize is a command published in the GitHub repository acaprino/daodan (8 stars, last pushed 9d ago), licensed MIT. It adds 45 tokens to every session and 1,796 once invoked, about $0.0002 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 commands, from other repositories
prompt
System instructions for writing effective prompts. Apply when generating commands, skills, agents, or any LLM instructions.
prompt-show
Display full details of a saved prompt by ID.
music-suno-prompt
Grounded Suno prompt synthesis from local knowledge corpus + persona canon + label canon. No vibes-prompting.
ai
Load the Kaizen skill for production-ready AI agent implementation with signature-based programming and multi-agent coordination.
audit-prompt
Evaluate an existing prompt for clarity, effectiveness, and edge cases.
develop-image-prompt.eval
Generates a detailed image generation prompt from a document or content description. Good output: a prompt that is specific, visual, non-abstract, includes style/composition/lighting guidance, and is calibrated to the specified dimensions and style options.