Changelog

November 2026

  1. better-fs-tools@0.4.0

    • @better-fs-tools/ai-sdk@0.4.0
    • @better-fs-tools/cloudflare-computer@0.4.0
    • @better-fs-tools/cloudflare-shell@0.4.0
    • @better-fs-tools/fs@0.4.0
    • @better-fs-tools/just-bash@0.4.0
    • @better-fs-tools/node@0.4.0
    • @better-fs-tools/pi@0.4.0
    • @better-fs-tools/pi-durable@0.4.0
    • @better-fs-tools/read@0.4.0
    • @better-fs-tools/shell@0.4.0
    • @better-fs-tools/write@0.4.0

    pi-durable needs pi 1.6 (deb6a44)

    Peer ranges. @earendil-works/pi-durable and @earendil-works/chord are now ~1.6.0. pi 1.2, 1.3, 1.4, and 1.5 are not supported. To keep pi 1.2, stay on @better-fs-tools/pi-durable 0.3.

    Read records update again. On pi 1.4 and later, documentReadStore() stored the first read record of a path, and each later change of that record failed. The tools hid the error, so the record stayed stale, and an edit after an earlier edit of the same file was refused. ReadStateDoc now sets the checkpointWhen predicate that pi 1.4 made required, so a put or a delete replaces the record. Each change is stored as a complete record.

