Install
openclaw skills install skill-preflightAutomatically inject relevant skills and protocols into agent context using local embeddings. Free, no API calls — uses Ollama with nomic-embed-text.
openclaw skills install skill-preflightA smart plugin for OpenClaw that automatically injects the most relevant skills and protocols into your agent's context before each run. Uses Ollama embeddings — free, offline-capable, no separate embedding API key required.
When you run an agent, this plugin:
skills/ and memory/protocols/ directories for documentationnomic-embed-text (via Ollama)Result: Agents follow custom protocols and skills without burning tokens on irrelevant context.
http://localhost:11434nomic-embed-text (download with ollama pull nomic-embed-text)Download from ollama.com and install.
ollama pull nomic-embed-text
ollama serve
Leave this running in the background. It listens on http://localhost:11434 by default.
Add to your openclaw.json:
{
"plugins": {
"skill-preflight": {
"enabled": true,
"config": {
"minScore": 0.3,
"maxResults": 3,
"protocolDirs": ["memory/protocols"],
"skillsDirs": ["skills"]
}
}
}
}
Create your skills and protocols in:
skills/ — skill documentation (looks for SKILL.md in subdirs or loose .md files)memory/protocols/ — protocol docs (.md files, 1 level deep)| Option | Default | Description |
|---|---|---|
protocolDirs | ["memory/protocols"] | Directories to scan for protocol docs (recursive, 1 level) |
skillsDirs | ["skills"] | Directories to scan for skill docs |
toolsFiles | ["TOOLS.md"] | Individual files to always include in the index |
pinnedDocs | [] | Docs always injected first, regardless of score |
maxResults | 3 | Max ranked docs to inject per run (pinned docs don't count toward this) |
maxDocLines | 100 | Truncate injected docs to N lines (0 = no limit) |
minScore | 0.3 | Cosine similarity threshold (0–1). Lower = more permissive. Tune via debug logs. |
embedModel | nomic-embed-text:latest | Ollama embedding model |
ollamaBaseUrl | http://localhost:11434 | Ollama API base URL. For local-only privacy, keep this on localhost, 127.0.0.1, or ::1. If you point it at a remote host, prompt text and indexed doc content are sent to that host for embeddings. |
requestTimeoutMs | 10000 | Timeout for embedding requests (ms) |
minPromptLength | 20 | Minimum prompt length to trigger preflight. Short prompts skip embedding. |
Pin specific docs so they're always injected first, regardless of relevance score:
{
"plugins": {
"skill-preflight": {
"config": {
"pinnedDocs": ["memory/protocols/house-rules.md", "skills/ethereum/SKILL.md"]
}
}
}
}
Pinned docs appear first and don't count toward maxResults.
Enable debug logging in OpenClaw to see similarity scores:
skill-preflight: scores — DebuggingProtocol(0.72), EthereumSkill(0.51), MemoryProtocol(0.34), ...
Use this to dial in minScore. If too many irrelevant docs are injected, raise it. If relevant docs are missing, lower it.
curl http://localhost:11434/api/tagsollama list (should show nomic-embed-text)requestTimeoutMs in configprotocolDirs or skillsDirsstatus: deprecated or status: archived are skippedminScore (lower threshold = more docs)maxResults (cap on how many ranked docs)pinnedDocs to always include critical docsnomic-embed-text takes ~100–300ms per document on typical hardwareminScore to reduce docs being embeddedDocs are standard Markdown with optional frontmatter:
---
name: My Custom Skill
description: A brief description of what this does
status: active
---
# My Custom Skill
Detailed instructions, examples, step-by-step procedures...
Frontmatter is optional. If not provided, the first heading or filename is used as the title, and the first few lines become the description.
ollamaBaseUrl on localhost, 127.0.0.1, or ::1 if you want docs and prompts to stay on the same machineollamaBaseUrl points to another host, the following are sent to that host for embedding:
MIT
Questions? Check the OpenClaw docs at openclaw.ai or report issues on GitHub.