Add new two commands monitor & shift#351
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d6b1d5d3b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| **1 session** — auto-resume it, no question needed: | ||
| ```bash | ||
| CLAUDE_PLUGIN_DATA="${CLAUDE_PLUGIN_DATA}" node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" monitor --resume-session <that-session-id> |
There was a problem hiding this comment.
Preserve model/effort flags when resuming monitor sessions
The resume flow drops user-supplied runtime flags: if someone runs /codex:monitor --resume --model ... --effort ..., this step re-invokes monitor --resume-session <id> without forwarding those flags, so the monitor silently runs with default model/effort. This makes the command behave differently depending on session count and can violate explicit user configuration.
Useful? React with 👍 / 👎.
| const diffStat = spawnSync("git", ["diff", "--stat", "HEAD"], { cwd, encoding: "utf8" }); | ||
| const diffFull = spawnSync("git", ["diff", "HEAD"], { cwd, encoding: "utf8" }); |
There was a problem hiding this comment.
Include untracked files in shift handoff artifacts
The shift package is built from git diff ... HEAD, which excludes untracked files; in practice, newly created files that were never staged are omitted from both the Changed Files summary and Full Diff block. This causes incomplete handoff context whenever work includes brand-new files, even though those files are often the most important context for Codex to continue correctly.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97c869f02e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bedccf9cb1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| // Build untracked diff by running git diff --no-index /dev/null <file> for each | ||
| const untrackedDiffParts = []; | ||
| for (const file of untrackedFiles.slice(0, 20)) { |
There was a problem hiding this comment.
Include every untracked file diff in shift packages
When a handoff includes more than 20 newly-created files, the Changed Files section still lists all untracked paths but the Full Diff silently includes only the first 20 because of this slice. That makes /codex:shift produce an incomplete package for common scaffolding or generated-file changes, so the resumed Codex thread can miss brand-new source files without any indication that the diff was truncated.
Useful? React with 👍 / 👎.
This pull request introduces a comprehensive session and history tracking system for Codex handoff and monitoring workflows in the Claude plugin. It adds new commands for session management, implements persistent recording and compaction of session history, and integrates a background hook to automatically log assistant turns and touched files. These changes enable seamless handoff between Claude and Codex, improved context sharing, and robust session resumption.
New Command Definitions and Session Management:
/codex:monitorcommand for starting or resuming Codex background sessions, with logic for session selection, fresh starts, and user prompts when multiple sessions exist./codex:shiftcommand to hand off the current session to Codex, including session selection, merging, and launching a Codex terminal, with user prompts for multiple sessions and support for merging all sessions.Session and History Tracking Library:
shift-history.mjs, a library for managing shift sessions: creating/resuming sessions, recording entries (assistant summaries and touched files), compacting and merging session history, and formatting context for Codex prompts.Automated Session Logging Hook:
shift-history-hook.mjs, a hook that runs after each Claude turn to append a summary and touched files to the active shift session’s history log, ensuring session context is always up to date.hooks.jsonto fire on each Stop event.Key Features: