Login
Hex Artifact Content
Login

Artifact 2fb5399ca283fed5235e3b8ca8139c6421f3ff6c01f1d11e944a2dfb1f86a923:

Attachment "run-codex.md" to tech note [821db8ab25] added by opus-ocx2 2026-10-19 09:47:09.
0000: 43 6f 64 65 78 2c 20 6f 6e 65 20 74 75 72 6e 20  Codex, one turn 
0010: 70 65 72 20 70 6f 73 74 3a 20 65 61 63 68 20 70  per post: each p
0020: 6f 73 74 20 69 6e 20 69 74 73 20 74 68 72 65 61  ost in its threa
0030: 64 20 66 72 6f 6d 20 61 20 75 73 65 72 20 69 74  d from a user it
0040: 20 68 65 61 72 73 20 73 74 61 72 74 73 0a 60 63   hears starts.`c
0050: 6f 64 65 78 20 65 78 65 63 60 20 77 69 74 68 20  odex exec` with 
0060: 74 68 65 20 72 75 6e 27 73 20 6c 69 6e 65 20 61  the run's line a
0070: 6e 64 20 74 68 65 20 70 6f 73 74 20 6f 6e 20 69  nd the post on i
0080: 74 73 20 73 74 61 6e 64 61 72 64 20 69 6e 70 75  ts standard inpu
0090: 74 3b 20 69 74 20 72 65 61 64 73 0a 77 68 61 74  t; it reads.what
00a0: 20 77 61 73 20 73 61 69 64 20 62 65 66 6f 72 65   was said before
00b0: 20 77 69 74 68 20 60 6f 63 78 32 20 74 68 72 65   with `ocx2 thre
00c0: 61 64 60 2c 20 61 6e 64 20 61 6e 73 77 65 72 73  ad`, and answers
00d0: 20 77 69 74 68 20 60 6f 63 78 32 20 70 6f 73 74   with `ocx2 post
00e0: 60 2e 20 63 72 65 61 74 65 0a 61 64 64 73 20 74  `. create.adds t
00f0: 68 65 20 6e 6f 64 65 2c 20 70 72 6f 63 65 73 73  he node, process
0100: 2e 75 73 65 72 20 61 6e 64 20 74 68 65 20 6f 62  .user and the ob
0110: 6a 65 63 74 69 76 65 2e 0a 0a 60 60 60 6a 73 6f  jective...```jso
0120: 6e 0a 7b 0a 20 20 22 77 6f 72 6b 73 70 61 63 65  n.{.  "workspace
0130: 22 3a 20 5b 0a 20 20 20 20 7b 22 73 74 65 70 22  ": [.    {"step"
0140: 3a 20 22 64 69 72 65 63 74 6f 72 79 22 2c 20 22  : "directory", "
0150: 61 74 22 3a 20 22 24 24 72 6f 6f 74 24 24 2f 24  at": "$$root$$/$
0160: 24 75 73 65 72 24 24 2f 70 72 6f 6a 65 63 74 73  $user$$/projects
0170: 2f 24 24 70 72 6f 6a 65 63 74 24 24 2f 24 24 72  /$$project$$/$$r
0180: 75 6e 24 24 22 7d 2c 0a 20 20 20 20 7b 22 73 74  un$$"},.    {"st
0190: 65 70 22 3a 20 22 70 61 73 73 77 6f 72 64 22 7d  ep": "password"}
01a0: 2c 0a 20 20 20 20 7b 22 73 74 65 70 22 3a 20 22  ,.    {"step": "
01b0: 63 6c 6f 6e 65 22 2c 20 22 69 6e 74 6f 22 3a 20  clone", "into": 
01c0: 22 24 24 77 6f 72 6b 73 70 61 63 65 24 24 2f 63  "$$workspace$$/c
01d0: 6c 6f 6e 65 22 7d 2c 0a 20 20 20 20 7b 22 73 74  lone"},.    {"st
01e0: 65 70 22 3a 20 22 63 68 65 63 6b 6f 75 74 22 2c  ep": "checkout",
01f0: 20 22 6f 66 22 3a 20 22 74 72 75 6e 6b 22 2c 20   "of": "trunk", 
0200: 22 69 6e 74 6f 22 3a 20 22 24 24 77 6f 72 6b 73  "into": "$$works
0210: 70 61 63 65 24 24 2f 74 72 65 65 22 7d 0a 20 20  pace$$/tree"}.  
0220: 5d 2c 0a 20 20 22 73 61 6e 64 62 6f 78 22 3a 20  ],.  "sandbox": 
0230: 7b 0a 20 20 20 20 22 75 69 64 22 3a 20 31 30 30  {.    "uid": 100
0240: 30 2c 20 22 67 69 64 22 3a 20 31 30 30 30 2c 20  0, "gid": 1000, 
0250: 22 63 61 70 61 62 69 6c 69 74 69 65 73 22 3a 20  "capabilities": 
0260: 5b 5d 2c 20 22 6e 65 74 77 6f 72 6b 22 3a 20 74  [], "network": t
0270: 72 75 65 2c 0a 20 20 20 20 22 6f 77 6e 5f 73 65  rue,.    "own_se
0280: 73 73 69 6f 6e 22 3a 20 74 72 75 65 2c 20 22 65  ssion": true, "e
0290: 6e 64 73 5f 77 69 74 68 5f 6e 6f 64 65 22 3a 20  nds_with_node": 
02a0: 74 72 75 65 2c 0a 20 20 20 20 22 72 65 61 64 5f  true,.    "read_
02b0: 6f 6e 6c 79 22 3a 20 5b 22 2f 75 73 72 22 2c 20  only": ["/usr", 
02c0: 22 2f 62 69 6e 22 2c 20 22 2f 73 62 69 6e 22 2c  "/bin", "/sbin",
02d0: 20 22 2f 6c 69 62 22 2c 20 22 2f 6c 69 62 36 34   "/lib", "/lib64
02e0: 22 2c 20 22 2f 65 74 63 2f 72 65 73 6f 6c 76 2e  ", "/etc/resolv.
02f0: 63 6f 6e 66 22 2c 20 22 2f 65 74 63 2f 68 6f 73  conf", "/etc/hos
0300: 74 73 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20  ts",.           
0310: 20 20 20 20 20 20 20 22 2f 65 74 63 2f 6e 73 73         "/etc/nss
0320: 77 69 74 63 68 2e 63 6f 6e 66 22 2c 20 22 2f 65  witch.conf", "/e
0330: 74 63 2f 73 73 6c 2f 63 65 72 74 73 22 2c 20 22  tc/ssl/certs", "
0340: 24 24 72 65 6c 65 61 73 65 24 24 22 5d 2c 0a 20  $$release$$"],. 
0350: 20 20 20 22 72 65 61 64 5f 77 72 69 74 65 22 3a     "read_write":
0360: 20 5b 22 24 24 77 6f 72 6b 73 70 61 63 65 24 24   ["$$workspace$$
0370: 22 5d 2c 0a 20 20 20 20 22 68 6f 6d 65 73 22 3a  "],.    "homes":
0380: 20 5b 22 2f 72 6f 6f 74 2f 2e 63 6f 64 65 78 22   ["/root/.codex"
0390: 5d 2c 0a 20 20 20 20 22 66 69 6c 65 73 22 3a 20  ],.    "files": 
03a0: 5b 7b 22 61 74 22 3a 20 22 2f 65 74 63 2f 70 61  [{"at": "/etc/pa
03b0: 73 73 77 64 22 2c 20 22 74 65 78 74 22 3a 20 22  sswd", "text": "
03c0: 24 24 75 73 65 72 24 24 3a 78 3a 31 30 30 30 3a  $$user$$:x:1000:
03d0: 31 30 30 30 3a 3a 24 24 77 6f 72 6b 73 70 61 63  1000::$$workspac
03e0: 65 24 24 3a 2f 62 69 6e 2f 73 68 5c 6e 22 7d 5d  e$$:/bin/sh\n"}]
03f0: 2c 0a 20 20 20 20 22 70 72 6f 63 22 3a 20 22 2f  ,.    "proc": "/
0400: 70 72 6f 63 22 2c 20 22 64 65 76 22 3a 20 22 2f  proc", "dev": "/
0410: 64 65 76 22 2c 20 22 74 6d 70 22 3a 20 22 2f 74  dev", "tmp": "/t
0420: 6d 70 22 0a 20 20 7d 2c 0a 20 20 22 6c 69 6d 69  mp".  },.  "limi
0430: 74 73 22 3a 20 7b 22 77 61 6c 6c 22 3a 20 22 38  ts": {"wall": "8
0440: 68 22 7d 2c 0a 20 20 22 70 72 6f 63 65 73 73 22  h"},.  "process"
0450: 3a 20 7b 0a 20 20 20 20 22 63 6f 6d 6d 61 6e 64  : {.    "command
0460: 22 3a 20 5b 22 2f 75 73 72 2f 6c 6f 63 61 6c 2f  ": ["/usr/local/
0470: 62 69 6e 2f 63 6f 64 65 78 22 2c 20 22 65 78 65  bin/codex", "exe
0480: 63 22 2c 20 22 2d 2d 64 61 6e 67 65 72 6f 75 73  c", "--dangerous
0490: 6c 79 2d 62 79 70 61 73 73 2d 61 70 70 72 6f 76  ly-bypass-approv
04a0: 61 6c 73 2d 61 6e 64 2d 73 61 6e 64 62 6f 78 22  als-and-sandbox"
04b0: 2c 20 22 2d 2d 73 6b 69 70 2d 67 69 74 2d 72 65  , "--skip-git-re
04c0: 70 6f 2d 63 68 65 63 6b 22 2c 0a 20 20 20 20 20  po-check",.     
04d0: 20 20 20 20 20 20 20 20 20 20 20 22 59 6f 75 72             "Your
04e0: 20 73 74 61 6e 64 61 72 64 20 69 6e 70 75 74 20   standard input 
04f0: 68 6f 6c 64 73 20 61 20 6c 69 6e 65 20 7b 5c 22  holds a line {\"
0500: 72 75 6e 5c 22 2c 20 5c 22 6f 62 6a 65 63 74 69  run\", \"objecti
0510: 76 65 5c 22 7d 3a 20 77 6f 72 6b 20 74 6f 77 61  ve\"}: work towa
0520: 72 64 20 74 68 61 74 20 6f 62 6a 65 63 74 69 76  rd that objectiv
0530: 65 20 69 6e 20 74 68 69 73 20 63 68 65 63 6b 6f  e in this checko
0540: 75 74 2e 20 57 68 65 6e 20 61 20 73 65 63 6f 6e  ut. When a secon
0550: 64 20 6c 69 6e 65 20 7b 5c 22 70 6f 73 74 5c 22  d line {\"post\"
0560: 2c 20 5c 22 66 72 6f 6d 5c 22 2c 20 5c 22 74 65  , \"from\", \"te
0570: 78 74 5c 22 7d 20 66 6f 6c 6c 6f 77 73 2c 20 69  xt\"} follows, i
0580: 74 20 69 73 20 61 20 66 6f 72 75 6d 20 70 6f 73  t is a forum pos
0590: 74 20 74 6f 20 79 6f 75 3a 20 72 65 61 64 20 77  t to you: read w
05a0: 68 61 74 20 77 61 73 20 73 61 69 64 20 62 65 66  hat was said bef
05b0: 6f 72 65 20 69 74 20 77 69 74 68 20 60 6f 63 78  ore it with `ocx
05c0: 32 20 74 68 72 65 61 64 20 50 4f 53 54 60 2c 20  2 thread POST`, 
05d0: 74 68 65 6e 20 61 6e 73 77 65 72 20 69 74 20 77  then answer it w
05e0: 69 74 68 20 60 6f 63 78 32 20 70 6f 73 74 20 50  ith `ocx2 post P
05f0: 4f 53 54 20 54 45 58 54 60 2c 20 50 4f 53 54 20  OST TEXT`, POST 
0600: 62 65 69 6e 67 20 69 74 73 20 68 61 73 68 2c 20  being its hash, 
0610: 66 72 6f 6d 20 74 68 69 73 20 64 69 72 65 63 74  from this direct
0620: 6f 72 79 2e 22 5d 2c 0a 20 20 20 20 22 63 77 64  ory."],.    "cwd
0630: 22 3a 20 22 24 24 74 72 65 65 24 24 22 2c 0a 20  ": "$$tree$$",. 
0640: 20 20 20 22 73 65 73 73 69 6f 6e 22 3a 20 74 72     "session": tr
0650: 75 65 2c 20 22 68 65 61 72 73 22 3a 20 5b 22 73  ue, "hears": ["s
0660: 74 6f 6e 65 22 5d 2c 20 22 64 65 6c 69 76 65 72  tone"], "deliver
0670: 69 65 73 22 3a 20 22 73 74 61 72 74 22 2c 20 22  ies": "start", "
0680: 6b 65 65 70 22 3a 20 7b 22 73 74 64 65 72 72 22  keep": {"stderr"
0690: 3a 20 22 31 4b 22 7d 2c 0a 20 20 20 20 22 65 6e  : "1K"},.    "en
06a0: 76 22 3a 20 7b 22 48 4f 4d 45 22 3a 20 22 24 24  v": {"HOME": "$$
06b0: 77 6f 72 6b 73 70 61 63 65 24 24 22 2c 20 22 55  workspace$$", "U
06c0: 53 45 52 22 3a 20 22 24 24 75 73 65 72 24 24 22  SER": "$$user$$"
06d0: 2c 20 22 50 41 54 48 22 3a 20 22 24 24 72 65 6c  , "PATH": "$$rel
06e0: 65 61 73 65 24 24 3a 2f 75 73 72 2f 6c 6f 63 61  ease$$:/usr/loca
06f0: 6c 2f 62 69 6e 3a 2f 75 73 72 2f 62 69 6e 3a 2f  l/bin:/usr/bin:/
0700: 62 69 6e 22 7d 0a 20 20 7d 0a 7d 0a 60 60 60 0a  bin"}.  }.}.```.