rho-cli 0.1.25

Rho CLI tools for encrypted agent collaboration, dataset publishing, controlled runs, and result release workflows
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# Two Console Demo

This is the simplest end-to-end local demo using two terminals:

- terminal 1 as `agent1`
- terminal 2 as `agent2`

It uses the tools that already exist in this repo:

- `rho`
- `rho-chat`
- `rho-dataset`
- `publish`

It does not yet use the future automated message bus or approval daemon.
Where those pieces do not exist yet, this walkthrough uses explicit manual files.

This demo now uses a dedicated sandbox root:

```text
./sandbox/two-console-demo/
```

That means the demo writes its generated `users/`, `shared/`, request, and result files under `./sandbox/two-console-demo/`, so you can inspect or delete the whole tree in one step.

## What You Will Prove

By the end of this demo:

- `agent1` and `agent2` run in separate `pi` sessions
- `agent1` stages a twin dataset with mock and real variants
- `agent1` publishes only the mock twin into shared space
- `agent2` writes code against the shared mock dataset
- `agent2` tests that code locally
- `agent2` manually requests a real-data run from `agent1`
- `agent1` reviews the code and runs it against the private real data
- `agent1` publishes the result back into the shared folder
- `agent2` reads the published result

## Prerequisites

From the repo root:

```bash
cd /Users/madhavajay/dev/rho/main
```

You should already have:

- `pi` installed and built
- `user1` authenticated in `pi`
- `user2` authenticated in `pi`

Useful check:

```bash
./rho user1 "Say exactly: user1 harness is working"
./rho user2 "Say exactly: user2 harness is working"
```

## Terminal 1: Agent1

Start the interactive `pi` session:

```bash
cd /Users/madhavajay/dev/rho/main
./rho-chat user1
```

Leave it open.

## Terminal 2: Agent2

Start the second interactive `pi` session:

```bash
cd /Users/madhavajay/dev/rho/main
./rho-chat user2
```

Leave it open.

## Terminal 3: Setup Commands

Use a third shell for filesystem setup and manual request/result files.

```bash
cd /Users/madhavajay/dev/rho/main
mkdir -p ./sandbox/two-console-demo
```

## Step 1: Agent1 Creates The Twin Dataset

Run:

```bash
./rho-dataset \
  --name prices-demo \
  --real ./examples/datasets/prices-real.csv \
  --mock ./examples/datasets/prices-mock.csv \
  --owner user1 \
  --share-dir ./sandbox/two-console-demo/users/user1/datasets/share \
  --private-dir ./sandbox/two-console-demo/users/user1/datasets/private \
  --description "Example price dataset with real and mock CSV twins"
```

This stages the dataset under:

```text
./sandbox/two-console-demo/users/user1/datasets/share/<uuid>/
./sandbox/two-console-demo/users/user1/datasets/private/<uuid>/
```

If you want to inspect it:

```bash
find ./sandbox/two-console-demo/users/user1/datasets -maxdepth 4 -type f | sort
```

## Step 2: Agent1 Publishes The Mock Twin

Use the dataset UUID printed by the previous command.

Example:

```bash
./publish user1 fec0edc4-007a-4437-993e-0cd17fe4df55 \
  --source-root ./sandbox/two-console-demo/users \
  --target-root ./sandbox/two-console-demo/shared/datasets
```

This copies the shareable bundle into:

```text
./sandbox/two-console-demo/shared/datasets/<uuid>/
```

Verify:

```bash
find ./sandbox/two-console-demo/shared/datasets/<uuid> -maxdepth 3 -type f | sort
```

For the example UUID:

```bash
find ./sandbox/two-console-demo/shared/datasets/fec0edc4-007a-4437-993e-0cd17fe4df55 -maxdepth 3 -type f | sort
```

## Step 3: Agent2 Inspects The Shared Dataset

In terminal 2 (`agent2`), ask:

```text
Read sandbox/two-console-demo/shared/datasets/fec0edc4-007a-4437-993e-0cd17fe4df55/dataset.yaml and sandbox/two-console-demo/shared/datasets/fec0edc4-007a-4437-993e-0cd17fe4df55/mock/prices-mock.csv. Explain the schema and tell me how to sum the price column.
```

