Instant context routing for AI agents. A cheap model watches your conversation and automatically injects the right docs and skills before your agent responds — so it never forgets to read what it needs.
You document everything. You have an index with summaries. You have read_when hints everywhere. You have reminders in CLAUDE.md. And still, the agent doesn't read the right docs before coding.
The problem isn't missing documentation — it's that static injection doesn't adapt to what you're actually asking right now.
On every user message, Reflex:
- Reads the last 10 conversation entries
- Looks at your registry of available docs and skills
- Uses a fast model (gpt-5.2 by default, any OpenAI-compatible endpoint) to decide what's relevant
- Injects a directive to read relevant docs and invoke relevant skills
- Tracks what's already been injected — no duplicates within a session
Your agent sees the injection as part of the current message — not buried in a system prompt.
1. Install the reflex binary
curl -sL https://raw.githubusercontent.com/markmdev/reflex/master/install.sh | shOr with Go:
go install github.com/markmdev/reflex@latest2. Set your API key
reflex config set api-key sk-your-openai-keyOr use an environment variable:
export OPENAI_API_KEY=sk-your-key3. Install the Claude Code plugin
/plugin marketplace add markmdev/claude-plugins
/plugin install reflex@markmdevThat's it. No registry to maintain — Reflex discovers everything automatically.
| Framework | Hook location | Docs |
|---|---|---|
| OpenClaw | hooks/openclaw/ |
Setup |
Skills — add name and description frontmatter to .claude/skills/*/SKILL.md:
---
name: planning
description: "Create implementation plans. Use for new features, refactoring, architecture."
---Docs — add summary and read_when frontmatter to any .md file:
---
summary: "OAuth implementation details and gotchas"
read_when:
- authentication
- OAuth
- login
---Reflex discovers both automatically. No list to maintain.
Reflex is a framework-agnostic CLI. Hooks call it; you can also call it directly.
echo '{
"messages": [{"type": "user", "text": "help me set up OAuth"}],
"registry": {
"docs": [{"path": "auth.md", "summary": "OAuth guide", "read_when": ["OAuth"]}],
"skills": []
},
"session": {"docs_read": [], "skills_used": []}
}' | reflex route
# Output:
{"docs":["auth.md"],"skills":[]}View recent routing decisions:
reflex logsAny OpenAI-compatible API works. Default: OpenAI gpt-5.2 via Responses API.
Config lives at ~/.config/reflex/config.yaml:
provider:
base_url: https://api.openai.com/v1
model: gpt-5.2
responses_api: trueSwitch providers by changing those lines:
# Kimi K2.5
provider:
base_url: https://api.moonshot.ai/v1
api_key_env: MOONSHOT_API_KEY
model: kimi-k2.5Or use the CLI:
reflex config set model gpt-4o-mini
reflex config set base-url https://api.openai.com/v1
reflex config showInput (stdin JSON):
{
"messages": [{"type": "user", "text": "..."}],
"registry": {
"docs": [{"path": "file.md", "summary": "...", "read_when": ["keyword"]}],
"skills": [{"name": "planning", "description": "..."}]
},
"session": {"docs_read": ["already-read.md"], "skills_used": []},
"metadata": {}
}Output (stdout JSON):
{"docs": ["file.md"], "skills": []}Returns {"docs": [], "skills": []} when nothing is needed. Errors go to stderr. Always exits 0 — never blocks your agent.