T: TypeContext Unproven concept

// a typed context language

Context,
typed.

Write context as a typed tree. Lint it. Compress it. Validate it. Emit a grounded pack. Short and deterministic input, checked before inference instead of after the hallucination.

See the pipeline $ tc emit task.tc --budget 8k
Target fit
4–8k
Target dangling
0
Target provenance
100%

status: hypothesis. No implementation, no benchmark yet. Syntax and numbers on this page are illustrative.

task.tc → pack.json

raw window · 38,412 tok

tools[42].schema = {…}

history[0..118] …

mcp.search_all() → 9 files

auth/refresh.go (full, 812 L)

"also, be concise" ← in evidence

ref → spec#retry ✗ cut

ts=16:47:03 prefix drift

…lost in the middle…

typed pack · 5,960 tok

pack fix_refresh : Pack {

instruction goal

evidence src : Code.sig

@ auth/refresh.go#L12-48

evidence spec : Doc.excerpt

@ docs/auth.md §3.2

ref spec src

}

token budget5,960 / 8,192
schema valid 0 dangling refs instruction ≠ evidence stable prefix
Write/ Lint/ Compress/ Validate/ Emit

01 — The harness today

The window is a dump.

Dynamic discovery helps strong models. For small and local LLMs "go find it yourself" usually breaks. They need an assembled, checked pack.

  1. E01

    Window bloat

    MCP schemas, tools and history eat the budget before the task arrives.

  2. E02

    Lost in the middle

    The fact that matters sits between two thousand that don't.

  3. E03

    Broken prompt cache

    A drifting prefix invalidates the cache on every call.

  4. E04

    Weak instruction following

    Small models blur the order with the material it refers to.

  5. E05

    Ungrounded answers

    Without sources, confident text is indistinguishable from invention.

  6. E06

    No audit trail

    Nobody can say exactly what went into the model.

02 — Built for local LLMs

A compiler pass before inference.

Five checks on the way in. The model gets less to read, and every line of it is typed.

01

Typed IR + validate

Broken or incomplete context is rejected before a single token is generated.

validate(ir) → ok

02

Lint dangling refs

The model never points at something that was trimmed away.

refs: 0 dangling

03

Lossy compress

Signatures and types instead of raw code, so the pack fits in 4–8k.

812 L → Code.sig

04

Instruction ≠ Evidence

A hard wall between what to do and what to read. No orders hiding in the material.

kind: instruction | evidence

05

Emit with provenance

A Context Runtime pack where every piece names its source. E-E-A-T for a small model.

@ file#L12-48 · sha256

03 — Honest boundaries

One job. Done strictly.

TypeContext does not replace retrieval or Context Runtime, and it does not fix model weights. It makes the input deterministic and short.

Priority trimis the host's job
Judgmentis optional, via LeX
Assembly, provenancebelong to Context Runtime
TypeContexttypes, lints, compresses, validates, emits

Not proven yet

This is a concept, not a result. It counts as proven only if, on the same tasks and the same small or local models, typed packs beat raw or retrieved context on accuracy and grounding, fit 4–8k without losing needed facts, and actually improve prompt-cache hits. If not, the idea gets narrowed or dropped.