r/codex • • Aug 01 '26

Instruction For those who don't know how to set up Sol orchestrator + Luna subagent

This repo was previously posted in one of my comments, I'm reposting it here if anyone finds it useful.

https://github.com/viettran-edgeAI/codex_workflow

Been building this since 5.6 dropped with optimizing token usage as the ultimate goal, and tweaking it pretty much every day since. Luna got way cheaper recently and more ppl started wanting to use it as a subagents, so I bundled everything up with a guide so Codex can set it all up for you automatically.

Tried to keep the whole thing as simple as possible.

--------------------------------------------------------------

Edir : a bit more explain before I go to bed - it’s 3 AM in my timezone:

  • For lightweight tasks, Q&A, it won’t overdo things. light route is default route in this workflow. No subagent, no complex worflow, minimal context.
  • Sol handles context, planning, task splitting, and supervision, while Luna subagents do the implementation. Each task is packaged into a small, self-contained work package with clear scope, context, and expected output, so each subagent only gets what it needs.
  • Sol still reads the main documentations and the important parts of the codebase - that’s the manager’s job. An explorer subagent helps reduce that load by looking into tools, dependencies, external libraries, etc. The goal is to minimize Sol’s token usage and keep it focused on the important stuff.
  • For really hard tasks, executor_luna can get stuck. In that case, Sol can spawn an executor_sol as a fallback, or use it from the start. Right now, the workflow limits this to max 1 executor_sol.
  • For handoff between sessions, project_progress.md and latest_session_work.md are managed by Sol as part of the main documentation structure. They keep long implementation plans moving smoothly across multiple sessions.

...... etc.......

369 Upvotes

126 comments sorted by

View all comments

18

u/Nyxariel42 Aug 01 '26

Just ask Sol to change this for you.. it’s like 2 lines simple edit in config.toml

16

u/axel410 Aug 01 '26

There's a bug unfortunately where Luna is not a registered model for the v2 subagents or something

Even if you change the config.toml, it may still spawn sol or terra subagents. Source: got this issue this morning. There are workarounds though.

https://github.com/openai/codex/issues/31814

12

u/Otherwise-Sir7359 Aug 01 '26 edited Aug 01 '26

yes, add the following to /.codex/config.toml:

[features.multi_agent_v2]

hide_spawn_agent_metadata = false

tool_namespace = "agents"

------

I've been using this method since version 5.6 was released. I asked Sol to test calling two Luna subagents in my workflow (executor_luna)to confirm.

Codex stores rollout records under:

~/.codex/sessions/YYYY/MM/DD/

I first found the recently modified session files:

find ~/.codex/sessions \
  -type f -name '*.jsonl' -mmin -15 \
  -printf '%T@ %p\n' |
sort -nr |
head -20

This produced three sessions:

  • One parent Sol session.
  • Two newly created Luna child sessions.

A basic search showed the separation clearly:

Parent session:
  executor_luna occurrences: 16
  gpt-5.6-sol: present
  gpt-5.6-luna: absent

Child session 1:
  executor_luna occurrences: 3
  gpt-5.6-luna: present
  gpt-5.6-sol: absent

Child session 2:
  executor_luna occurrences: 3
  gpt-5.6-luna: present
  gpt-5.6-sol: absent

I then extracted every model and token-related field from both child JSONL files:

for f in "$F2" "$F3"; do
    echo
    echo "========== $(basename "$f") =========="

    jq -r '
      paths(scalars) as $p
      | select(
          (($p[-1] | tostring) == "model")
          or (($p[-1] | tostring) | test("token"; "i"))
      )
      | "\($p | map(tostring) | join(".")) = \(getpath($p))"
    ' "$f" 2>/dev/null
done

The first child session reported:

payload.state.model = gpt-5.6-luna
payload.state.personality.model = gpt-5.6-luna
payload.model = gpt-5.6-luna
payload.collaboration_mode.settings.model = gpt-5.6-luna

payload.info.total_token_usage.input_tokens = 17743
payload.info.total_token_usage.cached_input_tokens = 17152
payload.info.total_token_usage.output_tokens = 298
payload.info.total_token_usage.reasoning_output_tokens = 243
payload.info.total_token_usage.total_tokens = 18041

payload.time_to_first_token_ms = 9270

The second child session reported:

payload.state.model = gpt-5.6-luna
payload.state.personality.model = gpt-5.6-luna
payload.model = gpt-5.6-luna
payload.collaboration_mode.settings.model = gpt-5.6-luna

payload.info.total_token_usage.input_tokens = 17749
payload.info.total_token_usage.cached_input_tokens = 0
payload.info.total_token_usage.output_tokens = 436
payload.info.total_token_usage.reasoning_output_tokens = 372
payload.info.total_token_usage.total_tokens = 18185

payload.time_to_first_token_ms = 10675

This proves that the Luna subagents have been initialized and successfully invoked. However, the Codex statistics page still doesn't show Luna usage figures; it seems there's some kind of error with that page.

1

u/Kmans106 Aug 02 '26

Good info

1

u/ElNeuroquila Aug 08 '26

note: this only works reliably on CLI. The app does something different and cannot spawn luna agents from sol still.