## Step 4: Agent2 Writes The Code

Still in terminal 2, ask:

```text
Create sandbox/two-console-demo/shared/workspace/sum_prices.py that reads a CSV with columns date,symbol,price and prints the sum of the price column.
```

If the directory does not exist yet, ask it to create it or create it manually:

```bash
mkdir -p ./sandbox/two-console-demo/shared/workspace
```

## Step 5: Agent2 Tests Against Mock Data

In terminal 2, ask:

```text
Run python3 sandbox/two-console-demo/shared/workspace/sum_prices.py sandbox/two-console-demo/shared/datasets/fec0edc4-007a-4437-993e-0cd17fe4df55/mock/prices-mock.csv
```

This is the current stand-in for the future sandboxed mock-run tool.

## Step 6: Agent2 Creates A Real-Run Request

The request tooling is not built yet, so create the request manually from terminal 3:

```bash
mkdir -p sandbox/two-console-demo/shared/.rho/requests
mkdir -p sandbox/two-console-demo/shared/.rho/inbox/agent1
```

Create the request manifest:

```bash
cat > sandbox/two-console-demo/shared/.rho/requests/req-001.yaml <<'EOF'
version: 1
request:
  id: req-001
  from: agent2
  to: agent1
  dataset_uuid: fec0edc4-007a-4437-993e-0cd17fe4df55
  code_paths:
    - sandbox/two-console-demo/shared/workspace/sum_prices.py
  command:
    - python3
    - sandbox/two-console-demo/shared/workspace/sum_prices.py
    - DATASET_CSV
  requested_tier: real
  created_at: 2026-04-02T00:00:00Z
EOF
```

Create the inbox message for `agent1`:

```bash
cat > sandbox/two-console-demo/shared/.rho/inbox/agent1/msg-001.yaml <<'EOF'
version: 1
message:
  id: msg-001
  from: agent2
  to: agent1
  type: request_run_real
  related_request_id: req-001
  body:
    text: "Please review and run req-001 on the real dataset."
EOF
```

## Step 7: Agent1 Reviews The Incoming Request

In terminal 1 (`agent1`), ask:

```text
Read sandbox/two-console-demo/shared/.rho/inbox/agent1/msg-001.yaml and sandbox/two-console-demo/shared/.rho/requests/req-001.yaml, then review sandbox/two-console-demo/shared/workspace/sum_prices.py and summarize what it does and whether it looks safe.
```

This is the current manual version of the future `review_shared_code` tool.

## Step 8: Agent1 Runs On Mock First

From terminal 3:

```bash
python3 sandbox/two-console-demo/shared/workspace/sum_prices.py sandbox/two-console-demo/shared/datasets/fec0edc4-007a-4437-993e-0cd17fe4df55/mock/prices-mock.csv
```

If you want to notify `agent2`, write a manual status update:

```bash
mkdir -p sandbox/two-console-demo/shared/.rho/inbox/agent2

cat > sandbox/two-console-demo/shared/.rho/inbox/agent2/msg-002.yaml <<'EOF'
version: 1
message:
  id: msg-002
  from: agent1
  to: agent2
  type: status_update
  related_request_id: req-001
  body:
    status: mock_run_finished
    text: "Mock run completed successfully."
EOF
```

## Step 9: Agent1 Runs On Real Data

The real/private CSV is local to `agent1` and was staged under:

```text
./sandbox/two-console-demo/users/user1/datasets/private/<uuid>/real/prices-real.csv
```

For the example UUID:

```bash
python3 sandbox/two-console-demo/shared/workspace/sum_prices.py sandbox/two-console-demo/users/user1/datasets/private/fec0edc4-007a-4437-993e-0cd17fe4df55/real/prices-real.csv
```

This is the current stand-in for the future Gondolin real-data run.

## Step 10: Agent1 Publishes The Result

From terminal 3:

```bash
mkdir -p sandbox/two-console-demo/shared/.rho/results
mkdir -p sandbox/two-console-demo/shared/results/req-001
```

