Code Cache for Openclaw

A semantic code caching skill that enables AI agents to store, search, and reuse previously generated code to save time and tokens.

ryx2
v1.0.0
Feb 13, 2026
0
1.7k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install code-cache

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install code-cache using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Code Cache?

Code Cache is a high-performance extension for AI agents that implements semantic code caching via the Raysurfer API. By maintaining a repository of previously executed and validated code, it allows agents to bypass repetitive generation cycles. This skill ensures that when an agent encounters a familiar task, it can instantly retrieve a proven solution rather than starting from scratch.

Integrating this into your Openclaw Skills library enables a more efficient development lifecycle. It prioritizes high-quality, human-voted snippets, reducing the risk of hallucinations and significantly lowering the operational cost of running LLM-based agents. By leveraging semantic search, agents can find relevant logic even if the task description isn't a perfect textual match.

Code Cache Use Cases

  • Reducing latency by retrieving cached code for frequent tasks like report generation or data fetching.
  • Lowering API costs by avoiding redundant LLM generation for identical or similar logic.
  • Ensuring consistency across agent executions by reusing proven, high-quality code snippets.
  • Improving code quality over time through manual and automatic voting on cached blocks.

How Code Cache Works

  1. The agent performs a semantic search using natural language to check for existing code in the Openclaw Skills database that matches the current task.
  2. If a match is found (Cache Hit), the agent retrieves and executes the cached code directly.
  3. If no match exists (Cache Miss), the agent generates new code and executes it as normal.
  4. Post-execution, the agent uploads the new code to the cache with a success or failure status.
  5. The retrieval system uses verdict scoring and voting to ensure future searches prioritize the most effective solutions.

Code Cache Setup

To use this within your Openclaw Skills ecosystem, first obtain an API key from the Raysurfer dashboard. You can then configure the skill using one of the following methods:

# Set the environment variable
export RAYSURFER_API_KEY=your_api_key_here

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

Code Cache Data Schema & Taxonomy

Code Cache organizes information semantically to facilitate rapid retrieval. The following data points are tracked for each entry:

Attribute Description
Task Description Natural language summary used for semantic matching.
Source Code The actual file content stored and retrieved for execution.
Verdict Score A numerical filter (default min 0.3) for retrieval quality.
Votes Upvotes and downvotes that refine search relevance over time.
Metadata Status flags indicating if the code successfully executed.

Code Cache Advanced Features

  • Semantic search with adjustable top-k and min-score filters for precise code retrieval.
  • Automated sandbox preparation with the files command to inject cached code directly into agent prompts.
  • Manual and automatic voting mechanisms to improve the collective intelligence of the cache.
  • Support for multi-file uploads to handle complex, modular scripts in a single execution context.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Github Stars: 0
forks: 0

Featured*