knowledge-base-cache

A layered cache for large knowledge bases, storing frequently used information in faster or more readily available tiers and assembling relevant context for an agent. It is intended for knowledge that may not fit in one context window.

In plain words
What is it for?
Use it to organize large knowledge repositories, cache frequently requested answers, retrieve information semantically, and assemble results within a token budget. It is meant for ongoing or large-scale knowledge access rather than small one-off collections.
Why use it?
Repeatedly retrieving and rebuilding the same information can increase API use and exceed the amount of text an agent can handle at once. Tiered storage and context assembly reduce that repeated work for recurring queries.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/dqz00116/skill-lib/knowledge-base-cache
Any agent
npx skills add Dqz00116/skill-lib --skill knowledge-base-cache
Clone the repo
git clone --depth 1 https://github.com/Dqz00116/skill-lib

Made for: Claude Code, Codex.

Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,395 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00023 $0.02395
Opus 5 $0.00012 $0.01197
Sonnet 5 $0.00005 $0.00479
Haiku 4.5 $0.00002 $0.00239

Measured 2d ago against content hash b518923cb488, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

knowledge-base-cache 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 2d 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.

knowledge-base-cache/SKILL.md · 375 lines

How it starts

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

Knowledge Base Cache Skill

Overview

A layered knowledge base system with hot/cold/warm cache tiers and intelligent Working Memory for context management. Reduces API costs through multi-tier caching while supporting unlimited knowledge scale.

When to Use

Use this skill when:

  • Managing large knowledge bases that exceed context window limits
  • Reducing API costs for frequent knowledge queries
  • Implementing multi-tier caching (hot/cold/warm) for knowledge retrieval
  • Needing intelligent context assembly with token budget management
  • Requiring automatic caching with semantic retrieval capabilities

Do NOT use when:

  • Simple, small knowledge bases that fit in a single context window
  • One-off queries where caching overhead exceeds savings
  • Only basic file storage without caching tiers is needed

Create a structured knowledge repository with layered architecture (hot/cold/warm) and intelligent context management.

Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                  Application Layer                  │
│                    Agent Core                               │
└──────────────────────────┬──────────────────────────────────┘
                           │
┌──────────────────────────▼──────────────────────────────────┐
│              Working Memory Layer                      │
│  • Context Assembly        • Token Budget Management        │
│  • Multi-Source Coordination • LRU Cache                    │
└─────────────┬───────────────────────────────────────────────┘
              │ Standard Interface KnowledgeSource
    ┌─────────┼─────────┐
    ▼         ▼         ▼ (Reserved)
┌───────┐ ┌───────┐ ┌───────┐
│  Hot  │ │  Cold │ │ Warm  │
│ Cache │ │Storage│ │Vector │
│ Layer │ │ Layer │ │ Layer │
└───┬───┘ └───┬───┘ └───┬───┘
    │         │         │
Context   Repository  Vector DB
 Cache     Files     (Future)

Three-Tier Architecture

Tier Technology Use Case Status
🔥 Hot Context Cache (API) Full document retrieval, 90% cost savings ✅ Available
❄️ Cold Repository Files Keyword search, browsing, discovery ✅ Available
🌡️ Warm Vector DB Semantic search, precise Q&A 🔮 Planned

Read the full file on GitHub · 375 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. 2d ago First seen · 375 lines · 23 tokens per session scan A b518923cb488

Subscribe to this mod's changes

knowledge-base-cache is a skill published in the GitHub repository Dqz00116/skill-lib (22 stars, last pushed 3mo ago), licensed MIT. It adds 23 tokens to every session and 2,395 once invoked, about $0.0001 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

wegent-knowledge

Knowledge base management and search tools for Wegent. Provides capabilities to list, create, update, and search knowledge bases and documents using RAG retrieval. Use this skill when the user wants to manage knowledge bases, documents, or search for information programmatically.

wecode-ai/Wegent · 51 tokens

karpathy-llm-wiki

Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.

Astro-Han/karpathy-llm-wiki · 67 tokens

common-llm-security

OWASP LLM Top 10 (2025) audit checklist for AI applications, agent tools, RAG pipelines, and prompt construction. Use when performing any security review touching LLM client code, prompt templates, agent tools, or vector stores.

HoangNguyen0403/agent-skills-standard · 56 tokens

grounded-answer

Answer a user question through DocMason's canonical grounded workflow using retrieval, provenance tracing, render escalation, and a final answer-state check.

JetXu-LLM/DocMason · 32 tokens

knowledge-base-sync

Stage, incrementally refresh, validate, and publish the DocMason knowledge base from the local source corpus.

JetXu-LLM/DocMason · 26 tokens

qi-cli

Guide for using qi, a local knowledge search CLI for macOS and Linux. Use this skill whenever the user asks about qi commands, indexing documents, searching a knowledge base, asking questions with RAG, configuring providers (Ollama, OpenAI), understanding search modes (BM25, hybrid, vector), or anything related to the…

itsmostafa/qi · 125 tokens