# Context layer

## Terms

| term | meaning in this packet |
|---|---|
| harness | Everything around a coding agent that is not the model: its tools, hooks, guards, skills, instructions and capture. The kit's plugins are a harness. |
| hook | A command Claude Code runs at an event (UserPromptSubmit, PreToolUse, Stop …). |
| guard | A PreToolUse hook that can refuse a tool call. |
| gate | A guard that applies a rule to the text an agent writes. The word gate is one. |
| refusal | A guard's decision that the call does not run, with a reason the agent reads. |
| false refusal | A refusal of an act the guard's rule does not name. Over-refusal in the guardrail literature. |
| override | A recorded decision to let a refused act pass, with its stated reason. |
| mention | A word quoted to talk about the word itself, as opposed to using it (the use/mention distinction). |
| sense | One meaning of a word in a domain. A term is a word bound to one concept in one domain. |
| kind (of a file) | What a file is for the rule: prompt, kept, verbatim, code, other (jgwill/miadi-orchestration-kit `rispecs/agent-harness-hooks/03-specify.md` S1). |
| capture hook | A hook that records what happened in a session and returns nothing to the model. |
| latency budget | The time a hook on the request path may take before the person waits on it. |
| prompt door | The command family through which an agent creates, checks and reads a prompt version (S6). |
| controlled vocabulary | A list of terms with the senses they may and may not carry, kept by an owner. |

The word the gate lists is written here only as a mention, in backticks: `gap`. For the space
between current reality and the desired outcome this packet writes "resolve tension", as the
system rule asks.

## Fields

Six fields, mutually exclusive by the question each answers. Each field has a `G-` code that the
spec cites.

| code | field | discipline | the question it answers here | lane |
|---|---|---|---|---|
| G-terminology | Terminology management and controlled languages | linguistics, technical communication | how a term is bound to one concept in one domain | A |
| G-linters, G-polysemy | Prose linting and word sense | computational linguistics, documentation engineering | how a writing tool scopes a word rule, and why a surface match cannot tell senses apart | A |
| G-messages, G-gaming | Error message design and specification gaming | human-computer interaction, AI safety | how a refusal makes the fix obvious, and what a surface rule invites | A |
| G-aci, G-hooks | Agent-computer interfaces and Claude Code hooks | software engineering, agent systems | how an edit-time check returns to the agent, and what the hook contract allows | B |
| G-guardrails, G-overrefusal, G-policy | Guardrails, over-refusal and policy enforcement levels | AI safety, policy as code | which on-fail actions exist besides refusal, what false refusals cost, how overrides are recorded | B |
| G-tracing, G-tail, G-dropped | Low-overhead telemetry and tail latency | distributed systems | how capture stays off the request path and records what it dropped | C |
| G-promptops, G-agents-write-prompts | Prompt management and agents that write prompts | LLMOps, software engineering | how prompts are versioned, checked and generated by agents | C |
| G-provenance | Provenance and attribution of records | archival science, W3C PROV | who said a recorded thing (already grounded in `../tracing-provider-vocabulary/`) | crosswalk |

## Source rules

- A source is `verified: yes` only when a lane opened a page that shows its author or publisher,
  title and year. Lanes were told not to invent DOIs, URLs, numbers or quotes.
- Practitioner documentation (Claude Code, Vale, Guardrails AI, Sentinel, Langfuse) is cited for
  what a tool does, never for a general claim.
- Factory measurements are cited from jgwill/miadi-orchestration-kit `rispecs/agent-harness-hooks/01-reverse-engineer.md`, with the
  command that produced them.

## Placement

This packet lives in jgwill/Miadi `foundations/`, beside the packets it extends, so `@miadi/foundations`
publishes it and an episode's Foundations card can hold it. The specification it grounds and the
hooks live in jgwill/miadi-orchestration-kit (`rispecs/agent-harness-hooks/`, `claude/miadi-deepdiver`,
`claude/miadi-session-observability`, `claude/miadi-chronicle-episode-kit`).

## Related

- jgwill/miadi-orchestration-kit `rispecs/agent-harness-hooks/`: the specification this packet grounds.
- jgwill/miadi-orchestration-kit `rispecs/self-improvement-cycle/`: S8's scorer joins its list.
- `../tracing-provider-vocabulary/` (`miadi-foundation://tracing-provider-vocabulary`):
  the `status` and `source` axes, the `prompt management` capability, and the caution that
  guardrail configuration is an instrument kept at the provider "until a need appears".
- `../self-improving-agent-loops/` (`miadi-foundation://self-improving-agent-loops`):
  Goodhart's law and specification gaming, applied here to word substitution.
- `../linguistic-relativity-indigenous-epistemology/`: why the factory cares
  which words its agents use. Not re-grounded here.
