Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeContext

Status: unproven concept. There is no working implementation, no benchmark, and no evidence yet that this approach helps. Everything below is a hypothesis to be tested, not a claim.

TypeContext is a proposed typed context language: write the context for an LLM call as a typed tree, then lint it, compress it, validate it, and emit a grounded pack.

The problem it targets

Today's agent harnesses tend to fill the model window with tool schemas, MCP output, and history. The known symptoms:

  • window bloat before the task even arrives;
  • lost-in-the-middle: the relevant fact is buried;
  • prompt-cache misses caused by a drifting prefix;
  • weak instruction following in small and local models;
  • hallucination without grounding;
  • no audit of what exactly was sent to the model.

Dynamic discovery removes part of this pain for strong models. For weak or local models, "find it yourself" often breaks; the hypothesis is that they need an assembled and checked pack instead of a dump.

The hypothesis

A compiler-style pass before inference could make the input deterministic and short:

  1. Typed IR + validate - reject broken or incomplete context before inference.
  2. Lint dangling refs - the model never references something that was cut.
  3. Lossy compress - signatures and types instead of raw code, to fit 4-8k tokens.
  4. Instruction vs Evidence - a hard split between what to do and what to read.
  5. Emit with provenance - a Context Runtime pack where every piece names its source.

What would count as proof

None of this is measured yet. The concept is proven only if, on the same tasks and the same small or local models, TypeContext packs show:

  • better task accuracy or fewer ungrounded answers than a raw or retrieved context;
  • a fit within a 4-8k token budget without losing the facts the task needs;
  • stable prefixes that actually improve prompt-cache hits;
  • a reproducible record of what went into the model.

If the gains do not appear, or appear only for strong models that already cope with dynamic discovery, the concept should be narrowed or dropped.

Boundaries

  • It does not replace retrieval or Context Runtime and does not fix model weights.
  • Priority trim belongs to the host.
  • Judgment is optional, via LeX.
  • Assembly and provenance belong to Context Runtime.

Roadmap

IR draft, emit contract, local-LLM-friendly packs, then an evaluation against the criteria above. The syntax, commands, and token numbers on the landing page (index.html) are illustrative only.

About

TypeContext is a proposed typed context language: write the context for an LLM call as a typed tree, then lint it, compress it, validate it, and emit a grounded pack

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages