Interactive Explainer

DeepSeek Harness:
From Your Files
to the Model

DeepSeek Harness (dsh) is an open-source agent harness you start with one npx command. This article follows your code through it: who decides which files to open, what leaves your machine on each request, and how that changes when the model runs on Fireworks, Baseten, or Modal instead of at DeepSeek.

December 2026 · 24 min read · 6 figures

A model takes in text and produces text. It remembers nothing between requests and can't touch your files. A harness is the program around it that supplies the rest. It builds the context for each request, keeps the session history, chooses which tools to offer, runs the calls the model makes within the permissions you set, and repeats until the task is done. The harness sets what the model can see and do. The model decides what to do next.

Claude Code and Codex are harnesses. So is DeepSeek Harness, which DeepSeek publishes under the MIT license as a developer preview. This article looks at it through three questions that come up when you let a harness work on your own code.

Three Questions

The questions come from where a harness sits, between your code and a model. Which files does it open? Where do their contents go? How much of it runs on your machine? The next two sections cover the parts of dsh and follow one complete run, and the three after that take one question each. Figure 1 shows the whole system those sections zoom into.

Three colors mark location in every figure: your machine, model host (whoever runs inference), and vendor cloud (other services from the harness maker, such as search or sign-in).

Figure 1 - The whole system
Pick a question to see the part of the system it is about.

Here are the same three questions with their short answers.

1. How does dsh decide which files to read?

It doesn't. The model asks, one tool call at a time. dsh keeps no index and no embeddings. It loads instruction files such as AGENTS.md by itself. Other project files are opened by tools the model calls, usually grep, glob, and read.

Full answer: How It Decides What to Read
2. If the model is on Fireworks, Baseten, or Modal, how does data flow?

Straight from your machine to that host. DeepSeek is not in that path, but a web search by the model goes to DeepSeek if you have a DeepSeek key or sign-in. Requests also get smaller, because the part of dsh that talks to DeepSeek's API adds a copy of your session log by default, and the part for other providers doesn't. Signing in to a DeepSeek account or submitting feedback also contacts DeepSeek.

Full answer: Swapping the Model Host
3. What runs locally, and what needs a cloud client?

The loop, file access, shell, and session history all run on your machine. The only required remote part is a model endpoint, and that can be your own server. Codex and Claude Code are built the same way, then add hosted runs that dsh doesn't ship.

Full answer: Local, Host, or Cloud

Because the source is open, these answers can be checked. For this article, dsh 0.2.2-rc.5 (the latest release on npm) ran in a small test project with made-up API keys, and every provider's address was pointed at a fake model server on localhost. The byte counts below are the sizes of the requests that server received. No provider was contacted, so they show what dsh sends and nothing about how a provider responds. Other claims come from the source code or vendor docs, linked in the text or in the references.

The Pieces on Your Machine

Running npx @deepseek-ai/dsh web starts a Node process that serves a web page at 127.0.0.1:3080. The browser tab is a client and the Node process is the server, but both are on your machine. Nothing about that split involves a cloud. The same process also runs without a page, as a one-shot command (headless) or behind a TypeScript or Python SDK. Figure 2 opens up that process.

Figure 2 - Inside dsh
The numbers are the order of events in one step. Pick one to see its part of the diagram.

Session log, steps, and turns

A step is one model request plus the tools it calls. A turn is the run of steps that answers one of your messages. Everything that happens is appended to a session log, and the history sent to the model is computed from that log. The project holds itself to a strict rule here:

Model-visible means logged. Every model request must be reconstructable from the log. DeepSeek Harness, docs/architecture.md

That rule is why resume, fork, and replay work. It also means the log holds everything the model saw, including file contents and command output, which matters once we look at where the log goes.

Tools and permissions

A model can't open a file or run a command itself. It can only reply. So the request in each step carries a list of tools, which are actions dsh can run for it, such as read, grep, write, and bash. To use one, the model replies with the tool's name and its inputs. That reply is a tool call:

{ "name": "read", "input": { "file_path": "src/pricing/discount.js" } }

dsh runs the tool and puts the result in the next request. These are stages 3 and 4 in Figure 2. Since every action passes through dsh, it can refuse one.

