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
10 changes: 9 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The MCP server has no third-party runtime dependencies. Each external agent owns
- one active prompt turn at a time;
- bounded public answer text;
- recent plan and tool-status summaries;
- a monotonic progress revision, elapsed time, and bounded public-response preview;
- lifecycle state and sanitized errors.

## ACP lifecycle
Expand All @@ -33,10 +34,17 @@ The MCP server has no third-party runtime dependencies. Each external agent owns
4. Create a session with `session/new`, the target directory, no nested MCP servers, and additional orchestration rules.
5. Send the task with `session/prompt`.
6. Consume `session/update` events. Keep public message chunks, plan entries, and bounded tool metadata; discard thought chunks.
7. Keep the process alive for focused follow-ups until cancellation, close, or MCP shutdown.
7. Let `grok_status` long-poll a newer progress revision for up to 30 seconds so the orchestration skill can relay visible progress without tight polling.
8. Keep the process alive for focused follow-ups until cancellation, close, or MCP shutdown.

The child process receives only a small system environment allowlist, supported Grok authentication variables, and variables explicitly named by the operator. Failed or timed-out sessions terminate their Grok process while retaining a bounded diagnostic summary.

## Interactive handoff mode

`grok_handoff_interactive` is intentionally outside the managed ACP lifecycle. On macOS it writes the sanitized handoff prompt to a mode-0600 temporary file, opens a new Terminal window, reads and removes that file, and starts the official interactive Grok TUI. Read-only handoffs use the read-only sandbox. Writing handoffs require a Git repository root and ask Grok to create an isolated worktree.

The MCP call returns after Terminal opens. The bridge does not retain the TUI process, session ID, transcript, or completion state. The user owns interaction and lifecycle from that point and must return to Codex explicitly for independent verification.

## Read-only mode

`grok_spawn_readonly` starts Grok with `--sandbox read-only`. The bridge accepts any readable absolute directory. Grok's sandbox is the enforcement boundary; the prompt also states that the session must not modify project files.
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

All notable changes to this project will be documented here.

## 0.3.0 - 2026-07-18

### Added

- Added a macOS-only `grok_handoff_interactive` tool that opens the official Grok TUI in a new Terminal window with a Codex-authored task prompt.
- Added read-only and isolated-worktree access modes for user-supervised interactive handoffs.

### Security

- Interactive implementation handoffs cannot write directly to the primary checkout and do not authorize commits, pushes, publication, or changes outside the Grok-created worktree.
- Initial handoff prompts use mode-0600 temporary files and are removed by the launched Terminal command before Grok starts.

## 0.2.0 - 2026-07-18

### Added

- Added monotonic progress revisions, elapsed time, timestamped tool events, and a bounded public-response preview to Grok agent status.
- Added optional long-polling to `grok_status` through `after_revision` and `wait_seconds`.
- Made the orchestration skill relay material Grok progress and provide a user-visible heartbeat at least once per minute.

### Security

- Kept visible progress limited to public answer chunks, plan entries, tool metadata, and lifecycle state; private chain-of-thought remains discarded.

## 0.1.1 - 2026-07-17

### Fixed
Expand Down
15 changes: 13 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ Important boundaries:

Read [SECURITY.md](SECURITY.md) before using the plugin on private code.

## Eight management tools
## Nine management tools

| Tool | Purpose | Filesystem mode |
| --- | --- | --- |
| `grok_spawn_readonly` | Start an independent investigation, review, or plan analysis | Grok `read-only` sandbox |
| `grok_spawn_worker` | Implement inside an approved linked worktree | Grok `workspace` sandbox + bridge guard |
| `grok_status` | Read lifecycle, plan, and recent tool activity | Read-only |
| `grok_handoff_interactive` | Open an interactive Grok TUI in a new macOS Terminal window and stop Codex supervision after prompt handoff | Read-only or a Grok-created isolated worktree |
| `grok_status` | Read lifecycle, elapsed time, plan, recent tool activity, and a public-response preview; optionally wait for a newer revision | Read-only |
| `grok_result` | Read the public answer, optionally waiting briefly | Read-only |
| `grok_send` | Send a focused follow-up; writing sessions require renewed scope confirmation | Inherits session mode |
| `grok_cancel` | Cancel the active turn | Control operation |
Expand All @@ -153,6 +154,16 @@ Read [SECURITY.md](SECURITY.md) before using the plugin on private code.

The bridge permits at most three open Grok processes. The skill recommends one by default and two only for genuinely independent work.

### Interactive handoff mode

When the user explicitly asks Codex to hand a task fully to Grok and interact with it directly, Codex turns the goal, scope, known context, completion criteria, and restrictions into a self-contained prompt. `grok_handoff_interactive` then opens a new macOS Terminal window. The Grok TUI is user-supervised from that point onward: Codex does not poll it, close it automatically, or pretend to know its current state.

