In depth
After ten or fifteen turns, the original goal gets buried under tool results, and the LLM starts drifting. Goal pinning fixes this structurally: a hook at turn_start re-injects the goal before any tool result lands. The agent physically cannot forget what it cannot unsee. It's the cheapest improvement you can make to a long-running agent, three lines of YAML.
What it looks like in practice
YAML
1hooks:2 - on: turn_start3 do:4 - inject_message:5 role: system6 content: "REMINDER: {{memory.goal}}"Related concepts
Working memoryPer-session state the agent can write and read across turns, including a goal, a todo list, and arbitrary key-value notes.CompactionA runtime process that summarises old turns once the context window is nearly full, freeing space for new turns.HooksDeclarative event handlers that fire at specific points in an agent's lifecycle (turn_start, tool_end, etc).
Read the deep dive
Hooks: 4 production patterns we ship today on Digitorn
Read article
Newsletter
Get the next post in your inbox.
Engineering notes from the Digitorn team. No marketing, no launch announcements, no "10 prompts that will change your life". Just the things we write that we'd want to read.