Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Claudiu is a native desktop app, written in Rust with [Rune](https://github.com/

Each session is your own `claude` process in a real terminal, and sign-in stays with Claude Code. Around it, Claudiu adds a sidebar of running and recent sessions, notifications when a background session finishes or asks something, an editor mode (Ctrl+Shift+E), usage meters, a GitHub pane, cards Claude draws inline, sessions that move between git worktrees, extra accounts that share one configuration, and Codex and OpenCode subagents (Settings → Custom subagents). Codex subagents need Node and a `codex login`, OpenCode subagents need `opencode` on PATH, and with Allow edits on, either acts without Claude Code's permission rules. With Codex subagents on, the sidebar also shows Codex's 5-hour and 7-day limits, which Claudiu reads from the session logs in `~/.codex`. Settings lists the rest.

While a custom subagent works, the main conversation shows a line for each plan and tool step, and the subagent's own view in Claude Code's tasks list streams its messages, reasoning and command output. The first Codex run takes longer while npm downloads the adapter. Claude can choose a Codex subagent's effort when it starts one (`max` runs as Codex's `xhigh`); otherwise Codex uses the effort in `~/.codex/config.toml`.
While a custom subagent works, its own view in Claude Code's tasks list streams its messages, reasoning, plan and tool steps and command output. The main conversation stays as it is until the subagent hands back its report. The first Codex run takes longer while npm downloads the adapter. Claude can choose a Codex subagent's effort when it starts one (`max` runs as Codex's `xhigh`); otherwise Codex uses the effort in `~/.codex/config.toml`.

A message Claude sends a running Codex subagent reaches it in the task it is working on, and its answer streams like the rest. OpenCode takes such messages too if its version supports them. Otherwise, and once the subagent has finished, Claude Code sends the message as a follow-up.

Expand Down
12 changes: 0 additions & 12 deletions mod/hooks/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,6 @@ function withSteps(report, name, steps) {
return `${report}\n\n---\nSteps ${name} ran (${steps.length}):\n${listed.join('\n')}`
}

function showActivity($, label, text) {
const line = displayText(text).replace(/\s+/g, ' ').trim()
$.ui.log(`${label} · ${line.length > 200 ? line.slice(0, 199) + '…' : line}`)
}

function displayText(text) {
// Color and cursor codes first: removing only their escape character would leave `[31m` behind.
return text.replace(/\x1b\[[0-9;:?]*[ -/]*[@-~]/g, '').replace(/\r\n?/g, '\n').replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, '')
Expand Down Expand Up @@ -498,9 +493,6 @@ async function* customStep($, e, next, run) {
run.steps = []
const { agent, model, edits } = customTypes.get(run.type)
const name = AGENT_NAMES[agent]
const label = `${name} (${e.agentId})`
const starting = agent === 'codex' ? 'Starting Codex adapter. On first run, npm may need to download it.' : 'Starting OpenCode.'
showActivity($, label, starting)
yield { kind: 'text', index: 0, text: `${name} on ${model}, ${edits ? 'edits allowed' : 'read-only'}\n\n` }
run.report = null
let previousKind
Expand Down Expand Up @@ -528,13 +520,10 @@ async function* customStep($, e, next, run) {
continue
}
if (event.kind === 'text' || event.kind === 'thought' || event.kind === 'output') {
if (event.kind === 'thought' && previousKind !== 'thought') showActivity($, label, 'Thinking')
if (event.kind === 'text' && previousKind !== 'text') showActivity($, label, 'Writing a response')
const prefix = previousKind === event.kind ? '' : { text: previousKind ? '\n\n' : '', thought: '\n\nThinking\n', output: '\n\nTool output\n' }[event.kind]
yield { kind: 'text', index: 0, text: prefix + displayText(event.text) }
} else if (event.kind === 'step' || event.kind === 'progress') {
if (event.kind === 'step') run.steps.push(event.text)
showActivity($, label, event.text)
yield { kind: 'text', index: 0, text: `\n▸ ${displayText(event.text)}\n` }
} else if (event.kind === 'report' || event.kind === 'failed') {
helperEnded = !event.spawnError
Expand All @@ -555,7 +544,6 @@ async function* customStep($, e, next, run) {
}
if (next.signal?.aborted) return
run.report ??= `${name} failed: the helper stopped without an answer.`
if (run.report.startsWith(`${name} failed:`)) showActivity($, label, run.report)
}
const message = withSteps(run.report, AGENT_NAMES[customTypes.get(run.type).agent], run.steps)
if (run.handedBack >= 2) {
Expand Down
25 changes: 9 additions & 16 deletions mod/hooks/subagents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,28 @@ function engine(on: any, helper: string[] | (() => AsyncGenerator<{ stream: stri
return registered
}

test('startup and activity reach the transcript while the helper is still running', async ($, on) => {
// The subagent's own view streams its activity; the main conversation gets none of it, since one line per step
// buried the person's own conversation.
test('activity streams in the subagent and leaves the main conversation alone', async ($, on) => {
const log: string[] = []
let logAtSpawn: string[] = []
let logBeforeReport: string[] = []
on('ui.log', (_$: any, e: any) => { log.push(e.text); return { value: undefined } })
engine(on, async function* () {
logAtSpawn = [...log]
yield { stream: 'stdout', text: '{"kind":"progress","tex' }
yield { stream: 'stdout', text: 't":"Session ready."}\n{"kind":"thought","text":"Checking "}\n' }
yield { stream: 'stdout', text: '{"kind":"thought","text":"the parser."}\n{"kind":"step","text":"Run tests"}\n' }
yield { stream: 'stdout', text: '{"kind":"progress","text":"Run tests · failed"}\n{"kind":"output","text":"\\u001b[31mtest failed\\u001b[0m"}\n' }
logBeforeReport = [...log]
yield { stream: 'stdout', text: '{"kind":"report","text":"Parser test failed."}\n' }
return { value: { code: 0, signal: null } }
}, [])
await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true })
await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' })
const chunks = await step($, 't1', 0, 'a1')

expect(logAtSpawn).toEqual(['Codex (a1) · Starting Codex adapter. On first run, npm may need to download it.'])
expect(logBeforeReport).toEqual([...logAtSpawn, 'Codex (a1) · Session ready.', 'Codex (a1) · Thinking', 'Codex (a1) · Run tests', 'Codex (a1) · Run tests · failed'])
expect(log).toEqual([])
const text = chunks.filter(c => c.kind === 'text').map(c => c.text).join('')
expect(text).toContain('▸ Session ready.')
expect(text).toContain('Thinking\nChecking the parser.')
expect(text).toContain('▸ Run tests · failed')
expect(text).toContain('Tool output\ntest failed')
expect(JSON.parse(chunks.find(c => c.kind === 'input').json).message).toBe('Parser test failed.\n\n---\nSteps Codex ran (1):\n- Run tests')
})
Expand Down Expand Up @@ -98,12 +97,14 @@ test('SendMessage reaches only the running Codex helper and its reaction streams
engine(on, async function* () {
yield helperChunk({ kind: 'inbox', id: INBOX_ID, path: INBOX_PATH })
yield helperChunk({ kind: 'progress', text: 'Waiting for input.' })
ready.resolve()
await first.promise
yield helperChunk({ kind: 'accepted', seq: 1 })
await second.promise
yield helperChunk({ kind: 'accepted', seq: 2 })
yield helperChunk({ kind: 'progress', text: 'Codex received the message in its current turn.' })
yield helperChunk({ kind: 'text', text: 'I will check both files.' })
reaction.resolve()
await finish.promise
yield helperChunk({ kind: 'report', text: 'Checked both files.' })
return { value: { code: 0, signal: null } }
Expand All @@ -114,11 +115,6 @@ test('SendMessage reaches only the running Codex helper and its reaction streams
written.resolve()
return { value: undefined }
})
on('ui.log', (_$: any, e: any) => {
if (e.text.endsWith('Waiting for input.')) ready.resolve()
if (e.text.endsWith('Writing a response')) reaction.resolve()
return { value: undefined }
})
on('session.receive', (_$: any, e: any) => ({ text: e.text }))
await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true })
await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' })
Expand Down Expand Up @@ -150,14 +146,11 @@ test('a delivery racing helper exit is queued by Claude and its inbox is cleaned
engine(on, async function* () {
yield helperChunk({ kind: 'inbox', id: INBOX_ID, path: INBOX_PATH })
yield helperChunk({ kind: 'progress', text: 'Waiting for input.' })
ready.resolve()
await wrote.promise
yield helperChunk({ kind: 'report', text: 'Finished first.' })
return { value: { code: 0, signal: null } }
}, [])
on('ui.log', (_$: any, e: any) => {
if (e.text.endsWith('Waiting for input.')) ready.resolve()
return { value: undefined }
})
on('fs.write', () => { wrote.resolve(); return { value: undefined } })
on('process.run', (_$: any, e: any) => {
cleanup.push(e.argv)
Expand Down
Loading