# LLM harnesses and governance

Canonical page: https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/

How agents built on large language models perform useful work, why the software around the model matters, and how their governance can be designed, tested and evaluated.

Each part can be read on its own. Parts 5 to 7 apply the principles to Claude Code in detail.

## Governing Claude Code and LLM agents through technical controls

This series explains how a model is controlled through a harness: the software infrastructure and runtime scaffolding that wraps around a large language model and turns its proposals into actions.

It begins with the overall behaviour of an LLM, which explains why such systems need to be governed. It then introduces the harness, and moves on to the technical controls, such as hooks, permissions and tests, that can be applied to Claude Code to govern its behaviour.

Expressed as a simple formula:

**An LLM or AI agent = Model (the brain) + Harness (scaffolding and runtime)**

1. [Part 1: How large language models work and what they need to complete a task](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/how-large-language-models-work/): What does an LLM need to complete a useful task? Understand how large language models generate outputs and why useful tasks need relevant context, clear requirements, tools and verification.

2. [Part 2: What an LLM harness is and how it runs tools](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/what-is-an-llm-harness/): How does a model request become an executed action? Learn what an LLM harness does, how it coordinates model requests and tool execution, and where permissions, isolation and hooks fit.

3. [Part 3: How LLM context, memory and handovers support long-running work](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/llm-context-memory-and-handovers/): How can work continue when the immediate context changes? Understand LLM context windows, persistent memory, prompt caching and handovers, with examples of keeping work coherent across sessions.

4. [Part 4: Why LLM agents need governance, permissions and evidence](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/why-llm-agents-need-governance/): Who can authorise actions, enforce limits and accept results? Understand why LLM agents need governance and how purpose, permissions, enforcement, human responsibility and evidence relate.

5. [Part 5: How to govern Claude Code by separating guidance from enforcement](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/claude-code-guidance-and-enforcement/): How can instructions be separated from enforceable controls? How to govern Claude Code by placing every rule that must hold in the enforcement layer: hooks, permission rules, managed settings and protected configuration, with guidance kept short and scoped.

6. [Part 6: How to diagnose Claude Code refusals and test governance hooks](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/claude-code-refusals-and-hook-testing/): How can a refusal be traced to the layer that made it? A step-by-step method for telling whether a Claude Code refusal came from the model or from a hook, and for testing that governance hooks allow, refuse and fail as intended.

7. [Part 7: How to classify Claude Code governance incidents and manage the limits of hook controls](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/claude-code-governance-incidents-and-limitations/): What do incidents reveal about the limits of hook-based controls? How to classify Claude Code governance incidents by the layer that acted, the known limits of hook controls and their compensating controls, a control test matrix and a triage checklist.

8. [Part 8: How to evaluate an LLM governance system](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/evaluate-llm-governance/): What evidence would support an assessment of outcomes? How to assess an LLM governance system through accepted outcomes, control decisions, recorded evidence and clearly defined rates.

## Glossary

These are working definitions used by the explanatory articles.

| Term | Meaning in this series |
|---|---|
| LLM | A learned language model that processes supplied inputs and generates outputs. |
| Parameters | Numerical values learned during training that support the model's capabilities. |
| Inference | Using a trained model to produce an output from supplied inputs. |
| Token | A unit used to represent text to the model; it need not be a whole word. |
| Context window | The bounded information available to a model interaction. |
| Context engineering | Selecting and maintaining the information supplied as work proceeds. |
| Grounding | Relating an answer or decision to identifiable evidence relevant to the task. |
| Retrieval | Finding and bringing external information into the application's working context. |
| Persistent state | Records retained outside the immediate model interaction for later use. |
| Compaction | Condensing accumulated conversation information to support continuation. |
| Prompt caching | Reusing processing associated with a matching input prefix under the provider's rules. |
| Tool | An interface through which surrounding software retrieves information or performs an operation. |
| Agent | A system that uses model decisions and observations to pursue a task through successive actions. |
| Workflow | A process whose sequence is substantially specified by application code. |
| Operating harness | The surrounding software coordinating context, model calls, tools and execution. |
| Evaluation harness | The system arranging evaluation tasks, capturing execution and assessing outcomes. |
| Guidance | Instructions or explanatory material supplied for the model to act upon. |
| Enforcement | A mechanism that restricts or decides whether an operation proceeds. |
| Permission | Authority for an operation under the applicable task and controls. |
| Isolation | A boundary restricting resources available to an executing process. |
| Hook | A handler invoked by the runtime at a defined event. |
| Skill | Packaged instructions, knowledge or procedures made available through an application. |
| MCP | Model Context Protocol, an interface for connecting applications with contextual resources and tools. |
| Fail closed | Withholding an operation when the relevant control cannot evaluate it. |
| Fail open | Allowing continuation when the relevant control cannot evaluate it. |
| False positive | A control decision that flags or blocks a case which should have been allowed under the intended rule. |
| Provenance | Information identifying the source and history of material or a recorded event. |
| Acceptance criteria | Conditions by which the requested outcome can be assessed. |
| Governance | Arrangements for purpose, authority, responsibility, constraints, evidence and changes. |

