Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hashline Edit Format

Hashline is the harness’s read/edit format. Each line is tagged with a short hash of its content, so an edit can be rejected when the file has changed since the agent last read it.

Source: crates/core/src/hashline.rs. Exposed as the built-in tools __HASHLINE_READ__ and __HASHLINE_EDIT__.

Format

Lines are formatted as {line_num}:{hash}|{content}:

1:a3|fn main() {
2:7f|    println!("hello");
3:b2|}

__HASHLINE_READ__ returns a file in this form. The agent then references lines by line:hash when editing.

Hash function

The hash is FNV-1a (offset basis 2166136261, prime 16777619) truncated to the low byte (hash & 0xff) and formatted as two lowercase hex characters. With 256 possible values it is meant for change detection, not collision resistance.

Edit operations

__HASHLINE_EDIT__ takes an array of operations. Each references a target line by line:hash:

  • replace — replace lines from start to optional end (inclusive) with new content
  • insert_before — insert content before the referenced line
  • insert_after — insert content after the referenced line
  • delete — delete lines from start to optional end (inclusive)

Every referenced line’s hash is validated before anything is applied. If any hash does not match the current file, the whole edit is rejected and the agent is told to re-read. Operations are applied in reverse line order (so earlier edits don’t shift later line numbers) and the file is written atomically via a temp file and rename. The parser accepts either operations or edits for the array key, and either content or new_text for the text field.