Stop dumping every SKILL.md into the prompt. Keep/drop skills before the first model message — shrink context, save tokens.
Skill folders grow. Agents dump many SKILL.md files every turn. Unrelated skills burn tokens before the model even starts.
A pre-message keep/drop gate:
- Load a closed catalog of skills
select_skills(mode=local|jev)→SelectionResult {kept, dropped, chars_saved}- Hook injects only kept skills into the prompt
Multi-skill keep/drop for context size — not a single-skill suggester.
Python 3.10+, zero third-party runtime deps. No API key in local mode.
python -m pip install -e .
python -m jev_skill_selection select \
--root ./tests/fixtures/skills \
--mode local \
--threshold 0.1 \
--message "rebase my branch and open a PR" \
--jsonReal output on the 5 fixtures (docker-compose, git-ops, pptx-author, python-debug, web-search):
mode=local kept=1 dropped=4 chars 1431 → 393 (saved 1038)
kept: git-ops
dropped: docker-compose, pptx-author, python-debug, web-search
| Skills in prompt | Rough chars | |
|---|---|---|
| Before (dump all 5) | 5 | 1431 |
After (keep git-ops) |
1 | 393 |
| Saved | −4 | 1038 |
Local Jaccard on this short message scores
git-ops≈ 0.14. Harness / live e2e useJEV_THRESHOLD=0.1for the same prompt. Default CLI threshold is0.45(stricter — calibrate per catalog).
Soft inject (what every adapter ships today): tell the model which skills to prefer via context.
Hard filter (product goal): drop unrelated skills so they never enter the tool/skill index — they cannot burn tokens.
Prefer hard when the host exposes it. Soft is the universal fallback.
local(default): keyword / metadata shortlist, no key, offlinejev: TypeSafe Noul keep? / Choice soft scores viaPOST https://api.typesafe.ai/v1/systemone- Auth:
TYPESAFE_API_KEY - Model pin:
jev-1.13.0(verify on docs.typesafe.ai)
- Auth:
Use Jev when local overlap is too blunt for your catalog.
python -m pip install -e .
# or with tests:
python -m pip install -e ".[dev]"Requires Python 3.10+. Runtime deps: none (stdlib only).
python -m jev_skill_selection catalog --root ./tests/fixtures/skills
python -m jev_skill_selection select \
--root ./skills --mode local -m "fix the pytest traceback"
# Jev (placeholder key only — never commit secrets)
export TYPESAFE_API_KEY=ts_...
python -m jev_skill_selection select \
--root ./skills --mode jev --model jev-1.13.0 \
-m "rebase my branch and open a PR" --jsonfrom jev_skill_selection import load_catalog, select_skills, SelectionOptions
from jev_skill_selection.hook import before_first_message, HookContext
catalog = load_catalog(["./skills"])
result = select_skills(
"fix the pytest traceback",
catalog,
SelectionOptions(mode="local", threshold=0.45, max_keep=5),
)
print(result.kept_names, result.chars_saved)
outcome = before_first_message(HookContext(
user_message="...",
skill_roots=["./skills"],
options=SelectionOptions(mode="local"),
))
system_prompt_extra = "\n\n".join(outcome.prompt_blocks)Thin adapters under adapters/ hard-filter dropped skills by default (token savings).
Soft inject remains optional via JEV_FILTER_MODE=soft|both.
Full install paths → docs/INTEGRATION.md.
Live e2e: mock LLM + optional real Jev (./scripts/run_live_e2e.sh).
| Host | Path | Hard (default) | Soft (optional) |
|---|---|---|---|
| Claude Code | adapters/claude_code/ |
skillOverrides → "off" |
UserPromptSubmit → additionalContext |
| Codex | adapters/codex/ |
[[skills.config]] enabled=false (may need restart) |
same wire soft inject |
| Hermes | adapters/hermes/ |
llm_request strips <available_skills> |
pre_llm_call → context |
| OpenCode | adapters/opencode/ |
tool.definition filters available_skills |
chat.message |
Shared helpers: jev_skill_selection.adapters.common. Defaults: JEV_MODE=local, JEV_FILTER_MODE=hard.
flowchart LR
A[SKILL.md roots] --> B[catalog loader]
C[user message] --> D["select_skills(local|jev)"]
B --> D
D --> E["SelectionResult\nkept / dropped / chars_saved"]
E --> F[pre-message hook]
F --> G[only kept → prompt]
catalog + select_skills(mode=local|jev)
→ SelectionResult {kept, dropped, chars_saved}
→ pre-message hook adapter
→ only kept skills enter the prompt
| Module | Role |
|---|---|
catalog.py |
Scan --root for SKILL.md (name / description + body) |
select.py |
select_skills(...) |
local_mode.py |
Offline keyword shortlist |
jev_client.py / jev_mode.py |
TypeSafe SystemOne client + Noul / Choice |
hook.py |
Host-agnostic pre-message helper |
cli.py |
python -m jev_skill_selection catalog|select |
| skill_suggestion cookbook | This repo | |
|---|---|---|
| Output | Suggest at most one skill name | Keep/drop many skills |
| Goal | Single-skill recommendation | Context volume / token savings |
| Timing | Suggestion UX | Before first model message |
python -m pip install -e ".[dev]"
python -m pytest -q
# Optional live hosts (mock LLM):
# ./scripts/run_live_e2e.shDefault threshold 0.45? Calibrate per catalog. Local Jaccard and Jev Noul are not directly comparable.
noul vs choice? Default noul = independent keep/drop (multi-keep). choice ≈ soft ranking for small catalogs.
Model pin? jev-1.13.0 for reproducibility — re-check the official model list after releases.
More host detail: docs/INTEGRATION.md.
MIT
English · 中文说明
