harness-optimizer

harness-optimizer is a skill for Claude Code, Codex from ApexIQ/skillsmith. It costs 39 tokens per session (1,902 once invoked), scanned A, original, MIT.

A guide to tuning AI-agent settings for cost, speed, context limits, and reliability. It covers model choice, token use, context-window management, prompt design, and routing tasks between models.

In plain words
What is it for?
Use it to configure a new project, choose models for different tasks, reduce token use, investigate quality problems, and balance performance against cost.
Why use it?
It helps address high usage costs, context limits, inconsistent results, and quality drops when an agent handles different kinds of work.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md; positional $N argument; mentions AGENTS.md.

Good fit Use it to configure a new project, choose models for different tasks, reduce token use, investigate quality problems, and balance performance against cost.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/apexiq/skillsmith/harness_optimizer
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.

Any agent
npx skills add ApexIQ/skillsmith --skill harness_optimizer
Clone the repo
git clone --depth 1 https://github.com/ApexIQ/skillsmith

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for harness-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/apexiq/skillsmith/harness_optimizer.svg)](https://agentmods.dev/skills/apexiq/skillsmith/harness_optimizer)
Your own site
<a href="https://agentmods.dev/skills/apexiq/skillsmith/harness_optimizer"><img src="https://agentmods.dev/badge/skills/apexiq/skillsmith/harness_optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,902 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00039 $0.01902
Opus 5 $0.00019 $0.00951
Sonnet 5 $0.00008 $0.00380
Haiku 4.5 $0.00004 $0.00190

Measured 7d ago against content hash caaf80fc2ee7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

harness-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 7d 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.

.agent/skills/harness_optimizer/SKILL.md · 228 lines

How it starts

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

⚡ Harness Optimizer — Tune Your Agent for Peak Performance

Philosophy: The best agent configuration is the one that ships the most correct code per dollar spent. Optimize for outcome-per-token, not raw capability.

1. When to Use This Skill

  • Agent token costs are too high
  • Agent is hitting context window limits
  • Agent performance is inconsistent or degrading
  • Switching between models for different tasks
  • Setting up a new project's agent configuration
  • Debugging why agent quality has dropped

2. Token Cost Optimization

The Token Budget Framework

Task Type Recommended Model Context Budget Target Cost
Simple code edits Fast/small model 8K tokens $0.01-0.05
Code review Medium model 16K tokens $0.05-0.20
Architecture design Best available model 32K tokens $0.20-1.00
Complex debugging Best available model 64K tokens $0.50-2.00
Documentation Medium model 16K tokens $0.05-0.15
Test generation Medium model 32K tokens $0.10-0.30

Cost Reduction Strategies

Strategy 1: Tiered Model Routing
# Route tasks to the cheapest model that can handle them
routing:
  simple_edits:
    model: claude-3-haiku     # Cheapest
    max_tokens: 4096
  code_review:
    model: claude-3.5-sonnet  # Mid-tier
    max_tokens: 8192
  architecture:
    model: claude-3.5-opus    # Premium — only when needed
    max_tokens: 16384
Strategy 2: Context Compression
## Before (wasteful — 2000 tokens)
Here is the entire file contents of user_service.py:
[... 200 lines of code ...]
Please fix the bug on line 45.

## After (efficient — 400 tokens)
In user_service.py, the `create_user` method (lines 40-55):
```python
def create_user(self, data):
    # BUG: missing email validation
    user = User(**data)
    self.db.save(user)

Fix: add email validation before line 43.


#### Strategy 3: Result Caching
```python
# Cache expensive operations
# Don't re-analyze unchanged files
cache = load_cache(".agent/context/recall_cache.json")

if file_hash == cache.get(file_path, {}).get("hash"):
    # File hasn't changed — reuse previous analysis
    return cache[file_path]["result"]
else:
    # File changed — re-analyze
    result = analyze(file_path)
    cache[file_path] = {"hash": file_hash, "result": result}
    save_cache(cache)

Read the full file on GitHub · 228 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. 7d ago First seen · 228 lines · 39 tokens per session scan A caaf80fc2ee7

Subscribe to this mod's changes

harness-optimizer is a skill published in the GitHub repository ApexIQ/skillsmith (5 stars, last pushed 5mo ago), licensed MIT. It adds 39 tokens to every session and 1,902 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.