Xpersona
A

Agent Cost Strategy

CLAWHUB · Unverified

Tiered model selection and cost optimization for multi-agent AI workflows. Use this skill whenever you are choosing a model for a task, spinning up a sub-age... Skill: Agent Cost Strategy Owner: djc00p Summary: Tiered model selection and cost optimization for multi-agent AI workflows. Use this skill whenever you are choosing a model for a task, spinning up a sub-age... Tags: latest:1.3.6 Version history: v1.3.6 | 2026-04-06T15:36:56.625Z | user Soften absolute session/model rules; add privacy note on cached context v1.3.5 | 2026-04-06T02:11:45.227Z | user Fix: replace bare c

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17akx17qd32yxnr1065qq0kdd83h2c3:agent-cost-strategy
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-djc00p-agent-cost-strategy/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

88,682 characters of source documentation, loaded on request.

Extracted files

4 files captured from the source.

SKILL.md

---
name: agent-cost-strategy
description: Tiered model selection and cost optimization for multi-agent AI workflows. Use this skill whenever you are choosing a model for a task, spinning up a sub-agent, setting up cron jobs or heartbeats, or trying to reduce API spend. Also use when the user says "save costs", "which model should I use", "optimize model usage", "this is getting expensive", or when delegating any task to a sub-agent. Works with any AI provider.
metadata: {"clawdbot":{"emoji":"💰","requires":{"bins":[]},"os":["linux","darwin","win32"],"version":"1.3.6"}
---

# Agent Cost Strategy

Use the cheapest model that can reliably do the job. Most tasks don't need your most powerful model.

## The Three Tiers

| Tier | When to Use | Examples |
|------|-------------|---------|
| **Fast/Cheap** | Sub-agents, background tasks, automated fixes, simple lookups, short replies | Claude Haiku, GPT-4o-mini, Gemini Flash |
| **Mid-tier** | Main session dialogue, moderate reasoning, multi-step tasks | Claude Sonnet, GPT-4o, Gemini Pro |
| **Powerful** | Architecture decisions, deep reviews, hard problems, after cheaper models fail twice | Claude Opus, GPT-4.5, Gemini Ultra |

## Task → Tier Routing

```text
Fix failing tests          → Fast/Cheap
Write boilerplate          → Fast/Cheap
Research / search          → Fast/Cheap
Cron / scheduled tasks     → Fast/Cheap (always)
Short replies (hi, ok)     → Fast/Cheap (always)
Background monitoring      → Fast/Cheap (always)
Build new feature          → Mid-tier
Review a PR                → Mid-tier
Main assistant dialogue    → Mid-tier (default)
Architecture decisions     → Powerful
Deep code review           → Powerful
Stuck after 2 attempts     → Escalate one tier up
```

## Heartbeat / Cron Model Rule

Always specify the cheapest model for scheduled and background tasks — they run frequently and costs add up fast. Check your platform's config for how to set a model per cron/heartbeat job.

For heartbeat intervals: set them just under your provider's cache TTL to keep the prompt cache warm and pay cache-read rates instead of full input rates. Check your provider's docs for the exact TTL.

## Communication Pattern Rule

One-word and short conversational messages (hi, thanks, ok, sure, yes, no) should always route to Fast/Cheap. Never burn a mid-tier or powerful model on an acknowledgment.

## Cache Optimization

Prompt caching cuts costs 50-90% on repeated context. Cache writes cost ~25% more but pay off after just 1-2 reuses. See `references/cache-optimization.md` for patterns and break-even math.

## Batch API (Non-Urgent Tasks)

For cron jobs, scheduled analysis, or anything that doesn't need an immediate response — use the Batch API (Anthropic/OpenAI both offer it). **50% discount** in exchange for async delivery (results within 24h). Never use real-time API for background work that can wait.

## Sub-Agent Model Rule (Critical)

**Always explicitly set the model when spawning sub-agents.** Never rely 

_meta.json

{
  "ownerId": "kn75k4jwpn9qgy3pk38e93gkt982zqmg",
  "slug": "agent-cost-strategy",
  "version": "1.3.6",
  "publishedAt": 1775489816625
}

references/cache-optimization.md

# Cache Optimization Patterns

Prompt caching saves cost by reusing previously processed context. Most providers charge ~10% of normal input price for cache reads — up to 90% savings on repeated context.

## What Caches Well

- System prompts (static instructions, personas, rules)
- Large documents loaded repeatedly (codebases, docs, schemas)
- Repeated tool definitions
- Shared base prompts across multiple sub-agents

## What Doesn't Cache

- Dynamic content that changes every request (timestamps, random values)
- Very short prompts (not worth caching)
- One-off requests with unique context

## Key Patterns

### Keep system prompts stable
Put static instructions at the top of your system prompt. They get cached after the first request and reused on every call — avoid injecting dynamic values (timestamps, session IDs) into the system prompt.

```text
[CACHED] System prompt with rules, persona, tools
[NOT CACHED] Current user message
```

### Large document analysis
Load the document once, then ask questions in follow-up turns.

```text
Turn 1: "Here is the codebase: [large content]" → cache miss, full price
Turn 2: "What does the auth module do?"         → cache hit, ~90% cheaper
Turn 3: "Find all API endpoints"                → cache hit, ~90% cheaper
```

### Sub-agent prompts
When spawning many sub-agents with the same base prompt, put shared context first — it gets cached across all of them.

```text
[SHARED — gets cached across all agents]
You are a test fixer. Rules: never comment out tests...

[UNIQUE per agent]
Fix this specific failure: <paste failure>
```

### Order matters
Always put static content before dynamic content. Providers cache from the beginning of the prompt — anything after a dynamic section won't be cached.

## Cache Write vs Read Cost — Break-Even Math

Cache writes cost ~25% **more** than regular input tokens, but cache reads cost 90% **less**. It pays off after just 1–2 reuses.

**Formula:**
```text
break_even_reads = cache_write_cost / (regular_cost - cache_read_cost)
```

**Example — 10k token system prompt on Anthropic Sonnet:**
- Regular cost per read: 10k × $3/M = **$0.030**
- Cache write (one-time): 10k × $3.75/M = **$0.0375**
- Cache read cost: 10k × $0.30/M = **$0.003**
- Break-even: $0.0375 / ($0.030 - $0.003) = **1.4 reads**

→ Cache anything reused 2+ times. For sessions that run long (which they should), almost everything is worth caching.

## Batch API (50% Discount for Non-Urgent Tasks)

Anthropic's Batch API processes requests asynchronously at half price — results returned within 24 hours.

**Best for:**
- Cron/scheduled tasks that don't need immediate responses
- Bulk analysis (e.g. processing many files overnight)
- Background monitoring that can tolerate latency

**Not for:**
- Real-time conversations
- Any task where the user is waiting

```python
# Instead of: real-time API call at full price
response = client.messages.create(model="claude-sonnet-4-6", ...)

# Use: batch API at 50% off for non-urge

skill-card.md

## Description:

Tiered model selection and cost optimization guidance for multi-agent AI workflows across AI providers.

This skill is ready for commercial/non-commercial use.

## Publisher:

[djc00p](https://clawhub.ai/user/djc00p)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and agent operators use this skill to choose cost-appropriate models, route sub-agent and scheduled work, and apply prompt caching and batch processing patterns without losing sight of accuracy, safety, or privacy needs.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Cost-focused defaults may route work to models that are too weak for accuracy, safety, or privacy-sensitive tasks.

Mitigation: Treat the tier rules as guidance and escalate model choice when task complexity, user impact, or safety sensitivity requires it.

Risk: Cached context can include workspace files, memory, secrets, or sensitive personal data.

Mitigation: Avoid caching sessions that contain secrets or sensitive personal data, and end those sessions when the privacy boundary matters more than cost savings.

Risk: Provider prices, cache behavior, batch discounts, TTLs, and model names can change.

Mitigation: Confirm current provider pricing and cache behavior before relying on the skill's example numbers in production workflows.

## Reference(s):

- [Cache Optimization Patterns](artifact/references/cache-optimization.md)
- [ClawHub skill page](https://clawhub.ai/djc00p/skills/agent-cost-strategy)

## Skill Output:

**Output Type(s):** [guidance, markdown, configuration, shell commands]

**Output Format:** [Markdown guidance with routing tables, rules, and inline examples]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Provider pricing, model names, cache TTLs, and discounts should be checked against current provider documentation before operational use.]

## Skill Version(s):

1.3.6 (source: server release evidence)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Agent Cost Strategy and adjacent AI workflows.