소스 정보
- 저장소
- lukemcqueen/hermes-cortex
- 최근 소스 활동
- 2026년 8월 29일 11:16
- 감지된 SKILL.md 언어
- 영어
- 스타
- 4
- 포크
- 1
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/lukemcqueen/hermes-cortex --skill llm-cost-optimization명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | llm-cost-optimization |
| description | Cut LLM API spend: cache-hit rate, thinking mode, telemetry. |
| version | 1.1.0 |
| category | devops |
| platforms | ["linux","macos"] |
| aliases | ["llm-cost-engineering"] |
| metadata | {"hermes":{"tags":["cost","cache","tokens","llm","deepseek","observability","spending"],"related_skills":["cron-cost-tracking","cron-cost-scheduling"]}} |
Class-level playbook for reducing LLM API spend on a fleet of agents. Built from the 2026-08-21 HC gaps party (Luke's fleet: $8/day pre-hike → $15–20/day after DeepSeek's Aug-16-2026 price increase; target <$10/day). Consolidated 2026-08-22: absorbed llm-cost-engineering (pricing mechanics, audit reading, installer pitfalls, verification).
For DeepSeek v4-flash (and most providers with automatic prefix caching), the price spread between cache-hit and cache-miss input tokens is ~31× ($0.007/M hit vs $0.22/M miss off-peak). Output tokens are a distant second driver. Every cost conversation starts with: what is the cache-hit rate, and is the prefix stable?
| Scenario (50M prompt tokens/day) | $/day |
|---|---|
| 95% cache hit | ~$1.2 |
| 80% cache hit | ~$4.5 |
| 70% cache hit | ~$8.5 |
| 50% cache hit | ~$13.6 |
prompt_cache_hit_tokens / prompt_cache_miss_tokens).prompt_tokens in audit logs is cumulative across turns, not per-call.
A 26M-token "run" is a long session (100+ turns re-sending growing context),
not a single giant call — 1M context limits make single calls impossible.usage_audit.jsonl should carry
cache_read_tokens/cache_write_tokens; without the split every cost claim
is a guess. Verify capture is actually LOADED (gateway restart), not just
patched on disk — see the deployed≠loaded pitfall.Thinking/reasoning tokens are output-priced and NEVER cached. On a thinking
model, reasoning can be 6× the answer text (55K thinking vs 9K answer in a
normal session). Disable thinking on mechanical jobs (reasoning_effort: none on dreams, briefings, prunes, eval) — verified −54% output tokens on the
same job. Keep it on reasoning-heavy work (orchestrator decisions, diagnosis,
evaluation). Pin via the cron manifest so it survives deploys, not just live
jobs.json (live edits get reverted by cortex-update).
Same-session continuation is CHEAPER and better, because re-sent history is a cache hit (~31× cheaper than fresh content):
| Pattern | Cost (modeled) |
|---|---|
| 1×150 turns (same session) | $0.79 |
| 3×50 turns (3 sessions) | $0.48 |
| 5×30 turns (5 sessions) | $0.45 |
The long session costs only ~$0.30 more and that gap is history re-sends at hit price — the cheapest thing you can buy. The real enemies:
reasoning_effort: none does.Rule: keep one session while the topic is coherent AND the prefix stays stable. Start fresh only on a context switch or when the session is so large that compaction/rewrites fire (those bust cache worse than a fresh start).
prompt_tokens per run is CUMULATIVE across turns — a 26M-token "prompt" is a
long session re-sending growing context, NOT one 26M-token call (context cap
makes that impossible).references/interactive-session-cost-state-db.md — state.db sessions
table has interactive tokens+cost live).hermes cron edit --model/--reasoning-effort
writes jobs.json, but the next cortex-update re-registers crons from the
source of truth (cron-manifest.yaml / install-crons.sh). Fix the SOURCE first,
then the live jobs — or your "migration" silently reverts. The manifest and
the installer's pin function must both change (14-cron deepseek-chat→v4-flash
migration reverted exactly this way, 2026-08-21).hermes update. Auto-reapply via a
post-update hook (install-cron-cost-tracking.py --force); a missing
cost_store.py shows as 9× MISS in --status. 2 days of data out of 13 seen
2026-08-21.session_estimated_cost_usd) uses hermes-agent's stale
pre-hike pricing table for v4-flash (in 0.14/out 0.28/hit 0.0028 vs local
0.22/0.66/0.007). Fixed in cost_store.py: record_run recomputes at the local
schedule, reprice guard is now consistency-based (self-heals stale rows).
The daily REPORT was always correct (recomputes from usage_audit); only the
DB store under-reported. See cron-cost-tracking skill.old text wasn't found — verify the real file state, not the installer's word.cache_write_tokens 0 for ALL 4828 rows, so the naive
hit% = read/(read+write) reads a fake 100%. Root cause is UPSTREAM
(hermes-agent agent/usage_pricing.py): the cache_read side maps DeepSeek's
top-level prompt_cache_hit_tokens (line ~1373) but the cache_write fallback
chain (~1385–1400) checks only ,
, — NEVER
DeepSeek's complementary . Since
, the miss tokens land in and the
cost math stays correct (); only the hit-rate metric
lies. — measured 93–99% across
all cron jobs (7-day window, 2026-08-29), so the system-prompt prefix IS
byte-stable. Upstream fix candidate: add to the
cache_write fallback chain (task ).references/deepseek-cache-economics.md — canonical DeepSeek pricing table,
cache rules, thinking-mode switch (absorbed llm-cost-engineering's
deepseek-cache-cost-mechanics.md 2026-08-22).references/fleet-cost-data-sources.md — where each fleet cost number lives
(audit files, DBs, billing page) — from llm-cost-engineering.references/fleet-cost-levers-verified.md — session-verified lever results.references/daemon-restart-peak-pins-2026-08-21.md — restart-gap and peak-pin
session detail.references/interactive-session-cost-state-db.md — state.db sessions table as
the interactive-cost source.references/session-telemetry-reporting.md — session-specific detail behind
the playbook.details.cache_write_tokenscache_creation_input_tokensresponse_usage.cache_write_tokensprompt_cache_miss_tokensprompt_tokens = hit + missinput_tokensmiss = input + writeprompt_cache_miss_tokensorch-upstream-cache-write-fix