๐ฆ 5-Layer Intelligent Skill Retrieval for Hermes Agent โ hard triggers, FTS5, synonym dictionary, dense embedding, RRF fusion. Zero core modification.
๊ฐ์
Hermes Agent loads every installed skill into the system prompt as a flat list. When you have 50+ skills: - โ overlapping descriptions confuse selection - โ 5,000โ10,000 tokens per turn just for the skill list - โ buried at the bottom of a long list Eagle Eye is a that acts as an intelligent pre-filter. Before each API call, it narrows the skill list to the top-5 most relevant candidates and injects them as a lightweight hint. Not every query needs a skill. "What should I eat for dinner?" is best answered by the LLM's general knowledge โ not by loading a restaurant-finder skill. Eagle Eye's confidence gate prevents forced matches. L1 (hard triggers) is 100% precise โ if the user types "debug", the debugging skill loads instantly with no probability involved. L2โL5 handles the long tail where fuzzy, semantic matching adds value. L2โL5 returns candidates, not conclusions. The LLM retains final authority to load a skill, combine multiple skills, or ignore the hint entirely.
README
๐ฆ Eagle Eye โ 5-Layer Intelligent Skill Retrieval for Hermes Agent
Narrow 100+ skills down to the right 5 โ deterministic triggers, fuzzy matching, semantic search, and rank fusion. Zero core modification.
The Problem
Hermes Agent loads every installed skill into the system prompt as a flat list. When you have 50+ skills:
- The LLM picks wrong โ overlapping descriptions confuse selection
- You burn tokens โ 5,000โ10,000 tokens per turn just for the skill list
- Rarely-used skills become invisible โ buried at the bottom of a long list
The Solution
Eagle Eye is a zero-invasive plugin that acts as an intelligent pre-filter. Before each API call, it narrows the skill list to the top-5 most relevant candidates and injects them as a lightweight hint.
User Query
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ L1: Hard Triggers โ
โ Deterministic keyword matching (3-tier) โ
โ Hit โ Inject full SKILL.md instantly โ
โ Miss โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ L2: FTS5 BM25 (text similarity) โ
โ L3: Synonym Dict (domain knowledge) โ
โ L4: Dense Embedding (semantic similarity) โ
โ L5: RRF Fusion (rank combination) โ
โ โ
โ Score โฅ threshold โ Inject skill hints โ
โ Score < threshold โ Silent (LLM decides) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
LLM Final Decision
Key Design Decisions
1. โNot matchingโ is a valid result
Not every query needs a skill. โWhat should I eat for dinner?โ is best answered by the LLMโs general knowledge โ not by loading a restaurant-finder skill. Eagle Eyeโs confidence gate prevents forced matches.
2. Deterministic first, probabilistic second
L1 (hard triggers) is 100% precise โ if the user types โdebugโ, the debugging skill loads instantly with no probability involved. L2โL5 handles the long tail where fuzzy, semantic matching adds value.
3. Hints, not decisions
L2โL5 returns candidates, not conclusions. The LLM retains final authority to load a skill, combine multiple skills, or ignore the hint entirely. The retrieval system doesnโt override the LLMโs judgment.
4. Each layer fails independently
If sentence-transformers isnโt installed, L4 degrades gracefully โ L1+L2+L3 still work. If jieba is missing, L1+L4 still work. The system never crashes; it always falls back to a working subset.
Quick Start
# 1. Clone
git clone https://github.com/willingning-coder/eagle-eye.git
cd eagle-eye
# 2. Generate config from your local skill library
python scripts/generate_config.py
# 3. Review and customize
# - Edit _HARD_TRIGGERS in src/skill_retriever.py
# - Edit src/skill_synonyms.yaml
# (See PROMPTS.md for LLM-assisted generation)
# 4. Install
bash scripts/install.sh
# 5. Restart Hermes
hermes gateway restart
Customization
Eagle Eye ships with minimal example data. The real power comes from generating your own configuration based on your installed skills.
Auto-Generate (Recommended)
# Scan your skills and generate template configs
python scripts/generate_config.py
# Or just list what was found
python scripts/generate_config.py --scan-only
Manual Customization
| Component | File | What to do |
|---|---|---|
| Hard Triggers | src/skill_retriever.py โ _HARD_TRIGGERS |
Add (keyword, skill-name) tuples. More specific first. |
| Synonym Dictionary | src/skill_synonyms.yaml |
Map natural language terms to skills. 5โ15 per skill. |
| Embedding Model | HERMES_EMBEDDING_MODEL env var |
Swap to a different sentence-transformers model. |
LLM-Assisted Generation
Use the prompts in PROMPTS_EN.md or PROMPTS_CN.md with any LLM to generate high-quality triggers and synonyms from your skill list.
Environment Variables
| Variable | Default | Description |
|---|---|---|
HERMES_DISABLE_SKILL_RETRIEVAL |
(unset) | Set 1 to disable entirely |
HERMES_SKILL_RETRIEVAL_TOP_K |
5 |
Number of skills to return |
HERMES_EMBEDDING_MODEL |
shibing624/text2vec-base-chinese-paraphrase |
Embedding model for L4 |
Performance
| Metric | Value |
|---|---|
| L1 real-world accuracy | ~90% |
| Functional test accuracy | 100% |
| Query latency (cached) | ~20ms |
| First-call latency | ~11s (model loading) |
| Memory footprint | ~403MB (with embedding) |
Architecture
See ARCHITECTURE.md for a deep technical dive covering:
- Layer-by-layer algorithm analysis with code
- RRF fusion math and why it beats score normalization
- Confidence gate design philosophy
- Failure mode matrix and degradation hierarchy
- Latency and memory profiling
File Structure
eagle-eye/
โโโ src/
โ โโโ skill_retriever.py # Core 5-layer retrieval engine
โ โโโ skill_synonyms.yaml # Synonym dictionary (template)
โ โโโ plugin.py # Hermes plugin (pre_llm_call hook)
โ โโโ plugin.yaml # Plugin manifest
โโโ scripts/
โ โโโ generate_config.py # Auto-generate config from your skills
โ โโโ install.sh # One-command installation
โโโ templates/
โ โโโ hard_triggers.example.py # Trigger format reference
โโโ README.md # This file (English)
โโโ README_CN.md # ไธญๆๆๆกฃ
โโโ ARCHITECTURE.md # Technical deep dive
โโโ PROMPTS_EN.md # LLM prompts for config generation (English)
โโโ PROMPTS_CN.md # LLM prompts for config generation (ไธญๆ)
โโโ CHANGELOG.md # Version history
โโโ LICENSE # MIT
Dependencies
| Package | Required? | Purpose |
|---|---|---|
jieba |
Yes | Chinese tokenization for L2โL3 |
sentence-transformers |
Optional | Dense embedding for L4 (graceful fallback if missing) |
numpy |
Optional | Numerical operations for L4 |
Contributing
Contributions are welcome! Areas where help is especially valuable:
- Trigger/synonym quality: Share your
_HARD_TRIGGERSandskill_synonyms.yamlconfigurations - Embedding model benchmarks: Test alternative models and report accuracy
- Multi-language support: Extend triggers and synonyms beyond Chinese/English
- Bug reports: Edge cases in fuzzy matching, false positives/negatives
License
์ถ์ฒ ๋๊ตฌ
๋ค๋ฅธ ํค์๋๋ฅผ ์ ๋ ฅํ๊ฑฐ๋ ํํฐ๋ฅผ ์ ๊ฑฐํด ๋ณด์ธ์.
์ค์น
npx skillfish add willingning-coder/eagle-eye