[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AVV04TFA4C5W4WW6YBRSHT":3,"skill-same:01M7AVV04TFA4C5W4WW6YBRSHT":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M7AVV04TFA4C5W4WW6YBRSHT","headroom-context-optimizer",null,"Optimize LLM context budgets, compress tool observations, deduplicate multi-turn transcripts, and detect prompt cache drift. Do not use for raw model prompt drafting or simple file truncation.","SpectreDeath\u002FBrain-Harness","SpectreDeath","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F207463416?v=4","01M7AVGR1D4X8ADT47APKGVH2Z","JL","01M7AVGR2HSGD23BA5DBTJJTVN",0,"MIT","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fheadroom-context-optimizer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: headroom-context-optimizer\ndescription: Optimize LLM context budgets, compress tool observations, deduplicate multi-turn transcripts, and detect prompt cache drift. Do not use for raw model prompt drafting or simple file truncation.\n---\n\n# Headroom Context Optimizer: Production Context Engineering\n\n`headroom-context-optimizer` provides automated, structure-aware context optimization, Cross-Context Retrieval (CCR) deduplication, prompt cache drift detection, and prior-turn extended thinking compaction. It is modeled after the industrial patterns in Headroom v0.41.0 to slash token consumption by 50% to 90% without losing reasoning fidelity.\n\nSee [CARD.md](CARD.md) for the companion summary card, 5-stage progression matrix, and invariants checklist.\n\n---\n\n## The 5-Stage Context Optimization Pipeline\n\n```text\n[1. Trigger & Type Detection] ──► [2. ContentRouter & SmartCrush] ──► [3. CCR Cross-Turn Dedup]\n                                                                                │\n                                                                                ▼\n[5. Savings Ledger & Attribution] ◄── [4. Cache Alignment Check] ◄──────────────┘\n```\n\n---\n\n## 1. Trigger & Type Detection\n\nEvaluate candidate content or conversation transcripts against optimization thresholds:\n\n1. **Detect Structure**:\n   - Inspect payloads to identify format: `json` (arrays\u002Fobjects), `code` (Python, JS, TS, Rust), `diff` (git patches), `log` (build\u002Ftest traces), `search` (grep\u002Fripgrep matches), or `text`.\n2. **Apply Activation Gates**:\n   - Only compress content exceeding 100 characters or 25 tokens.\n   - For multi-turn transcripts, gate deduplication on messages exceeding 3 lines and 40 characters.\n\n> **Completion criterion**: Content format classified and activation threshold verified.\n\n---\n\n## 2. ContentRouter & SmartCrush\n\nRoute content to specialized compressors rather than uniform blind summarization:\n\n1. **JSON Array Compaction (SmartCrusher)**:\n   - For lists with >5 dict elements, extract unified schema keys, retain a 3-row head sample and 2-row tail sample, and emit a compact summary structure.\n2. **Code AST-Aware Compression**:\n   - Strip redundant whitespace and consecutive blank lines while preserving AST boundaries.\n3. **Log & Search Reduction**:\n   - Truncate repetitive log entries, keeping the initial 10 lines, omitted count sentinel, and trailing 10 lines.\n\n> **Completion criterion**: Structure-aware compression applied; savings ratio $\\ge 0.20$ on redundant data.\n\n---\n\n## 3. CCR Cross-Turn Deduplication\n\nReclaim context from repetitive multi-turn tool observations:\n\n1. **Compute SHA-256 Block Digest**:\n   - Calculate short 12-character cryptographic digests for multi-line assistant and tool returns.\n2. **Emit CCR Retrieval Marker**:\n   - Replace repeating observation blocks with `[CCR tool digest: \u003Chash> | original length: \u003CN> chars | matching turn \u003Corigin>]`.\n3. **Preserve Recent Turns**:\n   - Keep the most recent 2 to 4 turns completely verbatim for immediate reasoning coherence.\n\n> **Completion criterion**: Duplicate tool returns folded into deterministic retrieval markers.\n\n---\n\n## 4. Cache Alignment Check\n\nInspect system prompts to guarantee stable prefix prompt caching:\n\n1. **Scan for Volatile Elements**:\n   - Check system prompt for UUIDs, ISO-8601 timestamps, JWT tokens, and hex hashes.\n2. **Enforce Prompt Immutability (Detector-Only)**:\n   - Never mutate system prompts in place (which destroys cache prefixes).\n   - Flag detected volatile elements to the developer so dynamic context can be relocated into user turns.\n\n> **Completion criterion**: System prompt confirmed 100% byte-stable or volatile elements flagged.\n\n---\n\n## 5. Savings Ledger & Attribution\n\nRecord cumulative context savings:\n\n1. **Calculate Metrics**:\n   - Track `total_in_tokens`, `total_out_tokens`, `net_tokens_saved`, and estimated dollar savings ($3.00\u002FMTok blend).\n2. **Emit Observability Event**:\n   - Log savings metrics into the session transcript or Prometheus `\u002Fmetrics`.\n\n> **Completion criterion**: Savings ledger updated and compression statistics surfaced.\n\n---\n\n## Anti-Patterns\n\n- **Uniform Blind Truncation** — Chopping raw characters off the end of a payload without recognizing JSON, code, or log structures.\n- **System Prompt Cache Busting** — Dynamically inserting timestamps or run IDs into the system prompt, invalidating Anthropic\u002FOpenAI prompt cache prefixes.\n- **Excessive Dedup Fragmentation** — Folding small single-line strings into digest markers where the marker itself costs more tokens than the original text.\n- **LLM Parse Failure Reprompts** — Paying full LLM API roundtrips for malformed JSON before executing fast local string salvage.\n- **Unverified In-Process Sandboxing** — Running untrusted external scripts in-process without sandboxed execution boundaries.\n","# Headroom Context Optimizer: Production Context Engineering\n\n`headroom-context-optimizer` provides automated, structure-aware context optimization, Cross-Context Retrieval (CCR) deduplication, prompt cache drift detection, and prior-turn extended thinking compaction. It is modeled after the industrial patterns in Headroom v0.41.0 to slash token consumption by 50% to 90% without losing reasoning fidelity.\n\nSee [CARD.md](CARD.md) for the companion summary card, 5-stage progression matrix, and invariants checklist.\n\n---\n\n## The 5-Stage Context Optimization Pipeline\n\n```text\n[1. Trigger & Type Detection] ──► [2. ContentRouter & SmartCrush] ──► [3. CCR Cross-Turn Dedup]\n                                                                                │\n                                                                                ▼\n[5. Savings Ledger & Attribution] ◄── [4. Cache Alignment Check] ◄──────────────┘\n```\n\n---\n\n## 1. Trigger & Type Detection\n\nEvaluate candidate content or conversation transcripts against optimization thresholds:\n\n1. **Detect Structure**:\n   - Inspect payloads to identify format: `json` (arrays\u002Fobjects), `code` (Python, JS, TS, Rust), `diff` (git patches), `log` (build\u002Ftest traces), `search` (grep\u002Fripgrep matches), or `text`.\n2. **Apply Activation Gates**:\n   - Only compress content exceeding 100 characters or 25 tokens.\n   - For multi-turn transcripts, gate deduplication on messages exceeding 3 lines and 40 characters.\n\n> **Completion criterion**: Content format classified and activation threshold verified.\n\n---\n\n## 2. ContentRouter & SmartCrush\n\nRoute content to specialized compressors rather than uniform blind summarization:\n\n1. **JSON Array Compaction (SmartCrusher)**:\n   - For lists with >5 dict elements, extract unified schema keys, retain a 3-row head sample and 2-row tail sample, and emit a compact summary structure.\n2. **Code AST-Aware Compression**:\n   - Strip redundant whitespace and consecutive blank lines while preserving AST boundaries.\n3. **Log & Search Reduction**:\n   - Truncate repetitive log entries, keeping the initial 10 lines, omitted count sentinel, and trailing 10 lines.\n\n> **Completion criterion**: Structure-aware compression applied; savings ratio $\\ge 0.20$ on redundant data.\n\n---\n\n## 3. CCR Cross-Turn Deduplication\n\nReclaim context from repetitive multi-turn tool observations:\n\n1. **Compute SHA-256 Block Digest**:\n   - Calculate short 12-character cryptographic digests for multi-line assistant and tool returns.\n2. **Emit CCR Retrieval Marker**:\n   - Replace repeating observation blocks with `[CCR tool digest: \u003Chash> | original length: \u003CN> chars | matching turn \u003Corigin>]`.\n3. **Preserve Recent Turns**:\n   - Keep the most recent 2 to 4 turns completely verbatim for immediate reasoning coherence.\n\n> **Completion criterion**: Duplicate tool returns folded into deterministic retrieval markers.\n\n---\n\n## 4. Cache Alignment Check\n\nInspect system prompts to guarantee stable prefix prompt caching:\n\n1. **Scan for Volatile Elements**:\n   - Check system prompt for UUIDs, ISO-8601 timestamps, JWT tokens, and hex hashes.\n2. **Enforce Prompt Immutability (Detector-Only)**:\n   - Never mutate system prompts in place (which destroys cache prefixes).\n   - Flag detected volatile elements to the developer so dynamic context can be relocated into user turns.\n\n> **Completion criterion**: System prompt confirmed 100% byte-stable or volatile elements flagged.\n\n---\n\n## 5. Savings Ledger & Attribution\n\nRecord cumulative context savings:\n\n1. **Calculate Metrics**:\n   - Track `total_in_tokens`, `total_out_tokens`, `net_tokens_saved`, and estimated dollar savings ($3.00\u002FMTok blend).\n2. **Emit Observability Event**:\n   - Log savings metrics into the session transcript or Prometheus `\u002Fmetrics`.\n\n> **Completion criterion**: Savings ledger updated and compression statistics surfaced.\n\n---\n\n## Anti-Patterns\n\n- **Uniform Blind Truncation** — Chopping raw characters off the end of a payload without recognizing JSON, code, or log structures.\n- **System Prompt Cache Busting** — Dynamically inserting timestamps or run IDs into the system prompt, invalidating Anthropic\u002FOpenAI prompt cache prefixes.\n- **Excessive Dedup Fragmentation** — Folding small single-line strings into digest markers where the marker itself costs more tokens than the original text.\n- **LLM Parse Failure Reprompts** — Paying full LLM API roundtrips for malformed JSON before executing fast local string salvage.\n- **Unverified In-Process Sandboxing** — Running untrusted external scripts in-process without sandboxed execution boundaries.\n",{"name":5,"description":7},"main","eff3b00e36d1d233ad4a4389605c82fbfa0326d3",".agents\u002Fskills\u002Fheadroom-context-optimizer","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness","https:\u002F\u002Fgithub.com\u002FSpectreDeath","I'm here to manage stress so I wouldn't expect earth shattering break throughs I'm just an enthusiast that likes making stuff. ","2026-11-15 05:32:58",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add SpectreDeath\u002FBrain-Harness --skill headroom-context-optimizer",{"tool":37,"command":38},"bunx","bunx skills add SpectreDeath\u002FBrain-Harness --skill headroom-context-optimizer",{"tool":40,"command":41},"pnpm","pnpm dlx skills add SpectreDeath\u002FBrain-Harness --skill headroom-context-optimizer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fheadroom-context-optimizer\u002FSKILL.md",true,[45,51,55],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"CARD.md","REFERENCE","参考文档",2125,"https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fheadroom-context-optimizer\u002FCARD.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"config.default.yaml",521,"https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fheadroom-context-optimizer\u002Fconfig.default.yaml",{"path":56,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":59,"sourceHtmlUrl":60},"scripts\u002Fheadroom_runner.py","SCRIPT","脚本",3706,"https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fheadroom-context-optimizer\u002Fscripts\u002Fheadroom_runner.py",[62,69,76,83,90,97],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7E0W6FR68J2N9CXCZTAQJFX","ui-behavior-primitive-architect","Architect, audit, and verify zero-dependency headless UI behavior primitives, WebMCP agent bridges, WAI-ARIA\u002FSSR\u002FRTL tri-modal checks, and framework expert routing. Do not use for static CSS theme styling or backend database migrations.","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fui-behavior-primitive-architect\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7E0VZ7JQNW34G271DENFGYP","trustgraph-ontology-governor","Govern knowledge graphs, SHACL-AF triple policies, OntologyRAG subclass validation, PROV-O dual named graphs, and Laya entropy decision scoring. Do not use for relational SQL queries or generic web scraping.","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftrustgraph-ontology-governor\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7E0VQ6Z7R45Q8QAZ4MT39EK","shim-harness-governor","Govern universal CLI agent loops, 4-tier tool permissions, ancestor-symlink workspace sandboxes, deterministic-first command routing, collision-safe MCP namespacing, and layered skill loading. Do not use for static UI styling or external SQL analytics.","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fshim-harness-governor\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7E0VC18NMP1QBSRJ3TPQ7MB","graphiti-zep-memory-governor","Govern bi-temporal knowledge graphs with Graphiti future-edge clamping, MinHash\u002FLSH entity dedup, RRF\u002FMMR reranking, and Zep typed ontologies. Do not use for static SQL joins or generic web crawling.","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgraphiti-zep-memory-governor\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7E0V12ABE1RW3ZRCST8VH5Z","agora-mcp-workbench-architect","Architect, audit, and orchestrate Agora Workbench MCP servers, loopback sidecars, unified state graphs, gateway\u002Fdispatcher connectors, and policy-enforced data lakes. Do not use for static frontend CSS styling or non-MCP desktop GUI automation.","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fagora-mcp-workbench-architect\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M7BFYG6QT3484VC57TZ19V7P","skill-eval-assurance-runner","Evaluate and assure agent skills using small-N Wilson confidence intervals, unbiased pass^k reliability, deterministic trajectory graders, preflight boundary honesty, and sealed digest verification. Do not use for subjective prose review or unconstrained production deployment.","https:\u002F\u002Fgithub.com\u002FSpectreDeath\u002FBrain-Harness\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fskill-eval-assurance-runner\u002FSKILL.md",[],[]]