Two settings decide what it refuses. The sandbox mode limits which files a tool can change: none (read-only), those in your project and temporary folders (workspace-write), or any (danger-full-access). The approval policy covers a call that needs more than the sandbox mode allows. With ask, you get to approve or reject it. With never, it is rejected without asking you. New sessions start with workspace-write and ask.

How a plugin works

The four boxes inside dsh in Figure 2 are each a plugin. The architecture document says every part of the product is one. A plugin is a package of code with a setup function, usually called apply. (Some core plugins, such as tools, use a class constructor instead.) When dsh loads the plugin, it runs that function and passes in an object, ctx, that connects the plugin to the others. Through ctx, a plugin can do three things:

  • Provide something others use. The tools plugin provides the tool list, which other plugins reach as ctx.tools.
  • Add to what another plugin provides. The tool-fs plugin adds file tools such as read, write, and edit by calling ctx.tools.register.
  • Respond to an event. As dsh works, it announces events such as "a step is about to start" or "a tool has returned". With ctx.on, a plugin registers a function to run each time one happens.

Events are how something can happen without the model asking for it. A tool runs because the model called it. A function registered for an event runs because dsh reached that point. The agent-instructions plugin works this way. It loads AGENTS.md files, which hold instructions for agents, mainly through two events:

// simplified from agent-instructions export function apply(ctx, config) { // before each step ctx.on('agent/pre-step', (step, next) => { // read AGENTS.md files not sent yet // add them to this step as a message }) // after each tool call ctx.on('tools/result', (call, result) => { // after a read, write, or edit, note the // file. When the step ends, check its // folder for AGENTS.md }) }

In order, this is what happens:

  1. The plugin loads. apply registers the two functions. No instruction file has been read yet.
  2. You ask a question. Before the first step, the agent loop announces agent/pre-step and waits. The first function reads the AGENTS.md files from disk and hands back a message with their contents. The loop writes that message to the session log, so it is part of the first request.
  3. The model calls read. When the tool returns, tools/result is announced, and the second function notes which file was read. When the step ends, the plugin checks that file's folder. If there is an AGENTS.md the model hasn't seen, it is queued for the next step.

The loop doesn't know which plugins are listening, so one can be removed without touching the rest. In a test run with agent-instructions turned off, no AGENTS.md was sent and nothing else in the requests changed. Other plugins that come up in this article connect in the same ways:

PluginWhat it doesHow it connects
tool-fsAdds file tools such as read, write, and editAdds to the tool list
llm-pi-aiSends requests to hosts such as FireworksAdds to the model adapters
session-log-deepseekCopies the session log into requests to DeepSeekAdds a field to those requests
session-titleSets the session's title, which a second plugin, session-title-llm, asks the model forEvent: your message was logged
compaction-basicSummarizes old history when it gets too longEvent: a step is about to start

Profiles and presets

The framework that loads plugins and passes events between them is called Cordis. It needs to be told which plugins to load and with what settings. That is a list, written in YAML.

A profile is a named version of the list, one for each way of running dsh: web for the browser app, headless for the one-shot command, sdk and acp for other programs to drive it. The web and headless lists start from the same 99 entries. Then web adds 103 for the browser app, and headless adds 2. The --dump-config flag prints a profile's list without starting anything. Here are 4 of the 202 entries in web, with comments added:

$ dsh --profile web --dump-config # the session log - id: session name: '@deepseek-ai/dsh-session' # copies that log into requests to DeepSeek - id: session-log-deepseek name: '@deepseek-ai/dsh-session-log-deepseek' # which model to start with - id: agent-default-model name: '@deepseek-ai/dsh-agent-default-model' config: provider: deepseek-official model: deepseek-flash # calls DeepSeek's API with your key - id: llm-deepseek name: '@deepseek-ai/dsh-llm-deepseek-api-key'

Each entry is one plugin. name is the package to load, config holds the settings passed to its setup function, and id is the label you use to change the entry. Entries can load in any order, because each plugin declares what it needs and Cordis waits until that is available. You don't edit this list directly. Your changes go in a separate patch file for that profile, and dsh applies them on top. For example, this turns off the session log copy:

# ~/.dsh/profiles/web/cordis.patch.yml - id: session-log-deepseek config: enabled: false # the entry that --dump-config prints afterwards - id: session-log-deepseek name: '@deepseek-ai/dsh-session-log-deepseek' config: enabled: false

