Purpose
Fork a terminal session to a new terminal window using agentic coding tools (Claude Code, Codex CLI, Gemini CLI) or raw CLI commands. Supports context handoff with conversation summary for agentic tools.
Variables
ENABLE_RAW_CLI_COMMANDS: true # Allow forking with raw CLI commands (ffmpeg, curl, python, etc.)
ENABLE_GEMINI_CLI: true # Enable Gemini CLI agent forking
ENABLE_CODEX_CLI: true # Enable Codex CLI agent forking
ENABLE_CLAUDE_CODE: true # Enable Claude Code agent forking
AGENTIC_CODING_TOOLS: claude-code, codex-cli, gemini-cli # List of supported agentic tools
Workflow
Parse User Request
- Extract: tool type (agentic vs raw CLI), tool name, command/task
- Check for "summary" keyword (context handoff for agentic tools)
- Example: "fork terminal use claude code to fix tests" → Tool: claude-code, Task: "fix tests", Summary: no
Read Fork Tool
- Tool: Read
.claude/skills/fork-terminal/tools/fork_terminal.py
- Understand forking mechanism and parameters
- Example: fork_terminal(command: str) → Spawns new terminal with command
Handle Summary Context (Agentic Tools Only)
- IF: User requested summary (keywords: "summarize", "summary", "include context")
- AND: Tool is in AGENTIC_CODING_TOOLS (claude-code, codex-cli, gemini-cli)
- AND: Tool is enabled via ENABLE flag
- THEN: Apply summary workflow:
- Read
.claude/skills/fork-terminal/prompts/fork_summary_user_prompt.md template
- Fill template IN MEMORY (IMPORTANT: don't update the file, fill it in memory only)
- Replace XML tags: with conversation history between you and user
- Replace XML tags: with the user's task
- This filled prompt will be passed to the PROMPT parameter (-p flag) of the agentic coding tool
- Template structure: Provides context handoff so new agent has conversation history
- ELSE: Use task as-is without summary (for raw CLI or when summary not requested)
- Summary examples:
- "fork terminal use claude code to fix tests summarize work so far"
- "spin up new terminal with codex include summary for refactoring"
- "create terminal with gemini with context to implement feature"
- Non-summary example: "fork terminal use claude code to run tests" → Direct task, no summary
Route to Cookbook
- Determine scenario based on tool type and enabled flags
- Options: Raw CLI, Claude Code, Codex CLI, Gemini CLI
- Example: "claude code" requested + ENABLE_CLAUDE_CODE=true → Claude Code scenario
Execute Cookbook Scenario
- Read and follow appropriate cookbook file
- Cookbook will construct the fork command
- Example: claude-code.md → Builds claude command with flags
Fork Terminal
- Tool: Execute fork_terminal(command)
- Spawns new terminal window with constructed command
- Example: fork_terminal("claude --model sonnet -p 'fix tests'")
Cookbook
Raw CLI Commands
- IF: The user requests a non-agentic coding tool AND
ENABLE_RAW_CLI_COMMANDS is true.
- THEN: Read and execute:
.claude/skills/fork-terminal/cookbook/cli-command.md
- EXAMPLES:
- "Create a new terminal to with ffmpeg"
- "Create a new terminal to with curl"
- "Create a new terminal to with python"
Claude Code
- IF: The user requests a claude code agent to execute the command AND
ENABLE_CLAUDE_CODE is true.
- THEN: Read and execute:
.claude/skills/fork-terminal/cookbook/claude-code.md
- EXAMPLES:
- "fork terminal use claude code to "
- "spin up a new terminal request using claude code"
- "create a new terminal to with claude code"
Codex CLI
- IF: The user requests a codex CLI agent to execute the command AND
ENABLE_CODEX_CLI is true.
- THEN: Read and execute:
.claude/skills/fork-terminal/cookbook/codex-cli.md
- EXAMPLES:
- "fork terminal use codex to "
- "spin up a new terminal request using codex"
- "create a new terminal to with codex"
Gemini CLI
- IF: The user requests a gemini CLI agent to execute the command AND
ENABLE_GEMINI_CLI is true.
- THEN: Read and execute:
.claude/skills/fork-terminal/cookbook/gemini-cli.md
- EXAMPLES:
- "fork terminal use gemini to "
- "spin up a new terminal request with gemini"
- "create a new terminal to using gemini"
1---2name: fork-terminal-23description: Purpose4---56# Purpose78Fork a terminal session to a new terminal window using agentic coding tools (Claude Code, Codex CLI, Gemini CLI) or raw CLI commands. Supports context handoff with conversation summary for agentic tools.910## Variables1112ENABLE_RAW_CLI_COMMANDS: true # Allow forking with raw CLI commands (ffmpeg, curl, python, etc.)13ENABLE_GEMINI_CLI: true # Enable Gemini CLI agent forking14ENABLE_CODEX_CLI: true # Enable Codex CLI agent forking15ENABLE_CLAUDE_CODE: true # Enable Claude Code agent forking16AGENTIC_CODING_TOOLS: claude-code, codex-cli, gemini-cli # List of supported agentic tools1718## Workflow19201. **Parse User Request**21 - Extract: tool type (agentic vs raw CLI), tool name, command/task22 - Check for "summary" keyword (context handoff for agentic tools)23 - Example: "fork terminal use claude code to fix tests" → Tool: claude-code, Task: "fix tests", Summary: no24252. **Read Fork Tool**26 - Tool: Read `.claude/skills/fork-terminal/tools/fork_terminal.py`27 - Understand forking mechanism and parameters28 - Example: fork_terminal(command: str) → Spawns new terminal with command29303. **Handle Summary Context (Agentic Tools Only)**31 - IF: User requested summary (keywords: "summarize", "summary", "include context")32 - AND: Tool is in AGENTIC_CODING_TOOLS (claude-code, codex-cli, gemini-cli)33 - AND: Tool is enabled via ENABLE flag34 - THEN: Apply summary workflow:35 - Read `.claude/skills/fork-terminal/prompts/fork_summary_user_prompt.md` template36 - Fill template IN MEMORY (IMPORTANT: don't update the file, fill it in memory only)37 - Replace XML tags: <fill in the history here> with conversation history between you and user38 - Replace XML tags: <fill in the next user request here> with the user's task39 - This filled prompt will be passed to the PROMPT parameter (-p flag) of the agentic coding tool40 - Template structure: Provides context handoff so new agent has conversation history41 - ELSE: Use task as-is without summary (for raw CLI or when summary not requested)42 - Summary examples:43 - "fork terminal use claude code to fix tests summarize work so far"44 - "spin up new terminal with codex include summary for refactoring"45 - "create terminal with gemini with context to implement feature"46 - Non-summary example: "fork terminal use claude code to run tests" → Direct task, no summary47484. **Route to Cookbook**49 - Determine scenario based on tool type and enabled flags50 - Options: Raw CLI, Claude Code, Codex CLI, Gemini CLI51 - Example: "claude code" requested + ENABLE_CLAUDE_CODE=true → Claude Code scenario52535. **Execute Cookbook Scenario**54 - Read and follow appropriate cookbook file55 - Cookbook will construct the fork command56 - Example: claude-code.md → Builds claude command with flags57586. **Fork Terminal**59 - Tool: Execute fork_terminal(command)60 - Spawns new terminal window with constructed command61 - Example: fork_terminal("claude --model sonnet -p 'fix tests'")6263## Cookbook6465### Raw CLI Commands6667- IF: The user requests a non-agentic coding tool AND `ENABLE_RAW_CLI_COMMANDS` is true.68- THEN: Read and execute: `.claude/skills/fork-terminal/cookbook/cli-command.md` 69- EXAMPLES:70 - "Create a new terminal to <xyz> with ffmpeg"71 - "Create a new terminal to <xyz> with curl"72 - "Create a new terminal to <xyz> with python"7374### Claude Code7576- IF: The user requests a claude code agent to execute the command AND `ENABLE_CLAUDE_CODE` is true.77- THEN: Read and execute: `.claude/skills/fork-terminal/cookbook/claude-code.md`78- EXAMPLES:79 - "fork terminal use claude code to <xyz>"80 - "spin up a new terminal request <xyz> using claude code"81 - "create a new terminal to <xyz> with claude code"8283### Codex CLI8485- IF: The user requests a codex CLI agent to execute the command AND `ENABLE_CODEX_CLI` is true.86- THEN: Read and execute: `.claude/skills/fork-terminal/cookbook/codex-cli.md`87- EXAMPLES:88 - "fork terminal use codex to <xyz>"89 - "spin up a new terminal request <xyz> using codex"90 - "create a new terminal to <xyz> with codex"9192### Gemini CLI9394- IF: The user requests a gemini CLI agent to execute the command AND `ENABLE_GEMINI_CLI` is true.95- THEN: Read and execute: `.claude/skills/fork-terminal/cookbook/gemini-cli.md`96- EXAMPLES:97 - "fork terminal use gemini to <xyz>"98 - "spin up a new terminal request <xyz> with gemini"99 - "create a new terminal to <xyz> using gemini"