Read-only work uses Grok's `read-only` sandbox. Implementation work uses `--worktree` to create an isolated worktree and accepts file edits there, while commits, pushes, publication, and other external actions still require explicit authorization in the Grok window. The user can return to Codex afterward for independent diff, test, and claim verification.

### How visible progress works

While Grok is running, the skill asks Codex to use `grok_status` for incremental waits of up to 30 seconds and relay material plan steps, tool status, elapsed time, or public-response previews as concise progress messages in the Codex task. It also emits a heartbeat within 60 seconds when Grok exposes no new detail. The bridge never forwards private chain-of-thought, so this is verifiable work status rather than hidden reasoning text.

## Requirements and compatibility

- macOS, Linux, or WSL;
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ flowchart LR

在私有代码上使用前,请阅读 [SECURITY.md](SECURITY.md)。

## 八个管理工具
## 九个管理工具

| 工具 | 用途 | 文件系统模式 |
| --- | --- | --- |
| `grok_spawn_readonly` | 启动独立调查、审查或方案分析 | Grok `read-only` 沙箱 |
| `grok_spawn_worker` | 在获批的 linked worktree 中执行实现任务 | Grok `workspace` 沙箱 + Bridge 检查 |
| `grok_status` | 查看生命周期、计划和最近工具活动 | 只读 |
| `grok_handoff_interactive` | 在新的 macOS Terminal 窗口打开可交互 Grok TUI,Codex 完成 prompt 移交后不再监督 | 只读或 Grok 创建的隔离 worktree |
| `grok_status` | 查看生命周期、运行时长、计划、最近工具活动和公开回答片段;支持按进度版本等待增量 | 只读 |
| `grok_result` | 获取公开回答,可短暂等待当前轮次完成 | 只读 |
| `grok_send` | 在同一会话中聚焦追问;写入会话需重新确认范围 | 继承会话模式 |
| `grok_cancel` | 取消当前轮次 | 控制操作 |
Expand All @@ -152,6 +153,16 @@ flowchart LR

Bridge 最多同时保留三个 Grok 进程;Skill 默认建议只使用一个,只有真正独立的任务才并行使用两个。

### 交互式移交模式

当你明确要求“把任务全权交给 Grok,并让我在窗口里直接沟通”时,Codex 会先把目标、范围、已有上下文、完成标准和禁止事项整理成完整 prompt,再调用 `grok_handoff_interactive` 打开新的 macOS Terminal 窗口。之后 Grok TUI 由你直接监督和追问,Codex 不轮询、不自动收尾,也不会假装知道窗口里的最新状态。

只读任务使用 Grok `read-only` 沙箱;实现任务默认使用 `--worktree` 创建隔离工作区,并自动接受工作区内的文件编辑,但提交、推送、发布和其他外部操作仍需你在 Grok 窗口里另行授权。完成后回到 Codex,Codex 再检查 worktree diff、测试和关键结论。

### 可见进度如何工作

Grok 运行期间,Skill 会让 Codex 用 `grok_status` 做最长 30 秒的增量等待,并把有实质变化的计划步骤、工具状态、运行时长或公开回答片段转成 Codex 任务里的简短进度消息;即使没有新细节,也会在 60 秒内给出一次心跳。Bridge 不转发私有思维链,因此这里展示的是可核验的工作状态,不是模型的隐藏推理文本。

## 要求与兼容性

- macOS、Linux 或 WSL;
Expand Down
6 changes: 6 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ The bridge asks the official Grok CLI to use its advertised `cached_token` metho
## Dependency and process model

The MCP server uses only Node.js standard-library modules. Grok is launched with argument arrays rather than shell command interpolation. All child processes are terminated when the bridge shuts down, with a forced-kill fallback.

## Interactive handoff boundary

Interactive handoff is macOS-only and opens the official Grok TUI in a separate Terminal window. It is not an ACP-managed agent: Codex cannot observe its later prompts, approvals, filesystem activity, or completion state. Read-only handoffs use Grok's read-only sandbox. Writing handoffs start with `--worktree` and must originate at a Git repository root; the handoff prompt forbids commits, pushes, publication, and changes to other worktrees without fresh user authorization in that Terminal window.

The initial prompt is passed through a mode-0600 temporary file that the Terminal command removes before starting Grok. The prompt is sanitized but still leaves the machine for xAI under the user's Grok plan and policies. Do not use interactive handoff for secrets or unrelated personal data.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grok-subagent-codex-marketplace",
"version": "0.1.1",
"version": "0.3.0",
"private": true,
"description": "A Codex plugin that delegates bounded work to the official Grok Build CLI over ACP.",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/grok-subagent/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grok-subagent",
"version": "0.1.1",
"version": "0.3.0",
"description": "Run authenticated Grok Build agents as controlled external subagents from Codex.",
"author": {
"name": "Walvez"
Expand Down
Loading
Loading