An edit replaces the entry's whole config, so include any settings you want to keep. Swapping the Model Host uses the same file to add Fireworks, Baseten, and Modal.

In the web profile, a preset picks what one agent can do. It is a second, shorter list of plugins that load for that agent only. The default, standard, has the usual tool set. minimal leaves out the text search, read, and edit tools and gives the model a shell. It also leaves out agent-instructions, so AGENTS.md isn't loaded. The same harness can behave quite differently from session to session.

Routes and adapters

A route is a provider name plus a model, such as deepseek-official with deepseek-flash. An adapter turns a step into an HTTP request for that route. dsh has two kinds: its own DeepSeek adapter, and one backed by pi-ai, the provider library from the pi agent, for every other route. DeepSeek is also one of the providers pi-ai knows, so its API can be reached through either one. Which of the two handles your request decides most of what leaves your machine.

One Question, Start to Finish

The test project had four small files: two JavaScript files and two AGENTS.md files. The one at the root said to use tabs and run npm test before finishing. The one in src/pricing/ said "Never round inside this folder." The question was "Where is the discount logic?" The fake model was scripted to search first, then open one file, then answer, which is how a real model usually handles a question like this.

Figure 3 - One recorded turn
Request sizes are from the capture on a custom third-party route, with the headless profile. Event counts are from the session log file that run left on disk.

What left, and when

Four requests left the machine, in this order:

  • Request 1, 24.9 KB
    • Sent: the system prompt, the question, the root AGENTS.md, the working directory path, the sandbox policy, and 23 tool definitions. The tool definitions are 20.5 KB of it.
    • Not sent: source code, a file listing, or git status.
  • Title request, 0.8 KB
    • Sent: your first message and a short instruction, asking the same model for a session title.
    • Not sent: anything from the project.
  • Request 2, 25.6 KB
    • Added to request 1: the model's grep and glob calls and their results.
    • This is the first source code to leave. A grep result includes the matching lines, so three lines of code were sent before any file was opened.
  • Request 3, 26.5 KB
    • Added to request 2: the model's read call, all of discount.js, and src/pricing/AGENTS.md.

The model never asked for src/pricing/AGENTS.md. dsh added it because the model had just read something in its folder, with a note that the instructions apply to work under src/pricing and take precedence over broader ones. It made no difference to this question, but if you next asked for a change to the discount, the model would already know not to round.

These sizes are from the one-shot headless command. The same question asked in the web app sent more. Its first request was 41.5 KB and had 31 tools, and it also carried the local time and time zone, a list of available skills, the folder dsh is installed in, and the address of the web page.

How a result gets into the next request

Two parts of dsh build each request. Prompt assembly supplies the system prompt and the list of tools. The session log supplies the messages. A tool feeds both, in different ways: its definition goes to prompt assembly, and its results go to the log.

So when grep returned in the recorded turn, prompt assembly wasn't involved. The result was written to the log, and the loop started another step because the model still had to see it. The messages read back from the log now ended with the model's call and its result. In the captures from the DeepSeek, Fireworks, and custom routes, the system prompt and tool list were identical in all three steps, and each step's messages were the previous ones with new ones added at the end. An unchanged beginning also lets a host reuse cached work.

A plugin can also add a message of its own. That is how src/pricing/AGENTS.md arrived in the third request. agent-instructions saw that read had returned and queued the file for the next step, where it was recorded as a message separate from the read result.

Every step resends the history

The API is stateless, so each step sends the whole history again, rebuilt from the local log. That is why the requests in Figure 3 grow from 24.9 to 26.5 KB. When the history nears the model's limit, at 80% of the context window at the latest, a plugin asks the model the session last used to summarize the older part and keeps the newest messages as they were, up to about 16% of the window.

How It Decides What to Read

There is no retrieval system to describe. A search of the source tree finds no embedding model, no vector index, and no repository map. The model decides, and the harness shapes that decision in four ways: what it loads up front, which tools it offers, what it tells the model about them, and how much each call may return.

What loads before the model speaks

