Full Transcript

·YouTLDR

Grok Build Architecture Deep Dive — 250K Lines of Production Rust, Exposed by a Privacy Scandal

17:49EnglishTranscribed Jul 22, 2026
0:00

A task that only needed 192 kilobytes of

0:02

code, but the AI agent uploaded 5.1

0:06

gigabytes, your entire project,

0:08

including SSH keys, API tokens, and

0:10

database passwords, all sent to the

0:12

cloud without consent. That was the

0:14

Grock build privacy scandal. But the

0:17

code they were forced to open source, it

0:19

reveals genuinely brilliant

0:20

architecture. 79 rust crates, over

0:23

250,000 lines of production code. Let's

0:26

break it down.

0:28

Welcome to this deep dive into Grock

0:31

Build's architecture, how it works

0:33

internally, and how it compares to

0:34

Claude code. Whether you're picking a

0:37

tool for your daily workflow or building

0:39

AI tools yourself, understanding these

0:42

architectural patterns will help you

0:44

make better decisions. We'll cover the

0:46

actor model, kernel level sandboxing,

0:49

sub aent orchestration, context

0:51

management, and more. Let's get started.

0:55

First, some context on how we can even

0:57

read this code. In May 2026, SpaceX AAI

1:01

launched Grock Build as a public beta. 2

1:04

months later, security researchers at

1:06

Surlab discovered it was uploading 5.1

1:08

GB of data for a task that only needed

1:11

192 kilobyt entire Git histories, SSH

1:14

keys, and secrets, all sent as Git

1:17

bundles to Google Cloud Storage. The

1:19

story went viral on July 14th. the

1:21

register, the Verge, everyone picked it

1:24

up. Musk promised complete deletion of

1:26

the data and the very next day, SpaceX

1:29

open sourced the full code base under

1:31

the Apache 2.0 license. The silver

1:34

lining, we now have over 250,000 lines

1:37

of production Rust code to study. Let's

1:40

see what's inside.

1:42

Here's Grock Build at a glance. It's

1:44

written entirely in Rust edition 2024

1:47

with strict clippy linting. The code

1:49

base is organized into 79 crates with

1:52

over 250,000 lines, not counting tests

1:55

and generated files. It uses Tokyo as

1:58

its async runtime for multi-threaded

2:01

execution. The terminal interface is

2:03

built with Ratatouille, giving you a

2:05

full screen terminal UI with scrollback,

2:08

prompts, and permission modals. The

2:09

default model is Grock 4.5 with a

2:12

500,000 token context window. And of

2:15

course, it's now fully open source under

2:17

Apache 2.0. know you invoke it simply by

2:20

typing grock in your terminal.

2:23

Before we dive into the differences,

2:25

let's understand the universal pattern

2:27

that both tools share. The agentic loop

2:30

you type a prompt. The AI thinks about

2:32

what to do. It takes an action, reading

2:35

a file, running a test, editing code. It

2:38

checks the result and if it's not done,

2:40

it loops back to the thinking step and

2:42

tries again. This cycle repeats until

2:45

the task is complete. The key insight is

2:48

that the AI acts autonomously within

2:50

boundaries you set. Your permissions

2:52

define what actions are allowed. Both

2:54

Claude Code and Grock build implement

2:56

this exact pattern, but with very

2:58

different architectural choices

3:00

underneath. Claude Code uses a

3:03

Typescriptbased singlethreaded event

3:05

loop on the bun runtime. Grock build

3:08

uses a Rustbased multi-threaded actor

3:10

model running on Tokyo. That's a

3:13

fundamental difference we'll explore

3:14

next.

3:16

Grock build goes beyond just typing in

3:18

the terminal. It offers five deployment

3:20

modes, each serving a different

3:22

workflow. First, interactive mode, the

3:24

default when you type Grock. It gives

3:26

you a full screen terminal UI with

3:28

scroll back, prompts, and permission

3:30

modals. Second, headless mode. You pass

3:33

a prompt with the -p flag. It runs

3:35

non-interactively and exits. Perfect for

3:38

CI and automation pipelines. Third, STIO

3:42

ACP. This is the agent communication

3:44

protocol. a JSON RPC protocol over

3:46

standard input and output. IDE

3:49

extensions for VS Code and Jet Brains

3:51

connect through this. Fourth, the leader

3:53

Damon, a longunning background process

3:55

that keeps your sessions alive. We'll

3:57

explore this one in detail next. And

4:00

fifth, a websocket server for remote

4:02

access from any machine authenticated

4:04

with a shared secret.

4:07

The leader Damon is Grock Build's most

4:10

interesting deployment feature. Imagine

4:12

you're in the middle of a complex coding

4:14

task. Your terminal crashes and you lose

4:17

all your inprogress work. Frustrating,

