overcodex 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {overcodex-0.1.0 → overcodex-0.2.0}/PKG-INFO +43 -10
  2. {overcodex-0.1.0 → overcodex-0.2.0}/README.md +42 -9
  3. overcodex-0.2.0/agents/judge-sol-xhigh.toml +11 -0
  4. overcodex-0.2.0/agents/reviewer-sol-high.toml +11 -0
  5. overcodex-0.2.0/agents/scout-luna-low.toml +11 -0
  6. overcodex-0.2.0/agents/worker-terra-medium.toml +11 -0
  7. overcodex-0.2.0/codex/AGENTS-ULTRACODE.md +66 -0
  8. overcodex-0.2.0/config/agents-block.toml.tpl +22 -0
  9. overcodex-0.2.0/config/statusline.toml +3 -0
  10. {overcodex-0.1.0 → overcodex-0.2.0}/hooks/overcodex-ctx-lib.sh +5 -7
  11. overcodex-0.2.0/install-openclaw.sh +24 -0
  12. {overcodex-0.1.0 → overcodex-0.2.0}/install.sh +120 -24
  13. overcodex-0.2.0/prompts/ultracode.md +17 -0
  14. {overcodex-0.1.0 → overcodex-0.2.0}/pyproject.toml +7 -1
  15. overcodex-0.2.0/skill/overcodex-ultracode/SKILL.md +55 -0
  16. overcodex-0.2.0/skill/overcodex-ultracode/agents/openai.yaml +6 -0
  17. overcodex-0.2.0/skill/overcodex-ultracode/references/codex-adapter.md +18 -0
  18. overcodex-0.2.0/skill/overcodex-ultracode/references/openclaw-adapter.md +16 -0
  19. overcodex-0.2.0/skill/overcodex-ultracode/references/role-prompts.md +21 -0
  20. {overcodex-0.1.0 → overcodex-0.2.0}/src/overcodex/__init__.py +1 -1
  21. {overcodex-0.1.0 → overcodex-0.2.0}/src/overcodex/cli.py +8 -1
  22. {overcodex-0.1.0 → overcodex-0.2.0}/uninstall.sh +23 -4
  23. overcodex-0.1.0/codex/AGENTS-ULTRACODE.md +0 -54
  24. {overcodex-0.1.0 → overcodex-0.2.0}/.gitignore +0 -0
  25. {overcodex-0.1.0 → overcodex-0.2.0}/LICENSE +0 -0
  26. {overcodex-0.1.0 → overcodex-0.2.0}/bin/codex-swap +0 -0
  27. {overcodex-0.1.0 → overcodex-0.2.0}/config/hooks-block.toml.tpl +0 -0
  28. {overcodex-0.1.0 → overcodex-0.2.0}/hooks/overcodex-ctx-watch.sh +0 -0
  29. {overcodex-0.1.0 → overcodex-0.2.0}/hooks/overcodex-handoff-inject.sh +0 -0
  30. {overcodex-0.1.0 → overcodex-0.2.0}/hooks/overcodex-notify.sh +0 -0
  31. {overcodex-0.1.0 → overcodex-0.2.0}/hooks/overcodex-precompact-offer.sh +0 -0
  32. {overcodex-0.1.0 → overcodex-0.2.0}/prompts/handoff-cancel.md +0 -0
  33. {overcodex-0.1.0 → overcodex-0.2.0}/prompts/handoff-status.md +0 -0
  34. {overcodex-0.1.0 → overcodex-0.2.0}/prompts/handoff.md +0 -0
  35. {overcodex-0.1.0 → overcodex-0.2.0}/shell/zshrc-snippet.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: overcodex
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Codex CLI, overclocked — cold multi-account switching, context-threshold handoff, instrumented statusline, and AGENTS.md routing policy for multi-agent workflows
5
5
  Project-URL: Homepage, https://github.com/arthur-bump-pm/overcodex
6
6
  Project-URL: Repository, https://github.com/arthur-bump-pm/overcodex
@@ -30,8 +30,7 @@ Description-Content-Type: text/markdown
30
30
  codex-swap work # register/list accounts, then switch — restart required
31
31
  /prompts:handoff # package this session's state, resume fresh next launch
32
32
 
33
- ctx [████░░░░░░] 42% remaining | 5h limit 71% | weekly limit 18%
34
- └ get_context_remaining └ native Codex statusline items
33
+ native footer: model with reasoning | current directory | project name | context remaining | 5h limit | weekly limit
35
34
  ```
36
35
 
37
36
  ## Install
@@ -50,7 +49,13 @@ codex-swap add personal # then log in to each: CODEX_HOME=~/.codex-accounts/w
50
49
  codex-swap work # cold switch: writes auth.json, then restart codex
51
50
  ```
52
51
 
53
- Start a **new** Codex CLI session (hooks and AGENTS.md load at session start) and confirm the statusline shows the context/limit meters. Run `/prompts:handoff` inside Codex to hand off before you hit auto-compact.
52
+ Start a **new** Codex CLI session (hooks and AGENTS.md load at session start) and confirm its native footer shows the configured fields; Codex may omit unavailable usage-limit fields. Run `/prompts:handoff` inside Codex to hand off before you hit auto-compact.
53
+
54
+ The same routing policy is packaged as a portable skill for OpenClaw. Install it from a packaged overcodex build with `openclaw skills install "$(overcodex skill-path)" --global`, then configure the four role agent IDs described in `skill/overcodex-ultracode/references/openclaw-adapter.md`.
55
+
56
+ For agent-assisted setup, tell OpenClaw:
57
+
58
+ > Install and activate Overcodex UltraCode. Run `curl -fsSL https://raw.githubusercontent.com/arthur-bump-pm/overcodex/main/install-openclaw.sh | bash`, verify it with `openclaw skills list` and `openclaw agents list`, then configure the scout, worker, reviewer, and judge roles. Do not change credentials or existing agent settings without showing me the proposed diff first.
54
59
 
55
60
  <details>
56
61
  <summary>Other install methods, requirements, upgrading</summary>
