DeepSeek Harness: From Your Files to the Model DeepSeek published DeepSeek Harness (dsh) 0.2.2-rc.5, an open-source agent harness under the MIT license as a developer preview, started with a single npx command. Testing against a fake local model server showed the harness keeps no index or embeddings, opens project files only through model-issued tool calls such as grep, glob and read, and sends requests straight from the user's machine to whichever inference host is configured, with DeepSeek out of that path unless a DeepSeek key or sign-in is used. The DeepSeek API connector adds a copy of the session log to requests by default while connectors for other providers do not, and the agent loop, file access, shell and session history all run locally. 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. 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 https://github.com/deepseek-ai/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 . Here are the same three questions with their short answers. 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 reading 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 hosts 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 placement 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. 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: 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/docs/architecture.md 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: | Plugin | What it does | How it connects | |---|---|---| | tool-fs | Adds file tools such as read , write , and edit | Adds to the tool list | | llm-pi-ai | Sends requests to hosts such as Fireworks | Adds to the model adapters | | session-log-deepseek | Copies the session log into requests to DeepSeek | Adds a field to those requests | | session-title | Sets the session's title, which a second plugin, session-title-llm , asks the model for | Event: your message was logged | | compaction-basic | Summarizes old history when it gets too long | Event: a step is about to start | Profiles and presets The framework that loads plugins and passes events between them is called Cordis https://github.com/cordiverse/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 hosts 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 https://github.com/earendil-works/pi , the provider library from the pi agent ../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. 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. - Sent: the system prompt, the question, the root - 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. - Added to request 1: the model's - Request 3, 26.5 KB - Added to request 2: the model's read call, all of discount.js , and src/pricing/AGENTS.md . - Added to request 2: the model's 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/packages/compaction/compaction-basic/README.md 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/packages/context/agent-instructions/README.md plugin reads files before the model has asked for any, because it runs when a step is about to start How a plugin works plugins . 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/packages/bundle/base/cordis.patch.yml . 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/packages/fs/tool-fs-search/README.md 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. 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 hosts . 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/docs/subsystems/sandbox.md 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/SAFETY.md 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. Show the numbers as a table 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/docs/deepseek-llm-api-wire-extensions.md 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. | Host | Setup in dsh | API used for DeepSeek models | What the host says about storing requests | |---|---|---|---| | Fireworks | Built in, FIREWORKS API KEY | Anthropic Messages | Not logged or stored https://docs.fireworks.ai/guides/security compliance/data handling for open models unless you opt in. Kept in memory for the request and briefly for prompt caching. | | Baseten | Built in, BASETEN API KEY | OpenAI Chat Completions | Model APIs follow a zero data retention https://www.baseten.co/security-practices/ posture. | | Modal | Custom route: base URL, API type, model IDs, key | Whatever your server speaks | Depends on how you deploy. Servers and Endpoints: not stored https://modal.com/docs/guide/security . 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 https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.5/docs/user/guide/providers.md documents compat switches such as maxTokensField and thinkingFormat: deepseek . And Modal's vLLM example https://modal.com/docs/examples/llm inference 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 hosts-demo 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