Sudo, part by part: the harness around the model, in ten figures

Rafael
•

Sudo is the admin assistant in Curiosity Studio. He reads, changes and operates a workspace's configuration, and by default nothing he writes applies until a person approves the diff. Very little of that comes from the model. A language model reads text and writes text; it does not run a command, keep a file, remember yesterday's conversation or wait for anyone's approval. Everything that does is the harness: the software around the model that turns its output into actions and its actions back into input.

This post takes Sudo apart one piece at a time, with a figure for each. The previous post was about sharing one harness across many assistants. This one stays with a single assistant and looks at what each part does.

The model and everything around it

The anatomy of Sudo. The model sits in the middle. Around it, the harness: the prompt with a skill index, the loop, skills read on demand, the shell, a context budget, the session, other conversations and the approval gate. The admin talks to the harness. The harness reads the workspace as the admin and changes it only through an approved commit.

The model is the part the workspace chooses. Studio has 19 model providers built in, among them Anthropic, OpenAI, Mistral, Azure OpenAI, AWS Bedrock and Ollama for open weights on your own servers. Switching between them is configuration. The same model behaves very differently depending on what surrounds it. Give it a single chat box and it can only talk about your workspace. Give it the eight parts around the middle of that figure, and it can find out why a dashboard is wrong and fix the endpoint. It can also compile the fix and hand you the diff.

Most of those parts are ordinary software, and none of them is specific to one model. When the model changes, the harness stays.

The loop

The loop. The model reads its context and writes a thought and one shell script. The harness runs the script in the sandbox and appends what it printed to the context. The loop repeats until the model answers the admin, or runs commit, which stages the change and stops.

At the center is the loop from the ReAct paper by Yao and colleagues. The model writes "reasoning traces and task-specific actions in an interleaved manner". The action is carried out, and what came back becomes part of the next input. In Sudo the action is always a shell script. The harness runs it, appends what it printed, and calls the model again.

Say an admin asks for the supplier to appear on the list of overdue corrective actions. The model looks at the corrective action type, sees no supplier field, runs graph edges on one record, and finds a RaisedAgainstSupplier edge. That observation changes the plan: the supplier is an edge, not a field. The next script edits the endpoint to follow the edge.

The loop ends in one of two ways. Sudo answers, or he runs commit, which stages the change and stops the turn. No path changes the workspace without a commit, and what happens to a commit is decided at the approval gate further down.

One tool that takes a script

Two ways to find endpoints that reference an agent that no longer exists. With a tool per operation, three round trips, and every list passes through the model's context. With one tool that takes a script, one round trip, the lists stay in the sandbox, and only the two missing names come back.

Sudo has exactly one tool, shell, and it takes one parameter, a script. He used to have seventy-four tools, one set per configurable surface, plus six sub-agents to route between them. The Computerwelt post tells that story. Two reasons for the change show up in the figure.

The first is round trips. With a tool per operation, every intermediate list passes through the model: it reads every agent name and every endpoint in order to compare them. A script does the comparison in the sandbox and returns two lines. Cloudflare reached the same conclusion for tool calls in general in Code Mode: the approach "really shines when an agent needs to string together multiple calls", because the intermediate results never enter the model's context.

The second is questions nobody listed. "Which endpoints reference an agent that no longer exists?" was never a tool. It is two greps and a comm, and a model that has read a lot of shell writes them without being taught.

The interpreter is Computerwelt, our C# port of a sandboxed bash and a minimal Python. It runs inside the Studio server process. There is no bash binary, no process is started, and network commands such as curl are absent rather than refused.

A filesystem as the interface

The filesystem Sudo works in. Four mounts accept writes: /workspace, his copy of the configuration, /frontend, the front end on a branch, /artifacts and /tmp. Only /workspace and /frontend lead anywhere, through commit and review. Seven mounts are read only: /reference, /docs, /sdk, /proc, /session, /stage and /home/uploads.

A shell needs something to work on, and Sudo's is a virtual filesystem. /workspace is the configuration as the definitions export writes it: one file per endpoint, AI tool, agent, scheduled task, index and schema. Around it are the things he consults. /reference holds a well formed example of every surface, /docs a page per code scope, and /sdk the product's C# surface. /proc holds live runtime state, regenerated on every read, so a running task's log is a tail away.

Two properties of this layout do most of the work. The writable mounts are his copies, so an edit there changes nothing live. And the read-only mounts let him check instead of guess. Before he writes an endpoint he can cat a correct one from /reference. Before he names a method he can look it up with type. The filesystem documentation lists every folder under /workspace and the surface it maps to.

