Skip to main content

Compile any content into a tiered, budget-aware, agent-navigable progressive-disclosure manifest, plus an on-demand expansion protocol — for small/on-device context windows

Project description

faro-progressive-context

Compile any content into a tiered, budget-aware, agent-navigable progressive-disclosure manifest — for small / on-device context windows.

On-device models have tiny context windows (~4k today, ~32k near-term). Stuffing everything in — or lossily compressing it — loses information. The alternative is progressive disclosure: give the model a compact, accurate index of what exists and when each piece is relevant, then let it fetch detail on demand within a hard token budget.

faro-progressive-context is the open-source compiler + format + runtime for that index. It is the agent-navigated half of Faro's context tooling (the model reads the index and decides what to expand); its sibling faro-embedded-search is the retrieval-driven half. The two stay independent — this library has no hard dependency on it.

Status: Phase 1 (pre-alpha). The format, expansion runtime, eval harness, and the compiler (pcx build) are here and tested — adapters for tools/docs/skills/memory, the descriptor engine (bottom-up + contrastive + self-grade), cost annotation, and per-budget emit. Still to come: per-budget frontier shaping, website/file adapters with clustering (Phase 3), and the hosted Faro registry (Phase 5).

The idea in one screen

A progressive-context manifest (pcx.json) is a tree of nodes. Every node carries:

  • a descriptorwhat (one line: what this is) and when (one line: when it's relevant). These are the navigation index, and their quality is the whole game.
  • token costs — so the runtime can plan expansion against a budget without fetching anything.
  • either children (a branch) or a payload pointer (a leaf). Leaves are never inlined and always verbatim — no information is lost to a summary.

Variants are pre-generated per budget (pcx.4k.json, pcx.32k.json, …); budgets are arbitrary integers, so a developer who needs headroom for their own content can build a 31k variant — or reserve it at runtime.

What's here (Phase 0)

Module What it does
schema/pcx-0.1.schema.json the format, as JSON Schema
faro_progressive_context.types Manifest / Node / Payload dataclasses
faro_progressive_context.validate structural (zero-dep) + JSON Schema validation
faro_progressive_context.runtime the expansion protocol: peek / expand / collapse / search, with hard budget enforcement and a runtime reserve
faro_progressive_context.navigator KeywordNavigator (deterministic baseline, no model) and LLMNavigator (bring your own complete())
faro_progressive_context.eval the navigation-success @ budget harness — the headline quality metric

Quick start

pip install -e ".[dev,schema]"

# validate a manifest
pcx validate examples/scope-skills/manifest.pcx.4k.json --schema

# score navigation-success @ budget with the deterministic baseline navigator
pcx eval examples/scope-skills/manifest.pcx.4k.json examples/scope-skills/cases.json -v
from faro_progressive_context import Manifest, Runtime

m = Manifest.from_dict(json.load(open("examples/scope-skills/manifest.pcx.4k.json")))
rt = Runtime(m, reserve=1024)          # leave 1k for your own content

rt.peek()                               # frontier: tier-1 descriptors + budget_remaining
rt.expand("recurring")                  # reveal a branch's children (charged against budget)
ref = rt.expand("recurring.create")     # splice a leaf's verbatim payload; raises if over budget

The expansion protocol

The runtime — not the model — is the budget authority. effective_budget = variant.budget − reserve, and every expand is checked against it. When full it auto-collapses LRU leaves (opt-in) or refuses and tells the agent to choose. The budget is never silently exceeded.

Why a benchmark, not vibes

The moat is descriptor quality, so quality is measured, not asserted. The eval harness gives a navigator only the manifest and a budget plus (query → correct leaf) cases, and reports navigation-success @ budget, first-hop precision, and average hops. The deterministic KeywordNavigator establishes an offline floor; swap in an LLMNavigator to score a real model.

Length is the point

Accuracy without length misses why this exists. The eval reports first_view_tokens and tokens_to_answer next to accuracy, and the runtime renders the frontier at progressively shorter levels (titlebrieffull) so the agent opens with the shortest view and escalates only when unsure. On Scope's 24 tools, a title-first view is ~14× smaller than the full descriptor set, and the model reaches the right tool having seen ~6.9× less context than loading every schema. See benchmarks/scope-tools.

Progressive disclosure trades tokens for round-trips, so the whole artifact is meant to stay resident: Runtime(resolver=...) resolves leaves from a local store, making every expand an O(1) splice rather than a network fetch.

Troubleshooting

Setup mistakes fail with actionable messages; see docs/troubleshooting.md for the full table (missing extras, model config, architecture mismatches).

License

MIT © Faro

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faro_progressive_context-0.0.6.tar.gz (46.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faro_progressive_context-0.0.6-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file faro_progressive_context-0.0.6.tar.gz.

File metadata

  • Download URL: faro_progressive_context-0.0.6.tar.gz
  • Upload date:
  • Size: 46.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for faro_progressive_context-0.0.6.tar.gz
Algorithm Hash digest
SHA256 963db658dec2fa9299a559e70ef24e6894979b7dd5113a12934eaea53c291ec3
MD5 9c6284c62f94a08e05c90a143da9f4c3
BLAKE2b-256 a0c5205b0b6bb9a62dd2c1eadb3cce66851cbf4b715dc26bd07bc9949faa6a5b

See more details on using hashes here.

File details

Details for the file faro_progressive_context-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for faro_progressive_context-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b9bd9ba350bd87fc4ea1743b645fe6e722e59060021a9108adbd6d21f26819bc
MD5 3dc2c412515ed18d27a5775c9e3e305a
BLAKE2b-256 d0be6ab4bf3625990374d11b476a87c2bda6d9b3ca8db46272a69aa6f2a01b2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page