Open Source 开源项目 4d ago Updated 4d ago 更新于 4天前 60

[GitHub] JuliusBrussee/caveman 【GitHub】JuliusBrussee/caveman

Caveman 2 introduces a local proxy that compresses agent input (tool schemas, files, logs, history) before every provider call, achieving 33.2% fewer input tokens in a pinned Claude Code benchmark The original Caveman skill (v1) compressed agent output into concise "caveman-speak" while preserving byte-exact code/commands/errors; v2 extends this to input reduction The `caveman learn` analyzer scans local agent history, scores token sinks, and proposes fixes across four categories: safe fix, offl Caveman 2通过本地代理(Proxy)在每次provider调用前压缩agent读取的内容,实现33.2%的输入token节省,同时保持字节级精确恢复 提供两种产品形态:Caveman Proxy(减少输入token)和Caveman Skill(减少输出token),可单独或组合使用,支持30+个AI agent 引入"caveman learn"本地分析工具,扫描历史对话识别token浪费点并生成优化建议,分为safe fix/offload/habit/load-bearing四类 核心设计理念"Keep your agent. Brain big. Context small"—

68
Hot 热度
72
Quality 质量
62
Impact 影响力

Analysis 深度分析

TL;DR

  • Caveman 2 introduces a local proxy that compresses agent input (tool schemas, files, logs, history) before every provider call, achieving 33.2% fewer input tokens in a pinned Claude Code benchmark
  • The original Caveman skill (v1) compressed agent output into concise "caveman-speak" while preserving byte-exact code/commands/errors; v2 extends this to input reduction
  • The caveman learn analyzer scans local agent history, scores token sinks, and proposes fixes across four categories: safe fix, offload, habit, and load-bearing
  • The proxy requires no code changes, forwards requests to the original provider (e.g., Anthropic), and preserves OAuth credentials and recovery copies locally
  • Supports 30+ agents including Claude Code, Codex, Gemini CLI, Cursor, Windsurf, and Cline, with dual licensing (BSL-1.1 runtime, MIT CLI)

Why It Matters

Token cost and context window management are among the most pressing operational challenges for AI agent practitioners; tools that demonstrably reduce input tokens without degrading agent capability directly lower inference costs and enable longer, more complex sessions. Caveman's approach of compressing both directions of agent communication (input and output) while guaranteeing byte-exact recovery of critical artifacts represents a practical, deployable optimization that doesn't require model fine-tuning or provider lock-in.

Technical Details

  • Caveman Proxy: A local middleware that intercepts and compresses all input flowing to the provider (tool schemas, file contents, conversation history, logs) before each API call, with byte-exact recovery of original content stored locally
  • Caveman Skill: An agent prompt/skill that instructs the model to produce compressed textual responses ("caveman-speak") while keeping code blocks, commands, error messages, and other structured output byte-for-byte identical to uncompressed output
  • Benchmark Results: In a pinned 54-run Claude Code benchmark, the proxy achieved 33.2% reduction in provider-reported input tokens while passing all 18 exact-answer verification checks
  • caveman learn Analyzer: Reads local agent history from disk (Claude Code, Codex, etc.), computes a "Cave Score," ranks token sinks by flow volume, and classifies each sink as safe fix / offload / habit / load-bearing; caveman learn implement proposes diffs for each fix and re-measures after application
  • Architecture: Go-based proxy runtime with Node.js CLI; supports OAuth passthrough for Claude Pro/Max; no backend dependency—traffic routes directly to the chosen provider through the local proxy

Industry Insight

  • Input compression via proxy is a near-term, high-ROI optimization for any team running agentic workflows at scale; the 33% token reduction demonstrated here likely generalizes across providers and agent frameworks, directly translating to cost savings on per-token pricing models
  • The "caveman-speak" output compression strategy could inspire a new class of agent prompt engineering techniques that decouple communicative efficiency from artifact fidelity—a principle worth formalizing and benchmarking across model families
  • The caveman learn diagnostic framework (history scanning, sink classification, diff-based remediation) represents a reusable pattern for agent observability and cost auditing that other tooling vendors could adopt or integrate into their platforms

TL;DR

  • Caveman 2通过本地代理(Proxy)在每次provider调用前压缩agent读取的内容,实现33.2%的输入token节省,同时保持字节级精确恢复
  • 提供两种产品形态:Caveman Proxy(减少输入token)和Caveman Skill(减少输出token),可单独或组合使用,支持30+个AI agent
  • 引入"caveman learn"本地分析工具,扫描历史对话识别token浪费点并生成优化建议,分为safe fix/offload/habit/load-bearing四类
  • 核心设计理念"Keep your agent. Brain big. Context small"——保持agent能力不变,仅压缩上下文窗口,不牺牲智能换取成本
  • 在54次Claude Code基准测试中通过全部18项精确答案检查,证明压缩不影响输出质量

为什么值得看

Caveman解决了当前AI agent工具普遍存在的token浪费问题,为开发者提供了在不修改代码、不降低模型能力的前提下显著降低API调用成本的实用方案。其"诊断-建议-验证"的闭环优化模式,为agent效率工程提供了可复用的方法论。

技术解析

  • Caveman Proxy架构:本地代理拦截agent与provider之间的流量,在请求发送前压缩输入内容(工具schema、文件、日志、历史等),通过字节级精确恢复确保数据完整性,无需修改代码即可接入,OAuth凭证直通Anthropic等provider
  • Caveman Skill机制:通过提示词工程让agent以精简的"caveman-speak"风格输出,代码、命令和错误信息保持原始格式不变,MIT许可,兼容30+ agent
  • caveman learn分析引擎:本地读取agent历史数据,识别四类token浪费模式——safe fix(冗余CLAUDE.md、未调用skill)、offload(重复粘贴的上下文,可移至caveman memory)、habit(习惯性浪费,仅建议不强制)、load-bearing(必要配置,不计入优化)
  • 基准测试验证:54次Claude Code运行中,Proxy方案减少33.2% provider-reported input tokens,同时通过全部18项精确答案检查,证明压缩不影响输出质量
  • 安装与集成:支持npm全局安装、一键脚本(macOS/Linux/Windows),可自动检测并配置30+个agent(Claude Code、Codex、Gemini CLI、Cursor、Windsurf、Cline等),提供dry run模式和安全回滚机制

行业启示

  • Agent效率优化成为新赛道:随着agent工具普及,token成本优化从"可选"变为"必选",Caveman证明了通过工程手段而非模型改进即可实现显著降本,为agent基础设施层提供了新的优化维度
  • 本地优先的隐私与成本平衡:Proxy方案在本地完成压缩,敏感数据不离开用户机器,同时OAuth凭证直通provider,兼顾了隐私保护与服务可用性,符合企业级部署需求
  • 可观测性驱动优化:caveman learn提供的"Cave Score"和token浪费分类,为agent使用者提供了量化的优化路径,这种"诊断-建议-验证"的闭环模式值得行业借鉴,推动了agent运维从经验驱动向数据驱动转变

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Agent Agent Open Source 开源 LLM 大模型 Code Generation 代码生成 Evaluation 评测