The agent-instructions plugin reads files before the model has asked for any, because it runs when a step is about to start (How a plugin works). It finds the project root by walking up to the nearest .git, then loads the AGENTS.md and CLAUDE.md files, and their .local.md versions, from there down to your working directory. Without a .git it looks only in the working directory. A personal AGENTS.md in ~/.dsh or ~/.agents loads first. The project files and the personal files each get a 64 KiB budget, and when a group is over budget the broadest files are dropped first. Instruction files in deeper folders load only after the model uses read, write, or edit on something in or below that folder, as in Figure 3. A grep match there doesn't count, and neither does a bash command.

Two things look like file loading and are not. Typing @src/app.ts in the web UI completes a path, and the docs are explicit that choosing one "never reads or attaches file contents". Skills work in a similar way: the model sees their names and descriptions, and a skill's body loads only when it asks for it or you type / and the skill's name.

Search first, then read

The default prompt tells the model to use glob to find files by name, grep to search contents, and read to open a match. It also says not to do these jobs with shell commands such as find, rg, or cat, which the model could run through the bash tool.

These are instructions to the model and nothing enforces them. A plugin that would require reading a file before editing it exists, and the shipped configuration lists it as disabled.

Some of the names match shell commands, but only bash uses a shell. In a run that called all four tools, a system call trace showed what each one started:

  • read started nothing. The dsh process opened the file itself.
  • grep and glob each started a copy of ripgrep that ships with dsh. The model fills in inputs such as the pattern and the path, and dsh sets the rest of the command.
  • bash started a shell inside the sandbox, and the shell ran the command the model wrote.

glob lists hidden and git-ignored files and skips version control folders. A plain grep leaves hidden and git-ignored files out, which is ripgrep's default. (The package README says both tools include them, but only glob passes the flags that do so.) That doesn't protect a secret in an ignored .env file. In a test run, glob listed the file, read opened it, and grep searched it when given its path or the filter *.

How much one call returns

read returns up to 2,000 lines or 51,200 bytes of file text, whichever comes first, and cuts any line at 2,000 characters. The result ends with a note telling the model where to continue. Try a few file shapes.

Figure 4 - What one read returns
Computed with the same rules as read-render.ts, assuming one byte per character. All four presets were also run through the real tool, and the note at the end matched each time.

The last preset shows a blind spot. Paging works by line, so anything past character 2,000 on a single line can never be reached with read. The model has to fall back to the shell.

Other tools have their own limits. grep shows 250 matches and glob shows 100 paths, oldest first, so a long list leaves out the most recently changed files. Anything else over about 12,500 tokens is cut to its beginning and end. Shell output has an earlier limit: past 64,000 bytes, such as in a long test run, only the end is kept. The full output is normally saved to a file on your disk and the model is told the path, so it can search the saved copy with another tool call. Saving isn't guaranteed. A command that prints more than 64 MiB, for example, leaves only its last 64,000 bytes.

These limits decide what the model sees, not what leaves your machine. With each grep result, dsh also logs the matching lines as data for the web app, and that data is cut separately. On DeepSeek routes it can go out with the session log copy (Swapping the Model Host). In a test run, a search found 250 long lines. The model was shown 154 of them, and the log copy held 96 that it wasn't shown.

What is it allowed to open?

Almost anything you can. The sandbox modes cover file changes, and reading is left alone. In a test run, read opened /etc/hostname, well outside the project, with no prompt. A shell command reached a server over the network. Writing outside the project failed from both the shell and the write tool. The sandbox documentation says the same thing: network access is "outside this vocabulary".

Put together: in workspace-write mode, the model can read any file you can, including ~/.ssh, and can use the network from a shell command, without asking. The project's own safety notice recommends a disposable VM or container.

Swapping the Model Host

DeepSeek's models are available from several companies, and dsh is not tied to DeepSeek's API or even to DeepSeek's models. To see what changes, dsh was configured for each route with a made-up key, and the same question was asked with the provider's address replaced by the fake server. No Fireworks, Baseten, or Modal account was involved. Figure 5 shows the size and contents of each request dsh built.

Figure 5 - The same turn, five routes
Show the numbers as a table
Content-Length of each request a local fake server received, dsh 0.2.2-rc.5, headless profile. The first and last routes share one capture, because pointing the DeepSeek adapter at another address is how its requests were recorded. With DeepSeek's real address, dsh also fetches DeepSeek's model list. Session logs grow with file contents and output, so real sessions will be larger.

