Skip to content

Agent lifecycle via first-party hooks (Claude Code plugin, Codex notify) instead of inferring from OSC 9;4 #361

Closed as not planned

Description

@joelmoss

Inspired by fut (mikker/fut, docs/agents.md, integrations/claude-code, integrations/codex, integrations/pi). Related to #358, which covers the same need through OSC 7501.

Problem

The pane busy indicator comes from OSC 9;4 (GHOSTTY_ACTION_PROGRESS_REPORT, macapp/WorkroomApp/Core/GhosttyRuntimeAdapter.swift:61). Claude Code emits it once at start and once at end. Codex never emits it, so Codex panes show no busy state at all. OSC 9;4 also can't express "blocked" (a permission prompt, question or login).

#358 fixes this via OSC 7501, but it is blocked on ghostty-org/ghostty#14560 (still a draft) and on emitters actually shipping support.

What fut does

  • Ships first-party lifecycle adapters: a Claude Code plugin, a Codex plugin plus the documented notify setting for authoritative turn completion, and a Pi integration.
  • The adapters call fut agent report working|blocked|completed|idle|exited, with --source, --agent-session-id and --turn-id. The terminal defaults to FUT_TERMINAL_ID.
  • A report is owned by the reporting process's live branch, so state clears when the agent process ends even without a final exited.
  • Codex screen-detection fallback: when Codex is the foreground process and hasn't reported, fut infers idle, working and blocked from the live bottom viewport. Inferred state is marked under activity.detection.rule, and explicit reports always take precedence. FUT_AGENT_DETECTION_LOG=1 logs the matches for debugging.

Proposal

  1. Add workroom agent report <state>, which sends the report to wr-agent with the pane's terminal ID taken from an env var.
  2. Ship a Claude Code plugin that maps its hooks onto these reports (UserPromptSubmit → working, Notification/permission → blocked, Stop → completed), and document Codex's notify setting.
  3. Keep wr-agent as the source of truth, as Program status (OSC 7501) via wr-agent: show when an agent is blocked on the user #358 proposes, so state survives reattach and works on boxd hosts.
  4. Optional: a Codex screen-detection fallback, using the ShadowTerminal the daemon already keeps.

When OSC 7501 lands, it becomes one more reporting source into the same daemon state. This issue doesn't replace #358.


🤖 Left by Claude Code

Activity

  1. joelmoss commented on Oct 16, 2026

    @joelmoss
    OwnerAuthor

    This was generated by AI during triage.

    Closing as wontfix.

    The need behind this issue is met without hooks. #358 shipped OSC 7501 program status through wr-agent (ADR 0050). Claude Code 2.1.295 and later report working, blocked, done and clear, and Codex does too since openai/codex#52725 and #54114 (app=codex, with kind on blocked). So Codex panes are no longer without a busy state, and both agents get marks across reattach and on remote hosts with no adapter.

    ADR 0050 already rejected hooks as the source: one agent each, edits to the user's own agent settings, no lifetime rules, and reattach and remote correctness belonging to the agent that owns the session. A report CLI and screen detection have even less reason now that the agents report themselves. The reasoning and what would reopen it are in .out-of-scope/agent-lifecycle-hooks.md.

    One gap turned up in triage: Codex reports without first probing for support, so Workroom shows its marks but never alerts or counts its requests. That's tracked in #481.


    🤖 Left by Claude Code.

  2. added
    wontfixThis will not be worked on
    and removed on Oct 16, 2026
  3. added a commit that references this issue on Oct 16, 2026
    12b1a0f
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

    enhancementNew feature or requestwontfixThis will not be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions