Skip to content

agent-tunnel: investigate in-session >share for Codex via Codex's Claude-compatible plugin hooks #107

Description

@pchalasani

Context

For Claude Code, publishing a session is done in-session by typing:

>share --dangerously-skip-permissions my-cool-session

This works because agent-tunnel ships a Claude Code UserPromptSubmit plugin hook (plugins/agent-tunnel/hooks/share_hook.py, registered via hooks.json). When you submit that prompt, the hook fires, receives session_id + cwd + transcript_path, writes the registry, and returns {"decision":"block","reason":"…"} so the prompt is intercepted (never reaches the model) and the handle is printed. That block-and-reply behavior is what makes >share feel like a slash command.

For Codex CLI, PR #102 publishes via the terminal instead: agent-tunnel share --agent codex <name>. There is no in-session >share today.

Why this is worth investigating (it may be achievable)

Codex actually has a Claude-compatible plugin/hook system. On this machine ~/.codex/config.toml contains, e.g.:

[hooks.state."ralph-loop@claude-plugins-official:hooks/hooks.json:stop:0:0"]
trusted_hash = "sha256:…"

i.e. codex loads Claude-plugin hooks.json files and keys them by event (stop here) + a per-invocation trust hash. codex plugin / codex features (hooks is a stable feature) manage this. So an in-session >share for codex is plausibly just a matter of wiring, not a hard "codex can't".

agent-tunnel's share_hook.py already defensively detects a codex-shaped transcript_path and labels the record agent=codex, so if the hook ever fires inside codex it does the right thing.

Open questions to answer

  1. Does codex fire a UserPromptSubmit-equivalent hook event (or any pre-turn user-input event)?
  2. Does codex honor the {"decision":"block","reason":…} protocol to suppress the prompt and surface a message? (Claude's >share needs this; without it, the >share text would still reach the model.)
  3. Does the hook payload include session_id / cwd / codex rollout path (so the hook can register the right session)?
  4. What's the install/trust path — publish agent-tunnel to a codex plugin marketplace, or a manual ~/.codex/config.toml hook entry + trust?

Outcome

If (1)–(3) hold, wire the existing share_hook.py into codex (register the plugin/hook, document the trust step) so codex users get the same >share --… my-cool-session in-session shortcut. If codex lacks block-decision support, document agent-tunnel share --agent codex as the permanent codex path.

Refs: PR #102, plugins/agent-tunnel/hooks/share_hook.py (_detect_agent), plugins/agent-tunnel/hooks/hooks.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions