Expand description
L6 — context assembly, M0 slice.
Byte-stable prefix: a small owner system prompt (a file, Pi-style) and
ALL dynamics as SyntheticReason-tagged user messages. Repo instruction
files load inside the untrusted-content envelope from the milestone that
first loads them — this one.
Modules§
- compaction
- Compaction planning + assembly (M2).
- tokens
- Anchored token accounting (M2; review A12b).
Constants§
- DEFAULT_
SYSTEM_ PROMPT - Small on purpose: the harness stays out of the model’s way.
- MEMORY_
BUDGET_ BYTES - Auto-memory (M2):
<config>/memory/MEMORY.md, budget-capped, enveloped. Owner-authored, but it still rides in the envelope — memory files quote repo content and past sessions, so the same defense applies.
Functions§
- defang
- Neutralize any closing-delimiter sequence the wrapped content might carry,
so untrusted text can’t forge its way out of the envelope with a literal
</project-instructions>(or any</…>) followed by text that appears to be trusted. The human gate is the real backstop; this removes the cheap escape. Deterministic (no nonce) so transcripts stay golden-comparable: any</becomes<\u{200b}/(a zero-width space breaks the tag for a parser while staying visually identical and harmless as text). - load_
memory - load_
system_ prompt - Owner override lives at
~/.config/hotl/system-prompt.md. - nested_
instructions - Dynamic subdir hints (M2): the first time a tool touches
a file under a directory carrying its own AGENTS.md/CLAUDE.md, that file
is injected just-in-time. Returns
(source_marker, item)— the caller dedupes by checking the projection for the marker. - project_
instructions - Load the repo’s instruction file (if any) as a provenance-tagged user item wrapped in the untrusted-content envelope.
- turn_
context - The MOIM ephemeral turn-context block (M2): attached to the
request only — never persisted, never cached (it rides after the cache
marker by construction).
context_used_pctis optional (tech-debt #9): broadcasting how full the window is every sample can induce “context anxiety” (premature wrap-up — Anthropic long-horizon finding), so a caller may omit it.