Skip to the content.

Context Engineering

12 concepts covering principles and patterns for engineering the instruction context that reaches LLMs in agent frameworks. Derived from empirical analysis of Goose + AgentFS across strong and weak models.

Concept Type Description
LLM Context Layer Model Pattern Layered model of how instructions reach a stateless LLM per turn
Instruction Override Semantics Lesson How LLMs resolve conflicting instructions — specialization wins, contradiction is nondeterministic
MOIM / Persistent Instructions Reality Lesson Goose MOIM (tom extension) injects instructions.md into per-turn <turn-context> at recency peak. Requires tom enabled and GOOSE_MOIM_MESSAGE_FILE (env or config.yaml key) — tom has no default file.
JIT-Reminder via Hooks Pattern Using hook-based tool blocking to inject targeted reminders at the recency zone
Fail-Open Hook Design Pattern Hooks remind, never lock: block at most once, enforce only on confirmed dependencies, treat the reply after a hold as approval; Goose’s fixed “Do not retry” denial wrapper
Rule Ordering by Frequency Lesson Ordering rules by operational frequency improves adherence over lifecycle-based ordering
Goose Message Role Mapping Reference How Goose maps its internal concepts to OpenAI Chat Completions API message roles
Generation Prior Conflict Pattern How pretraining priors override system prompt rules at generation time
CNL Authoring for Weak Models Convention Controlled Natural Language principles for agent instruction authoring. Includes State-Locking Keywords (LOCKED technique for persisting model-generated values across turns).
Assistant Prefix as Continuation Lesson Assistant-role prefix messages shift model from generation to continuation mode
Rule Trigger Classification Pattern Guard / inline constraint / effect taxonomy — effect rules are 0% enforceable, litmus test and conversion pattern
Goose Turn-Message Attention Map Reference U-shaped attention analysis of Goose’s per-turn message structure with zone classifications and strategic placement guidance