4:20

right? Grock Build solves this with a

4:22

persistent background process that holds

4:25

all your session state. Your terminal,

4:27

the UI you see, just connects to the

4:30

Damon. If the terminal crashes, you

4:33

simply reconnect to the leader and pick

4:35

up exactly where you left off with full

4:37

state replay. Multiple clients can

4:39

connect to the same Damon

4:40

simultaneously. Your terminal, your IDE

4:43

extension, a websocket client from

4:46

another machine. They all talk the same

4:48

ACP protocol to the same stateful

4:50

process. Think of it this way. Claude

4:53

code is like a local document. Your work

4:56

is saved, but if the app crashes

4:58

mid-action, that in-flight operation is

5:00

lost. Grock build is like Google Docs.

5:02

The server holds the state. So even if

5:04

your browser tab dies, you reconnect and

5:07

everything is still there. Now let's

5:10

look at how the process architecture

5:11

differs fundamentally between the two

5:13

tools. Claude code uses a singlethreaded

5:16

event loop. One query engine controller

5:19

manages the conversation. The loop runs

5:21

serial turns, but tool calls within a

5:24

single turn can execute in parallel

5:25

batches. It's TypeScript running on the

5:27

bun runtime. Simple, predictable, easy

5:30

to reason about. Grock build uses an

5:32

actor model on Tokyo, Rust's

5:34

multi-threaded async runtime. Each

5:36

session runs on its own dedicated

5:38

thread. They never share state. The MVP

5:41

agent acts as an ACP server, spawning

5:44

isolated sessions that communicate only

5:47

through message passing. Here's the

5:49

analogy. Each session in Grock Build is

5:51

like a person in their own room with

5:53

their own desk. They never share papers.

5:56

They just pass notes through a slot in

5:58

the door. One person having a bad day

6:00

can't mess up another's work. The

6:03

practical difference. Claude code runs

6:05

one process per conversation. Grock

6:07

build runs multiple fully isolated

6:09

sessions within a single leader process.

6:13

Both tools use the same everything is a

6:15

tool pattern. When the AI wants to read

6:17

a file, it calls a read file tool. When

6:20

it wants to run npm test, it calls a

6:22

bash tool. Every capability is a tool.

6:26

Why? Because every tool goes through the

6:28

same pipeline. The model makes a

6:30

request, inputs get validated,

6:32

permissions are checked, the tool

6:33

executes, and results are formatted and

6:36

returned. Adding a new capability is

6:38

just adding a new tool. It automatically

6:40

inherits permissions, logging, and error

6:43

handling for free. Looking at the tool

6:45

categories side by side, both have file

6:48

operations, code execution, web access,

6:50

and sub aents. Grock Build adds media

6:53

generation tools like image gen and

6:55

image to video. In total, Claude Code

6:58

has over 40 tools and Grock Build has

7:00

over 45. The key takeaway, if you're

7:03

building your own AI tools, adopt this

7:05

pattern. It gives you extensibility

7:07

without complexity.

7:09

Here's a clever problem both tools face.

7:12

When a tool reads a 500line file or runs

7:15

a test suite, it dumps a lot of text

7:17

into the AI's context window. that eats

7:19

up the limited memory the AI has to work

7:21

with. Grock Build solves this with what

7:24

I call the concise namespace trick.

7:27

Every tool has two output methods. Model

7:30

output, what gets sent to the AI, and

7:32

chat completion output, what gets shown

7:34

to you. The concise variants like bash

7:37

concise and read file concise send

7:39

deliberately stripped down results to

7:41

the AI while you still see the full

7:43

output. This prevents context bloat from

7:46

the start.

7:48

Claude code takes a different approach.

7:50

It uses tool search to load tool schemas

7:52

on demand. Most tools are hidden until

7:54

needed, saving input tokens. Then it

7:57

uses retroactive trimming. Old tool

7:59

results get compressed when context gets

8:01

tight. The trade-off is clear. Grock

8:04

build truncates up front so the AI gets

8:06

less context but avoids bloat. Clawed

8:09

code gives the AI full context early for

8:11

better reasoning then compacts later

8:13

when space runs out. Both are valid

8:15

approaches. It depends on whether you

8:17

prefer prevention or cure.

8:21

Context management is the hard problem

8:24

in AI agent engineering. Think of it

8:26

like pair programming with someone who

8:28

has limited short-term memory. After a

8:31

while, they start forgetting what you

8:32

discussed earlier. You need a strategy.

8:35

Claude code uses a six-level compaction

8:38

cascade. It starts with cheap

8:40

strategies. capping tool result size,

8:42

snipping old history, and escalates only

8:45

when needed through micro compaction,

8:47

context collapse, session memory

8:49

compaction, and finally a full reset as

8:51

a last resort. It's fully automatic, no

