β³ This skill is pending AI review.
Scores will appear once the review pipeline completes.
ClawTrace Self-Evolve
Ask Tracy to analyze your recent trajectories and improve your agent behavior based on data-driven recommendations.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
Not yet listed on ClawHub or SkillsMP
// README
Paper
ClawTrace: Cost-Aware Tracing for LLM Agent Skill Distillation Β βΒ Boqin Yuan, Renchu Song, Yue Su, Sen Yang, Jing Qin Β· arXiv 2604.23853
Skill-distillation pipelines learn reusable rules from LLM agent trajectories, but they lack a key signal β how much each step costs. ClawTrace records every LLM call, tool use, and sub-agent spawn during a session and compiles it into a TraceCard: a ~1.5 kB YAML summary with per-step USD cost, token counts, and redundancy flags. On top of TraceCards, CostCraft produces three patch types β preserve, prune (with counterfactual evidence), and repair β that improve agent skills without inflating cost.
π Read the paper: https://arxiv.org/abs/2604.23853 Β Β·Β BibTeX
Why this exists
My OpenClaw agent burned ~40Γ its normal token budget in under an hour. Root cause: it was appending ~1,500 messages of history to every LLM call. By the time I noticed, it had already spent a few dollars on what should have been a 3-cent task β and I couldn't see it from logs, because OpenClaw flattens everything into a wall of JSON. The loop was invisible.
ClawTrace was built after that incident, and the paper above is what came out of using it at scale.
ClawTrace records every agent run as a tree of spans and lets you inspect it.
openclaw plugins install @epsilla/clawtrace
openclaw clawtrace setup
openclaw gateway restart
Then open clawtrace.ai. Your next run appears automatically.
What it shows
- Token usage per step β see exactly which LLM call ate your budget
- Tool calls and retries β spot loops before they compound
- Execution timeline β Gantt chart of every span, parallel and sequential
- Full input/output β click any step to see what went in and what came back
Ask Tracy
You can also ask questions in plain English. Tracy is an AI analyst wired directly to your trajectory graph. She runs live Cypher queries against your data, generates charts, and tells you specifically what to fix.
"Why did my last run cost so much?" "Which tool is failing most often?" "Is my context window growing across sessions?"
Three views per trace
Every trajectory has three views β click any node/span/bar to open step detail with full payloads, token counts, duration, cost, and errors.
Execution path β collapsible tree, parent-child relationships, per-node cost badges
Call graph β force-directed diagram of every agent, model, and tool in the run
Timeline β Gantt chart showing where time actually went
Getting started
1. Install the plugin on your OpenClaw agent
openclaw plugins install @epsilla/clawtrace
2. Authenticate
openclaw clawtrace setup
Paste your observe key from clawtrace.ai when prompted. 200 free credits, no credit card.
3. Restart the gateway
openclaw gateway restart
Done. Every run now streams to ClawTrace automatically.
Self-evolving agents
The plugin also exposes a /v1/evolve/ask endpoint so your agent can query Tracy about its own trajectories. Install the ClawTrace Self-Evolve skill and your agent will periodically check its own cost and failure patterns, apply fixes, and log what it changed.
openclaw skills install clawtrace-self-evolve
Architecture
graph TB
subgraph Agent Runtime
OC[OpenClaw Agent]
PLG["@epsilla/clawtrace plugin<br/>8 hook types"]
end
subgraph Ingest Layer
ING[Ingest Service<br/>FastAPI + Cloud Storage]
end
subgraph Data Lake
RAW[Raw JSON Events<br/>Azure Blob / GCS / S3]
DBX[Databricks Lakeflow<br/>SQL Pipeline]
ICE[Iceberg Silver Tables<br/>events_all, pg_traces,<br/>pg_spans, pg_agents]
end
subgraph Graph Layer
PG[PuppyGraph<br/>Cypher over Delta Lake]
end
subgraph Backend Services
API[Backend API<br/>FastAPI + asyncpg]
PAY[Payment Service<br/>Credits + Stripe]
MCP[Tracy MCP Server<br/>Cypher queries]
end
subgraph AI Layer
TRACY[Tracy Agent<br/>Anthropic Managed Harness<br/>Claude Sonnet 4.6]
end
subgraph Frontend
UI[ClawTrace UI<br/>Next.js 15 + React 19]
DOCS[Documentation<br/>Server-rendered Markdown]
end
subgraph External
NEON[(Neon PostgreSQL<br/>Users, API Keys,<br/>Credits, Sessions)]
STRIPE[Stripe<br/>Payments]
end
OC --> PLG
PLG -->|"POST /v1/traces/events"| ING
ING --> RAW
RAW --> DBX
DBX --> ICE
ICE --> PG
PG -->|Cypher| API
PG -->|Cypher| MCP
API --> NEON
PAY --> NEON
PAY --> STRIPE
MCP -->|tool results| TRACY
TRACY -->|SSE stream| API
UI -->|REST API| API
UI -->|SSE| API
API -->|deficit check| PAY
Data flow
- Capture β The plugin intercepts 8 OpenClaw hook types:
session_start,session_end,llm_input,llm_output,before_tool_call,after_tool_call,subagent_spawning,subagent_ended - Ingest β Events are batched and POSTed to the ingest service, which writes partitioned JSON to cloud storage (
tenant={id}/agent={id}/dt=YYYY-MM-DD/hr=HH/) - Transform β Databricks Lakeflow SQL pipeline materializes raw events into 8 Iceberg silver tables every 3 minutes
- Query β PuppyGraph virtualizes the Delta Lake tables as a Cypher-queryable graph (Tenant β Agent β Trace β Span with CHILD_OF edges)
- Serve β Backend API runs Cypher queries; Tracy's MCP s
// HOW IT'S BUILT
// FILES
2 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
plugins/clawtrace/skills/SKILL.md5.5 KBupstream β
--- name: ClawTrace Self-Evolve description: Ask Tracy to analyze your recent trajectories and improve your agent behavior based on data-driven recommendations. version: 1.0.0 metadata: {"openclaw":{"emoji":"π¬","os":["linux","darwin","win32"],"homepage":"https://clawtrace.ai","requires":{"env":["CLAWTRACE_OBSERVE_KEY"]}}} --- # ClawTrace Self-Evolve Skill You have access to ClawTrace, an observability platform that captures and analyzes all your trajectories. Use this skill to understand your own performance and improve over time. ## When to Use This Skill Invoke this skill when any of the following is true: - A run just completed and cost more than expected - A run failed or produced unexpected output - You've completed 5 or more runs since your last self-analysis - Your session is ending and you want to log learnings - You notice repeated failures on the same type of task ## How to Call the Endpoint Send a POST request to `https://api.clawtrace.ai/v1/evolve/ask`. Authentication uses your observe key, which is already set in your environment as `CLAWTRACE_OBSERVE_KEY`. ```python import httpx import os def ask_tracy(question: str, trace_id: str = None, session_id: str = None) -> str: """Ask Tracy to analyze trajectories and return recommendations.""" observe_key = os.environ.get("CLAWTRACE_OBSERVE_KEY", "") if not observe_key: return "ClawTrace observe key not configured." payload = {"question": question} if trace_id: payload["trace_id"] = trace_id if session_id: payload["session_id"] = session_id full_response = [] with httpx.stream( "POST", "https://api.clawtrace.ai/v1/evolve/ask", headers={ "Authorization": f"Bearer {observe_key}", "Content-Type": "application/json", }, json=payload, timeout=120, ) as response: event_type = "" for line in response.iter_lines(): if line.startswith("event: "): event_type = line[7:] elif line.startswith("data: ") and event_type == "text": import json data = json.loads(line[6:]) full_response.append(data.get("text", "")) return "".join(full_response) ``` ## What to Ask β Question Templates Use these questions for maximum insight. Substitute actual values for placeholders. ### After a costly run ``` "My last run cost significantly more than usual. The trace_id is {trace_id}. What caused the cost spike and what should I change to prevent it?" ``` ### After a failed run ``` "My last run failed. The trace_id is {trace_id}. What step failed, what was the input that caused it, and how should I handle this case differently?" ``` ### Periodic self-analysis (every 5 runs) ``` "Analyze my last 10 trajectories. What patterns do you see in my failures? Where am I spending the most tokens? What one change would have the biggest impact on cost and reliability?" ``` ### Before a high-stakes task ``` "I'm about to execute a complex multi-step task. Based on my recent trajectory history, what are my most common failure modes and how should I guard against them?" ``` ### Context window management ``` "Is my context window growing too large across sessions? Review my recent traces and tell me if I should trim my history and when." ``` ### Tool call efficiency ``` "Which of my tool calls are taking the longest or failing most often? What can I change to make my tool usage more reliable and efficient?" ``` ## How to Act on Recommendations When Tracy responds, follow these rules: 1. **Extract the core recommendation.** Tracy will identify 1β3 specific changes. Focus on the highest-impact one. 2. **Apply changes to this session immediately.** If Tracy says your context window is bloated, trim history now before continuing. 3. **Log the insight to your MEMORY.md.** Record what you learned so future sessions benefit: ``` ## ClawTrace Learnings β {date} - Issue: {what Tracy found} - Fix: {what I changed} - Impact: {expected improvement} ``` 4. **Confirm the change worked.** After applying a recommendation, mention it in your next response: "Based on trajectory analysis, I've adjusted X to prevent Y." 5. **Do not ask Tracy more than twice per session** unless a new failure occurs. Each call consumes credits and Tracy's value is in patterns across many runs, not micro-optimization within one session. ## Example β Full Interaction ``` # End of a session β periodic self-review insight = ask_tracy( "Analyze my performance over the last 5 trajectories. " "What's costing the most, what's failing, and what's the single most important thing to fix?" ) # Tracy responds with analysis # You read it, extract the recommendation, and act: # e.g. "Your context window averages 1,200 messages per LLM call. # Trim to last 50 messages. This would cut input cost by ~90%." # Apply immediately: # β truncate conversation history to last 50 messages # β log to MEMORY.md # β confirm in next output ``` ## Important Notes - Tracy has access to your real trajectory data. Her analysis reflects actual runs, not simulations. - Responses stream as SSE β parse the `text` events to build the full response. - The `session_id` returned in the first SSE event can be reused to continue a conversation with Tracy across multiple calls. - Tracy respects tenant isolation β she can only see your own trajectories. - If you don't have a specific `trace_id`, omit it and Tracy will analyze recent trajectories automatically.README.mdupstream β
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/epsilla-cloud-clawtrace-plugins-clawtrace-skills.md