In depth
Asking an LLM to edit a file it has never seen results in the model fabricating the contents based on the filename. Always. The read-before-edit guard tracks a per-session set of read files and rejects Edit calls on anything outside that set. The agent reads the error in its tool result, course-corrects by reading the file, then retries. It is the difference between a coding agent that helps and one that silently corrupts your repo.
Related concepts
Filesystem moduleThe runtime module that exposes file operations (read, write, edit, grep, glob) to the agent.Behaviour rulesFocused guards that protect against common agent failure modes (runaway loops, repeated tool calls, drift).Tool useThe LLM capability to emit a structured call to an external function, which the runtime executes and feeds back as context.
Read the deep dive
How to build a Claude Code clone in YAML
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.