The harness also keeps the credentials out. The loop that holds the model's API key runs in the server; the sandbox gets none of it. Sudo can declare a secret and write code that reads it. Nothing in the sandbox can read its value, and the sandbox has no network to send it over. Andrea Luzzardi argues for the same split in The Agent Harness Belongs Outside the Sandbox: "The loop never enters the sandbox."

Keeping the context in budget

Figure 5. One long conversation as the model reads it, and as the admin sees it. Long output is shortened to its start and end, the oldest tool results are cleared within a long turn, and near the limit the history is summarised. The chat keeps every step and marks where the summary happened.

Everything in the loop lands in the context window, and the window is finite. A long window is also a worse one. Chroma's Context Rot report tested 18 models and found that "performance grows increasingly unreliable as input length grows", even on simple tasks. So the harness manages what the model reads, at four levels, from the smallest unit to the whole conversation.

  • Per script, output is capped at 4 MB, and a cut answer says it was cut. A graph query emits at most 50 nodes per section and adds a Truncated entry, so a partial answer never reads as a whole one. The 4 MB cap is a resource limit and a context budget at once: what a script prints is what the model reads.
  • Per command, long output is shortened to its start and its end, where the header and the error usually are. Commands built for Sudo print short previews by default. chat <uid> shows a line per message and says how long the full text is, and --message 2 prints one in full.
  • Per turn, when a single turn runs long, the oldest tool results are cleared from what the model reads.
  • Per conversation, near the window's limit, the history is summarised and the model continues from the summary. The chat keeps every message and marks where the summary was made.

Anthropic's guide to context engineering describes the last two as tool result clearing and compaction. It treats context as "a finite resource with diminishing marginal returns". The same idea explains what is not in the window at all. Files Sudo edited, his to-do list and a staged commit live in the session, so no summary can lose them.

A session that resumes instead of restoring

What a session keeps. Stored with the conversation: the files Sudo wrote, the paths he deleted, the working directory, the command history, the to-do list and a staged commit. Re-read on every command: the live configuration. What he sees is the live workspace with his own edits on top.

A session belongs to one conversation, so two admins in two conversations never share a working directory or an uncommitted edit. It stores only what Sudo changed. Everything else is re-read from the live workspace on every command.

That is the difference between resuming and restoring a snapshot. A snapshot would show Sudo the workspace as it was when he last looked. Re-reading shows it as it is, with his own edits on top. An endpoint another admin changed this morning is the one he sees this afternoon. A staged commit is stored as the exact bytes that were staged. He may keep editing afterwards, and what is applied has to be what was reviewed.

Two clocks apply. After 30 minutes idle, the copy held in memory is dropped and re-read from storage on the next message, which only frees memory. The stored session is kept for three months. A staged commit has no clock: it waits until someone answers it. The same sessions are open from a terminal through curio, so a session started there is listed in the chat, and the other way round.

Skills, read when they are needed

How skills reach the model. Every turn, the system prompt lists each skill by name with a one-line description, sorted by name. When a task needs one, the model reads its body. A skill holds instructions, and cannot widen what Sudo is allowed to do.

Sudo does not write a surface from memory. Before he writes an endpoint he reads add-code-endpoint; before he changes access he reads access-control. A skill is a short Markdown how-to stored in the workspace, and the built-in ones cover everything from scheduled tasks to NLP pipelines.

Loading every skill on every turn would fill the window with recipes for surfaces the conversation never touches. So the prompt carries one line per skill: its name and a description. The body is read when a task needs it, and once read it stays available for the rest of the conversation. The open Agent Skills format works the same way: "at startup, agents load only the name and description of each available skill". The list is sorted by name for a practical reason. The same skills then produce the same prompt bytes on every turn, which keeps the model provider's prompt cache hitting.

Skills are also how a workspace teaches Sudo its own conventions: an attribute every endpoint must carry, a naming scheme, the team to name in a commit message. They are ordinary workspace records, editable under Manage / AI / Skills. What a skill cannot do is widen Sudo's reach. A skill that says "apply this without asking" removes no approval, and one that says "fetch this URL" gives the sandbox no network.

A plan he writes down, and a person who can steer

Planning and steering during a turn. Before a change with several steps, Sudo writes the steps to his to-do list. A message the admin sends while he is replying is parked as the next turn and goes out when the reply ends. Stop ends the reply and keeps what was done.

