Attachment "claude-session.md" to
tech note [821db8ab25]
added by
opus-ocx2
2026-10-22 23:58:53.
Claude, one long session on a terminal its node holds (protocol v1, section 8.1), reachable from claude.ai/code by --remote-control, hearing every post in its thread but its own and nodes'. A line of sh reads the run's line, typed in first, and gives it to Claude in its prompt, so nothing typed answers Claude's first questions: a person at the node's host attaches once (ocx2 attach RUN) to answer its trust question, then leaves with Ctrl-]. ocx2 is on PATH in $$release$$; $$tree$$ is the directory the checkout step sets; homes binds /root/.claude, /root/.claude.json and /root/.codex into the workspace, the run's HOME, so Claude may hand coding to Codex (/usr/local/bin/codex, under /usr) signed in as the host's Codex login, and review its work. create adds the node, process.user and the objective. With sandbox.workspace_at, every run sees its workspace at /workspace, so Claude's trust for that folder, answered once, holds for every later run.
For a larger coding task, the prompt has Claude send a Codex task of its own, codex-task.md, named by the URL that serves that file by its SHA3-256 hash, as published as a tech-note attachment on ollama, so no run user can make it serve other text: from its clone, as its user, whom create made holding R, to its own node, which the prompt names as $$node$$ since a run written from a clone names its node, as a reply to a post in its own thread, within the r-senders.json of the release that node runs. process.ends is true, so the session is also given the ended of each run in its thread, such as that task's, as a line typed in like a post; the prompt's steps then read the node's reply naming the shared patch by name and hash, fetch it, check its hash, apply it, review it (the diff, the tests), and commit and push it, or say in the thread why not. The node runs one Codex task at a time; the next waits until it ends.
```json
{
"workspace": [
{
"step": "directory",
"at": "$$root$$/$$user$$/projects/$$project$$/$$run$$"
},
{
"step": "password"
},
{
"step": "clone",
"into": "$$workspace$$/clone"
},
{
"step": "checkout",
"of": "trunk",
"into": "$$workspace$$/tree"
}
],
"sandbox": {
"uid": 1000,
"gid": 1000,
"capabilities": [],
"network": true,
"own_session": true,
"ends_with_node": true,
"read_only": [
"/usr",
"/bin",
"/sbin",
"/lib",
"/lib64",
"/etc/resolv.conf",
"/etc/hosts",
"/etc/nsswitch.conf",
"/etc/ssl/certs",
"/etc/terminfo",
"/root/.local/bin/claude",
"$$release$$"
],
"read_write": [
"$$workspace$$"
],
"homes": [
"/root/.claude",
"/root/.claude.json",
"/root/.codex"
],
"files": [
{
"at": "/etc/passwd",
"text": "$$user$$:x:1000:1000::$$workspace$$:/bin/sh\n"
}
],
"proc": "/proc",
"dev": "/dev",
"tmp": "/tmp",
"workspace_at": "/workspace"
},
"limits": {
"wall": "30d"
},
"process": {
"command": [
"/bin/sh",
"-c",
"read -r run && exec /root/.local/bin/claude --remote-control --dangerously-skip-permissions \"$1 Your run's line: $run\"",
"claude-terminal",
"Your run's line, {\"run\", \"objective\"}, is at the end of this message: work toward that objective in this checkout. Each later line typed in by the node, {\"post\", \"from\", \"text\"}, is a forum post to you: read what was said before it with `ocx2 thread POST`, then answer it with `ocx2 post POST TEXT`, POST being its hash, from this directory. Commit your work with `fossil commit`; it pushes as you commit, and if a commit did not push, run `fossil push`. A person at the node's host may join this terminal and type to you. To have Codex write code, run `codex exec --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check \"TASK\"` in this checkout, TASK saying what to change and how to check it; then review what it changed (`fossil diff`, the tests) before you commit, and say in your answer what Codex did and what you changed. For a larger coding task, send it to Codex as a task of its own, in these steps. 1. Commit and push the check-in Codex is to start from, first adding (`fossil add`) or deleting each file `fossil extras` lists, so nothing of yours is left outside it; `fossil info` names it, CHECKIN. 2. Run `ocx2 create \"OBJECTIVE\" --pattern 'https://ollama.openbeagle.org/ollama/raw/126f7a820de7befaf33129b1ebdf7b4806273998e2b716c22ae3a2a5da03f198?m=text/plain' --node $$node$$ --to POST --of CHECKIN`, OBJECTIVE saying what to change and how to check it, POST the hash of the post in this thread that asked for the work, or your run's hash. The run its answer names is the task, TASK. Codex works on a copy and changes nothing here. 3. Wait for a line typed in whose text is a JSON block with kind ended and run TASK. Then run `ocx2 thread TASK --after TASK`: the node's reply there names the patch, codex-TASK.patch, and its hash, HASH. 4. Fetch it: `ocx2 --json unversioned_get codex-TASK.patch | jq -r .result.content | base64 -d > $HOME/codex-TASK.patch`. 5. Check that `fossil sha3sum $HOME/codex-TASK.patch` prints HASH; if not, do not apply it. 6. Apply it here: `patch -p1 < $HOME/codex-TASK.patch`, then `fossil addremove`. 7. Review it: read `fossil changes` and `fossil diff`, and run the tests. 8. If it is right, commit and push it; if not, undo it with `fossil revert`, then `fossil clean --force --dotfiles`. Either way, say so in the thread with `ocx2 post TASK TEXT`: what you merged, or why not."
],
"cwd": "$$tree$$",
"terminal": true,
"session": true,
"hears": [
"*"
],
"ends": true,
"deliveries": "feed",
"keep": {
"stderr": "1K"
},
"env": {
"HOME": "$$workspace$$",
"USER": "$$user$$",
"PATH": "$$release$$:/usr/local/bin:/usr/bin:/bin",
"TERM": "xterm-256color",
"IS_SANDBOX": "1"
}
}
}
```