Skip to content

Hooks

Where this page sits

Hooks is none of the five layers. It is a facility of the harness (the execution boundary). This page decides when to use it and what not to mix with it. It is not a product API reference.

Doctrine says a published translation MUST (must) not fall below xCOMET 0.85. The procedure lives in Skills. The agent may still say "done" and move on without looking at the score. A declaration is read. It is also sometimes not read.

Hooks is the mechanism that closes that hole at a point in the run, by machine.

Definition

Hooks is a mechanism that runs work automatically at points in an agent's run, and lets a machine decide whether the run may proceed. It interrupts before the model writes the next sentence, just before a tool is called, or when a turn ends.

It does not add the substance of a judgment into this turn's prompt. It stops the run, records what happened, or runs a fixed after-step. Whether it is read is not left to the model.

The name differs by product. One host says Hooks. Another says lifecycle hook. CI says gate. The names are examples. They are not operating instructions.

Relation to the five layers

The five layers are a split of ownership. Hooks does not add an owner. It adds whether an existing owner can be enforced by machine at run time.

Five layersHooks
What it isWho owns whatAn interrupt at a point in the run
What it holdsKnowledge, memory, connection, the measureWhen it runs, what it enforces
Who actsThe model reads. Agent combinesThe harness always runs it
How it is keptBy being readBy stopping, recording, after-steps

It is not a sixth layer. Adding a layer adds another placement judgment. Hooks belongs to the harness. The map of ownership stays five layers.

IMPORTANT

Hooks may be a means of enforcing part of Doctrine / Skills by machine at run time. Hooks itself is not the measure. The measure stays in Doctrine.

How it differs

MechanismRole
SkillsStable knowledge and procedures (read)
MCPConnection to outside systems
Sub-agent quality gateDelegation to another context, and checking
HooksInterrupt into the lifecycle of the same run
DoctrinePurpose, prohibitions, priority (the measure)

A quality gate hands work to another role to look. Hooks interrupts inside the same run. Both can stop work. The subject that stopped it differs. Mix them, and it becomes unclear which one stopped it.

Drawing a permission line in code is what hooks is good at. Authority (whether it is still right) stays in Doctrine. The cut is in Permission vs. Authority.

When to use it

Use it when a declaration cannot, by itself, make the line hold.

Use whenExample
Blocking a dangerous operationA destructive change to production does not pass without confirmation
AuditKeep which tool was called, with which arguments
Machine measurement of a pass lineIf a score falls under the line, the run does not proceed
Fixed after-stepsFormatting, starting tests, where the deliverable is put

Checks a human need not look at every time SHOULD (should) live in hooks. A line that can be measured MUST NOT (must not) be left to the model's "done". Putting a verdict in code is deterministic verdicts.

When not to use it

Do notInstead
Use it as a place for knowledgeSkills
Finish the main connection to an outside system with hooks aloneMCP
Bury purpose and prohibitions in full in a scriptDoctrine
Ask another model, from a hook, to make the quality verdict itselfA deterministic verdict goes in code. A split of roles goes to a quality gate

Knowledge, connection, and the measure MUST NOT (must not) be gathered into hooks. If they are, harness settings become the map of layers. The map stays in the five layers.

WARNING

A long procedure written into hooks becomes a copy of Skills. In place of a declaration that is not read, an unmaintained script remains.

Nearby pages

WantedPage
Harness and the five layersHarness Engineering Mapping
Moving the outer loop into the systemLoop Engineering
Permission and statusPermission vs. Authority
Checking in another contextQuality gate pattern
The measure itselfIII.3 Doctrine

Summary

Hooks is a harness-side interrupt. It is not a layer. Use it for enforcement a declaration cannot carry, for audit, and for fixed after-steps. Knowledge stays in Skills, connection in MCP, the measure in Doctrine. Hooks is the means of enforcing those by machine at run time.


Previous: Harness Engineering Mapping

Next: Proposal vs. Binding

Released under the MIT License.