answer-cache
Agent protocol for mycortex answer cache — inserts a cache-check step between RAG miss and model call.
Skill by lukemcqueen
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/lukemcqueen-answer-cache
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/answer-cache
What's inside
- Skill name
answer-cache- Description
- Agent protocol for mycortex answer cache — inserts a cache-check step between RAG miss and model call. Saves tokens by caching LLM answers with quality gating, semantic dedup, and RLS isolation per profile.
- License
- MIT
- Instructions
- 126 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Answer Cache — Agent Protocol
## Purpose
When mycortex (`search`) misses and the model answers from training data, that
answer is ephemeral. Next session pays the same token cost. This skill inserts
a cache-check step between RAG miss and model call, so repeated queries hit
the local answer cache for 0 tokens.
## Core Flow
```
Query -> mycortex search (hit? use it, 0 tokens)
-> miss? mycortex answer search (hit? use it, 0 tokens)
-> miss? model answers (costs tokens)
-> quality gate passes? mycortex answer store -> future hits local
```
## CLI Commands
All via the `mycortex` CLI (`~/.hermes-cortex/scripts/mycortex`):
### Store an answer
```bash
mycortex answer store "<query>" "<answer>" \
--confidence high|medium|low \
--model deepseek/deepseek-v4-flash \
--tokens 512 \
--source-scope federated|source_name
```
- Quality gates auto-skip: time-sensitive queries, refusals, PII
- Use `--force` to bypass quality gates
- Use `--update` to overwrite an existing entry for the same query
- Semantic dedup checks before insert (trigram similarity > 0.6)
### Search cached answers
```bash
mycortex answer search "<query>" [--limit 10] [--min-score 0.0] [--json]
```
- Returns exact matches first, then trigram similarity matches
- `--min-score 0.5` filters low-confidence semantic matches
- `--json` for machine-readable output
### View statistics
```bash
mycortex answer stats [--json]
```
### Prune stale entries
```bash
mycortex answer prune [--days 90] [--min-access 0] [--dry-run]
```
## Agent Protocol
### Step 1: Search mycortex (existing RAG)
```python
result = terminal("mycortex search '<query>' --limit 5 --json")
```
### Step 2: On miss, check the answer cache
```python
result = terminal("mycortex answer search '<query>' --limit 3 --min-score 0.5 --json")
```
### Step 3: Model fallback + auto-store
```python
# Only if both searches yield nothing useful
# After getting the model's answer:
terminal("mycortex answer store '<query>' '<answer>' --confidence medium --tokens <N>")
```
### Step 4: Verify the cached answer is used on repeat
```python
result = terminal("mycortex answer search '<query>' --json")
# -> returns the stored answer with 0 token cost
```
## Quality Gate Rules
| Gate | What it prevents | Bypass |
|------|-----------------|--------|
| Time-sensitive | "current weather", "latest news" — content becomes stale | `--force` |
| Refusal | LLM "I cannot help" patterns — don't cache dead ends | `--force` |
| PII | Emails, phones, IPs in answers — never cache | `--force` |
| Semantic dedup | Similar query, same answer — don't duplicate | `--force` |
## Source Scope
- **`federated`** (default) — visible to ALL agents (like federated brain sources)
- **`<source_name>`** — visible only to agents with a grant for that source
(matches the RLS model: `mycortex.source_grants` controls per-role visibility)
## RLS Isolation
The same per-profile isolation model applies: each Hermes profile connects as
`mycortex_reader_<profile>` and sees only answers whose `source_scope` is
`federated` OR whose scope matches a source the profile has a grant for.
## Pruning
The existing `agent-mycortex-retention` cron handles stale answers:
- Orphaned answers: archived after 90 days with zero access
- Active low-use: access_count < 3 after 180 days
- Manual: `mycortex answer prune --days 90 --min-access 0`
## Test Commands
```bash
mycortex answer store "What is the capital of France?" "Paris" \
--confidence high --tokens 5 --force
mycortex answer search "capital of France" --jsonFrom lukemcqueen/hermes-cortex, MIT.
More from lukemcqueen/hermes-cortex
- 0.614score
ads
lukemcqueen
When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms.
SkillAFreshness: A★ 4Claude Code +9 - 0.602score
offline-knowledge
lukemcqueen
Offline knowledge cascade — query local content (web-cache, kiwix ZIM, mycortex) without internet.
SkillAFreshness: A★ 4Claude Code +9 - 0.602score
macos-service-management
lukemcqueen
Manage and troubleshoot macOS launchd services — plist authoring, exit code diagnosis, variable expansion rules, and service lifecycle
SkillAFreshness: A★ 4Claude Code +9 - 0.598score
hermes-cortex
lukemcqueen
Install, configure, and maintain Hermes Cortex — the observability and knowledge layer for Hermes Agent (Ollama, mycortex, Langfuse, Cortex Dashboard, nginx…
SkillAFreshness: A★ 4Claude Code +9 - 0.598score
hermes-cortex-setup
lukemcqueen
Install and configure Hermes Cortex core components — Ollama, mycortex knowledge brain, health server, agent registry, hooks, cron jobs, and profile…
SkillAFreshness: A★ 4Claude Code +9 - 0.596score
pi-coding-agent
lukemcqueen
Operate the Pi coding agent CLI — install, extensions, Jev.
SkillAFreshness: A★ 4Claude Code +9 - 0.566score
ai-coding-agents
lukemcqueen
Delegate coding tasks to external AI coding agent CLIs — Claude Code, Codex CLI, and OpenCode.
SkillBFreshness: B★ 4Claude Code +9 - 0.566score
auto-remediation-fixes
lukemcqueen
Essential auto-remediation fixes for staging server guardian — timeout patterns, provider drift fixes, and operational hygiene for cron job errors and agent…
SkillBFreshness: B★ 4Claude Code +9 - 0.565score
evaluating-agent-frameworks
lukemcqueen
Evaluate an external agent framework for interop.
SkillBFreshness: B★ 4Claude Code +9 - 0.516score
web-cache
lukemcqueen
Local semantic web cache for AI agents — cache web_search and web_extract results locally with embeddings, reducing API costs and enabling offline operation.
SkillCFreshness: C★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 1
- Open issues
- 1
- Last commit (this folder)
- Sep 4, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/lukemcqueen/hermes-cortex
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from lukemcqueen
- 0.614score
ads
lukemcqueen
When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms.
SkillAFreshness: A★ 4Claude Code +9 - 0.602score
offline-knowledge
lukemcqueen
Offline knowledge cascade — query local content (web-cache, kiwix ZIM, mycortex) without internet.
SkillAFreshness: A★ 4Claude Code +9 - 0.602score
macos-service-management
lukemcqueen
Manage and troubleshoot macOS launchd services — plist authoring, exit code diagnosis, variable expansion rules, and service lifecycle
SkillAFreshness: A★ 4Claude Code +9 - 0.598score
hermes-cortex
lukemcqueen
Install, configure, and maintain Hermes Cortex — the observability and knowledge layer for Hermes Agent (Ollama, mycortex, Langfuse, Cortex Dashboard, nginx…
SkillAFreshness: A★ 4Claude Code +9 - 0.598score
hermes-cortex-setup
lukemcqueen
Install and configure Hermes Cortex core components — Ollama, mycortex knowledge brain, health server, agent registry, hooks, cron jobs, and profile…
SkillAFreshness: A★ 4Claude Code +9 - 0.596score
pi-coding-agent
lukemcqueen
Operate the Pi coding agent CLI — install, extensions, Jev.
SkillAFreshness: A★ 4Claude Code +9
Cite this page
answer-cache skill. Agent Mart. https://agentmart.dev/skills/lukemcqueen-answer-cache (last updated 2026-10-24)