Write the released output:

```bash
python3 sandbox/two-console-demo/shared/workspace/sum_prices.py sandbox/two-console-demo/users/user1/datasets/private/fec0edc4-007a-4437-993e-0cd17fe4df55/real/prices-real.csv > sandbox/two-console-demo/shared/results/req-001/output.txt
```

Write the result manifest:

```bash
cat > sandbox/two-console-demo/shared/.rho/results/req-001.yaml <<'EOF'
version: 1
result:
  id: result-001
  request_id: req-001
  from: agent1
  to: agent2
  status: released
  artifact_paths:
    - sandbox/two-console-demo/shared/results/req-001/output.txt
EOF
```

Notify `agent2`:

```bash
cat > sandbox/two-console-demo/shared/.rho/inbox/agent2/msg-003.yaml <<'EOF'
version: 1
message:
  id: msg-003
  from: agent1
  to: agent2
  type: result_available
  related_request_id: req-001
  body:
    text: "Result released for req-001."
    result_manifest: "sandbox/two-console-demo/shared/.rho/results/req-001.yaml"
EOF
```

## Step 11: Agent2 Reads The Result

In terminal 2 (`agent2`), ask:

```text
Read sandbox/two-console-demo/shared/.rho/inbox/agent2/msg-003.yaml, sandbox/two-console-demo/shared/.rho/results/req-001.yaml, and sandbox/two-console-demo/shared/results/req-001/output.txt and summarize the released result.
```

## What Is Automated Today

Today’s automation:

- separate `pi` state per user
- twin dataset creation
- publish mock dataset to shared space
- shared mock development flow

## What Is Still Manual

Still manual in this walkthrough:

- request creation
- inbox message creation
- status update messages
- result manifest creation
- mock/real execution approval
- Gondolin sandbox orchestration

## Automated Check

There is also a repeatable smoke test for the current manual flow:

```bash
./tests/test-two-console-demo.sh
```

It does not launch the `pi` TUI.
Instead it automates the filesystem and execution parts of this walkthrough inside `./sandbox/two-console-demo/`:

- create twin dataset
- publish mock dataset
- run the shared `sum_prices.py` example on mock
- create a manual real-run request
- check request status
- approve the request through `./rho approve`
- run on private real data
- publish the result

For a live approval path through Telegram, create `.env` from [.env.example](/Users/madhavajay/dev/rho/main/.env.example) and run:

```bash
./tests/test-two-console-demo.sh --live
```

The live mode:

- initializes a Telegram bot profile inside `./sandbox/two-console-demo/`
- sends a rich approval request summary with inline `Approve`, `Deny`, and `Show Details` buttons
- also accepts `/approve req-...`, `/deny req-...`, `/show req-...`, `/approve_last`, and `/deny_last`
- records that decision through the same `./rho approve` CLI used by the non-live test

The transport split is documented in [approval-middleware.md](/Users/madhavajay/dev/rho/main/docs/approval-middleware.md).

The agentized controlled-action scenario adds offline fixture replay:

```bash
./tests/test-two-console-demo-agent-approval.sh --reset
./tests/test-two-console-demo-agent-approval.sh --record-fixtures --reset
./tests/test-two-console-demo-agent-approval.sh --offline --reset
./tests/test-two-console-demo-agent-approval.sh --offline --middleware fixture --middleware-fixture tests/fixtures/two-console-demo-agent-approval/middleware/deny-release.yaml --reset
```

That lets you:

- run the full online Pi flow
- record Pi step outputs into `tests/fixtures/...`
- replay the same scenario offline without calling Pi
- swap Telegram out for deterministic fixture approvals in tests

## Next Tools To Build

The next commands worth implementing are:

- `rho-message`
  Create a routed inbox message.

- `rho-request`
  Create a computation request manifest and notify the other agent.

- `rho-result`
  Publish a result manifest and notify the requester.

- `review_shared_code`
  `pi` extension tool for code review summaries.

- `run_request_on_mock`
  `pi` extension tool for local mock execution.

- `run_request_on_real`
  `pi` extension tool for local real execution, approval-gated.