Host-side file reading, search, listing and anchored editing.
cat and grep return line/hash addresses consumed by patch. One patch
validates every edit and the resulting syntax before replacing one file.
list-directories supplies the Python ls shim. Standard Python owns file
creation, copying, moving and deletion.
Paths are confined to the session's allowed roots. Host operations also
consult extension-owned :fs/access gates.
Host-side file reading, search, listing and anchored editing. `cat` and `grep` return line/hash addresses consumed by `patch`. One patch validates every edit and the resulting syntax before replacing one file. `list-directories` supplies the Python `ls` shim. Standard Python owns file creation, copying, moving and deletion. Paths are confined to the session's allowed roots. Host operations also consult extension-owned `:fs/access` gates.
Unified-diff rendering and line accounting for anchored patches. Independent of the tool and activity namespaces.
Unified-diff rendering and line accounting for anchored patches. Independent of the tool and activity namespaces.
Unicode-escape hygiene for model-authored edit TEXT.
Public surface: decode-unicode-escapes — undo the \uXXXX drift a model
writes when it means the character itself, and nothing else.
Unicode-escape hygiene for model-authored edit TEXT. Public surface: `decode-unicode-escapes` — undo the `\uXXXX` drift a model writes when it means the character itself, and nothing else.
Pure hashline primitives: the ANCHOR vocabulary cat mints, grep echoes and
patch spends.
An anchor is <1-based line>:<3-hex content hash> (Can Bölük's original
hashline shape). The LINE NUMBER locates the line; the CONTENT HASH verifies
it. A write requires BOTH coordinates to match exactly: any contradiction is
REFUSED (:anchor-mismatch) instead of relocating the edit. Only the
non-destructive read path may follow matching content through small line drift.
This namespace is pure — no IO, no tool wiring, no extension envelope. Every surface that addresses a line routes here so the scheme is never recomputed:
split-content-lines / char-offset-at-line blob <-> line/char coordinates
line-hash / line-anchor / anchor->line text -> <line>:<hash>
render-hashline-block [[ln text]…] -> gutter text
anchor-token / parse-anchor rendered line -> bare anchor
indices-matching-hash content-only hash lookup
resolve-one-anchor / resolve-anchor-range exact write resolution
resolve-anchor-range-read tolerant read resolution
resolve-anchor-edit-span anchor span -> char span
Pure hashline primitives: the ANCHOR vocabulary `cat` mints, `grep` echoes and `patch` spends. An anchor is `<1-based line>:<3-hex content hash>` (Can Bölük's original hashline shape). The LINE NUMBER locates the line; the CONTENT HASH verifies it. A write requires BOTH coordinates to match exactly: any contradiction is REFUSED (`:anchor-mismatch`) instead of relocating the edit. Only the non-destructive read path may follow matching content through small line drift. This namespace is pure — no IO, no tool wiring, no extension envelope. Every surface that addresses a line routes here so the scheme is never recomputed: split-content-lines / char-offset-at-line blob <-> line/char coordinates line-hash / line-anchor / anchor->line text -> `<line>:<hash>` render-hashline-block [[ln text]…] -> gutter text anchor-token / parse-anchor rendered line -> bare anchor indices-matching-hash content-only hash lookup resolve-one-anchor / resolve-anchor-range exact write resolution resolve-anchor-range-read tolerant read resolution resolve-anchor-edit-span anchor span -> char span
Language detection and PARSE VERDICTS for the anchored patch gate.
Two questions, answered through tree-sitter (com.blockether/tree-sitter-language-pack, which sources Clojure from our own grammar fork):
code-languages)?error-nodes)?patch spends both: it re-parses what a write would produce and refuses an
edit that introduces a syntax error the file did not already have, naming the
line and the unpaired delimiter instead of a bare error count.
All native handles (Parser/Tree/Node) are opened and closed inside each call; only plain Clojure data escapes. Requiring this namespace also requires the native resolver, which selects the right per-platform FFI library at runtime.
Language detection and PARSE VERDICTS for the anchored `patch` gate.
Two questions, answered through tree-sitter (com.blockether/tree-sitter-language-pack,
which sources Clojure from our own grammar fork):
1. what language is this file, and is it a language where a parse error
means the file is genuinely broken (`code-languages`)?
2. where exactly does the new content fail to parse (`error-nodes`)?
`patch` spends both: it re-parses what a write would produce and refuses an
edit that introduces a syntax error the file did not already have, naming the
line and the unpaired delimiter instead of a bare error count.
All native handles (Parser/Tree/Node) are opened and closed inside each call;
only plain Clojure data escapes. Requiring this namespace also requires the
native resolver, which selects the right per-platform FFI library at runtime.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |