agentic-context-engine: Skill for Claude Code

.claude/skills/kayba-pipeline/stage-3-metrics/SKILL.md

kayba-stage-3-metrics is a skill for Claude Code from kayba-ai/agentic-context-engine. It costs 92 tokens per session (3,166 once invoked), scanned A, original, Apache-2.0.

A workflow for turning observations from Kayba agent traces into measurable Python metrics. Traces are recorded histories of what an agent did during evaluation.

In plain words
What is it for?
It helps define metrics, calculate baselines from traces, review small samples or extreme results, and remove overlapping measurements.
Why use it?
It helps replace vague impressions with repeatable measurements and checks whether the metrics are reliable enough to compare results.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is kayba-ai/agentic-context-engine's own configuration. It tells Claude Code how to work on agentic-context-engine itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything agentic-context-engine configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python eval/compute_baselines.py --traces-dir {TRACES_FOLDER} --output eval/baseline_metrics.json.

About the project

Agentic Context Engine is an open-source engine that gives AI agents a persistent learning loop, helping them remember successful strategies and learn from failures across sessions. It is used to improve production agents, and also powers Kayba’s hosted service. Catalogue add-ons support workflows for operating and configuring the engine.

kayba-ai/agentic-context-engine · 2,565 stars · on GitHub · kayba.ai

Reuse

Borrowing it

Nothing to install: this file belongs to kayba-ai/agentic-context-engine. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/kayba-ai/agentic-context-engine/main/.claude/skills/kayba-pipeline/stage-3-metrics/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/kayba-ai/agentic-context-engine

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kayba-stage-3-metrics

README.md
[![agentmods](https://agentmods.dev/badge/skills/kayba-ai/agentic-context-engine/stage-3-metrics/github.svg)](https://agentmods.dev/skills/kayba-ai/agentic-context-engine/stage-3-metrics)
Your own site
<a href="https://agentmods.dev/skills/kayba-ai/agentic-context-engine/stage-3-metrics"><img src="https://agentmods.dev/badge/skills/kayba-ai/agentic-context-engine/stage-3-metrics/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kayba-stage-3-metrics

Your own site · 80×15
<a href="https://agentmods.dev/skills/kayba-ai/agentic-context-engine/stage-3-metrics"><img src="https://agentmods.dev/badge/skills/kayba-ai/agentic-context-engine/stage-3-metrics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,166 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00092 $0.03166
Opus 5 $0.00046 $0.01583
Sonnet 5 $0.00018 $0.00633
Haiku 4.5 $0.00009 $0.00317

Measured 9d ago against content hash 80a1e8a64c6c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

kayba-stage-3-metrics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/kayba-pipeline/stage-3-metrics/SKILL.md · 181 lines

How it starts

The opening of the file, as written. The whole thing — 181 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Stage 3: Metrics and Programmatic Analysis

Define metrics from insights, implement as code, run, review, iterate.

Inputs

  • TRACES_FOLDER — path to directory containing trace JSON files
  • eval/stage1_insights_summary.md — output from Stage 1
  • eval/stage2_domain_context.md — output from Stage 2

Read both input files before starting.

Process

This stage is iterative. You cycle through define → implement → run → review, with a hard cap of 3 iterations. A metric set is "clean" when ALL of the following hold:

  1. No small-sample metrics in the priority set — every metric used for priority ranking has denominator >= 5. Metrics with denominator < 5 are kept but labeled "confidence": "directional-only" and excluded from priority sorting.
  2. No unexplained extremes — no metric reads 0% or 100% unless you can write a one-sentence justification (e.g., "0% is correct because the agent never calls send_certificate anywhere in the dataset"). Record the justification in the metric's "extreme_justification" field.
  3. No redundant pairs — no two metrics share > 70% of their denominator events. Check this: for each pair, compute |events_A ∩ events_B| / min(|events_A|, |events_B|). If > 0.70, merge or drop one.
  4. Script runs without errors on the full trace set.

If after 3 iterations the set is not fully clean, ship what you have and log remaining issues in eval/baseline_metrics.json under a top-level "warnings" key.

Step 1: Define metrics

For each insight from the Kayba analysis, use the evidence fields to identify observable signals in the traces:

  1. Read the insights summary — focus on evidence citations, error strings, behavioral patterns
  2. For each valid insight, determine what trace signal would change if the agent followed the skill
  3. Classify each metric by detector pattern type:

Recovery detectors — consecutive calls to the same function where first has error, next succeeds

def has_recovery(calls, function_name):
    for i in range(len(calls) - 1):
        if calls[i]['name'] == function_name and is_error(calls[i]['output']):
            if calls[i+1]['name'] == function_name and is_success(calls[i+1]['output']):
                return True
    return False

Read the full file on GitHub · 181 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 181 lines · 92 tokens per session scan A 80a1e8a64c6c

Subscribe to this mod's changes

kayba-stage-3-metrics is a skill published in the GitHub repository kayba-ai/agentic-context-engine (2,565 stars, last pushed 11d ago), licensed Apache-2.0. It adds 92 tokens to every session and 3,166 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

titen-memory

Use the Titen MCP server to recall bounded evidence-grounded context, record verified durable signals, submit feedback, and coordinate checkpoints, leases, or handoffs. Use when work may benefit from prior project memory or when a verified outcome should be preserved for another agent; do not use it to capture raw…

RamaAditya49/titen · 77 tokens

open-source

Documentation reference for writing Python code using the browser-use open-source library. Use this skill whenever the user needs help with Agent, Browser, or Tools configuration, is writing code that imports from browseruse, asks about @sandbox deployment, supported LLM models, Actor API, custom tools, lifecycle…

browser-use/browser-use · 137 tokens

writing

A writing guide for turning verified facts and calculations into finished text for a specific audience. It follows the requested language, structure, and length.

bojieli/ai-agent-book · 27 tokens

mnemon

Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.

mnemon-dev/mnemon · 25 tokens

goai

GoAI is a Go SDK for AI applications. One unified API across 25+ LLM providers. Inspired by the Vercel AI SDK, adapted to Go idioms (generics, interfaces, channels).

zendev-sh/goai · 0 tokens

mnemo-cortex

Installs and wires Mnemo Cortex (local-first persistent memory) into OpenClaw and other MCP-capable agents. Use for cross-session recall, decision history, or multi-agent shared memory.

GuyMannDude/mnemo-cortex · 44 tokens