@@ -86,7 +91,7 @@ Each account gets its own isolated `CODEX_HOME` (a separate `auth.json`, never a
86
91
 
87
92
  ```mermaid
88
93
  flowchart LR
89
- A[Context fills up] --> B[get_context_remaining / statusline flags it]
94
+ A[Context fills up] --> B[Native footer shows context remaining]
90
95
  B --> C[You run /prompts:handoff]
91
96
  C --> D[Codex packages goals, state, next steps]
92
97
  D --> E[Session ends]
@@ -98,13 +103,29 @@ flowchart LR
98
103
  You lose the token bloat, not the thread. Combine with a `codex-swap` restart when you're also switching accounts.
99
104
 
100
105
  ### Statusline
101
- Codex's native statusline already covers the meters — run `/statusline` inside Codex and enable the context, five-hour, and weekly items (or set `tui.status_line` in config.toml yourself). The kit deliberately ships no statusline config: the native picker is authoritative, and the exact config-key vocabulary is undocumented — nothing to clobber, nothing to break.
106
+ The kit ships conservative defaults for Codex's native footer, in this order: `model-with-reasoning`, `current-dir`, `project-name`, `context-remaining`, `five-hour-limit`, and `weekly-limit`, with colors enabled. Codex renders these native fields and may omit usage-limit fields that are unavailable. Installation adds the defaults only when you do not already have `tui.status_line`; an existing user setting is preserved. Start a new Codex CLI session after installation for the footer to reload.
107
+
108
+ OverCodex hooks use rollout data separately to issue handoff warnings as context fills. They cannot inject a custom statusline command or replace Codex's native footer.
109
+
110
+ ### AGENTS.md routing policy + custom agents
111
+ A policy block appended to `$CODEX_HOME/AGENTS.md` (loaded globally, then project `AGENTS.md` files concatenate root-down) tells Codex when to delegate and enforces read-parallel/write-serial coordination, verification floors, escalation, and final synthesis. Four custom-agent definitions under `$CODEX_HOME/agents/`, registered in `[agents]`, pin bulk scouting to Luna, implementation to Terra, review to Sol/high, and adjudication to Sol/xhigh. Routed dispatches use an explicit `agent_type` and `fork_turns = "none"`; a task name alone does not route models.
112
+
113
+ For an explicit trigger inside Codex, run `/prompts:ultracode` and include the objective. For qualifying complex tasks, the global policy also defaults to delegation and requires the parent to explain any decision to stay serial.
114
+
115
+ When Codex opens this GitHub checkout, the root `AGENTS.md` supplies the repository-local instruction layer. Prompt it with `Activate Overcodex UltraCode in this repository` to have it inspect the global marker and run `./install.sh` when activation is requested. For OpenClaw, prompt it to run `./install-openclaw.sh`; the portable `SKILL.md` then supplies the same orchestration policy.
102
116
 
103
- ### AGENTS.md routing policy
104
- A policy block appended to `$CODEX_HOME/AGENTS.md` (loaded globally, then project `AGENTS.md` files concatenate root-down): bulk work rides cheap models/effort, verification rides a stronger reasoning tier, only final judgment spends the top tier. Routing table, hard floors, escalation rules included.
117
+ The detailed agent-facing activation contract is in [`AGENT-SETUP.md`](AGENT-SETUP.md). Short prompts are enough because the repository's `AGENTS.md` directs the agent to read that contract:
118
+
119
+ **Codex:** `Activate Overcodex UltraCode for Codex from https://github.com/arthur-bump-pm/overcodex. Clone it if needed, follow AGENT-SETUP.md, preserve unrelated settings, verify the roles and smoke test, then report the restart step.`
120
+
121
+ **OpenClaw:** `Activate Overcodex UltraCode for OpenClaw from https://github.com/arthur-bump-pm/overcodex. Clone it if needed, follow AGENT-SETUP.md, show configuration diffs before applying them, verify the skill and agents, then run a harmless scout check.`
122
+
123
+ The complete copy-paste versions are in [`overcodex-instructions.md`](overcodex-instructions.md).
124
+
125
+ For full proactive orchestration, select a supported Codex reasoning effort in the model controls. GPT-5.5 supports `none`, `low`, `medium`, `high`, and `xhigh`; GPT-5.6 Sol/Terra/Luna also support `max`. The bundled judge uses portable `xhigh`; use `max` only for a GPT-5.6 quality-critical adjudication. `ultra` is not a Codex effort value. Installing Overcodex does not silently replace your existing model or effort preference.
105
126
 
106
127
  ### Hooks + prompts
107
- `PreToolUse`/`PostToolUse`/`SessionStart`/`Stop` hooks wired via an inline `[hooks]` table in `config.toml`, plus `/prompts:*` markdown prompts under `$CODEX_HOME/prompts/` (YAML frontmatter, `$1`-`$9` placeholders) for the handoff flow and other repeatable operations.
128
+ `SessionStart`/`UserPromptSubmit`/`Stop`/`PreCompact` hooks wired via an inline `[hooks]` table in `config.toml`, plus `/prompts:*` markdown prompts under `$CODEX_HOME/prompts/` (YAML frontmatter, `$1`-`$9` placeholders) for the handoff flow and other repeatable operations.
108
129
 
109
130
  ## Cheat sheet
110
131
 
@@ -117,6 +138,8 @@ A policy block appended to `$CODEX_HOME/AGENTS.md` (loaded globally, then projec
117
138
  | `overcodex install` | (Re)install/refresh the kit — idempotent |
118
139
  | `overcodex uninstall` | Remove exactly what install added |
119
140
  | `overcodex path` | Print the bundled payload directory |
141
+ | `overcodex skill-path` | Print the portable OpenClaw/Codex skill directory |
142
+ | `install-openclaw.sh` | Install the packaged skill into OpenClaw |
120
143
 
121
144
  Or skip memorizing and **paste a prompt**:
122
145
 
@@ -135,7 +158,9 @@ flowchart TD
135
158
  HK --> PR[/prompts:handoff and friends]
136
159
  PR --> CS[codex-swap: isolated CODEX_HOME per account]
137
160
  CS --> RS[Cold restart adopts the new account]
138
- SL[Statusline: get_context_remaining + native limit items] --> HK
161
+ SL[Native footer: context-remaining + available usage limits] --> PR
162
+ HK --> RW[Hooks read rollout data for handoff warnings]
163
+ RW --> PR
139
164
  ```
140
165
 
141
166
  <details>
@@ -157,8 +182,11 @@ flowchart TD
157
182
  | `bin/codex-swap` | `~/.local/bin/` | Cold account switcher: register, list, point `$CODEX_HOME` at an account |
158
183
  | `hooks/*.sh` | `$CODEX_HOME/hooks/` | SessionStart / UserPromptSubmit / Stop handlers |
159
184
  | `config/hooks-block.toml.tpl` | inline `[hooks]` table appended to `config.toml` (markers) | Hook wiring — only if no `hooks` key exists |
185
+ | `config/agents-block.toml.tpl` | `[agents]` block appended to `config.toml` (markers) | Registers the four routed roles |
160
186
  | `codex/AGENTS-ULTRACODE.md` | appended to `$CODEX_HOME/AGENTS.md` (markers) | Model/effort routing policy |
161
187
  | `prompts/*.md` | `$CODEX_HOME/prompts/` | `/prompts:*` custom prompts (handoff, etc.) |
188
+ | `agents/*.toml` | `$CODEX_HOME/agents/` | Pinned Luna/Terra/Sol custom subagent roles |
189
+ | `skill/overcodex-ultracode/` | OpenClaw skill root (or packaged payload) | Portable policy, role prompts, and platform adapters |
162
190
 
163
191
  | `shell/zshrc-snippet.sh` | `~/.zshrc` (markers) | `codex-swap` PATH/alias wiring |
164
192
 
@@ -168,6 +196,7 @@ flowchart TD
168
196
  <summary>Maintainer workflow</summary>
169
197
 
170
198
  ```bash
199
+ ./tests/smoke.sh # isolated install/hooks/reinstall/uninstall verification
171
200
  ./sync.sh # live setup -> repo: scrub-gated diff, commit, push
172
201
  ./sync.sh --release # + version bump + GitHub release -> PyPI (trusted publishing)
173
202
  ./sync.sh --dry-run # preview either
@@ -181,6 +210,10 @@ A plain `git push` updates git installs only — **PyPI users get changes only v
181
210
 
182
211
  overcodex is the Codex CLI sibling of **[overclaude](https://github.com/arthur-bump-pm/overclaude)** (same author, same packaging shape) — overclaude does hot account swapping for Claude Code; Codex CLI's credential model only allows a cold switch, so this kit is built around that constraint instead of hiding it.
183
212
 
213
+ ### Hot-swap and the codext fork
214
+
215
+ True hot account switching exists on Codex only via [codext](https://github.com/Loongphy/codext) — an Apache-2.0 hard fork of the Codex CLI that polls `auth.json` and reloads it in-process at idle turn boundaries (verified in its source: `tui/src/auth_watch.rs`, `login/src/auth/manager.rs`). It works, with two trade-offs `codex-swap` deliberately doesn't make: it requires running a single-maintainer fork that rebases onto each upstream release, and it still doesn't solve cross-copy refresh-token rotation — switching back to an account whose token rotated elsewhere can force a re-login (codext issue #1 confirms). `codex-swap` stays cold-but-bulletproof by isolating accounts in separate `CODEX_HOME`s where tokens never move. If OpenAI ships auth live-reload upstream, `codex-swap` grows hot for free.
216
+
184
217
  ## License
185
218
 
186
219
  MIT — see [LICENSE](LICENSE).
@@ -10,8 +10,7 @@
10
10
  codex-swap work # register/list accounts, then switch — restart required
11
11
  /prompts:handoff # package this session's state, resume fresh next launch
12
12
 
13
- ctx [████░░░░░░] 42% remaining | 5h limit 71% | weekly limit 18%
14
- └ get_context_remaining └ native Codex statusline items
13
+ native footer: model with reasoning | current directory | project name | context remaining | 5h limit | weekly limit
15
14
  ```
16
15
 
17
16
  ## Install
@@ -30,7 +29,13 @@ codex-swap add personal # then log in to each: CODEX_HOME=~/.codex-accounts/w
30
29
  codex-swap work # cold switch: writes auth.json, then restart codex
31
30
  ```
32
31
 
33
- Start a **new** Codex CLI session (hooks and AGENTS.md load at session start) and confirm the statusline shows the context/limit meters. Run `/prompts:handoff` inside Codex to hand off before you hit auto-compact.
32
+ Start a **new** Codex CLI session (hooks and AGENTS.md load at session start) and confirm its native footer shows the configured fields; Codex may omit unavailable usage-limit fields. Run `/prompts:handoff` inside Codex to hand off before you hit auto-compact.
33
+
34
+ The same routing policy is packaged as a portable skill for OpenClaw. Install it from a packaged overcodex build with `openclaw skills install "$(overcodex skill-path)" --global`, then configure the four role agent IDs described in `skill/overcodex-ultracode/references/openclaw-adapter.md`.
35
+
36
+ For agent-assisted setup, tell OpenClaw:
37
+
38
+ > Install and activate Overcodex UltraCode. Run `curl -fsSL https://raw.githubusercontent.com/arthur-bump-pm/overcodex/main/install-openclaw.sh | bash`, verify it with `openclaw skills list` and `openclaw agents list`, then configure the scout, worker, reviewer, and judge roles. Do not change credentials or existing agent settings without showing me the proposed diff first.
34
39
 
35
40
  <details>
36
41
  <summary>Other install methods, requirements, upgrading</summary>
@@ -66,7 +71,7 @@ Each account gets its own isolated `CODEX_HOME` (a separate `auth.json`, never a
66
71
 
67
72
  ```mermaid
68
73
  flowchart LR
69
- A[Context fills up] --> B[get_context_remaining / statusline flags it]
74
+ A[Context fills up] --> B[Native footer shows context remaining]
70
75
  B --> C[You run /prompts:handoff]
71
76
  C --> D[Codex packages goals, state, next steps]
72
77
  D --> E[Session ends]
@@ -78,13 +83,29 @@ flowchart LR
78
83
  You lose the token bloat, not the thread. Combine with a `codex-swap` restart when you're also switching accounts.
79
84
 
80
85
  ### Statusline
81
- Codex's native statusline already covers the meters — run `/statusline` inside Codex and enable the context, five-hour, and weekly items (or set `tui.status_line` in config.toml yourself). The kit deliberately ships no statusline config: the native picker is authoritative, and the exact config-key vocabulary is undocumented — nothing to clobber, nothing to break.
86
+ The kit ships conservative defaults for Codex's native footer, in this order: `model-with-reasoning`, `current-dir`, `project-name`, `context-remaining`, `five-hour-limit`, and `weekly-limit`, with colors enabled. Codex renders these native fields and may omit usage-limit fields that are unavailable. Installation adds the defaults only when you do not already have `tui.status_line`; an existing user setting is preserved. Start a new Codex CLI session after installation for the footer to reload.
87
+
88
+ OverCodex hooks use rollout data separately to issue handoff warnings as context fills. They cannot inject a custom statusline command or replace Codex's native footer.
89
+
90
+ ### AGENTS.md routing policy + custom agents
91
+ A policy block appended to `$CODEX_HOME/AGENTS.md` (loaded globally, then project `AGENTS.md` files concatenate root-down) tells Codex when to delegate and enforces read-parallel/write-serial coordination, verification floors, escalation, and final synthesis. Four custom-agent definitions under `$CODEX_HOME/agents/`, registered in `[agents]`, pin bulk scouting to Luna, implementation to Terra, review to Sol/high, and adjudication to Sol/xhigh. Routed dispatches use an explicit `agent_type` and `fork_turns = "none"`; a task name alone does not route models.
92
+
93
+ For an explicit trigger inside Codex, run `/prompts:ultracode` and include the objective. For qualifying complex tasks, the global policy also defaults to delegation and requires the parent to explain any decision to stay serial.
94
+
95
+ When Codex opens this GitHub checkout, the root `AGENTS.md` supplies the repository-local instruction layer. Prompt it with `Activate Overcodex UltraCode in this repository` to have it inspect the global marker and run `./install.sh` when activation is requested. For OpenClaw, prompt it to run `./install-openclaw.sh`; the portable `SKILL.md` then supplies the same orchestration policy.
82
96
 
83
- ### AGENTS.md routing policy
84
- A policy block appended to `$CODEX_HOME/AGENTS.md` (loaded globally, then project `AGENTS.md` files concatenate root-down): bulk work rides cheap models/effort, verification rides a stronger reasoning tier, only final judgment spends the top tier. Routing table, hard floors, escalation rules included.
97
+ The detailed agent-facing activation contract is in [`AGENT-SETUP.md`](AGENT-SETUP.md). Short prompts are enough because the repository's `AGENTS.md` directs the agent to read that contract:
98
+
99
+ **Codex:** `Activate Overcodex UltraCode for Codex from https://github.com/arthur-bump-pm/overcodex. Clone it if needed, follow AGENT-SETUP.md, preserve unrelated settings, verify the roles and smoke test, then report the restart step.`
100
+
101
+ **OpenClaw:** `Activate Overcodex UltraCode for OpenClaw from https://github.com/arthur-bump-pm/overcodex. Clone it if needed, follow AGENT-SETUP.md, show configuration diffs before applying them, verify the skill and agents, then run a harmless scout check.`
102
+
103
+ The complete copy-paste versions are in [`overcodex-instructions.md`](overcodex-instructions.md).
104
+
105
+ For full proactive orchestration, select a supported Codex reasoning effort in the model controls. GPT-5.5 supports `none`, `low`, `medium`, `high`, and `xhigh`; GPT-5.6 Sol/Terra/Luna also support `max`. The bundled judge uses portable `xhigh`; use `max` only for a GPT-5.6 quality-critical adjudication. `ultra` is not a Codex effort value. Installing Overcodex does not silently replace your existing model or effort preference.
85
106
 
86
107
  ### Hooks + prompts
87
- `PreToolUse`/`PostToolUse`/`SessionStart`/`Stop` hooks wired via an inline `[hooks]` table in `config.toml`, plus `/prompts:*` markdown prompts under `$CODEX_HOME/prompts/` (YAML frontmatter, `$1`-`$9` placeholders) for the handoff flow and other repeatable operations.
108
+ `SessionStart`/`UserPromptSubmit`/`Stop`/`PreCompact` hooks wired via an inline `[hooks]` table in `config.toml`, plus `/prompts:*` markdown prompts under `$CODEX_HOME/prompts/` (YAML frontmatter, `$1`-`$9` placeholders) for the handoff flow and other repeatable operations.
88
109
 
89
110
  ## Cheat sheet
90
111
 
@@ -97,6 +118,8 @@ A policy block appended to `$CODEX_HOME/AGENTS.md` (loaded globally, then projec
97
118
  | `overcodex install` | (Re)install/refresh the kit — idempotent |
98
119
  | `overcodex uninstall` | Remove exactly what install added |
99
120
  | `overcodex path` | Print the bundled payload directory |
121
+ | `overcodex skill-path` | Print the portable OpenClaw/Codex skill directory |
122
+ | `install-openclaw.sh` | Install the packaged skill into OpenClaw |
100
123
 
101
124
  Or skip memorizing and **paste a prompt**:
102
125
 
@@ -115,7 +138,9 @@ flowchart TD
115
138
  HK --> PR[/prompts:handoff and friends]
116
139
  PR --> CS[codex-swap: isolated CODEX_HOME per account]
117
140
  CS --> RS[Cold restart adopts the new account]
118
- SL[Statusline: get_context_remaining + native limit items] --> HK
141
+ SL[Native footer: context-remaining + available usage limits] --> PR
142
+ HK --> RW[Hooks read rollout data for handoff warnings]
143
+ RW --> PR
119
144
  ```
120
145
 
121
146
  <details>
@@ -137,8 +162,11 @@ flowchart TD
137
162
  | `bin/codex-swap` | `~/.local/bin/` | Cold account switcher: register, list, point `$CODEX_HOME` at an account |
138
163
  | `hooks/*.sh` | `$CODEX_HOME/hooks/` | SessionStart / UserPromptSubmit / Stop handlers |
139
164
  | `config/hooks-block.toml.tpl` | inline `[hooks]` table appended to `config.toml` (markers) | Hook wiring — only if no `hooks` key exists |
165
+ | `config/agents-block.toml.tpl` | `[agents]` block appended to `config.toml` (markers) | Registers the four routed roles |
140
166
  | `codex/AGENTS-ULTRACODE.md` | appended to `$CODEX_HOME/AGENTS.md` (markers) | Model/effort routing policy |
141
167
  | `prompts/*.md` | `$CODEX_HOME/prompts/` | `/prompts:*` custom prompts (handoff, etc.) |
168
+ | `agents/*.toml` | `$CODEX_HOME/agents/` | Pinned Luna/Terra/Sol custom subagent roles |
169
+ | `skill/overcodex-ultracode/` | OpenClaw skill root (or packaged payload) | Portable policy, role prompts, and platform adapters |
142
170
 
143
171
  | `shell/zshrc-snippet.sh` | `~/.zshrc` (markers) | `codex-swap` PATH/alias wiring |
144
172
 
@@ -148,6 +176,7 @@ flowchart TD
148
176
  <summary>Maintainer workflow</summary>
149
177
 
150
178
  ```bash
179
+ ./tests/smoke.sh # isolated install/hooks/reinstall/uninstall verification
151
180
  ./sync.sh # live setup -> repo: scrub-gated diff, commit, push
152
181
  ./sync.sh --release # + version bump + GitHub release -> PyPI (trusted publishing)
153
182
  ./sync.sh --dry-run # preview either
@@ -161,6 +190,10 @@ A plain `git push` updates git installs only — **PyPI users get changes only v
161
190
 
162
191
  overcodex is the Codex CLI sibling of **[overclaude](https://github.com/arthur-bump-pm/overclaude)** (same author, same packaging shape) — overclaude does hot account swapping for Claude Code; Codex CLI's credential model only allows a cold switch, so this kit is built around that constraint instead of hiding it.
163
192
 
193
+ ### Hot-swap and the codext fork
194
+
195
+ True hot account switching exists on Codex only via [codext](https://github.com/Loongphy/codext) — an Apache-2.0 hard fork of the Codex CLI that polls `auth.json` and reloads it in-process at idle turn boundaries (verified in its source: `tui/src/auth_watch.rs`, `login/src/auth/manager.rs`). It works, with two trade-offs `codex-swap` deliberately doesn't make: it requires running a single-maintainer fork that rebases onto each upstream release, and it still doesn't solve cross-copy refresh-token rotation — switching back to an account whose token rotated elsewhere can force a re-login (codext issue #1 confirms). `codex-swap` stays cold-but-bulletproof by isolating accounts in separate `CODEX_HOME`s where tokens never move. If OpenAI ships auth live-reload upstream, `codex-swap` grows hot for free.
196
+
164
197
  ## License
165
198
 
166
199
  MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,11 @@
1
+ name = "judge-sol-xhigh"
2
+ description = "Read-only adjudicator for contradictory reviews and subtle high-risk correctness decisions."
3
+ developer_instructions = """
4
+ Adjudicate only the stated dispute using primary evidence and objective checks.
5
+ Do not edit files. Re-read the relevant artifact instead of inheriting another agent's conclusion.
6
+ Return verdict, confidence from 0 to 1, decisive evidence, rejected alternatives, and residual risk.
7
+ Use this role only when a cheaper reviewer cannot resolve a consequential ambiguity.
8
+ """
9
+ model = "gpt-5.6-sol"
10
+ model_reasoning_effort = "xhigh"
11
+ sandbox_mode = "read-only"
@@ -0,0 +1,11 @@
1
+ name = "reviewer-sol-high"
2
+ description = "Independent read-only reviewer for correctness, security, regressions, and missing tests."
3
+ developer_instructions = """
4
+ Review the assigned artifact independently. Do not edit files and do not trust the generator's conclusion.
5
+ Prioritize behavioral bugs, security issues, regressions, and missing validation over style.
6
+ Run objective read-only checks when available. Return verdict, confidence from 0 to 1, and evidence with file references.
7
+ State remaining test gaps even when the verdict is PASS.
8
+ """
9
+ model = "gpt-5.6-sol"
10
+ model_reasoning_effort = "high"
11
+ sandbox_mode = "read-only"
@@ -0,0 +1,11 @@
1
+ name = "scout-luna-low"
2
+ description = "Fast read-only scout for file discovery, inventories, and fixed-schema extraction."
3
+ developer_instructions = """
4
+ Explore only the assigned scope. Do not edit files.
5
+ Return concise findings with exact file paths or other concrete evidence.
6
+ Separate verified facts from inference and identify anything you could not inspect.
7
+ Follow the output contract from the parent prompt exactly.
8
+ """
9
+ model = "gpt-5.6-luna"
10
+ model_reasoning_effort = "low"
11
+ sandbox_mode = "read-only"
@@ -0,0 +1,11 @@
1
+ name = "worker-terra-medium"
2
+ description = "Implementation worker for a bounded change with explicit, non-overlapping file ownership."
3
+ developer_instructions = """
4
+ Implement only the assigned objective and paths. Do not broaden scope.
5
+ Inspect existing conventions before editing, preserve unrelated user changes, and run the requested focused checks.
6
+ Report files changed, checks run, results, and any residual risk.
7
+ If ownership overlaps another worker or the contract is ambiguous, stop and report the conflict before editing.
8
+ """
9
+ model = "gpt-5.6-terra"
10
+ model_reasoning_effort = "medium"
11
+ sandbox_mode = "workspace-write"
@@ -0,0 +1,66 @@
1
+ # --- overcodex ultracode (begin) ---
2
+ # ULTRACODE - Codex multi-agent routing policy
3
+
4
+ ## When to delegate
5
+ For a complex task with at least two independent, useful work streams, use subagents proactively by default. Good candidates are read-heavy exploration, independent verification, test/log analysis, and clearly partitioned implementation. A qualifying task should not remain entirely in the parent unless the parent records a concrete reason: no independent stream, unsafe shared writes, unavailable role/model, or coordination cost greater than the expected benefit. Do not spawn agents for a small task or work that is inherently sequential.
6
+
7
+ At the start of every qualifying task, silently perform the UltraCode planning gate below, then tell the user the selected workstreams and roles before dispatching. The parent must either dispatch at least one useful subagent or state the exception that kept the work serial.
8
+
9
+ Keep the main thread focused on requirements, decisions, and final synthesis. Give each subagent a bounded objective, scope, expected output, and verification standard. Wait for all required results before synthesizing.
10
+
11
+ ## Ultra planning gate
12
+ Before spawning, write a short routing plan in the parent context:
13
+
14
+ 1. Decompose the request into atomic workstreams and identify dependencies.
15
+ 2. Classify each stream as `inventory`, `mechanical`, `implementation`, `debugging`, `security`, `architecture`, or `adjudication`.
16
+ 3. Score each stream for ambiguity, blast radius, reversibility, and verification difficulty (low/medium/high).
17
+ 4. Select the lowest-cost model that meets the task's verification floor. Model choice must be justified by task fit, not by a generic preference for the strongest model.
18
+ 5. State ownership, allowed paths, expected artifact, test command, and escalation trigger for every dispatch.
19
+
20
+ Routing guidance:
21
+
22
+ | Task shape | Default model | Upgrade when |
23
+ |---|---|---|
24
+ | Inventory, search, schema extraction | `scout-luna-low` | the result is ambiguous or security-relevant |
25
+ | Mechanical, bounded implementation | `worker-terra-medium` | the change crosses shared contracts or tests are weak |
26
+ | Debugging with a reproducible failure | `worker-terra-medium` then `reviewer-sol-high` | the cause is nondeterministic or high blast radius |
27
+ | Security, auth, concurrency, migrations, destructive operations | `reviewer-sol-high` | evidence conflicts or the decision is subtle |
28
+ | Architecture tradeoff or disputed review | `judge-sol-xhigh` | only after independent evidence exists |
29
+
30
+ Do not use `judge-sol-xhigh` as a default worker. Do not send implementation to a read-only role. If no role meets the floor, stop and say what capability or model is missing rather than silently downgrading.
31
+
32
+ ## Installed roles
33
+ Use these exact Codex custom-agent types when their role fits:
34
+
35
+ | Agent | Model / effort | Use for |
36
+ |---|---|---|
37
+ | `scout-luna-low` | Luna / low | File discovery, mechanical inventory, fixed-schema extraction |
38
+ | `worker-terra-medium` | Terra / medium | Well-scoped implementation with explicit ownership |
39
+ | `reviewer-sol-high` | Sol / high | Independent correctness, security, regression, and test review |
40
+ | `judge-sol-xhigh` | Sol / xhigh | Contradiction resolution and subtle terminal verdicts |
41
+
42
+ Codex effort compatibility is model-specific. GPT-5.5 supports `none`, `low`, `medium`, `high`, and `xhigh`. GPT-5.6 Sol/Terra/Luna additionally support `max`. Keep `xhigh` as the portable judge default; select `max` only for a GPT-5.6 task whose quality requirement justifies extra cost and latency. Never write `ultra` as a Codex `model_reasoning_effort` value.
43
+
44
+ Use the parent Sol session for final synthesis. A high or xhigh parent effort may orchestrate proactively, but it does not remove the need for explicit role and scope selection.
45
+
46
+ When dispatching one of these roles, the `spawn_agent` call MUST set `agent_type` to the exact name above and `fork_turns` to `"none"`. Put all required task context in the child message. `task_name` is only a label and does not select a model; omitting `agent_type` silently inherits the parent model, while a full-history fork rejects role/model overrides.
47
+
48
+ ## Coordination rules
49
+ - Read-heavy work may run in parallel. Write-heavy work is serial by default.
50
+ - Never let two agents edit the same files concurrently. If parallel writes are justified, partition ownership by non-overlapping paths and say so in every worker prompt.
51
+ - Run objective checks such as tests, typecheck, lint, or numeric validation before spending a reviewer agent. A passing deterministic check outranks an LLM opinion.
52
+ - Verification must be independent: give the reviewer the artifact, requirements, and evidence, not the generator's conclusion.
53
+ - Every reviewer returns `verdict`, `confidence`, and `evidence`. Missing fields, confidence below 0.7, `UNSURE`, or contradictory results trigger one escalation to the next stronger role.
54
+ - Use panels only for high-risk fuzzy judgments. Give 2-3 reviewers distinct lenses; unanimous results may pass, while a split goes to `judge-sol-xhigh` rather than majority vote.
55
+ - Stop escalating when more than one quarter of downgraded stages require escalation. Re-plan the routing instead of silently moving every task to Sol.
56
+ - Reduce fan-out before lowering verification quality. The default `agents.max_depth = 1` is appropriate unless the user explicitly requests recursive delegation.
57
+
58
+ ## Floors
59
+ - User-visible final synthesis with no downstream check: parent Sol session.
60
+ - Security, auth, concurrency, money math, destructive operations, and migrations: `reviewer-sol-high` minimum.
61
+ - A subtle disputed verdict: `judge-sol-xhigh`.
62
+ - Bulk or repetitive work stays on Luna or Terra even when the parent runs at high or xhigh effort.
63
+
64
+ ## Dispatch lint
65
+ Before spawning, confirm that each agent adds new information or independent verification; has an objective, path or topic boundary, and output contract; uses the lowest role that meets its floor; and cannot race another writer. If those conditions are not met, keep the work in the main thread.
66
+ # --- overcodex ultracode (end) ---
@@ -0,0 +1,22 @@
1
+ # overcodex custom-agent registration. install.sh substitutes @AGENTS_DIR@.
2
+ # `task_name` only labels a child; routing requires agent_type plus a non-full
3
+ # history fork. AGENTS-ULTRACODE.md carries that dispatch contract.
4
+ [agents]
5
+ max_threads = 4
6
+ max_depth = 1
7
+
8
+ [agents.scout-luna-low]
9
+ description = "Fast read-only scout for discovery, inventory, and extraction."
10
+ config_file = "@AGENTS_DIR@/scout-luna-low.toml"
11
+
12
+ [agents.worker-terra-medium]
13
+ description = "Bounded implementation worker with explicit file ownership."
14
+ config_file = "@AGENTS_DIR@/worker-terra-medium.toml"
15
+
16
+ [agents.reviewer-sol-high]
17
+ description = "Independent correctness, security, regression, and test reviewer."
18
+ config_file = "@AGENTS_DIR@/reviewer-sol-high.toml"
19
+
20
+ [agents.judge-sol-xhigh]
21
+ description = "Adjudicator for contradictory or subtle high-risk verdicts."
22
+ config_file = "@AGENTS_DIR@/judge-sol-xhigh.toml"
@@ -0,0 +1,3 @@
1
+ [tui]
2
+ status_line = ["model-with-reasoning", "current-dir", "project-name", "context-remaining", "five-hour-limit", "weekly-limit"]
3
+ status_line_use_colors = true
@@ -24,12 +24,10 @@
24
24
  # "last_token_usage":{...},
25
25
  # "model_context_window":W},
26
26
  # "rate_limits":{...}}}
27
- # total_tokens / model_context_window * 100, taken from the LAST such line, is
28
- # used as the context-usage percentage everywhere below. This is a real
29
- # measurement (not a heuristic) but its recency depends on how often Codex
30
- # emits token_count events — needs live-session validation (see hooks-test
31
- # notes) to confirm the cadence is tight enough for the 60/75/85 thresholds to
32
- # feel timely rather than lagging.
27
+ # last_token_usage.total_tokens / model_context_window * 100, taken from the
28
+ # LAST such line, is used as the context-usage percentage everywhere below.
29
+ # `total_token_usage` is cumulative billing usage across turns and can exceed
30
+ # the context window many times over, so it must never drive these thresholds.
33
31
  #
34
32
  # Contract: ctx_pct_from_transcript prints an integer 0-100 on stdout and
35
33
  # returns 0 on success; on ANY failure (no file, no jq, malformed, division by
@@ -55,7 +53,7 @@ ctx_pct_from_transcript() {
55
53
  fi
56
54
  [ -n "$line" ] || return 1
57
55
 
58
- total="$(printf '%s' "$line" | jq -r '.payload.info.total_token_usage.total_tokens // empty' 2>/dev/null)"
56
+ total="$(printf '%s' "$line" | jq -r '.payload.info.last_token_usage.total_tokens // empty' 2>/dev/null)"
59
57
  window="$(printf '%s' "$line" | jq -r '.payload.info.model_context_window // empty' 2>/dev/null)"
60
58
  [ -n "$total" ] && [ -n "$window" ] || return 1
61
59
  case "$total" in ''|*[!0-9]*) return 1 ;; esac
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ repo_url="https://github.com/arthur-bump-pm/overcodex.git"
5
+
6
+ if ! command -v openclaw >/dev/null 2>&1; then
7
+ echo "install-openclaw: openclaw is required and was not found" >&2
8
+ exit 1
9
+ fi
10
+
11
+ if ! command -v overcodex >/dev/null 2>&1; then
12
+ if ! command -v pipx >/dev/null 2>&1; then
13
+ echo "install-openclaw: install pipx or overcodex first" >&2
14
+ exit 1
15
+ fi
16
+ pipx install "git+${repo_url}"
17
+ fi
18
+
19
+ skill_path="$(overcodex skill-path)"
20
+ openclaw skills install "$skill_path" --global
21
+
22
+ echo "Overcodex UltraCode is installed in OpenClaw."
23
+ echo "Next: ask OpenClaw to run 'openclaw skills list' and 'openclaw agents list',"
24
+ echo "then configure scout, worker, reviewer, and judge agent IDs."
@@ -25,6 +25,7 @@ AGENTS_MD="$CODEX_HOME/AGENTS.md"
25
25
  # Kit sources.
26
26
  SRC_SWAP="$SCRIPT_DIR/bin/codex-swap"
27
27
  SRC_HOOKS_TPL="$SCRIPT_DIR/config/hooks-block.toml.tpl"
28
+ SRC_AGENT_ROLES_TPL="$SCRIPT_DIR/config/agents-block.toml.tpl"
28
29
  SRC_AGENTS="$SCRIPT_DIR/codex/AGENTS-ULTRACODE.md"
29
30
  SRC_ZSNIPPET="$SCRIPT_DIR/shell/zshrc-snippet.sh"
30
31
 
@@ -41,6 +42,8 @@ ZSH_BEGIN='# --- overcodex integration (begin) ---'
41
42
  ZSH_END='# --- overcodex integration (end) ---'
42
43
  HOOKS_BEGIN='# --- overcodex hooks (begin) ---'
43
44
  HOOKS_END='# --- overcodex hooks (end) ---'
45
+ AGENT_ROLES_BEGIN='# --- overcodex agent roles (begin) ---'
46
+ AGENT_ROLES_END='# --- overcodex agent roles (end) ---'
44
47
  SL_BEGIN='# --- overcodex statusline (begin) ---'
45
48
  SL_END='# --- overcodex statusline (end) ---'
46
49
 
@@ -64,7 +67,7 @@ echo
64
67
  # ---------------------------------------------------------------------------
65
68
  # 0. Sanity: required kit files present.
66
69
  # ---------------------------------------------------------------------------
67
- for f in "$SRC_SWAP" "$SRC_HOOKS_TPL" "$SRC_AGENTS" "$SRC_ZSNIPPET"; do
70
+ for f in "$SRC_SWAP" "$SRC_HOOKS_TPL" "$SRC_AGENT_ROLES_TPL" "$SRC_AGENTS" "$SRC_ZSNIPPET"; do
68
71
  [ -f "$f" ] || die "kit file missing: $f (run from the repo root)"
69
72
  done
70
73
  # At least one hook script.
@@ -176,17 +179,29 @@ if [ -n "$PROMPTS" ]; then
176
179
  else
177
180
  note_skip "no prompts/*.md in kit (nothing to install)"
178
181
  fi
182
+
183
+ # agents/*.toml -> $CODEX_HOME/agents/ (optional custom subagent roles)
184
+ AGENT_FILES=$(ls "$SCRIPT_DIR"/agents/*.toml 2>/dev/null)
185
+ if [ -n "$AGENT_FILES" ]; then
186
+ mkdir -p "$CODEX_HOME/agents" || die "mkdir failed: $CODEX_HOME/agents"
187
+ for a in "$SCRIPT_DIR"/agents/*.toml; do
188
+ [ -f "$a" ] || continue
189
+ install_file "$a" "$CODEX_HOME/agents/$(basename "$a")" -
190
+ done
191
+ else
192
+ note_warn "no agents/*.toml in kit — routing policy will be advisory only"
193
+ fi
179
194
  echo
180
195
 
181
196
  # ---------------------------------------------------------------------------
182
- # 3. config.toml — add the inline [hooks] table and [tui].status_line IF ABSENT.
183
- # Never rewrites the file: python3+tomllib decides presence; the hooks block
184
- # is APPENDED at EOF between markers (a [hooks] table prepended at the top
185
- # would capture every top-level key after it); status_line is a [tui] insert.
197
+ # 3. config.toml — add [hooks], [agents], and [tui].status_line IF ABSENT.
198
+ # Never rewrites unrelated settings: python3+tomllib decides presence; new
199
+ # table blocks are appended at EOF between markers and status_line is a
200
+ # targeted [tui] insert.
186
201
  # ---------------------------------------------------------------------------
187
202
  echo "-- config.toml --"
188
203
 
189
- # toml_present <config> -> prints "hooks=present|absent" and "sl=present|absent"
204
+ # toml_present <config> -> prints hooks/agents/status_line/status_line_use_colors presence
190
205
  # on stdout. Exits 3 on a parse error (caller then leaves the file untouched).
191
206
  toml_present() {
192
207
  tp_cfg="$1"
@@ -205,18 +220,24 @@ except Exception as e:
205
220
  tui = d.get("tui")
206
221
  tui = tui if isinstance(tui, dict) else {}
207
222
  print("hooks=%s" % ("present" if "hooks" in d else "absent"))
223
+ print("agents=%s" % ("present" if "agents" in d else "absent"))
208
224
  print("sl=%s" % ("present" if "status_line" in tui else "absent"))
225
+ print("sl_colors=%s" % ("present" if "status_line_use_colors" in tui else "absent"))
209
226
  PY
210
227
  return $?
211
228
  fi
212
229
  # grep fallback (heuristic: matches a top-level-looking key line).
213
230
  if [ -f "$tp_cfg" ]; then
214
- if grep -Eq '^[[:space:]]*hooks[[:space:]]*=' "$tp_cfg"; then
231
+ if grep -Eq '^[[:space:]]*(hooks[[:space:]]*=|\[hooks\])' "$tp_cfg"; then
215
232
  echo "hooks=present"; else echo "hooks=absent"; fi
233
+ if grep -Eq '^[[:space:]]*(agents[[:space:]]*=|\[agents\])' "$tp_cfg"; then
234
+ echo "agents=present"; else echo "agents=absent"; fi
216
235
  if grep -Eq '^[[:space:]]*status_line[[:space:]]*=' "$tp_cfg"; then
217
236
  echo "sl=present"; else echo "sl=absent"; fi
237
+ if grep -Eq '^[[:space:]]*status_line_use_colors[[:space:]]*=' "$tp_cfg"; then
238
+ echo "sl_colors=present"; else echo "sl_colors=absent"; fi
218
239
  else
219
- echo "hooks=absent"; echo "sl=absent"
240
+ echo "hooks=absent"; echo "agents=absent"; echo "sl=absent"; echo "sl_colors=absent"
220
241
  fi
221
242
  return 0
222
243
  }
@@ -226,16 +247,21 @@ DET=$(toml_present "$CONFIG_TOML")
226
247
  if [ $? -eq 3 ]; then
227
248
  CFG_OK=0
228
249
  note_warn "config.toml is not valid TOML; leaving it completely untouched."
229
- note_warn " Fix $CONFIG_TOML, then re-run ./install.sh to wire hooks/status_line."
250
+ note_warn " Fix $CONFIG_TOML, then re-run ./install.sh to wire hooks/agents/status_line."
230
251
  fi
231
252
 
232
253
  if [ "$CFG_OK" = 1 ]; then
233
254
  HOOKS_STATE=$(printf '%s\n' "$DET" | sed -n 's/^hooks=//p')
255
+ AGENTS_STATE=$(printf '%s\n' "$DET" | sed -n 's/^agents=//p')
234
256
  SL_STATE=$(printf '%s\n' "$DET" | sed -n 's/^sl=//p')
257
+ SL_COLORS_STATE=$(printf '%s\n' "$DET" | sed -n 's/^sl_colors=//p')
235
258
 
236
259
  NEED_HOOKS=0
237
260
  [ "$HOOKS_STATE" = absent ] && NEED_HOOKS=1
238
261
 
262
+ NEED_AGENT_ROLES=0
263
+ [ "$AGENTS_STATE" = absent ] && NEED_AGENT_ROLES=1
264
+
239
265
  NEED_SL=0
240
266
  if [ "$SL_STATE" = absent ]; then
241
267
  if [ -n "$SRC_STATUSLINE" ]; then
@@ -255,6 +281,15 @@ if [ "$CFG_OK" = 1 ]; then
255
281
  note_warn " manually (substitute @HOOKS_DIR@ with $CODEX_HOME/hooks)."
256
282
  fi
257
283
  fi
284
+ if [ "$AGENTS_STATE" = present ]; then
285
+ if [ -f "$CONFIG_TOML" ] && grep -qF "$AGENT_ROLES_BEGIN" "$CONFIG_TOML"; then
286
+ note_skip "config.toml custom agent roles already wired by overcodex"
287
+ else
288
+ note_warn "config.toml already defines an 'agents' key — leaving it untouched."
289
+ note_warn " Merge the roles from config/agents-block.toml.tpl into your [agents] table"
290
+ note_warn " manually (substitute @AGENTS_DIR@ with $CODEX_HOME/agents)."
291
+ fi
292
+ fi
258
293
  if [ "$SL_STATE" = present ]; then
259
294
  if [ -f "$CONFIG_TOML" ] && grep -qF "$SL_BEGIN" "$CONFIG_TOML"; then
260
295
  note_skip "config.toml [tui].status_line already set by overcodex"
@@ -263,7 +298,7 @@ if [ "$CFG_OK" = 1 ]; then
263
298
  fi
264
299
  fi
265
300
 
266
- if [ "$NEED_HOOKS" = 1 ] || [ "$NEED_SL" = 1 ]; then
301
+ if [ "$NEED_HOOKS" = 1 ] || [ "$NEED_AGENT_ROLES" = 1 ] || [ "$NEED_SL" = 1 ]; then
267
302
  b=""
268
303
  [ -f "$CONFIG_TOML" ] && b=$(backup_file "$CONFIG_TOML")
269
304
  TMP="$CONFIG_TOML.tmp-$EPOCH"
@@ -287,16 +322,31 @@ if [ "$CFG_OK" = 1 ]; then
287
322
  } >> "$TMP"
288
323
  fi
289
324
 
325
+ # agents: register each installed role. A file under agents/ alone is not
326
+ # enough for reliable spawn_agent(agent_type=...) routing on all surfaces.
327
+ if [ "$NEED_AGENT_ROLES" = 1 ]; then
328
+ if [ -s "$TMP" ]; then
329
+ [ -n "$(tail -c1 "$TMP")" ] && printf '\n' >> "$TMP"
330
+ printf '\n' >> "$TMP"
331
+ fi
332
+ {
333
+ printf '%s\n' "$AGENT_ROLES_BEGIN"
334
+ sed "s|@AGENTS_DIR@|$CODEX_HOME/agents|g" "$SRC_AGENT_ROLES_TPL"
335
+ printf '%s\n' "$AGENT_ROLES_END"
336
+ } >> "$TMP"
337
+ fi
338
+
290
339
  # status_line: insert our keys just after an existing [tui] header, else
291
340
  # append a fresh [tui] table at EOF. Fragment header/comment/blank lines are
292
- # dropped so only the key lines land inside our markers.
341
+ # dropped so only missing key lines land inside our markers.
293
342
  if [ "$NEED_SL" = 1 ]; then
294
343
  TMP2="$CONFIG_TOML.tmp2-$EPOCH"
295
- awk -v sb="$SL_BEGIN" -v se="$SL_END" -v kf="$SRC_STATUSLINE" '
344
+ awk -v sb="$SL_BEGIN" -v se="$SL_END" -v kf="$SRC_STATUSLINE" -v skip_colors="$SL_COLORS_STATE" '
296
345
  function emitkeys( line) {
297
346
  while ((getline line < kf) > 0) {
298
347
  if (line == "" || line == "[tui]") continue
299
348
  if (line ~ /^[ \t]*#/) continue
349
+ if (skip_colors == "present" && line ~ /^[ \t]*status_line_use_colors[ \t]*=/) continue
300
350
  print line
301
351
  }
302
352
  close(kf)
@@ -325,6 +375,7 @@ PY
325
375
  _bmsg=""
326
376
  [ -n "$b" ] && _bmsg=" (backup: $b)"
327
377
  [ "$NEED_HOOKS" = 1 ] && note_did "wired the inline [hooks] table into config.toml$_bmsg"
378
+ [ "$NEED_AGENT_ROLES" = 1 ] && note_did "registered custom [agents] roles in config.toml$_bmsg"
328
379
  [ "$NEED_SL" = 1 ] && note_did "set [tui].status_line in config.toml$_bmsg"
329
380
  else
330
381
  [ "$HOOKS_STATE" = absent ] || [ "$NEED_HOOKS" = 1 ] || true
@@ -335,16 +386,46 @@ echo
335
386
 
336
387
  # ---------------------------------------------------------------------------
337
388
  # append_marked <target> <begin> <end> <src> <label>
338
- # Append a marker-wrapped block only if the begin marker is absent. Any
339
- # pre-existing overcodex marker lines in <src> are stripped so we never nest.
389
+ # Install or refresh a marker-wrapped block. Any pre-existing overcodex
390
+ # marker lines in <src> are stripped so we never nest. Existing blocks are
391
+ # replaced on change, which makes upgrades refresh policy text safely.
340
392
  # ---------------------------------------------------------------------------
341
393
  append_marked() {
342
394
  am_target="$1"; am_begin="$2"; am_end="$3"; am_src="$4"; am_label="$5"
395
+ mkdir -p "$(dirname "$am_target")" || die "mkdir failed for $am_target"
396
+ am_block="$am_target.block-$EPOCH-$$"
397
+ {
398
+ printf '%s\n' "$am_begin"
399
+ grep -vxF "$am_begin" "$am_src" | grep -vxF "$am_end"
400
+ printf '%s\n' "$am_end"
401
+ } > "$am_block" || die "could not stage $am_label"
402
+
343
403
  if [ -f "$am_target" ] && grep -qF "$am_begin" "$am_target"; then
344
- note_skip "$am_label already present in $am_target"
404
+ grep -qF "$am_end" "$am_target" || { rm -f "$am_block"; die "$am_label begin marker exists without end marker in $am_target"; }
405
+ am_tmp="$am_target.tmp-$EPOCH-$$"
406
+ awk -v b="$am_begin" -v e="$am_end" -v repl="$am_block" '
407
+ $0 == b {
408
+ while ((getline line < repl) > 0) print line
409
+ close(repl); replacing = 1; next
410
+ }
411
+ replacing == 1 { if ($0 == e) replacing = 0; next }
412
+ { print }
413
+ ' "$am_target" > "$am_tmp" || { rm -f "$am_block" "$am_tmp"; die "could not refresh $am_label"; }
414
+ rm -f "$am_block"
415
+ if cmp -s "$am_target" "$am_tmp"; then
416
+ rm -f "$am_tmp"
417
+ note_skip "$am_label already up-to-date in $am_target"
418
+ return 0
419
+ fi
420
+ b=$(backup_file "$am_target")
421
+ mv "$am_tmp" "$am_target" || die "could not refresh $am_label in $am_target"
422
+ note_did "refreshed $am_label in $am_target (backup: $b)"
345
423
  return 0
346
424
  fi
347
- mkdir -p "$(dirname "$am_target")" || die "mkdir failed for $am_target"
425
+ if [ -f "$am_target" ] && grep -qF "$am_end" "$am_target"; then
426
+ rm -f "$am_block"
427
+ die "$am_label end marker exists without begin marker in $am_target"
428
+ fi
348
429
  b=""
349
430
  [ -f "$am_target" ] && b=$(backup_file "$am_target")
350
431
  # Separator blank line before our block when the file has content.
@@ -352,12 +433,8 @@ append_marked() {
352
433
  [ -n "$(tail -c1 "$am_target")" ] && printf '\n' >> "$am_target"
353
434
  printf '\n' >> "$am_target"
354
435
  fi
355
- {
356
- printf '%s\n' "$am_begin"
357
- # Drop any stray marker lines already in the source to avoid nesting.
358
- grep -vxF "$am_begin" "$am_src" | grep -vxF "$am_end"
359
- printf '%s\n' "$am_end"
360
- } >> "$am_target" || die "could not append to $am_target"
436
+ cat "$am_block" >> "$am_target" || { rm -f "$am_block"; die "could not append to $am_target"; }
437
+ rm -f "$am_block"
361
438
  if [ -n "$b" ]; then
362
439
  note_did "appended $am_label to $am_target (backup: $b)"
363
440
  else
@@ -366,7 +443,7 @@ append_marked() {
366
443
  }
367
444
 
368
445
  # ---------------------------------------------------------------------------
369
- # 4. AGENTS.md — append the ultracode block between markers (if absent).
446
+ # 4. AGENTS.md — install or refresh the ultracode block between markers.
370
447
  # ---------------------------------------------------------------------------
371
448
  echo "-- AGENTS.md --"
372
449
  append_marked "$AGENTS_MD" "$AGENTS_BEGIN" "$AGENTS_END" "$SRC_AGENTS" "overcodex ultracode block"
@@ -411,9 +488,28 @@ with open(sys.argv[1], "rb") as f:
411
488
  sys.exit(0 if "hooks" in d else 1)
412
489
  PY
413
490
  then HOOKS_WIRED=yes; fi
414
- elif [ -f "$CONFIG_TOML" ] && grep -Eq '^[[:space:]]*hooks[[:space:]]*=' "$CONFIG_TOML"; then
491
+ elif [ -f "$CONFIG_TOML" ] && grep -Eq '^[[:space:]]*(hooks[[:space:]]*=|\[hooks\])' "$CONFIG_TOML"; then
415
492
  HOOKS_WIRED=yes
416
493
  fi
494
+
495
+ # custom agent roles registered.
496
+ AGENT_ROLES_WIRED=no
497
+ if [ -n "$PYTHON" ] && [ -f "$CONFIG_TOML" ]; then
498
+ if "$PYTHON" - "$CONFIG_TOML" <<'PY' >/dev/null 2>&1
499
+ import sys, tomllib
500
+ with open(sys.argv[1], "rb") as f:
501
+ d = tomllib.load(f)
502
+ agents = d.get("agents", {})
503
+ required = {"scout-luna-low", "worker-terra-medium", "reviewer-sol-high", "judge-sol-xhigh"}
504
+ sys.exit(0 if required.issubset(agents) else 1)
505
+ PY
506
+ then AGENT_ROLES_WIRED=yes; fi
507
+ fi
508
+ if [ "$AGENT_ROLES_WIRED" = yes ]; then
509
+ echo " [ok] config.toml custom agent roles registered"
510
+ else
511
+ note_warn "config.toml does not register every overcodex agent role — model routing will be advisory."
512
+ fi
417
513
  if [ "$HOOKS_WIRED" = yes ]; then
418
514
  echo " [ok] config.toml hooks key wired"
419
515
  else
@@ -0,0 +1,17 @@
1
+ ---
2
+ description: "Plan and execute a complex task with Codex subagents, model-aware routing, and independent verification."
3
+ argument-hint: "[task or objective]"
4
+ ---
5
+
6
+ # /prompts:ultracode — explicit Codex multi-agent execution
7
+
8
+ Use the Codex-native UltraCode policy in `$CODEX_HOME/AGENTS.md`.
9
+
10
+ 1. Restate the requested objective and split it into independent workstreams.
11
+ 2. Classify each stream and choose the best registered Codex role/model/effort for it. Use the exact `agent_type` and `fork_turns = "none"` fields when spawning.
12
+ 3. Before writing, announce the plan: workstream, owner, allowed paths, expected output, verification command, and escalation trigger.
13
+ 4. Dispatch read-only scouts in parallel. Serialize workers that could touch overlapping paths.
14
+ 5. Run objective checks before review. Use `reviewer-sol-high` for independent review and `judge-sol-xhigh` only for unresolved or high-risk disputes.
15
+ 6. Synthesize the results in the parent session. Report which agents ran, what they contributed, model/effort selected, checks run, and residual risk.
16
+
17
+ If the task is too small or inherently sequential, do it in the parent and explicitly state why delegation would not add value.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "overcodex"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Codex CLI, overclocked — cold multi-account switching, context-threshold handoff, instrumented statusline, and AGENTS.md routing policy for multi-agent workflows"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -40,9 +40,12 @@ packages = ["src/overcodex"]
40
40
  "config" = "overcodex/payload/config"
41
41
  "codex" = "overcodex/payload/codex"
42
42
  "prompts" = "overcodex/payload/prompts"
43
+ "agents" = "overcodex/payload/agents"
43
44
  "shell" = "overcodex/payload/shell"
45
+ "skill" = "overcodex/payload/skill"
44
46
  "install.sh" = "overcodex/payload/install.sh"
45
47
  "uninstall.sh" = "overcodex/payload/uninstall.sh"
48
+ "install-openclaw.sh" = "overcodex/payload/install-openclaw.sh"
46
49
 
47
50
  # hatchling's default sdist build respects VCS-ignore files and otherwise
48
51
  # only guarantees the `src/` package tree; it does NOT guarantee the payload
@@ -60,9 +63,12 @@ include = [
60
63
  "/config",
61
64
  "/codex",
62
65
  "/prompts",
66
+ "/agents",
63
67
  "/shell",
68
+ "/skill",
64
69
  "/install.sh",
65
70
  "/uninstall.sh",
71
+ "/install-openclaw.sh",
66
72
  "/README.md",
67
73
  "/LICENSE",
68
74
  "/pyproject.toml",
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: overcodex-ultracode
3
+ description: Coordinate complex engineering work with explicit scout, worker, reviewer, and judge roles, portable across Codex and OpenClaw.
4
+ ---
5
+
6
+ # Overcodex UltraCode
7
+
8
+ Use this skill for complex, cross-file, risky, or explicitly multi-agent work. Keep small, local edits in the current session. The main session owns requirements, decisions, integration, and the final answer.
9
+
10
+ ## Roles
11
+
12
+ - **scout-luna-low**: fast, read-only reconnaissance; map relevant files, constraints, and likely risks.
13
+ - **worker-terra-medium**: bounded implementation; write only within an explicit ownership boundary and report changed files and tests.
14
+ - **reviewer-sol-high**: independent review; inspect the diff and behavior, then return `PASS`, `FAIL`, or `UNSURE` with evidence and confidence.
15
+ - **judge-sol-xhigh**: adjudicate contradictory findings, choose the safest supported interpretation, and identify unresolved risk.
16
+
17
+ ## Dispatch contract
18
+
19
+ 1. Select a role explicitly. A task name or friendly label alone does not select a model or policy.
20
+ 2. Use the platform's exact role/agent identifier and request its configured model and reasoning level when supported.
21
+ 3. Default to isolated context and one delegation level. Do not let a child recursively spawn more workers unless the task explicitly requires it.
22
+ 4. If the platform cannot enforce role or model routing, preserve the role prompt but report that routing is advisory.
23
+
24
+ Codex naming is model-specific: GPT-5.5 uses `none`, `low`, `medium`, `high`, and `xhigh`; GPT-5.6 Sol/Terra/Luna also use `max`. Use `xhigh` for portable high-assurance review and reserve `max` for a GPT-5.6-only quality-critical adjudication. `ultra` is not a Codex effort value.
25
+
26
+ ## Task-aware planning
27
+
28
+ Before dispatching, create a compact plan in the parent session. Decompose the request into independent workstreams, classify each as `inventory`, `mechanical`, `implementation`, `debugging`, `security`, `architecture`, or `adjudication`, and rate ambiguity, blast radius, reversibility, and verification difficulty. Choose the lowest-cost configured model that satisfies the task's verification floor:
29
+
30
+ | Task shape | Default role | Upgrade trigger |
31
+ |---|---|---|
32
+ | Inventory or fixed-schema extraction | `scout-luna-low` | ambiguity or security relevance |
33
+ | Bounded implementation | `worker-terra-medium` | shared contracts, broad blast radius, or weak tests |
34
+ | Reproducible debugging | worker, then `reviewer-sol-high` | nondeterminism or high impact |
35
+ | Security, auth, concurrency, migrations, destructive work | `reviewer-sol-high` | conflicting evidence or subtle judgment |
36
+ | Architecture tradeoffs or disputed findings | `judge-sol-xhigh` | only after independent evidence |
37
+
38
+ Every dispatch must state its objective, ownership paths, expected artifact, verification command, and escalation trigger. Stronger models are a targeted upgrade, not the default. If no configured role meets the floor, stop and report the capability gap instead of silently downgrading.
39
+
40
+ Platform mechanics are in [codex-adapter.md](references/codex-adapter.md) and [openclaw-adapter.md](references/openclaw-adapter.md).
41
+
42
+ ## Coordination rules
43
+
44
+ - Read-only scouting may run in parallel. Writes to the same worktree run serially with explicit ownership.
45
+ - Before review, run the narrowest relevant tests and state the verification floor.
46
+ - Escalate `UNSURE`, confidence below 0.70, contradictory findings, security-sensitive changes, or a failed verification floor to the judge.
47
+ - Keep reviewer lenses independent: correctness, regressions, security, and operability are separate concerns.
48
+ - If more than 25% of delegated tasks escalate, stop scaling out and re-profile the work.
49
+ - When context is near its limit, package goals, decisions, changed files, tests, and exact next steps into a fresh-session handoff.
50
+
51
+ Reusable role prompts and output contracts are in [role-prompts.md](references/role-prompts.md).
52
+
53
+ ## Safety
54
+
55
+ This skill provides coordination instructions, not permissions. Review hooks, scripts, and external tool calls before trusting them. Never bypass platform trust or sandbox controls as part of normal operation.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Overcodex UltraCode"
3
+ short_description: "Portable multi-agent engineering orchestration"
4
+ default_prompt: "Use $overcodex-ultracode to coordinate this complex engineering task with explicit scout, worker, reviewer, and judge roles."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,18 @@
1
+ # Codex Adapter
2
+
3
+ Install the Codex kit with:
4
+
5
+ ```bash
6
+ pipx install overcodex
7
+ overcodex install
8
+ ```
9
+
10
+ The installer adds the routing policy to `$CODEX_HOME/AGENTS.md`, installs four role definitions under `$CODEX_HOME/agents/`, and registers them in `config.toml`. The portable skill itself is available from a packaged install with `overcodex skill-path`.
11
+
12
+ For delegation, use the exact registered Codex `agent_type` and `fork_turns = "none"`; a task name does not route a model. Restart Codex after installation, then review and trust the hooks with `/hooks`. GPT-5.5 Codex uses `none`, `low`, `medium`, `high`, or `xhigh`; GPT-5.6 Sol/Terra/Luna additionally support `max`. Keep `xhigh` for cross-model compatibility and request `max` only when the selected model is GPT-5.6 and the task is quality-critical. Never use Claude Code effort names or `ultra` in Codex configuration.
13
+
14
+ Run the repository smoke test before changing live configuration:
15
+
16
+ ```bash
17
+ ./tests/smoke.sh
18
+ ```
@@ -0,0 +1,16 @@
1
+ # OpenClaw Adapter
2
+
3
+ OpenClaw loads a skill directory containing `SKILL.md`. Install this package from a checkout or extracted wheel with:
4
+
5
+ ```bash
6
+ openclaw skills install ./skill/overcodex-ultracode --global
7
+ openclaw skills list
8
+ ```
9
+
10
+ For a one-message bootstrap, ask the OpenClaw agent to run the repository's `install-openclaw.sh`. It installs the Python package only when needed, installs the skill globally, and prints the remaining verification steps. The agent should show proposed changes before editing existing OpenClaw agent configuration.
11
+
12
+ The global destination is normally `~/.openclaw/skills`; workspace-local skills are also supported. Configure four OpenClaw agent IDs in the current `agents.list` schema, for example `ultracode-scout`, `ultracode-worker`, `ultracode-reviewer`, and `ultracode-judge`, each with its intended model and default thinking level. Restrict delegation with the agent allowlist and set a maximum spawn depth of 1 and concurrency of 4.
13
+
14
+ When dispatching, call `sessions_spawn` with the mapped `agentId`, `context: "isolated"`, a descriptive `taskName`, and the role prompt. Use `model` and `thinking` overrides only when the configured OpenClaw version permits them. Wait with `sessions_yield`; do not assume Codex's `agent_type` field exists in OpenClaw.
15
+
16
+ If separate role IDs are not configured, dispatch remains advisory: include the role prompt and requested model/thinking in the task, then disclose that the runtime could not enforce routing. Verify with `openclaw agents list` and a harmless scout task before relying on the workflow.
@@ -0,0 +1,21 @@
1
+ # Role Prompts
2
+
3
+ Use these as short prefixes for delegated tasks. Include the concrete objective, allowed paths, and expected evidence.
4
+
5
+ Every task prefix should also include: `class`, `risk`, `ownership`, `verification`, and `escalate_when`. The parent must choose the role from the task shape, not from agent availability alone.
6
+
7
+ ## Scout
8
+
9
+ You are `scout-luna-low`. Do not edit files. Trace the relevant implementation and tests, identify constraints and risks, and return: findings, file paths, recommended next step, and confidence.
10
+
11
+ ## Worker
12
+
13
+ You are `worker-terra-medium`. Implement only the stated objective inside the allowed ownership boundary. Preserve existing conventions. Run focused tests, report changed files, commands, results, and any unresolved concern.
14
+
15
+ ## Reviewer
16
+
17
+ You are `reviewer-sol-high`. Independently inspect the proposed diff and its tests. Look for correctness bugs, regressions, unsafe assumptions, and missing verification. Return exactly: verdict (`PASS`, `FAIL`, or `UNSURE`), confidence from 0 to 1, evidence with file paths, and the smallest corrective action.
18
+
19
+ ## Judge
20
+
21
+ You are `judge-sol-xhigh`. Reconcile the supplied evidence and competing findings. Prefer demonstrated behavior over speculation, decide whether the verification floor is met, and return: decision, rationale, residual risk, and next action.
@@ -1,4 +1,4 @@
1
1
  """overcodex — Codex CLI, overclocked: cold account switching, handoff prompts,
2
- statusline config, and AGENTS.md routing policy for multi-agent workflows."""
2
+ context hooks, and pinned custom agents for multi-agent workflows."""
3
3
 
4
4
  __all__ = []
@@ -1,7 +1,7 @@
1
1
  """overcodex CLI — runs the bundled kit installer/uninstaller.
2
2
 
3
3
  The package wheel carries the same payload a git clone has (bin/, hooks/,
4
- config/, codex/, prompts/, shell/, and the install/uninstall scripts). This
4
+ config/, codex/, prompts/, agents/, shell/, and the install/uninstall scripts). This
5
5
  CLI just locates that payload and runs the battle-tested bash scripts
6
6
  against it.
7
7
  """
@@ -35,6 +35,7 @@ def main():
35
35
  sub.add_parser("install", help="install/refresh the kit into $CODEX_HOME (idempotent, backs everything up)")
36
36
  sub.add_parser("uninstall", help="remove exactly what install added")
37
37
  sub.add_parser("path", help="print the bundled payload directory")
38
+ sub.add_parser("skill-path", help="print the portable OpenClaw/Codex skill directory")
38
39
  sub.add_parser("version", help="print the overcodex version")
39
40
  args = ap.parse_args()
40
41
 
@@ -45,6 +46,12 @@ def main():
45
46
  if args.cmd == "path":
46
47
  print(_payload_dir())
47
48
  return
49
+ if args.cmd == "skill-path":
50
+ path = os.path.join(_payload_dir(), "skill", "overcodex-ultracode")
51
+ if not os.path.isfile(os.path.join(path, "SKILL.md")):
52
+ sys.exit("overcodex: bundled portable skill is missing — reinstall the package")
53
+ print(path)
54
+ return
48
55
  if args.cmd == "version":
49
56
  print(pkg_version("overcodex"))
50
57
 
@@ -25,6 +25,8 @@ ZSH_BEGIN='# --- overcodex integration (begin) ---'
25
25
  ZSH_END='# --- overcodex integration (end) ---'
26
26
  HOOKS_BEGIN='# --- overcodex hooks (begin) ---'
27
27
  HOOKS_END='# --- overcodex hooks (end) ---'
28
+ AGENT_ROLES_BEGIN='# --- overcodex agent roles (begin) ---'
29
+ AGENT_ROLES_END='# --- overcodex agent roles (end) ---'
28
30
  SL_BEGIN='# --- overcodex statusline (begin) ---'
29
31
  SL_END='# --- overcodex statusline (end) ---'
30
32
 
@@ -107,23 +109,35 @@ for p in "$SCRIPT_DIR"/prompts/*.md; do
107
109
  fi
108
110
  done
109
111
 
112
+ # Custom agent definitions (by the names shipped in the kit).
113
+ for a in "$SCRIPT_DIR"/agents/*.toml; do
114
+ [ -f "$a" ] || continue
115
+ dest="$CODEX_HOME/agents/$(basename "$a")"
116
+ if [ -f "$dest" ]; then
117
+ rm -f "$dest" && note_did "removed $dest" || note_warn "could not remove $dest"
118
+ else
119
+ note_skip "not present: $dest"
120
+ fi
121
+ done
122
+
110
123
  # Prune now-empty kit dirs (never touch anything non-empty).
111
- for d in "$CODEX_HOME/hooks" "$CODEX_HOME/prompts"; do
124
+ for d in "$CODEX_HOME/hooks" "$CODEX_HOME/prompts" "$CODEX_HOME/agents"; do
112
125
  [ -d "$d" ] && rmdir "$d" 2>/dev/null && note_did "removed empty dir $d"
113
126
  done
114
127
  echo
115
128
 
116
129
  # ---------------------------------------------------------------------------
117
- # 2. config.toml — remove ONLY our marker blocks (hooks + status_line).
130
+ # 2. config.toml — remove ONLY our marker blocks (hooks + agent roles + status_line).
118
131
  # ---------------------------------------------------------------------------
119
132
  echo "-- config.toml --"
120
133
  if [ ! -f "$CONFIG_TOML" ]; then
121
134
  note_skip "no config.toml"
122
135
  else
123
- HAS_HOOKS=no; HAS_SL=no
136
+ HAS_HOOKS=no; HAS_AGENT_ROLES=no; HAS_SL=no
124
137
  grep -qF "$HOOKS_BEGIN" "$CONFIG_TOML" && HAS_HOOKS=yes
138
+ grep -qF "$AGENT_ROLES_BEGIN" "$CONFIG_TOML" && HAS_AGENT_ROLES=yes
125
139
  grep -qF "$SL_BEGIN" "$CONFIG_TOML" && HAS_SL=yes
126
- if [ "$HAS_HOOKS" = no ] && [ "$HAS_SL" = no ]; then
140
+ if [ "$HAS_HOOKS" = no ] && [ "$HAS_AGENT_ROLES" = no ] && [ "$HAS_SL" = no ]; then
127
141
  note_skip "config.toml has no overcodex blocks (no change)"
128
142
  else
129
143
  b=$(backup_file "$CONFIG_TOML")
@@ -133,12 +147,17 @@ else
133
147
  strip_block "$tmp" "$HOOKS_BEGIN" "$HOOKS_END" > "$tmp.2" && mv "$tmp.2" "$tmp" \
134
148
  || die "could not strip hooks block"
135
149
  fi
150
+ if [ "$HAS_AGENT_ROLES" = yes ]; then
151
+ strip_block "$tmp" "$AGENT_ROLES_BEGIN" "$AGENT_ROLES_END" > "$tmp.2" && mv "$tmp.2" "$tmp" \
152
+ || die "could not strip agent roles block"
153
+ fi
136
154
  if [ "$HAS_SL" = yes ]; then
137
155
  strip_block "$tmp" "$SL_BEGIN" "$SL_END" > "$tmp.2" && mv "$tmp.2" "$tmp" \
138
156
  || die "could not strip status_line block"
139
157
  fi
140
158
  mv "$tmp" "$CONFIG_TOML" || die "could not write $CONFIG_TOML"
141
159
  [ "$HAS_HOOKS" = yes ] && note_did "removed hooks block from config.toml (backup: $b)"
160
+ [ "$HAS_AGENT_ROLES" = yes ] && note_did "removed custom agent roles block from config.toml (backup: $b)"
142
161
  [ "$HAS_SL" = yes ] && note_did "removed [tui].status_line block from config.toml (backup: $b)"
143
162
  fi
144
163
  fi
@@ -1,54 +0,0 @@
1
- # --- overcodex ultracode (begin) ---
2
- # ULTRACODE.md — Model & Effort Routing for Codex (v2-codex, ported 2026-07 from the Claude Code ULTRACODE v2)
3
-
4
- ## 1. Core principle
5
- Spend the flagship tier only where judgment is the bottleneck, never where volume is. `model_reasoning_effort` and any per-role `model` override that you omit silently inherits the top-level `model` (currently `gpt-5.6-sol` — the flagship). Explicit down-routing is your default posture, not an optimization.
6
- Route each subagent/role by one question: "if this is quietly wrong, who catches it?" — a downstream check means you may downgrade; nobody means top tier.
7
-
8
- ## 2. Tier map (GPT-5.6 family, mid-2026)
9
- Codex's current lineup is three permanent price/capability tiers, not a Claude-style haiku/sonnet/opus/apex ladder — treat them as the equivalent rungs:
10
-
11
- | Rung | Codex tier | Claude-side equivalent | Use for |
12
- |---|---|---|---|
13
- | 1 (cheap/fast) | **Luna** | haiku | scouting, file listing, mechanical transforms, fixed-schema extraction |
14
- | 2 (mid) | **Terra** | sonnet | finder sweeps, well-scoped implementation edits, bulk reading of dense code |
15
- | 3 (flagship) | **Sol** | opus | security sweeps, cross-cutting edits, adversarial verification, judge panels, completeness critics |
16
- | 3 + effort ceiling | **Sol @ high** (or the Max reasoning-effort / Ultra sub-agent mode where the deployment exposes it) | fable/apex | terminal judge, final synthesis, subtle-correctness verdicts |
17
-
18
- Effort is the second axis: `model_reasoning_effort = low \| medium \| high` (config.toml or `--config`). Pair rung × effort the same way ULTRACODE always has:
19
- - Rung 1 → low. Rung 2 → medium. Rung 3 → high. Terminal/apex → Sol @ high, plus Max/Ultra if the account has it — never below Sol.
20
- - Effort amplifies capability, it never substitutes: Luna@high loses to Terra@medium on judgment work. Never pair a high-effort setting with a fan-out stage.
21
-
22
- ## 3. Routing surface (how to actually pin a tier per subagent)
23
- Codex's per-subagent override surface is younger than Claude Code's Task-tool `model` param — there is no first-class "one dispatch call, one model" primitive yet. Use what exists, and state the gap honestly where it doesn't:
24
- - **`[agents]` table (`AgentRoleToml` per role)** in config.toml — the closest analog to Claude's per-agent `model`. Give each role you define (scout, finder, verifier, judge) its own `model` + `model_reasoning_effort` entry. This is the primary lever; use it whenever the orchestrator supports role-scoped agents.
25
- - **`profiles`** (`codex --profile <name>`) — a named bundle of `model` + `model_reasoning_effort` (+ sandbox/approval settings). Define one profile per rung (e.g. `scout`, `implement`, `verify`, `apex`) and invoke the right profile per stage instead of editing global config mid-session.
26
- - **`orchestrator.max_threads` / `max_depth`** — the fan-out width and recursion-depth knobs. Set `max_threads` to match the routing-lint width rule below (wide stages get width, not tier); use `max_depth` to cap runaway recursive sub-agent spawning, which is the Codex-side proxy for "never two agents editing the same files."
27
- - **Where enforcement is weak** (no live per-call model override mid-session, no schema-typed subagent handoff): the orchestrating model itself must apply the routing table by discipline — choosing the right profile/role before dispatch — because the harness will not silently downgrade or refuse an unrouted call the way a stricter per-call API might. Say so in-session rather than assuming the harness caught it.
28
-
29
- ## 4. Hard guardrails (unchanged from v2, ported verbatim)
30
- Never downgrade below floor:
31
- - Final synthesis and any output the user sees with no downstream check: Sol, never below. Terminal stage = apex profile, or Sol@high with Max/Ultra if available.
32
- - Adversarial verification, judge panels, security verdicts, completeness critics: Sol floor. A false CONFIRM ends scrutiny.
33
- - Subtle-correctness verdicts (concurrency, auth/crypto, money math, migrations): apex — "looks correct" and "is correct" diverge most here.
34
-
35
- Verification order: where an OBJECTIVE check exists (tests, typecheck, lint, a numeric answer), gate on it via `codex exec` + shell BEFORE spending an LLM verifier. A passing test outranks an LLM CONFIRM. For fuzzy deliverables with no automatic check, buy a stronger generator, not a weak-generator-plus-judge pipeline.
36
-
37
- Escalation rule: every finder/verifier role emits `verdict`/`confidence`/`evidence` (approximate via prompt contract — Codex has no first-class typed `schema` param yet, so state the required shape in the prompt and treat a response missing any field as low confidence). Re-run once at the next rung up on confidence < 0.7, UNSURE, empty/malformed output, or contradiction between parallel roles. Escalation target must be ≥ generator's rung. Escalation has a ceiling too: >1-in-4 downgraded stages escalating means the routing was miscalibrated — stop and re-profile, don't silently run everything on Sol.
38
-
39
- Panels: 2–3 voters with distinct lenses (correctness / security / reproduces-it), never N identical-role repeats. Unanimous → accept; split → one apex adjudicator; never majority-vote or average.
40
-
41
- Budget pressure: cut `max_threads` / batch more files per role first; floors are the last thing to fall. Treat the apex rung as a read-only reserve (usually synthesis only). If budget can't cover the apex/Sol terminal stages, say so and propose the cut — never silently ship a downgraded final answer.
42
-
43
- ## 5. Routing lint (pre-flight, fix before dispatch)
44
- 1. Every role/profile has an explicit `model` + `model_reasoning_effort`, or the omission is a deliberate apex spend (inherits top-level `model`). More than 2 omissions = under-routing.
45
- 2. No wide/parallel role runs on Sol@high or inherits the apex profile; bulk roles sit at Luna/Terra regardless of the rest of the routing.
46
- 3. Verifiers, judges, synthesis are at their floors even under budget pressure; `max_depth` prevents two roles editing the same files concurrently.
47
- 4. Every downgraded trusted-adjacent stage has a stated escalation trigger, and an objective check (test/lint/typecheck via shell) gates before any LLM verifier where one exists.
48
- 5. Every role's prompt states an objective + expected output shape + scope boundary vs sibling roles — Codex has no schema enforcement, so the prompt IS the contract.
49
- 6. A stage is justified only if it accesses information the prior stage couldn't (new tool call, test run, independent read). A stage that reformats an upstream conclusion is overhead — collapse it into one higher-effort call.
50
- 7. Profile/role names embed the tier (e.g. `verify-sol-high`), so a session log shows the routing without opening config.toml.
51
-
52
- ## 6. Scope
53
- This table binds any one-off `codex exec` dispatch too, not just multi-agent orchestrator runs: a lone bulk-reading call is still a Luna/Terra job; a lone terminal judgment still earns Sol@high or a deliberate apex inheritance. Absence of `[agents]`/`orchestrator` config does not relax the discipline — apply it by hand via `--profile` and `--config model_reasoning_effort=`.
54
- # --- overcodex ultracode (end) ---
File without changes
File without changes
File without changes
File without changes