Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
{"name":"NanoClaw","title":"Harness Performance Architect","expertise":["Token Optimization","Hook Systems","Memory Persistence","Cross-Harness Engineering","Session Lifecycle Management"],"philosophy":"Every token spent must earn its place. Optimize the harness, not just the model."}
version
1.0.0
Overview
Agent harness optimization is the practice of tuning the runtime environment that surrounds an AI agent -- model selection, prompt structure, hook configuration, memory persistence, and session management -- to maximize output quality while minimizing token cost and latency. Derived from real-world patterns across 10+ months of daily agentic work, these techniques apply to any harness: Claude Code, Cursor, OpenCode, Codex, Gemini, and beyond.
Anti-Rationalization Table
Rationalization
Reality
"I'll figure it out as I go"
A structured approach saves time and reduces errors. Follow the workflow in this skill rather than improvising.
"I already know this topic"
Familiarity breeds shortcuts. Use the checklist to verify you haven't missed critical steps.
"This doesn't apply to my situation"
The patterns here generalize across contexts. Adapt, don't skip — the underlying principles hold.
"One more tool will fix it"
Adding complexity rarely solves process gaps. Master the core workflow first.
When to Use
Trigger phrases:
"agent harness optimizer"
"Token costs are rising faster than output quality"
"Agents lose context between sessions or after compaction"
"Hook scripts are slow, brittle, or produce noisy output"
Token costs are rising faster than output quality
Agents lose context between sessions or after compaction
Hook scripts are slow, brittle, or produce noisy output
You need the same agent behavior across multiple AI coding harnesses
Session history grows unwieldy and needs structured management
Background processes are eating into the main context window
You want to set up continuous learning from session patterns
When NOT to Use
Task is outside your authorization scope
You need to implement controls (use implementing-* skills)
Task is about analysis, not action (use analyzing-* skills)
Route dynamically: if task.complexity < 3 then fast_model elif task.complexity < 7 then standard_model else premium_model
System Prompt Slimming
Audit CLAUDE.md and AGENTS.md for redundant instructions -- most projects have 30-50% duplication
Move rarely-used instructions to category-specific files loaded on demand
Use compact formats: bullet lists over paragraphs, code over prose
Target: system prompt under 4K tokens for standard workflows, under 8K for complex projects
Strip instructions that duplicate harness defaults (e.g., "use Read tool" when the harness already enforces this)
Background Process Isolation
Never run builds, tests, or long-running commands in the main context window
Use run_in_background: true for all operations over 5 seconds
Offload analysis to cheaper models via subagent delegation
Use Grep/Glob for discovery instead of Bash find/grep to reduce output tokens
2. Memory Persistence via Hooks
Implement session-persistent memory using hook-based save/load:
SessionStart Hook (Load)
# On session start, load prior context# Read project memory, notepad, and recent session summarycat .omc/project-memory.json 2>/dev/null
cat .omc/notepad.md 2>/dev/null
PreToolUse Hook (Capture)
# Capture tool calls and prompts for pattern extractionecho"$(date +%s)|$TOOL_NAME|$INPUT_PREVIEW" >> .omc/session-trace.log
PostToolUse/Stop Hook (Save)
# On session end, persist learnings# Save key decisions, patterns learned, errors encountered# Keep under 2000 chars to avoid context bloat on next load
Memory File Structure
.omc/
project-memory.json # Persistent project context (conventions, stack, decisions)
notepad.md # Working memory (auto-pruned after 7 days)
session-trace.log # Tool call log for pattern extraction
state/ # Mode-specific state (autopilot, ralph, etc.)
3. Session Management
Manage agent sessions with structured lifecycle commands:
Branch -- Create isolated work contexts per task
Each task gets a git worktree or branch for isolation
Prevents context bleed between unrelated tasks
Search -- Query prior session history
Search session transcripts for patterns, decisions, and solutions
Avoid re-solving problems already solved
Export -- Extract session artifacts
Export decisions, code changes, and learnings as structured documents
Share across team or feed into continuous learning
Compact -- Reduce active context size
Summarize conversation history into dense notes
Remove resolved tool outputs, keep only decisions and blockers
Target: compact to 30% of original size
Metrics -- Track session efficiency
Tokens spent per task, per tool, per decision
Time-to-completion for common task types
Error rate and retry count
4. Hook Runtime Controls
Configure hook behavior at runtime without editing files:
# Set strictness profileexport ECC_HOOK_PROFILE=minimal # Only critical hooks (security, error)export ECC_HOOK_PROFILE=standard # Default -- lint, typecheck, memoryexport ECC_HOOK_PROFILE=strict # All hooks including style, docs# Disable specific hooks temporarilyexport ECC_DISABLED_HOOKS="pre:bash:tmux-reminder,post:edit:typecheck"# Cap SessionStart context sizeexport ECC_SESSION_START_MAX_CHARS=4000
# Disable SessionStart context for low-context setupsexport ECC_SESSION_START_CONTEXT=off
# Suppress cost warnings but keep other context/scope warningsexport ECC_CONTEXT_MONITOR_COST_WARNINGS=off
Hook Profile Design Principles
minimal: For fast iteration, debugging, and exploration. Only blocks security violations.
standard: For daily development. Includes type checking, lint, and memory hooks.
strict: For production code, PRs, and releases. Enforces style, docs, and full verification.
5. Cross-Harness Parity
Ensure agent behavior is consistent across harnesses:
Concern
Claude Code
Cursor
OpenCode
Codex
Gemini
Rules location
~/.claude/rules/
.cursorrules
opencode.json
AGENTS.md
System prompt
Hooks
Native hook system
File watchers
Plugin events
None
None
Skills/Commands
Plugin + slash commands
Custom instructions
Plugins + commands
Markdown only
Prompt-only
Memory
.claude/ directory
.cursor/
.opencode/
Project root
External store
MCP
Native support
Limited
Plugin-based
None
None
Parity Checklist
Core instructions translated to each harness's native format
Hooks replicated as file watchers or plugin events where native hooks unavailable
Skills portable as markdown with harness-agnostic trigger detection
Memory files in project root (harness-agnostic) with harness-specific symlinks
Test each harness independently: same input should produce same output quality
6. Continuous Learning from Sessions
Feed session patterns back into the system:
Observation Capture (automatic via hooks)
Record: tool calls, user corrections, error resolutions, repeated workflows
Scope: project-specific patterns stay project-scoped, universal patterns become global
Pattern Detection (background analysis)
User corrections become instinct candidates (confidence: 0.3-0.5 initially)
Repeated successful patterns increase confidence (up to 0.9)
Failed patterns decrease confidence or get removed