8:54

configuration needed. Grock build takes

8:56

a manual approach with three

8:58

configurable modes. Basic mode

9:00

summarizes all turns at once. Intrturn

9:03

mode keeps the most recent K turns

9:05

verbatim and summarizes the rest. And

9:08

the most powerful mode, interturn

9:10

segments, breaks the conversation into

9:12

semantic chapters. The segments approach

9:15

is unique. Think of it like chapters in

9:17

a book. Completed chapters get

9:18

summarized to disk. Only the current

9:21

active chapter stays in full detail.

9:23

This lets very long sessions, hours of

9:26

work remain manageable. The key

9:29

difference, Claude code autoes escalates

9:31

within a session. Grock Build lets you

9:33

pick the strategy up front and segments

9:35

are its most powerful trick for long

9:37

sessions.

9:39

The AI can do anything the tool system

9:41

allows. Without guardrails, delete all

9:44

files or push to production are

9:46

possible. Both tools take security

9:49

seriously, but with very different

9:51

philosophies. Claude code uses multiple

9:53

independent guards like airport security

9:56

with multiple checkpoints, five layers,

9:59

permission modes, permission rules in

10:01

config, tool level checks, hook

10:03

overrides with custom scripts, and an AI

10:05

classifier, a separate model evaluating

10:08

whether a call is risky. Any single

10:10

layer can block an action. And

10:11

critically, if the AI classifier can't

10:14

be reached, it blocks by default. That's

10:16

fail design. Grock build has software

10:19

permissions too, but its unique layer is

10:21

kernel level sandboxing. On Linux, it

10:24

uses landlock. The OS kernel itself

10:26

enforces path-based access control. On

10:29

Mac OS, it uses Apple's seat belt

10:31

framework. The sandbox is stored in a

10:33

once lock in Rust. Once applied, it

10:35

literally cannot be undone. Even if the

10:37

AI tricks the software layers, the OS

10:40

blocks the action. The irony? Grock

10:43

build has arguably stronger local

10:45

security with its kernel sandbox. But

10:47

the upload scandal happened at the

10:49

network level. The sandbox restricts

10:51

file and process access, not what gets

10:53

sent to servers. Security must be

10:56

defense in depth.

10:58

Without memory, every conversation

11:00

starts from zero. The AI doesn't know

11:02

your preferences, your project's quirks,

11:04

or that you told it yesterday to never

11:06

use semicolons. Claude Code stores

11:09

memories as markdown files in your home

11:11

directory organized into four types:

11:13

user, feedback, project, and reference.

11:17

It retrieves them using semantic recall.

11:20

A smaller AI model picks the five most

11:22

relevant memories per turn. It can also

11:24

autosave memories through pattern

11:26

detection and a dreaming consolidation

11:28

step between sessions.

11:30

Grock build uses a local vector store

11:33

combined with keyword indexing. Memories

11:35

are flat entries retrieved through

11:37

combined vector and keyword search

11:39

injected as memory blocks into the

11:41

prompt. But there's a key difference. It

11:44

doesn't autosave. The model must

11:46

explicitly call a memory write tool to

11:48

save anything. The philosophical

11:50

difference. Claude codes memories

11:52

actively influence behavior. They shape

11:55

how it responds. Grock builds memories

11:58

are more like searchable history, a

12:00

reference archive you can query.

12:03

This is a real differentiator for Grock

12:05

Build, its checkpoint and undo system.

12:08

Before each prompt, it creates a

12:09

multi-dommain snapshot capturing three

12:11

things. The file state with before and

12:14

after snapshots per file. The git state

12:16

including head and staged paths and the

12:19

hunk tracker recording edit regions. If

12:22

the AI messes something up, you can

12:24

rewind to before that specific prompt.

12:27

The rewind process is methodical. First,

12:29

it does a git soft restore with stash

12:32

and reset. Then reverts files from

12:34

snapshots, reststages the correct git

12:36

paths, and finally restores the hunk

12:38

state. Why is this better than just

12:40

using git roll back? Four reasons.

12:43

First, it works on uncommitted changes.

12:45

The AI often edits files without

12:47

committing. Second, it provides per

12:49

prompt granularity. Git only works at

12:52

commit boundaries. Third, it preserves

12:54

staging state. What was staged versus

12:56

unstaged gets fully reconstructed. And

12:59

fourth, it's non-destructive. Rewinding

13:01

saves your current state first, so you

13:04

can undo the undo.

13:06

This kind of fine grained undo is

13:08

something Claude Code doesn't have built

13:09

in. You'd rely on git history or manual

13:12

stashing.

13:14

Both tools support agents, but they

13:16

emphasize different strengths. Claude

13:19

Code's philosophy is deep serial

13:21

reasoning. First, the main agent handles

13:23

