feat: Agent Skill (local-context-router)#7
Merged
Merged
Conversation
Add the Agent Skill manifest: a trigger description and instructions to run the preflight, use text for text/ocr pages, and attach images only for vision pages. Open-standard format, so it works in Claude Code and Codex.
Route a PDF through the router (or OCR a bare image), render visual pages to a vision directory, and emit JSON or a human summary. Falls back to the repo source tree when the package is not installed.
Check the SKILL.md frontmatter, run the script on a text PDF, and confirm unsupported file types are rejected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Packages the router as an Agent Skill so Claude Code and Codex run the preflight automatically before sending a document to the model.
What
SKILL.md: trigger description (fires when the user shares a PDF/scan/screenshot) plus instructions — usetextfor text/ocr pages and attach the rendered image only forvisionpages. Uses the open Agent Skills format, so the same folder works in Claude Code and Codex.scripts/preflight.py: routes a PDF throughroute_pdf(or OCRs a bare image), renders visual pages into--vision-dir, and prints JSON or a human summary includingtokens_saved. Falls back to the reposrc/when the package is not yet installed.Tests
Validate the frontmatter (name matches directory, description present and bounded, mentions PDF/OCR/vision), run the script end to end on a text PDF, and confirm unsupported file types are rejected.
On a mixed 3-page document the skill routes prose to text, the table to vision (rendering its image), the scan to OCR, and reports ~3085 tokens saved.
Verified locally: ruff, ruff format, mypy (strict), pytest (42) all pass; the skill is discovered and usable in this repo.