PUBLIC ALPHA · PROVIDER-NEUTRAL · CANONICAL RUST KERNEL

Give every prompt token a job.

ContextLease manages an agent's context window like a resource allocator: protect critical modules, lend idle capacity, reclaim it safely, and compress only through registered release plans.

View on GitHub
  • 1 behavioral kernel
  • 7 language targets
  • ABI v2 native telemetry
allocation.live
6,144 / 8,192
systempinned
1,024
leases 768 tokens
memoryelastic · borrower
2,816
historyelastic · donor
2,304

lease.granted memory +768

Prompt builders usually discover context pressure at the last possible moment.

ContextLease makes it a controlled lifecycle:

BudgetBorrowReclaimObserve

MEMORY-MANAGEMENT IDEAS, APPLIED TO PROMPTS

A hard context limit.
A predictable control loop.

01

Declare

The host defines each module's floor, target, maximum, weight, lifecycle, protection, and whether it may lend or borrow.

02

Allocate

Demand is satisfied through protected floors, local targets, and donor-attributed expansion leases.

03

Reclaim

If donors grow, borrowers run the release pipelines they registered before receiving extra capacity.

04

Verify

Required terms, monotonic size, final bounds, and privacy-safe trace events are checked every time.

SEMANTIC COMPRESSION, WITHOUT LOCK-IN

Bring the model provider you already use.

Start with deterministic reducers. Add LLM summaries only where semantics matter. Provider IDs live in configuration and credentials stay in environment variables.

  • Built-in OpenAI-compatible HTTP adapter
  • Optional, lazy LiteLLM adapter
  • Custom provider protocol and test callable
  • Single-provider or multi-provider portfolio summaries
"providers": {
  "summary-fast": {
    "type": "openai-compatible",
    "base_url": "https://…/v1",
    "model": "summary-model",
    "api_key_env": "MODEL_API_KEY"
  }
}

"reclaim_pipeline": [{
  "algorithm_id":
    "builtin.semantic.summary.v1",
  "options": {"provider": "summary-fast"}
}]

OBSERVABILITY IS PART OF THE ALLOCATOR

See where the context went.

The bundled read-only Debug Web streams utilization, module pressure, compression, and donor-to-borrower leases. Prompt bodies stay out of telemetry.

127.0.0.1 · ContextLease Debug Web
ContextLease Debug Web dashboard with token allocation and lease telemetry

BUILT FOR CONTEXT THAT CHANGES

Agent runtimes.
RAG pipelines.
Long conversations.
Tool-heavy workflows.

The core has no opinion about your modules. System contracts, tools, memory, retrieval, examples, and history are external choices—ContextLease gives them a shared, enforceable budget.

START WITH A REAL, RUNNABLE DEMO

Stop truncating blindly.

Make prompt pressure visible, reclaimable, and testable.

Copied to clipboard