While building Wormhole in January 2026, I corrected a line in the first feature specification: “we are not preparing the core for cli directly, we are preparing it for the sdk”. A CLI is where people type commands in a terminal. An SDK is a set of interfaces other programs can call directly. Is that extra layer worthwhile? Consider a small requirement: the assistant is about to edit a file. A terminal can ask “Allow this?”, while another application integrating the assistant might need two buttons. Who displays the question, and who decides whether this write may proceed?1
I had previously looked into how Cursor helps a coding assistant understand a project and review changes and investigated loops, memory, and file modification in Cline and Gemini CLI. In August 2025 I wrote a Python tool-execution prototype and a separate TypeScript terminal prototype. With Wormhole I compared several assistants again, hoping to write down recurring design decisions in advance. I vaguely remember passing DeepWiki Q&A to a coding assistant for discussion as well. The earliest substantive principles preserved in the repository were already specific: the core reports progress through events, tool calls need permission checks, and every step must make clear whose turn comes next.2
If another application replaces the terminal, which code can it reuse?
Suppose I ask the assistant to change the download request timeout from 30 to 60 seconds. Opening a terminal and reading my question belong to the interface. Passing the question to the model, receiving its request to read a file, then returning the file contents to the model are still necessary with a different interface. Further down, the local program must do things such as opening the actual file and applying an edit. The model supplies only the tool name it wants to call and its arguments.
I therefore set boundaries for three packages. The core defines shared data such as a tool call, an execution result, and events during execution. The SDK wraps the core in an interface applications can use and connects models with concrete tools. The CLI calls the SDK and handles input and display. When I added file and command tools on January 27, this agreement gave a clear answer: disk read/write implementations belong in the SDK, while shared tool declarations and registration stay in the core. The terminal example can decide for itself how to prompt the user.34
That principle also changed how I thought about permissions. Studying Claude Code, Gemini CLI, Kode CLI, and OpenCode, I noted choices worth comparing. Does approval last only for the current session? Should reads and writes be treated differently? Who should be asked when no rule covers an operation? I decided that the integrating application should choose how to ask, while the SDK processes the authorization decision before tool execution. An explicit refusal skips the call.5
The model has answered. What justifies another step?
If the user asks “change the timeout to 60 seconds,” the model’s first turn may only say “read the download function.” If the terminal hands control back to the user then, all they see is a file-read request. The program must perform the read and call the model again with its result. Conversely, an extra round after a final answer only adds waiting. That calls for an explicit stopping rule.
My January design notes put several approaches in a table. These were the choices I compared at the time. The Gemini CLI entry refers to the particular continuation branch I had previously read.6
| Approach compared | Signal to continue | Cost |
|---|---|---|
| Path studied in Claude Code and Kode CLI | Execute tool calls in the response and return the results | Autonomous continuation without a tool request needs another signal |
| Gemini CLI next-step decision | When it is unclear whose turn is next, ask the model again | An additional model request introduces another wait |
| Path studied in OpenCode | Inspect the finish reason on the model response, such as a tool call or end of turn | Different providers’ signals must be normalized |
Wormhole’s early SDK recorded separately why a reply ended, whether it contained tool calls, and whose turn was next. In automatic mode, a tool result goes into the next turn. An ordinary reply ending with end_turn stops. When the reason is the output length limit, configuration controls continuation. Only when the reason is unrecognized does the SDK consult the next actor in state. The integrating application can also explicitly request continuation or termination. These decisions only use information the program already has.7
When the model says “change this”, how does the program find the right occurrence?
Return to the timeout example. Suppose a file contains both of the lines below and the user only wants to change downloads:
download(url, timeout=30)
upload(path, timeout=30)
If the model supplies only timeout=30 as the text to replace, the program finds two occurrences. By default Wormhole’s file_edit reports that the old text is not unique. To express the desired change, the model can specify download(url, timeout=30) as the old text and download(url, timeout=60) as the new text. The old text still locates the edit if someone added lines at the top, but if the download function was renamed it must be read again. A corresponding test uses foo foo as the file contents: asking to replace a single foo should report ambiguity.8
Only after locating a unique position does the tool have enough information to build a diff showing which old lines will be removed and which new ones added. The terminal example presents the diff before the approval question. The user can allow this call, refuse, or remember the choice for the scope shown by the interface. After normal approval, the SDK executes the call and adds the tool result and call ID to the session. The model’s next turn might receive a change summary or an error asking it to reread the file.97
[Abridged here: a target-specific implementation weakness and its source pointer have been omitted.]
There is also a timing gap: a person may edit the file after the model reads it. The SDK’s edit handler uses the record left by the read to check the modification time. On entering the edit, it rereads the file and compares a content digest, reporting an error by default if the content changed. Finally it writes the updated content to a temporary file in the same directory, then replaces the target. These steps check whether the read version is still current and determine how to write the changes back. A gap remains between checking and writing, so they do not guarantee that concurrent writers can never overwrite one another.8
Looking back at my question from August, this was what I most wanted to clarify: the model can describe a local replacement, the user can review only a diff, and the implementation can still write a complete new file. The three decisions address different questions.
Which principles should stay, and which should change?
The initial principles required sessions, messages, and message parts to be persisted in locked files. That met a practical need: when the process exited, reopening the assistant should recover the previous work. But if an SDK consumer already uses SQLite, should they have to maintain a second file store to use the same assistant?
The revision committed February 1 retained locked-file storage and allowed applications to supply another storage implementation. A SQLite example committed the same day stored sessions, execution state, and event records separately. A restored session could be retrieved from the database by session ID while the calling application used the same SDK interface.10
I see a difference between those two decisions. Changing the interface must preserve the promise that a write requires authorization, so place it on the execution path shared by all interfaces. Changing storage still needs to let users pick up their work next time. Files and SQLite can both do that if the interface can save and retrieve the appropriate state. A principle I can test with one refused write or one restored session actually helps me decide where the next piece of code belongs.
References
Footnotes
-
Cai, B. (2026, January 15). Core spec alignment for SDK. Wormhole, GitHub. Input and Clarifications in the January 14 spec, quotation on line 6. ↩
-
Cai, B. (2026, January 14). Wormhole Constitution. Wormhole, GitHub. Principles I–V and their rationales. ↩
-
Cai, B. (2026, January 14). Wormhole Constitution: Layering and dependencies. Wormhole, GitHub. Responsibilities and dependency direction of the three packages. ↩
-
Cai, B. (2026, January 27). Move OS tools into SDK, codify tool boundaries, update tests/docs [Commit]. Wormhole, GitHub. OS tool implementation and layering rules. ↩
-
Cai, B. (2026, January 20). Core-SDK contracts: Research. Wormhole, GitHub. Four references and tradeoffs in permission design research. ↩
-
Cai, B. (2026, January 22). Loop termination contract. Wormhole, GitHub. The four references and Wormhole’s choice. ↩
-
Cai, B. (2026, February 1). Wormhole SDK [Source snapshot]. GitHub. Continuation and termination branches, Adding tool results to sessions and deciding the next turn. ↩ ↩2
-
Cai, B. (2026, February 1). File edit tool [Source snapshot]. Wormhole, GitHub. Matching, diff generation, and replacement, Read records and conflict checking, Ambiguous match and concurrent modification tests. ↩ ↩2
-
Cai, B. (2026, February 1). LLM-powered coding agent example [Source snapshot]. Wormhole, GitHub. Terminal preview and user decisions, Edit tool returning a result or error. ↩
-
Cai, B. (2026, February 1). Storage persistence and SQLite provider example. Wormhole, GitHub. Revision of principle V, SQLite session storage implementation. ↩