Two adapters, two data flows

On the DeepSeek route, 70 KB of the 171 KB sent during that turn was a field called dsh_session_log. The model never sees it, because it sits outside the messages and tool definitions. It is a copy of the session log, sent in pieces as the log grows. The wire reference says it may include the working directory, system prompts, your messages, tool arguments and results, and output from failed attempts. A second field, dsh_plugin_packages, lists the plugins you have active.

Both are on by default. The web UI has a switch under Settings, General, "Upload Session Log when using the official model API", described as "Help improve DeepSeek models and products." Your cordis.patch.yml can turn off both:

# ~/.dsh/profiles/web/cordis.patch.yml - id: session-log-deepseek config: enabled: false # test turn: 171 KB to 101 KB - id: plugin-package-inventory-deepseek disabled: true # then to 78 KB

Much of that log repeats what the request already carries as model input, since DeepSeek's API has to see your prompt to answer it. The additions are the parts outside the model's view and the fact that it arrives as a structured record of the whole session.

On pi-ai routes neither field exists. The adapter doesn't implement them, and the captures show none. That includes pi-ai's own deepseek provider, so the adapter decides this and not the destination. What remains is an ordinary chat request with a deepseek-harness user agent, plus, on the Fireworks and Baseten routes, a session ID that lets the host send related requests to the same server. A system call trace of a full turn on the custom route, with telemetry left at its default, showed connections to the model server and nowhere else, both in the headless command and in the web app.

Fireworks, Baseten, and Modal

Fireworks and Baseten are two of more than 40 built-in providers, so an API key is enough. Modal isn't in the list. There you run your own model server, for example vLLM, and add it as a custom route.

HostSetup in dshAPI used for DeepSeek modelsWhat the host says about storing requests
FireworksBuilt in, FIREWORKS_API_KEYAnthropic MessagesNot logged or stored for open models unless you opt in. Kept in memory for the request and briefly for prompt caching.
BasetenBuilt in, BASETEN_API_KEYOpenAI Chat CompletionsModel APIs follow a zero data retention posture.
ModalCustom route: base URL, API type, model IDs, keyWhatever your server speaksDepends on how you deploy. Servers and Endpoints: not stored. Functions and Web Functions: up to 7 days.
# ~/.dsh/profiles/web/cordis.patch.yml - id: llm-pi-ai config: providers: fireworks: apiKeyEnv: FIREWORKS_API_KEY baseten: apiKeyEnv: BASETEN_API_KEY my-modal: apiKeyEnv: MODAL_VLLM_KEY api: openai-completions baseURL: https://your-app.example/v1 models: - id: deepseek-v4-flash

Two practical notes. An unrecognized endpoint is addressed as if it were OpenAI, and many servers reject something in that shape, so the provider guide documents compat switches such as maxTokensField and thinkingFormat: deepseek. And Modal's vLLM example deploys an endpoint that anyone with the URL can call, so add authentication before sending it private code.

The base URL trap

There are two ways to point dsh at another host, and they don't send the same data. Adding a provider uses the pi-ai adapter. Setting DEEPSEEK_BASE_URL keeps the DeepSeek adapter and changes only the address, so the session log copy and package list go to the new host. Select "DeepSeek adapter, other URL" in Figure 5 to see it. The wire reference states this directly: a gateway chosen through baseURL "receives the same values as the official endpoint".

Web search still goes to DeepSeek

Search is separate from inference. On a DeepSeek route, web_search runs as a second model call at DeepSeek. On any other route, it calls DeepSeek's Search API. With a Modal-style model route and a DeepSeek key present, the test run sent this:

POST <DeepSeek API origin>/v1/tools/search { "query": "half-even rounding", "count": 10, "need_content": false, "ori_question": "How should I round prices in the cart?" }

The query came from the model. The ori_question field is the user's own prompt, cut to 128 characters, and sendOriginalQuestion: false removes it. Without any DeepSeek credential, dsh leaves web_search out of the tool list, so a setup with only a Fireworks key has no reason to contact DeepSeek during a turn. Two other things contact DeepSeek whichever route you use. Submitting feedback uploads the session up to that point. In a test run on the custom route, nothing was uploaded until /feedback was typed, and then 94 KB was, including the source code the model had read. And if you sign in to a DeepSeek account, the web app checks it for notifications in the background, every 10 minutes unless the server sets another delay. By default web_fetch downloads pages directly from your machine.

