Changelog
November 2026
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-durableand@earendil-works/chordare 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-durable0.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 aneditafter an earliereditof the same file was refused.ReadStateDocnow sets thecheckpointWhenpredicate 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
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_patchaccepts 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-BCodex 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_patchalso 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.patchLinesNotFoundgets two optional arguments,fromandcontext, so host messages keep working.The
fuzzy-matchnote 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 codefuzzy-matchand its severity do not change.fuzzyMatchandpatchFuzzyMatchget an optionalwrittenargument with the counts, and theFuzzyWritetype is exported.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(), andcreateAiSdkFsTools()take a newcontextSchemaoption. The tool passes it to the AI SDK, which validates thetoolsContextentry of the tool beforeexecute. In the bundle, every tool gets the same schema.The tool types now have an optional
contextSchemafield. With it, the AI SDK types accept atoolsContextof the factory's context type, for examplecreateAiSdkFsTools<{ root: string }>(). Before,generateTextrefused anytoolsContextfor 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(), andcreateFsTools()takeReadToolOptions,EditToolOptions,WriteToolOptions,ApplyPatchToolOptions,BashToolOptions, andFsToolsOptions.fsis required. bash needsrunnerandenv. - Definitions.
readToolDefinition(),editToolDefinition(),writeToolDefinition(),applyPatchToolDefinition(),bashToolDefinition(), andfsToolDefinitions()in the./signaturesubpaths bind a core tool to its signature. A definition has the name, description, and JSON Schema to declare, avalidatefor model input, and anexecutethat 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, andoutputLimits.
Defaults
Option Default everywhere digestsha256Digest().nullturns it offread.converters[imageConverter()].[]turns images offlocksmemoryLocks()statenull. A bundle also takes a per-call factorybash cwdthe runner's cwdStateNeedsDigestis the one type for the pairing ofstateanddigest.Host choices are options
- Pi:
fs: piCwdFileSystem()andrunner: piCwdCommandRunner()from the new@better-fs-tools/pi/nodesubpath root each call atctx.cwd.locks: piMutationQueueLocks()anddigest: nodeDigest()are recommended. The./extensionentry uses all three, so it behaves as before.createPiFsTools()takesbash. The main entry imports no Node module. - pi-durable:
fs: durableEnvFileSystem(),state: documentReadStore(), andrunner: durableEnvRunner()replace the root options,state: "document",bash: true, andinheritEnv. - Node:
@better-fs-tools/nodehas the backends only:nodeFileSystem(),nodeCommandRunner(), andnodeDigest(). Pass them to any tool or bundle.
Signatures
Every integration uses the default signatures:
defaultReadSignature(),defaultEditSignature(),defaultWriteSignature(),defaultPatchSignature(), anddefaultBashSignature(). Each takesnamesto rename a parameter. Three presets stay for shapes that names cannot give:multiEditSignature()(many replacements in one edit call),lineRangeSignature()(inclusivestartandendlines), andfreeformPatchSignature()(the Codex patch grammar). pi-durable now sends a signature's grammar asconstrainedSampling, as the Pi and pi-agent-core integrations do.Removed
ReadToolDeps,EditToolDeps,WriteToolDeps,ApplyPatchToolDeps,ShellToolDeps,CreateFsToolsOptions, theCreate…Optionsintegration types, theXxxDependenciestypes,StateNeedsDigestOrDefault,PiAgentTooland its variants,camelCaseEditSignature()andsnakeCaseWriteSignature()(usenameson the default signatures),createNodeFsTools(),createNodeReadTool(),createNodeEditTool(),createNodeWriteTool(),createNodeApplyPatchTool(), andcreateNodeBashTool(). The integration types take the names of their factories, for exampleAiSdkReadToolOptions,PiFsToolsOptions, andAgentCoreReadTool.The Pi package needs Pi 1.x (0c29ed3)
The
@earendil-works/pi-coding-agentpeer 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/pi0.2.Tools for Pi agent core (7c6a73b)
@better-fs-tools/pi/agent-coregives the tools asAgentToolobjects for@earendil-works/pi-agent-core.createAgentCoreFsTools()returnsread,edit, andwrite, and optionallyapply_patchandbash. Puttoolsinagent.state.toolsor in anagentLoop()context.createAgentCoreReadTool(),createAgentCoreEditTool(),createAgentCoreWriteTool(),createAgentCoreApplyPatchTool(), andcreateAgentCoreBashTool()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 withisError: true, andreadis 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 ownwithFileMutationQueue(). Pass it aslockstocreatePiFsTools()or a Pi write tool, so a Better FS Toolseditand Pi's owneditorwriteon the same file wait for each other. The./extensionentry 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: truefor a tool error. Before, Pi recorded a failed call as a success.bashalso sets it for a nonzero exit and a timeout, as Pi's ownbashdoes. - Each file tool sets
annotations:readOnlyHint: trueonread, anddestructiveHint: trueonedit,write, andapply_patch. Permission extensions can read them. - No tool declares an
outputSchemaor returnsstructuredContent. A codemode script gets the text of the result, and a result withisError: truemakes the call reject.
PiReadToolResult,PiMutationToolResult, andPiBashToolResulthave a new requiredisErrorfield. 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 theread,edit, andwriteofCodingTools, and can addapply_patchandbash. It takes the options ofcreateFsTools(), with the same defaults, plus the Harness settingsnameandoutputLimits.durableEnvFileSystem()gives each call a filesystem over the call'sExecutionEnv, 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'sexec().readis 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)
writerefuses 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 gotNOT_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, andwritegoes 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.ReadObservationhas a newvisibleLinesfield, andReadRecordhas a newseenLinesfield. A store that builds its own records must addseenLines. A stored record without it counts as no range. TheNOT_READtext forwritenow 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,
editandapply_patchnow 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. Inapply_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()ineditfollows 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-matchnote ofeditandapply_patchnow saysat line 4when the match covers one line. Before, it saidat lines 4-4. A match over more lines still saysat lines 4-6.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(), andcreateAiSdkFsTools()now addimageConverter()when you pass noconverters. An image read gives a Piimagepart, or an AI SDKfilepart. Before, the read refused the image asunsupported. Pi's ownreadreturns images, so the Pi extension no longer takes that away.The read core still has no converters by default. A
converterslist you pass replaces the default, soconverters: []turns images off. In the bundles the option goes underread, for exampleread: { converters: [] }. A list withoutimageConverter()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 default New default Opt-in that brings the old behaviour back The bundles create read,edit,write, andapply_patch. The Pi extension registers all fourread,edit, andwrite.applyPatchisnullapplyPatch: true, or an options object as beforeThe bundles share a memoryStore({ clock }), soeditandwriteneed a read firststate: null: no read-before-writestate: memoryStore({ clock })A stale editorapply_patchre-matches against the new content (onStale: "rematch")onStale: "reject": a plainSTALEpreconditions: { onStale: "rematch" }Five guards run on every write guards: [].defaultGuards()returns an empty listguards: recommendedGuards()editmatchers:exact,normalized,escapeexact,normalizedmatchers: [...defaultEditMatchers(), escapeMatcher()]The editmodel text shows the numbered lines around each changeThe first line only formatter: 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: truein theeditoptions, for exampleedit: { 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(), andcreatePiFsTools()returnapplyPatch: nullunless asked. The AI SDKtoolsrecord has noapply_patchkey unless asked. New typesFsToolsWithApplyPatch,NodeFsToolsWithApplyPatch,AiSdkFsToolsWithApplyPatch, andPiFsToolsWithApplyPatchgive a non-nullapplyPatchwhen 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.streamingis gone. The read core readsbytes()the same way for one chunk or many.capabilitiesis now{ identity }. The memory backend keeps itsstreamingoption, because it sets howbytes()splits the file.WriteCapabilities.atomicandWriteCapabilities.preserveModeare gone.writeCapabilitiesis now{ compareAndSwap }. WhencompareAndSwapis false, the write tools still stat the target just before the write.MutatedFile.atomicis gone. Only thenot-atomicnote read it.- The write tools no longer add the
not-atomic,no-compare-and-swap, andmode-not-keptnotes. ThenotAtomic,noCompareAndSwap, andmodeNotKeptentries are gone from the write message catalog. runWritableFileSystemConformancealways runs "a replace keeps the mode". A backend whosestat()reportsmode: nullpasses it.- The
writeCapabilitiesoption ofmemoryFileSystemtakes onlycompareAndSwap. The memory backend always keeps the mode of an existing file.
The write conformance suite accepts
read-onlyfor a refused path (fb2736d)runWritableFileSystemConformance()checks that a write torefusedPathgives a policy reason. That check now also acceptsread-only, because a mutation error can carry it. Before, a backend that refused a write withread-only, for example onEROFS, 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 default New default Option that brings the old behaviour back defaultClassifiers()hasnotebookClassifier(), so read refuses a.ipynbfile, and edit and write refuse it asNOT_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"maxViewBytesis 128 KiB50 KiB. maxLinesandmaxCharsPerLinestay at 2 000limits: { maxViewBytes: 128 * 1_024 }notebookClassifier()andnotebookConverter()are still exported. The converter accepts codeNOTEBOOK, so it needsnotebookClassifier()in the chain. The write tools use the same classifiers, so with the default listnonTextGuard()inrecommendedGuards()no longer refuses a notebook. The sameclassifiersoption turns that refusal back on.Remove the capability notes from read results (0a87a0c)
readno longer adds theweak-identityandbuffered-backendinfo notes. The model cannot act on either note, so they used tokens and gave no value. Theidentitycapability stays.identity: falsestill setsfile.identitytonull, and the write tools still judge freshness by the content hash. TheweakIdentityandbufferedBackendentries are gone fromReadMessageCatalog.Remove notes that only the host can act on (91b848e)
The tools no longer add notes that the model cannot act on:
extension-failedfrom a failed formatter, in read,edit,write,apply_patch, and bash. The default formatter still formats the result, and the status stays. Theextension-failederror note of anEXTENSION_FAILEDerror stays.directories-createdin the write tools.FileChange.createdDirectoriesstill lists the new folders.hook-failedin the write tools. A hook that throws after the commit still does not fail the call.spill-failedin bash. The command is still not affected, andoutput.spillisnull.
The
formatterFailedentry is gone fromReadMessageCatalogandWriteMessageCatalog. ThedirectoriesCreatedandhookFailedentries are gone fromWriteMessageCatalog, andspillFailedis gone fromShellMessageCatalog.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-backenddetail 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()anddefaultShellFormatter()take anotesoption, as the read tool's formatters do. The function gets a note and returns the note to show, a changed note, ornullto 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, andapply_patchno longer add theread-before-write-offwarning 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. ThereadBeforeWriteOffentry is gone fromWriteMessageCatalog.