Code Reputation

👤 ryx2 📦 v1.0.1 ⭐ 4.4 ⬇️ 1.7K 下载
🤖 AI-Agent 免费 🔑 需 API Key

📖 技能介绍


name: code-cache description: Semantic code caching for AI agents. Cache, retrieve, and reuse code from prior agent executions. metadata: {"openclaw":{"emoji":"🏄","homepage":"https://raysurfer.com","requires":{"env":["RAYSURFER_API_KEY"]},"primaryEnv":"RAYSURFER_API_KEY"}}


Code Cache - Semantic Code Caching for AI Agents

This skill enables semantic code caching via the Raysurfer API.

What It Does

When your agent generates and executes code, Code Cache stores it. When a similar task comes up later, the agent can retrieve and run the cached code instead of regenerating it—saving time and tokens.

Setup

Get your API key from the Raysurfer dashboard and configure it:

# Via environment variable
export RAYSURFER_API_KEY=your_api_key_here

# Or via OpenClaw config
openclaw config set skills.entries.code-cache.apiKey "your_api_key_here"

Available Commands

Search for cached code

/code-cache search <task description> [--top-k N] [--min-score FLOAT] [--show-code]

Search for cached code snippets that match a natural language task description.

Options: - --top-k N — Maximum number of results (default: 5) - --min-score FLOAT — Minimum verdict score filter (default: 0.3) - --show-code — Display the source code of the top match

Example:

/code-cache search "Generate a quarterly revenue report"
/code-cache search "Fetch GitHub trending repos" --top-k 3 --show-code

Get code files for a task

/code-cache files <task description> [--top-k N] [--cache-dir DIR]

Retrieve code files ready for execution, with a pre-formatted prompt addition for your LLM.

Options: - --top-k N — Maximum number of files (default: 5) - --cache-dir DIR — Output directory (default: .code_cache)

Example:

/code-cache files "Fetch GitHub trending repos"
/code-cache files "Build a chart" --cache-dir ./cached_code

Upload code to cache

/code-cache upload <task> --files <path> [<path>...] [--failed] [--no-auto-vote]

7w4.net小葱技能。

Upload code from an execution to the cache for future reuse.

Options: - --files, -f — Files to upload (required, can specify multiple) - --failed — Mark the execution as failed (default: succeeded) - --no-auto-vote — Disable automatic voting on stored code blocks

Example:

/code-cache upload "Build a chart" --files chart.py
/code-cache upload "Data pipeline" -f extract.py transform.py load.py
/code-cache upload "Failed attempt" --files broken.py --failed

Vote on cached code

/code-cache vote <code_block_id> [--up|--down] [--task TEXT] [--name TEXT] [--description TEXT]

Vote on whether cached code was useful. This improves retrieval quality over time.

Options: - --up — Upvote / thumbs up (default) - --down — Downvote / thumbs down - --task — Original task description (optional) - --name — Code block name (optional) - --description — Code block description (optional)

Example:

/code-cache vote abc123 --up
/code-cache vote xyz789 --down --task "Generate report"

How It Works

  1. Cache Hit: When you ask for code similar to something previously executed, Code Cache returns the cached version instantly
  2. Cache Miss: When no match exists, your agent generates code normally, then Code Cache stores it for future use
  3. Verdict Scoring: Code that works gets 👍, code that fails gets 👎—retrieval improves over time

API Reference

The skill wraps these Raysurfer API methods:

Method Description
search(task, top_k, min_verdict_score) Unified search for cached code snippets
get_code_files(task, top_k, cache_dir) Get code files ready for sandbox execution
upload_new_code_snips(task, files_written, succeeded, auto_vote) Store new code after execution
vote_code_snip(task, code_block_id, code_block_name, code_block_description, succeeded) Vote on snippet usefulness

Why Code Caching?

LLM agents repeat the same patterns constantly. Instead of regenerating code every time:

  • 30x faster: Retrieve proven code instead of waiting for generation
  • Lower costs: Reduce token usage by reusing cached solutions
  • Higher quality: Cached code has been validated and voted on
  • Consistent output: Same task = same proven solution

Learn more at raysurfer.com or read the documentation.

🤖 AI 评测

这是一个成熟度较高的代码缓存工具,帮助 AI 代理复用历史成功代码,声称能带来 30 倍性能提升。文档清晰易懂,命令使用简单,配置也不复杂。安全性说明较为完善,用户能清楚了解代码上传和下载的风险。不过使用时需要依赖外部 Raysurfer 服务,代码和元数据会上传到第三方平台,用户需评估数据敏感性。整体质量良好,适合需要频繁执行重复代码任务的开发者。

📊 多维度评分

适应性4.3
规范性4.5
有效性4.7
可靠性4.3
可信度4.3

📁 包含文件 (6 个)

📄 README.md 5.7 KB
📄 SKILL.md 4.4 KB
📄 _meta.json 134 B
📄 code_cache.py 7.8 KB
📄 skill-card.md 2.1 KB
📄 tests/test_skill.py 22.1 KB