October 2026

  1. better-fs-tools@0.3.1

    • @better-fs-tools/ai-sdk@0.3.1
    • @better-fs-tools/cloudflare-computer@0.3.1
    • @better-fs-tools/cloudflare-shell@0.3.1
    • @better-fs-tools/fs@0.3.1
    • @better-fs-tools/just-bash@0.3.1
    • @better-fs-tools/node@0.3.1
    • @better-fs-tools/pi@0.3.1
    • @better-fs-tools/pi-durable@0.3.1
    • @better-fs-tools/read@0.3.1
    • @better-fs-tools/shell@0.3.1
    • @better-fs-tools/write@0.3.1

    apply_patch accepts a hunk whose @@ line is the line it changes (afd29e6)

    A model often writes the line it changes as the @@ header:

    @@ target: A−B
    -target: A−B
    +target: A-B

    Codex looks for the old lines only below the @@ line, so this hunk always failed. Now, when the old lines are not found below the @@ line, apply_patch also tries them at the @@ line itself, and takes that hit only when it starts there. A hunk whose first context line repeats the header works the same way. Hunks that matched before match at the same place.

    A hunk that still does not match now says where the search started, for example failed to find the expected lines at line 2, where the @@ line matched, or from line 3 on. patchLinesNotFound gets two optional arguments, from and context, so host messages keep working.

    The fuzzy-match note says what the tool wrote (afd29e6)

    The note after a loose match ended with "Check the result." In the evals, that sentence made a model rewrite a correct CRLF edit with LF line ends. The note now says what the tool did for that hit, for example The edit is applied. 1 line kept the file's CRLF line end. It names kept characters, kept CRLF line ends, or lines that the matcher changed, only when they took place. The note code fuzzy-match and its severity do not change. fuzzyMatch and patchFuzzyMatch get an optional written argument with the counts, and the FuzzyWrite type is exported.

  2. better-fs-tools@0.3.0

    • @better-fs-tools/ai-sdk@0.3.0
    • @better-fs-tools/cloudflare-computer@0.3.0
    • @better-fs-tools/cloudflare-shell@0.3.0
    • @better-fs-tools/fs@0.3.0
    • @better-fs-tools/just-bash@0.3.0
    • @better-fs-tools/node@0.3.0
    • @better-fs-tools/pi@0.3.0
    • @better-fs-tools/pi-durable@0.3.0
    • @better-fs-tools/read@0.3.0
    • @better-fs-tools/shell@0.3.0
    • @better-fs-tools/write@0.3.0

    The AI SDK tools take a contextSchema (d883b98)

    createAiSdkReadTool(), createAiSdkEditTool(), createAiSdkWriteTool(), createAiSdkApplyPatchTool(), createAiSdkBashTool(), and createAiSdkFsTools() take a new contextSchema option. The tool passes it to the AI SDK, which validates the toolsContext entry of the tool before execute. In the bundle, every tool gets the same schema.

    The tool types now have an optional contextSchema field. With it, the AI SDK types accept a toolsContext of the factory's context type, for example createAiSdkFsTools<{ root: string }>(). Before, generateText refused any toolsContext for these tools, so a caller needed a cast. Because of the new field, a tool of one context type no longer fits a variable of another context type.

    One interface and one set of defaults across the core and every integration (c70ca37)

    Every factory now has the same options and the same defaults, in three layers:

    • Core. createReadTool(), createEditTool(), createWriteTool(), createApplyPatchTool(), createBashTool(), and createFsTools() take ReadToolOptions, EditToolOptions, WriteToolOptions, ApplyPatchToolOptions, BashToolOptions, and FsToolsOptions. fs is required. bash needs runner and env.
    • Definitions. readToolDefinition(), editToolDefinition(), writeToolDefinition(), applyPatchToolDefinition(), bashToolDefinition(), and fsToolDefinitions() in the ./signature subpaths bind a core tool to its signature. A definition has the name, description, and JSON Schema to declare, a validate for model input, and an execute that maps model input and runs the tool. Use them to connect the tools to a framework of your own.
    • Integrations. The AI SDK, Pi, pi-agent-core, and pi-durable factories are adapters over the definitions. They take the core options, plus signature, plus only the options that their host needs for display or registration: contextSchema, promptSnippet, promptGuidelines, name, and outputLimits.

    Defaults

    OptionDefault everywhere
    digestsha256Digest(). null turns it off
    read.converters[imageConverter()]. [] turns images off
    locksmemoryLocks()
    statenull. A bundle also takes a per-call factory
    bash cwdthe runner's cwd

    StateNeedsDigest is the one type for the pairing of state and digest.

    Host choices are options

    • Pi: fs: piCwdFileSystem() and runner: piCwdCommandRunner() from the new @better-fs-tools/pi/node subpath root each call at ctx.cwd. locks: piMutationQueueLocks() and digest: nodeDigest() are recommended. The ./extension entry uses all three, so it behaves as before. createPiFsTools() takes bash. The main entry imports no Node module.
    • pi-durable: fs: durableEnvFileSystem(), state: documentReadStore(), and runner: durableEnvRunner() replace the root options, state: "document", bash: true, and inheritEnv.
    • Node: @better-fs-tools/node has the backends only: nodeFileSystem(), nodeCommandRunner(), and nodeDigest(). Pass them to any tool or bundle.

    Signatures

    Every integration uses the default signatures: defaultReadSignature(), defaultEditSignature(), defaultWriteSignature(), defaultPatchSignature(), and defaultBashSignature(). Each takes names to rename a parameter. Three presets stay for shapes that names cannot give: multiEditSignature() (many replacements in one edit call), lineRangeSignature() (inclusive start and end lines), and freeformPatchSignature() (the Codex patch grammar). pi-durable now sends a signature's grammar as constrainedSampling, as the Pi and pi-agent-core integrations do.

    Removed

    ReadToolDeps, EditToolDeps, WriteToolDeps, ApplyPatchToolDeps, ShellToolDeps, CreateFsToolsOptions, the Create…Options integration types, the XxxDependencies types, StateNeedsDigestOrDefault, PiAgentTool and its variants, camelCaseEditSignature() and snakeCaseWriteSignature() (use names on the default signatures), createNodeFsTools(), createNodeReadTool(), createNodeEditTool(), createNodeWriteTool(), createNodeApplyPatchTool(), and createNodeBashTool(). The integration types take the names of their factories, for example AiSdkReadToolOptions, PiFsToolsOptions, and AgentCoreReadTool.

    The Pi package needs Pi 1.x (0c29ed3)

    The @earendil-works/pi-coding-agent peer range is now ^1.0.0. Pi versions before 1.0 are not supported. The tools type-check and pass their tests against Pi 1.2.0.

    To keep Pi 0.84, stay on @better-fs-tools/pi 0.2.

    Tools for Pi agent core (7c6a73b)

    @better-fs-tools/pi/agent-core gives the tools as AgentTool objects for @earendil-works/pi-agent-core. createAgentCoreFsTools() returns read, edit, and write, and optionally apply_patch and bash. Put tools in agent.state.tools or in an agentLoop() context. createAgentCoreReadTool(), createAgentCoreEditTool(), createAgentCoreWriteTool(), createAgentCoreApplyPatchTool(), and createAgentCoreBashTool() build one tool each.

    The factories take the options of the core factories and createFsTools(), with the same defaults, over any writable filesystem. A tool error is a result with isError: true, and read is marked as safe to replay. The module imports no Node module and no Pi package at run time, so it runs in a browser or a Worker.

    piMutationQueueLocks() shares Pi's per-file queue (c795e74)

    piMutationQueueLocks() is a lock manager on Pi's own withFileMutationQueue(). Pass it as locks to createPiFsTools() or a Pi write tool, so a Better FS Tools edit and Pi's own edit or write on the same file wait for each other. The ./extension entry uses it. piMutationQueueLocks({ timeoutMs }) waits 30 seconds by default.

    Pi tool errors set isError, and the tools carry annotations (6f28551)

    The Pi tools now set the Pi 1.x result fields:

    • Every tool returns isError: true for a tool error. Before, Pi recorded a failed call as a success. bash also sets it for a nonzero exit and a timeout, as Pi's own bash does.
    • Each file tool sets annotations: readOnlyHint: true on read, and destructiveHint: true on edit, write, and apply_patch. Permission extensions can read them.
    • No tool declares an outputSchema or returns structuredContent. A codemode script gets the text of the result, and a result with isError: true makes the call reject.

    PiReadToolResult, PiMutationToolResult, and PiBashToolResult have a new required isError field. Code that builds these results by hand must set it.

    New package: @better-fs-tools/pi-durable (7b76cff)

    Better FS Tools for @earendil-works/pi-durable, the experimental durable harness of Pi. createDurableFsTools() is an extension that replaces the read, edit, and write of CodingTools, and can add apply_patch and bash. It takes the options of createFsTools(), with the same defaults, plus the Harness settings name and outputLimits.

    • durableEnvFileSystem() gives each call a filesystem over the call's ExecutionEnv, so the tools work on the local machine, over SSH with pi-env, and in a container. executionEnvFileSystem() is that filesystem, and it passes the filesystem and write conformance suites.
    • documentReadStore() keeps read records in the conversation's documents. They stay after a restart and follow a fork.
    • durableEnvRunner() runs bash commands through the environment's exec().
    • read is safe to replay. A tool error is an error result.

    pi-durable is experimental, so this package follows pi-durable 1.2 (~1.2.0).

    Reads in ranges count as a read of the whole file (112538c)

    write refuses to replace a file that the model has not read in full. Before, only one read that showed the whole file counted. A model that read lines 1 to 30 and then lines 28 to 47 of a 35-line file got NOT_READ.

    Now the read tool joins the line ranges of each read of the same content. When the ranges run from line 1 to the last line, the stored record has wholeFileVisible: true, and write goes ahead. A change to the file starts the ranges again. A line that the view clamped does not count. A ranged read after a whole read of the same content keeps the record whole.

    ReadObservation has a new visibleLines field, and ReadRecord has a new seenLines field. A store that builds its own records must add seenLines. A stored record without it counts as no range. The NOT_READ text for write now says that reads in ranges count.

    A loose match keeps the file's bytes on lines the model did not change (733ca84)

    After a loose match, edit and apply_patch now keep more of the file as it was:

    • A line that the model sends back unchanged keeps the file's own characters. In edit, these are the leading and trailing lines where the old text and the new text agree. In apply_patch, these are the - lines that come back as the same + lines. Context lines already kept their bytes.
    • A replaced line keeps the CR of the file line it replaces. A CRLF line in a mixed-EOL file stays CRLF.
    • When the old text and the new text of a hit are the same, the model wants only the folded characters changed, so the new text is written as given.

    Before, a loose match wrote the model's text for every changed line. A file with one CRLF line lost its CR, and a guard line that the model retyped with plain spaces lost its special spaces. lineTrimmedMatcher() in edit follows the same rule. Files with only LF or only CRLF line endings keep their line endings as before.

    A one-line fuzzy match names one line (a06b0b2)

    The fuzzy-match note of edit and apply_patch now says at line 4 when the match covers one line. Before, it said at lines 4-4. A match over more lines still says at lines 4-6.

  3. better-fs-tools@0.2.0

    • @better-fs-tools/ai-sdk@0.2.0
    • @better-fs-tools/cloudflare-computer@0.2.0
    • @better-fs-tools/fs@0.2.0
    • @better-fs-tools/cloudflare-shell@0.2.0
    • @better-fs-tools/just-bash@0.2.0
    • @better-fs-tools/node@0.2.0
    • @better-fs-tools/read@0.2.0
    • @better-fs-tools/pi@0.2.0
    • @better-fs-tools/shell@0.2.0
    • @better-fs-tools/write@0.2.0

    The Pi and AI SDK read tools return images (3233e65)

    createPiReadTool(), createPiFsTools(), the Pi extension entry, createAiSdkReadTool(), and createAiSdkFsTools() now add imageConverter() when you pass no converters. An image read gives a Pi image part, or an AI SDK file part. Before, the read refused the image as unsupported. Pi's own read returns images, so the Pi extension no longer takes that away.

    The read core still has no converters by default. A converters list you pass replaces the default, so converters: [] turns images off. In the bundles the option goes under read, for example read: { converters: [] }. A list without imageConverter() also refuses images.

    Minimal defaults for the write tools and the bundles (c640cd2)

    The defaults now follow the most common behaviour of other agent harnesses. Each removed behaviour is still one option away.

    Old defaultNew defaultOpt-in that brings the old behaviour back
    The bundles create read, edit, write, and apply_patch. The Pi extension registers all fourread, edit, and write. applyPatch is nullapplyPatch: true, or an options object as before
    The bundles share a memoryStore({ clock }), so edit and write need a read firststate: null: no read-before-writestate: memoryStore({ clock })
    A stale edit or apply_patch re-matches against the new content (onStale: "rematch")onStale: "reject": a plain STALEpreconditions: { onStale: "rematch" }
    Five guards run on every writeguards: []. defaultGuards() returns an empty listguards: recommendedGuards()
    edit matchers: exact, normalized, escapeexact, normalizedmatchers: [...defaultEditMatchers(), escapeMatcher()]
    The edit model text shows the numbered lines around each changeThe first line onlyformatter: defaultWriteFormatter({ snippet: true })
    A miss shows the closest region, a found new text is already-applied, the third miss adds a noteA plain NO_MATCH, even when the new text is in placerecovery: true in the edit options, for example edit: { recovery: true }

    In the bundles, these options go in the tool's own options, for example edit: { recovery: true, guards: recommendedGuards() }. The tool descriptions still ask the model to read a file before it edits it.

    createFsTools(), createNodeFsTools(), createAiSdkFsTools(), and createPiFsTools() return applyPatch: null unless asked. The AI SDK tools record has no apply_patch key unless asked. New types FsToolsWithApplyPatch, NodeFsToolsWithApplyPatch, AiSdkFsToolsWithApplyPatch, and PiFsToolsWithApplyPatch give a non-null applyPatch when the option is set.

    Remove capability flags that only made notes (8441cdf)

    A capability flag now exists only when a tool reads it to decide what to do.

    • FileSystemCapabilities.streaming is gone. The read core reads bytes() the same way for one chunk or many. capabilities is now { identity }. The memory backend keeps its streaming option, because it sets how bytes() splits the file.
    • WriteCapabilities.atomic and WriteCapabilities.preserveMode are gone. writeCapabilities is now { compareAndSwap }. When compareAndSwap is false, the write tools still stat the target just before the write.
    • MutatedFile.atomic is gone. Only the not-atomic note read it.
    • The write tools no longer add the not-atomic, no-compare-and-swap, and mode-not-kept notes. The notAtomic, noCompareAndSwap, and modeNotKept entries are gone from the write message catalog.
    • runWritableFileSystemConformance always runs "a replace keeps the mode". A backend whose stat() reports mode: null passes it.
    • The writeCapabilities option of memoryFileSystem takes only compareAndSwap. The memory backend always keeps the mode of an existing file.

    The write conformance suite accepts read-only for a refused path (fb2736d)

    runWritableFileSystemConformance() checks that a write to refusedPath gives a policy reason. That check now also accepts read-only, because a mutation error can carry it. Before, a backend that refused a write with read-only, for example on EROFS, failed the check. The read suite still accepts only the read policy reasons.

    Minimal defaults for notebooks, hard links, and the read view (3233e65)

    Three more defaults now follow the most common behaviour of other agent harnesses. Each old behaviour is one option away.

    Old defaultNew defaultOption that brings the old behaviour back
    defaultClassifiers() has notebookClassifier(), so read refuses a .ipynb file, and edit and write refuse it as NOT_TEXTA notebook is JSON text. defaultClassifiers() is image, pdf, office, binary, utf8classifiers: [notebookClassifier(), ...defaultClassifiers()]
    nodeFileSystem, createNodeFsTools(), and the Pi tools refuse to replace a file with more than one hard linkhardLinks: "in-place": the file is written through the link, not atomically. A file with one link is still replaced by temp file and renamehardLinks: "refuse"
    maxViewBytes is 128 KiB50 KiB. maxLines and maxCharsPerLine stay at 2 000limits: { maxViewBytes: 128 * 1_024 }

    notebookClassifier() and notebookConverter() are still exported. The converter accepts code NOTEBOOK, so it needs notebookClassifier() in the chain. The write tools use the same classifiers, so with the default list nonTextGuard() in recommendedGuards() no longer refuses a notebook. The same classifiers option turns that refusal back on.

    Remove the capability notes from read results (0a87a0c)

    read no longer adds the weak-identity and buffered-backend info notes. The model cannot act on either note, so they used tokens and gave no value. The identity capability stays. identity: false still sets file.identity to null, and the write tools still judge freshness by the content hash. The weakIdentity and bufferedBackend entries are gone from ReadMessageCatalog.

    Remove notes that only the host can act on (91b848e)

    The tools no longer add notes that the model cannot act on:

    • extension-failed from a failed formatter, in read, edit, write, apply_patch, and bash. The default formatter still formats the result, and the status stays. The extension-failed error note of an EXTENSION_FAILED error stays.
    • directories-created in the write tools. FileChange.createdDirectories still lists the new folders.
    • hook-failed in the write tools. A hook that throws after the commit still does not fail the call.
    • spill-failed in bash. The command is still not affected, and output.spill is null.

    The formatterFailed entry is gone from ReadMessageCatalog and WriteMessageCatalog. The directoriesCreated and hookFailed entries are gone from WriteMessageCatalog, and spillFailed is gone from ShellMessageCatalog.

    Remove internal words from note and error text (2424aa4)

    Six default messages used words that only make sense inside the package. They now say what happened in plain words:

    • read scan-limit: "Scanning stopped at N bytes, so the total line count is unknown."
    • read not-a-file: "PATH is a directory." The list of refused types and "before any content read" are gone.
    • read and write dangerous-path: "PATH is refused by policy (DETAIL). Choose another path." The phrase "refused policy class" is gone.
    • read unsupported-backend: "This host cannot read PATH (DETAIL). Do not retry."
    • read aborted: "The read was aborted during the PHASE phase, so nothing was read."

    The write unsupported-backend detail for a file that no classifier accepts is now "its file type is not supported". Codes, data, and catalog keys do not change. A host that matches the old text must update its match.

    Hide or rewrite notes in the write and bash formatters (e8749ae)

    defaultWriteFormatter() and defaultShellFormatter() take a notes option, as the read tool's formatters do. The function gets a note and returns the note to show, a changed note, or null to hide it from the model text. The write version also gets the tool name. The report keeps every note, so a host can still log a note that it hides from the model.

    defaultShellFormatter({ notes: (note) => (note.code === "clamped" ? null : note) });

    Remove the read-before-write-off note (02516b0)

    With no state store, edit, write, and apply_patch no longer add the read-before-write-off warning note. The host chooses whether to give a store, and the model cannot change that choice, so the note used tokens and gave no value. The tools behave as before: with no store, they change a file without a read check. The readBeforeWriteOff entry is gone from WriteMessageCatalog.