You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/reimagining-bash-for-untrusted-contexts.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
title: "Reimagining Bash for untrusted contexts"
3
3
date: "2026-04-28"
4
-
description: "Bash is designed for humans and it should stay that way. When I talk about untrusted contexts, I mean automated processes and AI agents. Both scenarios come to the same conclusion: they are trying to act like humans, but in reality, they don't have the same constraints."
4
+
description: "Bash is designed for humans and it should stay that way. When I talk about untrusted contexts, I mean automated processes and AI agents. Both scenarios come to the same conclusion: they are trying to act like humans, but in reality, don't have the same constraints."
5
5
---
6
6
7
7
Bash is designed for humans and it should stay that way. When I talk about untrusted contexts, I mean automated processes and AI agents. Both scenarios come to the same conclusion: they are trying to act like humans, but in reality, they don't have the same constraints.
8
8
9
-
As humans, we don't constantly need textual feedback to reach our goals. We have other concerns like efficiency, developer experience (including visual comfort and ergonomics), concerns that agents don't share.
9
+
As humans, we don't constantly need textual feedback to reach our goals. We have other concerns like efficiency, developer experience (including visual comfort and ergonomics). Concerns that agents don't share.
10
10
11
11
Bash delivers this experience perfectly for us, but not for untrusted processes.
12
12
@@ -16,7 +16,7 @@ Since agents are trained on human data, they know how to use Bash by default. Ho
16
16
17
17
Commands fall into three categories: Observation (ls, grep, cat), Mutation (rm, mv, mkdir), and State (cd, export) which alter the context.
18
18
19
-
The question arises mainly for mutation and state commands. Humans consider the silence of these as a success; it's the convenient behavior. Having plenty of messages confirming it succeeded would bring a lot of noise into our shell, and we usually don't want that.
19
+
The question arises mainly for mutation and state commands. Humans consider their silence as a success; it's the convenient behavior. Having plenty of messages confirming it succeeded would bring a lot of noise into our shell, and we usually don't want that.
20
20
21
21
For agents, on the other hand, I believe each command should report clear details on state, filesystem changes, and environment configuration to provide the observability and determinism they need.
22
22
@@ -30,17 +30,17 @@ This approach also enriches the context, giving more landmarks to work with.
30
30
31
31
Sandboxing is the first word that comes to mind when we talk about untrusted processes. If we want to reimagine a Bash adapted for this, it would be a missed opportunity not to have a native sandbox system.
32
32
33
-
In fact, mutation commands could be handwritten, so we might think sandboxing is less important. But for cases like python3 command, where an agent executes arbitrary code, it becomes essential. That's why we absolutely want to natively sandbox every logic execution.
33
+
In fact, mutation commands could be handwritten, so we might think sandboxing is less important. But for cases like python3 command, where an agent executes arbitrary code, it becomes essential. We absolutely want to natively sandbox every logic execution.
34
34
35
35
<SandboxAnimation />
36
36
37
-
It's interesting to maintain this philosophy and additionally provide its own workspace to not pollute the user's file system.
37
+
It's essential to maintain a similar philosophy and additionally provide its own workspace to isolate it from the user's file system.
38
38
39
39
## Reimagining it
40
40
41
41
In theory, the solution is quite simple: add more information to the output. In practice, we can't natively structure the commands' output within the existing Bash paradigm.
42
42
43
-
To me, the only way is to rebuild Bash commands. The good news is, we don't necessarily need to rebuild everything, only the important ones for untrusted processes. Some open-source alternatives already explore different philosophies, but none quite fit the need yet.
43
+
To me, the only way is to rebuild Bash commands. The good news is, we don't necessarily need to rewrite everything, only the important ones for untrusted processes. Some open-source alternatives already explore different philosophies.
44
44
45
45
I also created a light proof of concept in TypeScript. It's a long-term project, so it will depend on you and other people wanting to collaborate on this. Feel free to check it out 👉 [GitHub](https://github.com/capsulerun/bash)
0 commit comments