complex problems with a large context

13:26

window. Sub agents supplement when

13:28

parallelism helps running in the

13:30

background or in isolated work trees.

13:32

Think of it as one deep thinker with

13:34

optional helpers. Grock builds

13:37

philosophy is parallel workers as a

13:39

first class pattern. The sub agent

13:41

coordinator orchestrates multiple

13:43

workers each running in their own

13:45

isolated work tree. On Linux with BTRFS

13:48

these are instant file system snapshots.

13:51

On Mac OS with APFS they use copy and

13:53

write reef links. Workers start

13:55

instantly from a pre-created pool. When

13:58

does each approach win? For complex bugs

14:01

requiring deep reasoning, clawed code.

14:03

The single thinker can hold the full

14:05

problem in context. For finding all

14:07

usages of something across a codebase or

14:09

large refactoring across many files,

14:11

grock build parallel workers search and

14:14

edit simultaneously without conflicts.

14:16

For subtle architectural decisions,

14:18

clawed code step-by-step reasoning

14:20

chains benefit from serial depth.

14:24

Let's put it all together with the final

14:26

comparison. On reasoning depth, Claude

14:29

code offers a large context window with

14:31

deep serial thinking. Grock build offers

14:33

parallel sub aents with a divide and

14:35

conquer approach. On speed, claude code

14:38

optimizes for thoroughess while Grock

14:40

build optimizes for parallelism. On

14:43

model choice, cla code uses anthropic

14:46

models while Grock build works with any

14:48

open compatible model. On privacy,

14:50

Claude Code has a clean record with no

14:53

incidents. Grock Build has the

14:55

controversial upload scandal. On open

14:57

source, Claude Code is proprietary.

14:59

Grock Build is Apache 2.0. Session

15:02

persistence. Claude Code saves history

15:04

to disk but is processbound. Grock

15:07

builds leader Damon provides full state

15:09

replay across crashes. Local security.

15:12

Cloud Code has five software layers plus

15:14

an AI classifier. Grock build uses

15:16

kernel level sandboxing with landlock

15:18

and seat belt. Practical recommendation,

15:21

use claude code if you value deep

15:23

reasoning, a mature ecosystem, and

15:25

proven privacy. Use Grock build if you

15:28

want parallel agents, model flexibility,

15:30

or the ability to audit the source code

15:32

yourself. You can even use both. They

15:35

support the same protocols.

15:38

If you're building AI powered tools,

15:40

here are five architectural patterns you

15:42

can apply today. Number one, everything

15:44

is a tool. A unified tool pipeline gives

15:47

you permissions, logging, and

15:49

extensibility for free. Both tools prove

15:52

this pattern works at scale. Actor model

15:55

versus event loop. Choose actors when

15:58

you need multi-session isolation. Each

16:00

session gets its own thread and can't

16:02

corrupt others. Choose an event loop

16:04

when simplicity matters. Most developers

16:07

only need one session at a time. Number

16:10

three, context management is the hard

16:13

problem. Both tools spend enormous

16:15

engineering effort here. Plan for it

16:17

early in your design. Whether you autoes

16:19

escalate like clawed code or let users

16:21

choose strategies like rock build, you

16:23

need a compaction plan. Number four,

16:26

layered configuration pays off. Both

16:29

tools use five or more configuration

16:31

layers. Enterprise, personal, project

16:33

settings all compose cleanly. Design for

16:35

this from the start. Number five,

16:38

security must be defense in depth. No

16:41

single layer is enough. The scandal

16:43

proved that even kernel sandboxing

16:46

misses network level threats. You need

16:49

multiple independent guards covering

16:51

different attack surfaces. The AI coding

16:53

agent space is converging on the same

16:56

patterns with different trade-offs.

16:58

Understanding the architecture helps you

16:59

use them better and build your own when

17:02

the time comes.

17:04

One final thought on the trust question.

17:06

Open source doesn't automatically mean

17:08

trustworthy. The upload code is still

17:10

there in the codebase, just disabled by

17:12

a flag. And proprietary doesn't mean

17:15

untrustworthy. Claude code has never had

17:17

a data exfiltration incident. What

17:20

actually matters? Network monitoring,

17:23

clear privacy policies, and independent

17:25

security audits. Judge tools by their

17:28

behavior, not their marketing.

17:30

Understanding these architectures helps

17:32

you make informed choices and gives you

17:35

the patterns to build your own AI tools

17:37

when the time comes. And if you found

17:40

this comparison helpful, hit subscribe

17:42

for more deep dives into AI coding

17:44

tools. Thanks for watching.

More transcripts

Explore other videos transcribed with YouTLDR.

Get the TLDR of any YouTube video

Transcribe, summarize, and repurpose videos in 125+ languages — free, no signup required.

Try YouTLDR Free