Repository navigation
feat(hooks): native Codex hooks name a Codex pane's session on herdr-core - #727
Open
evrimalacan wants to merge 2 commits into
Open
evrimalacan wants to merge 2 commits into
evrimalacan wants to merge 2 commits into
Conversation
…core herdr-core knows that a terminal runs Codex, but not which conversation. So a Codex pane there had no Chat and no History. Claude panes have both, because Collie's Claude hook writes a beacon that names the session. `collie hooks install codex --native` adds Collie's entries to Codex's own $CODEX_HOME/hooks.json, for SessionStart, UserPromptSubmit, Stop and SessionEnd. Each entry runs `collie beacon codex-hook`. The verb writes a hook edge for the pane and, outside the Herdr TUI, a beacon with harness codex and the session id. It prints nothing and always exits 0. The verb finds its host by climbing past shells to the parent, then reads the host's arguments. Only a Codex window counts. Plain `codex` runs hooks in its shared app-server, with that process's environment, so a hook from there writes nothing. Codex has to run as `codex --no-daemon`. The install keeps every other handler, appends its own, is idempotent, and the uninstall removes only Collie's entries. `hooks status`, a new doctor row `beacon-hooks-codex` and the bridge's "hooks installed" probe read the file too. On herdr-core the doctor note for a Codex pane with no session now points at the native install and --no-daemon, not at Herdr's integration. The notify install (`hooks install codex`) stays as it is. Co-authored-by: Daniel JB Clark <djbclark@gmail.com>
…erdr-core A new section, Codex native hooks: the install, the "Hooks need review" trust step, why Codex must run as `codex --no-daemon`, the four events, how the install treats hooks.json, and the limits. The herdr-core notes, the troubleshooting page and the Chat table in configure.md name the Codex install beside the Claude one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codex panes on herdr-core have no session, so the phone shows no Chat or History for them. Claude panes get theirs from the hook (M74, and #647 on macOS). This does the same for Codex with Codex's own lifecycle hooks.
What it does:
collie hooks install codex --nativeadds Collie's entries to$CODEX_HOME/hooks.jsonfor SessionStart, UserPromptSubmit, Stop and SessionEnd. Other handlers stay, and uninstall removes only Collie's. Thenotifyinstall is unchanged.collie beacon codex-hook. It finds the Codex TUI that runs the hook, reads the pane markers from its environment, writes hook edges, and outside the Herdr TUI also a beacon with harnesscodexand the session id.codex app-serverdaemon orcodex exec, it writes nothing, because that environment names no pane or the wrong one. So Chat needscodex --no-daemon, and the docs say so.bridge/beacon-io.ts: the hooks-installed probe also reads Codex'shooks.json, so a host with only Codex hooks still joins beacons.collie doctorgets abeacon-hooks-codexrow. On herdr-core, the hint for a Codex pane now points at this install, not atherdr integration install codex.Relation to #596: this takes the lifecycle hook part of #596 by @djbclark (co-author on the commit), without the permission broker and Moshi, as you suggested there. #596 writes edges only. That is enough on the Herdr TUI, which names the session itself, but on the core nothing names it, so this adds the beacon.
Tested live on macOS 27.0.1 arm64, herdr-app 0.1.11, hc 0.1.16, Codex 0.167.0, with a 1.26.4 bridge:
codex --no-daemonpane wrote a beacon with its own session id and pane,collie sessionsshowed SESSION yes, and the phone showed Chat for it/new, SessionStart fired at the next prompt with the new id, and the beacon followed itNot tested live: tmux, zellij and Linux.
Base branch — see CONTRIBUTING.md:
main— there is one line of development, andmainis itChecks
bun run typecheck(root andweb/),bun run lint,bun test ./bridge ./cli ./scripts,cd web && bun run testall passcd web && bun run testpass.bun test ./cli(11),./bridge(263) and./scripts(2) fail only tests that fail the same way onmainon this Mac: the/varsymlink, the Keychain wording, and pi's examples folder.## [Unreleased], below one of### Added/### Changed/### Fixed/### Packaging/### Docs, opening with a bold lead sentence(
- **The lead sentence.** the detail …), no commit hash. A fork PR or a docs-onlychange is exempt, the maintainer picks the version there
- **Codex panes on herdr-core get Chat and History.** \collie hooks install codex --native` adds Collie's entries to Codex's own `hooks.json`, and each one names its pane's Codex session. Start Codex as `codex --no-daemon` and trust the hooks when Codex asks; `collie doctor` reports them in `beacon-hooks-codex`. Thanks @djbclark (feat(hooks): native Codex hooks and macOS process probing #596).`Written with Claude Code and reviewed with Codex.