# Local Context Router

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-sid732-localcontextrouter-local-context-router`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [sid732](https://agentstack.voostack.com/s/sid732)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [sid732](https://github.com/sid732)
- **Source:** https://github.com/sid732/LocalContextRouter/tree/main/.claude/skills/local-context-router
- **Website:** https://pypi.org/project/localcontextrouter/

## Install

```sh
agentstack add skill-sid732-localcontextrouter-local-context-router
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Local Context Router

A multimodal model reads a PDF by extracting its text and rendering every page to
an image, then paying for both. On a page that is mostly prose, the image is
wasted spend. Run this preflight first and send the model only what each page
needs.

## When to use

Before reading, summarizing, or extracting from a PDF, scan, or screenshot the
user has shared.

## Requirements

The `localcontextrouter` package must be installed (`pip install localcontextrouter`,
macOS). It provides the `localctx` command used below.

## Run

Route the document and read the JSON, rendering any visual pages into a folder:

```sh
localctx  --json --vision-dir ./lcr-pages
```

If the `localctx` command is not available, run the bundled script with a Python
that has `localcontextrouter` installed (the script imports the same package):

```sh
python scripts/preflight.py  --json --vision-dir ./lcr-pages
```

## Use the result

The JSON has `tokens_saved` and a `pages` array. Each page carries `source`,
`text`, `text_tokens`, `image_tokens`, and `image`:

- `source: "text"`: use `text` directly; do not attach the image.
- `source: "ocr"`: the page was image-only and has been OCR'd on-device; use `text`.
- `source: "vision"`: the page is a table, chart, or diagram; attach the image at
  `image` so the model can read it. The `text` is a rough fallback only.

Assemble the text and OCR pages in reading order, attach images only for the
vision pages, and mention `tokens_saved` if the user cares about cost.

## Notes

Everything runs locally and offline; the document does not leave the machine.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [sid732](https://github.com/sid732)
- **Source:** [sid732/LocalContextRouter](https://github.com/sid732/LocalContextRouter)
- **License:** MIT
- **Homepage:** https://pypi.org/project/localcontextrouter/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-sid732-localcontextrouter-local-context-router
- Seller: https://agentstack.voostack.com/s/sid732
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