Local, Host, or Cloud

It helps to split a coding agent into jobs and ask where each one runs. Codex and Claude Code make good comparisons because they solve the same problem with more hosted services around them. Switch the harness, then switch who hosts the model.

Figure 6 - Where each job runs
Harness Model
Select a row for details. Solid chips show where a job runs by default, dashed chips are optional or conditional, and gray chips are off or not available. The third-party setting means any built-in or custom route for dsh, a custom Responses API provider for Codex, and Bedrock, Google Cloud, or Foundry for Claude Code.

Four reasons to need something remote

  1. Inference. Something has to run the model. It can be a vendor, a host like Fireworks, or a machine you own. The captures in this article used a server on localhost and needed no cloud at all.
  2. Hosted tools. Web search is the main one. In all three harnesses it runs on the vendor's or model host's servers.
  3. An account. Signing in pays for usage. dsh needs an API key or an optional DeepSeek sign-in, and a third-party key alone is enough to work.
  4. Running while your laptop is closed. This is the one job where a cloud client changes the design. The repository has to be copied to a remote machine, and the loop, files, and shell all move there.

On the last point the three differ most. Codex cloud and Claude Code cloud sessions run on the vendor's machines by default and need a ChatGPT or claude.ai account, so they aren't available with only a third-party model key. The dsh repository ships no hosted runner. You can run the dsh host on your own server and open its web page through a reverse proxy, in which case "local" means that server.

Compared with Codex and Claude Code

dshCodex CLIClaude Code
Finds code withgrep and glob tools, bundled ripgrepThe shell, with a prompt that prefers rgfind and grep in Bash on macOS, Linux, and WSL; Grep and Glob tools on Windows
Opens files withread, 2,000 lines or 51,200 bytesThe shellRead, 25,000 tokens by default
Loads without askingAGENTS.md and CLAUDE.md, nested ones when touchedAGENTS.md from root to working directory, 32 KiBCLAUDE.md, or AGENTS.md if there is none, nested ones when touched, plus memory and git state
Model APIs spokenAnthropic Messages, OpenAI Chat Completions and Responses, Gemini, and others through pi-aiOpenAI Responses onlyAnthropic Messages, Bedrock, Google Cloud
Other vendors' modelsBuilt inIf the host offers the Responses APINot supported by Anthropic
Shell sandbox by defaultWrites limited, network openWrites limited, network offOff; permission modes decide what runs. When on, writes limited and network allowlisted
Session record on disk~/.dsh/sessions, compressed~/.codex/sessions~/.claude/projects, plaintext, 30 days by default
Transcript sent to the vendor outside model inputOn by default on DeepSeek routes. On any route, feedback uploads the sessionSession logs go with feedback when you include them. Usage metrics are on by defaultOnly if you choose to share it

Where the work happens is nearly identical. All three run the loop on your machine, search with text tools by default, and send a growing history to a model endpoint. The differences are in which endpoints they accept, how tightly the shell is confined, and what the vendor receives besides model input.

Before You Use Private Code

Everything above turns into a short list of choices.

  • Choose the route on purpose. A built-in or custom provider sends model input to that host. The DeepSeek adapter also sends the session log copy and package list, wherever its base URL points.
  • Decide on session log upload if you use a DeepSeek route. It is one switch, and it is on by default.
  • Decide on web search. If a DeepSeek credential is present, the model's search queries go to DeepSeek, whichever host runs the model. When that host isn't DeepSeek, the start of your prompt goes with them by default.
  • Treat feedback as an upload. It sends the session to DeepSeek on every route.
  • Check the host's storage terms for the product you deploy. On Modal the answer depends on the deployment type.
  • Confine it from outside. The sandbox limits writes. To limit reads or network, use a container or VM.
  • Pin a version. The README promises breaking changes, and the defaults described here belong to 0.2.2-rc.5.

The harness decides what the model sees and what leaves your machine, and both are easy to check. Point it at a server you control and read what arrives.