Files
swarm-zap/hooks/model-skill-injector/HOOK.md

40 lines
1.4 KiB
Markdown

---
name: model-skill-injector
description: "Injects model-specific best-practice context into bootstrap depending on the active LLM (Anthropic vs OpenAI)"
metadata:
{
"openclaw": {
"emoji": "🧠",
"events": ["agent:bootstrap"],
"requires": { "config": ["workspace.dir"] }
}
}
---
# model-skill-injector
Fires on `agent:bootstrap` and appends a model-family-specific best-practices
hint file to the bootstrap context, so the agent always knows which tool-design
rules apply for the currently active model — without bloating the base system
prompt.
## What it does
1. Reads the active model string from the event config (`agents.defaults.model.primary`).
2. Detects the model family by model name only:
- **Anthropic** — any model containing `claude`
- **OpenAI** — any model containing `gpt`
3. Injects the corresponding hint file from the workspace `skills/llm-tool-best-practices/` folder as a virtual bootstrap file named `MODEL_HINTS.md`.
4. If the model is unknown / not matched, injects a neutral fallback noting both families.
## Files
- Anthropic hints: `skills/llm-tool-best-practices/hints/anthropic.md`
- OpenAI hints: `skills/llm-tool-best-practices/hints/openai.md`
- Fallback: `skills/llm-tool-best-practices/hints/generic.md`
## Notes
- Runs read-only; never writes files.
- Only injects the targeted section — does not load the full best-practices doc each turn.