Before a change with more than one step, Sudo writes the steps down with the todo command and ticks each one off as he goes. The list renders to /session/todo.md, which the admin can read, and it outlives the conversation. A change that half-finished yesterday picks up at the right step today.

There is no separate planning mode. Sudo explores in his own copy with cat, grep and graph, and none of that changes anything live. A plan and a change differ only in whether he ran commit.

The admin can steer while he works. A message sent during a reply does not interrupt it. It is parked under the transcript as the next turn and goes out when the reply ends. Until then the admin can take it back. Stop ends the reply and keeps what was done. A commit that stop interrupted says why it stopped, instead of coming back as a failure. Sudo also knows what is on the admin's screen: the surface in the foreground tab is what "this endpoint" means.

The approval gate

From edit to workspace. Every changed file is built, and one failure refuses the whole set. commit stages the set under an id and stops. The conversation's approval level decides who reads it: the admin, a separate review conversation, or no one at a level an admin confirmed explicitly. Every path ends in one definitions import, recorded as one tracked change.

build compiles every changed file against the scope it will run in. It compiles against the workspace as the whole change set leaves it, so an AI tool may call an agent added in the same commit. commit builds again, refuses the whole set if one file fails, stages it under an id and ends the turn. The approval binds to that id. If Sudo stages a newer commit while a review is open, the old review refuses to apply.

An approved commit has one way in: an ordinary definitions import of the files that differ, recorded as one change in the configuration history and attributed to the admin who approved it. Stored code that can change data waits for the same kind of approval before it runs. That covers a migration, a scheduled task and an endpoint not marked read only.

Each conversation has an approval level, and it decides who reads the diff. Ask for approval, the default, means the admin does. Approve for me hands the diff to a separate review conversation, which approves, rejects with what to fix, or escalates to the admin. Apply without asking applies each commit as it is staged, and an admin has to confirm that level explicitly. At every level the change arrives through the same import and lands in the same history. Our post on the approval whitepaper argues why this gate matters more than which model sits behind it.

More than one conversation

The task board, with lanes Pending, Working, Needs input, In review and Done. Failures in the workspace's own code are filed as cards. With Auto on, up to three cards start at once, each as its own Sudo conversation with its own session, branch and commit. A reviewer reads only the diff; a tester runs a test written in plain words and hands in pass, fail or skip.

A single conversation is enough for one change. For the rest, the harness starts more conversations of Sudo's, each with its own session, and connects them.

  • The reviewer is the conversation behind Approve for me. It did not write the diff and has only the diff and the workspace to go on, which is the reason it is separate.
  • The tester carries out a test an admin wrote in plain language. It works read only, with the workspace browser when the test allows it, and hands in pass, fail or skip with the output it rests on.
  • The task board is one board per workspace. Admins write cards and hand them over. With Auto on, up to three cards run at once, each as its own conversation. Each works on its own front-end branch, so two of them never overwrite each other's commits. Failures in the workspace's own code, such as an endpoint or a connector that throws, are filed on the board as cards. When the last card in progress is done, a conversation judges the work: the one that handed the card over, or a new review conversation. It starts the next cards, in parallel only when they do not depend on each other.
  • Delegated agents run as calls of their own, grouped under the agent's name in the conversation that started them. What an agent did is still there when the turn ends.

Each of these is a separate context. A conversation working on the export endpoint does not carry the translation work in its window. A reviewer reads the diff without the reasoning that produced it. The Anthropic guide makes the same point about sub-agents: each one "returns only a condensed, distilled summary of its work". Here the condensed result is a diff and a sentence.

The whole harness on one page

Part What it does in Sudo Read more
Model The one the workspace configured, from 19 built-in providers LLM configuration
Loop Think, run one script, read its output, until an answer or a commit This post
Tool One shell, bash and Python in process, no network, no host The sandbox
Filesystem The configuration as files, plus what he consults, read only The workspace filesystem
Context budget Capped output, start and end, cleared results, summaries Figure 5
Session His edits over the live export, kept per conversation Computerwelt, part 3
Skills A line each in the prompt, the body on demand Skills
Plan and steering A to-do list in the session, queued messages, stop Commands
Approval Build, commit, a reader, one import Reviewing and approving
Other conversations Reviewer, tester, task board, delegated agents One harness, many assistants

Swap the model and every row below it stays the same, which is why the harness is where we put the guarantees: what Sudo can reach, what he can change, and who has to agree first.

Further reading

Read next

Articles on context graphs, enterprise search and industrial AI

Connected knowledge for AI systems