Add project- and task-aware lazy skill routing before prompt injection
What variant of Codex are you using?
Codex CLI (codex-cli 0.144.5). The underlying skill injection behavior likely also affects App and IDE sessions.
What feature would you like to see?
## Summary
Codex should automatically select a small set of relevant skills based on the current project and user task before
constructing the model-visible skills instructions.
Instead of injecting metadata for every implicitly available installed skill, Codex should use a lightweight retrieval
or routing stage to identify the most relevant skills and inject only those into the main agent context.
## Current behavior
Codex discovers all implicitly invokable skills and includes their names, descriptions, and paths in
<skills_instructions>.
Skill bodies are loaded progressively, which is good, but the metadata for the entire skill catalog still competes for
the fixed skills context budget. With a large skill library, descriptions are heavily truncated, reducing routing
quality and adding irrelevant context to every project.
The model only decides which skills are relevant after the full metadata catalog has already been added to its
context.
## Requested behavior
Before constructing the main agent prompt, Codex should:
- Inspect lightweight project signals such as repository manifests, languages, frameworks, file structure, and
project instructions.
- Consider the current user task, since project type alone is not sufficient.
- Retrieve a small candidate set from the installed skill registry.
- Inject only the highest-confidence relevant skills into the main session.
- Continue loading full
SKILL.mdbodies only when a selected skill is actually used.
Conceptually:
```text
project signals + current task
|
v
lightweight skill router
|
v
relevant skill subset
|
v
main Codex session
For example, a Next.js repository may normally select frontend, Playwright, and SEO skills. If the current task is
spreadsheet analysis or PDF generation, Codex should add the corresponding task-specific skill instead of relying only
on the repository type.
## Expected controls
- Allow users to pin a small set of always-visible skills.
- Respect policy.allow_implicit_invocation = false.
- Preserve explicit $skill-name invocation for any installed skill.
- Apply a configurable confidence threshold and maximum selected-skill count.
- Show which skills were selected and why.
- Provide an opt-out or broad-catalog compatibility mode.
- Re-evaluate when the task changes materially.
## Expected result
Users can keep a large skill library installed without injecting the whole catalog into every project. The main agent
receives more complete metadata for the few relevant skills, improving routing accuracy while reducing unrelated
prompt content.
## Non-goals
This request does not require eagerly loading skill bodies. It also does not require changing MCP or tool permissions.
It is specifically about retrieval and injection of skill metadata before the main agent begins processing the task.
Additional information
Related issues searched
- #21425 separates installed plugins from per-session metadata injection and discusses on-demand loading.
- #24237 requests project-level filtering of inherited/global skills.
- #9799 requests manual selection of a narrow skill set per session.
- #22692 requests user-selected skill/plugin profiles.
- #19090 reports truncation of the model-visible skills catalog.
This request is narrower in a different direction: automatic project- and task-aware retrieval before the main prompt
is constructed, rather than requiring users to maintain profiles or manually enumerate exclusions.