Definitions are explained and supported in Parts 1 to 4 and 8; the [reference register](https://vikrammohan.com/thought-leadership/llm-harnesses-and-governance/#references) provides the primary sources used.

## Primary reference register

External references were consulted on **18 October 2026**. Official documentation is a living source; research findings retain the scope of their original experiments. The sources below support the explanations in this series.

| Reference | Contribution | Source type |
|---|---|---|
| [NIST AI 600-1 Generative Artificial Intelligence Profile](https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.600-1.pdf) | Confabulation and the need to assess generated content; section 2.2 | Official voluntary framework companion, July 2024 |
| [NIST AI 100-1 AI Risk Management Framework 1.0](https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.100-1.pdf) | Governance, responsibilities and oversight; GOVERN function | Official voluntary framework, January 2023 |
| [How tool use works](https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works) | Structured model requests and external execution | Anthropic documentation |
| [How Claude Code works](https://code.claude.com/docs/en/how-claude-code-works) | Model, tools, context and the operating harness | Anthropic documentation |
| [Building effective agents](https://www.anthropic.com/engineering/building-effective-agents) | Workflows, agents and proportionality | Anthropic engineering, 19 December 2024 |
| [How the agent loop works](https://code.claude.com/docs/en/agent-sdk/agent-loop) | Model and tool exchanges within an agent run | Anthropic documentation |
| [Choose a sandbox environment](https://code.claude.com/docs/en/sandbox-environments) | Permission decisions and isolation boundaries | Anthropic documentation |
| [Automate actions with hooks](https://code.claude.com/docs/en/hooks-guide) | Event-triggered handlers and different decision mechanisms | Anthropic documentation |
| [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) | Context selection, retrieval and continuity concepts | Anthropic engineering, 29 September 2025 |
| [Language Models are Few-Shot Learners](https://arxiv.org/abs/2005.14165) | Distinction between contextual examples and parameter updates | Brown et al., original research, 2020 |
| [Lost in the Middle](https://aclanthology.org/2024.tacl-1.9/) | Context capacity versus information use in tested models and tasks | Liu et al., TACL, 2024 |
| [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) | Reuse of input-prefix processing | Anthropic documentation |
| [Work with sessions](https://code.claude.com/docs/en/agent-sdk/sessions) | Conversation persistence and its distinction from filesystem state | Anthropic documentation |
| [Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) | Reported coding experiments concerning continuity and progress | Anthropic engineering, 26 November 2025 |
| [Extend Claude Code](https://code.claude.com/docs/en/features-overview) | Skills, extensions and separate subagent contexts | Anthropic documentation |
| [MCP architecture overview](https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture) | Applications, tools and contextual resources connected through MCP | Official protocol documentation |
| [Not What You’ve Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection](https://arxiv.org/html/2302.12173v2) | Indirect prompt injection through retrieved material | Greshake et al., original research, 2023 |
| [Demystifying evals for AI agents](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents) | Agent and evaluation harnesses; transcript versus outcome | Anthropic engineering, 9 January 2026 |

NIST material supplies governance vocabulary; it is not a certification of any configuration described here. Anthropic material documents its products or reports its own engineering experience. The research papers establish findings within their stated experimental scope.

Vikram Mohan is not a solicitor or barrister. Nothing on this site is legal advice. For legal advice, speak to a regulated legal professional.

© Vikram Mohan - All rights reserved. No liability accepted for content on this website. [LinkedIn](https://www.linkedin.com/in/mohanvikram/) · [Privacy](https://vikrammohan.com/privacy)
