context-fork
Execute slash commands and skills with context: fork frontmatter in isolated
pi subprocesses. Each fork gets its own context window, optional agent configuration,
and model routing. Results flow back into the main conversation.
Fork vs inline execution
Section titled “Fork vs inline execution”Commands and skills normally run inline — their content is expanded and sent
directly to the current conversation. With context: fork, the command spawns a
separate pi process that:
- Has no access to the parent conversation history
- Can use a different model than the parent
- Can be restricted to specific tools and skills via agent config
- Returns only the final assistant output to the parent
This is useful for:
- Heavy tasks that need isolation to avoid polluting the main context
- Specialized agents with different tool access or system prompts
- Model routing — run cheap tasks on Haiku, complex ones on Sonnet
Frontmatter fields
Section titled “Frontmatter fields”Add these to command/skill markdown files:
---context: fork # Required: tells context-fork to interceptagent: researcher # Optional: load agent config from .tallow/agents/model: haiku # Optional: model alias or full IDallowed-tools: "*" # Parsed but ignored (no permission system)---context: fork | inline
Section titled “context: fork | inline”- fork — spawn subprocess, isolated execution
- inline (default) — expand inline, no subprocess
agent: <name>
Section titled “agent: <name>”Loads agent configuration from:
- Bundled agents (shipped with tallow)
- Package agents (from settings.json packages)
~/.claude/agents/(user-level, Claude Code compatibility)~/.tallow/agents/(user-level, tallow).claude/agents/(project-level, Claude Code compatibility).tallow/agents/(project-level, tallow)
Priority: last wins per name. .tallow/ takes precedence over .claude/.
Agent config provides:
tools: bash, read, edit— tool allowlist for subprocessskills: path/to/skill— skills to loadmodel: sonnet— default model if the command doesn’t specify one- System prompt — injected via
--append-system-prompt
If the agent is not found, the command shows an error notification with available agent names.
model: <value>
Section titled “model: <value>”Model to use for the subprocess. Can be:
- Alias:
sonnet,haiku,opus— maps to latest 4.5 release - Full ID:
claude-sonnet-4-5-20250514— passes through as-is - inherit (default) — subprocess uses the default model from config
Priority: command model > agent model > inherit.
The resolved model is shown in the fork result display.
allowed-tools
Section titled “allowed-tools”Parsed but ignored. Tallow has no permission system — tool access is controlled
via the agent’s tools: frontmatter field.
Model aliases
Section titled “Model aliases”Short aliases map to full Anthropic model IDs:
| Alias | Full model ID |
|---|---|
sonnet | claude-sonnet-4-5-20250514 |
haiku | claude-haiku-4-5-20250514 |
opus | claude-opus-4-5-20250514 |
Full model IDs pass through unchanged.
Display
Section titled “Display”Fork commands show a compact 🔀 prefix in chat:
🔀 /research quantum computingThe working indicator shows:
🔀 forking: /research → researcher (haiku)When complete, the result includes:
- Command name
- Agent name (if configured)
- Model used
- Execution duration
Subprocess behavior
Section titled “Subprocess behavior”Each fork:
- Spawns
pi --mode json -p --no-sessionin the current working directory - Passes
--models <model>if a model is specified - Passes
--tools <tool1>,<tool2>from agent config - Passes
--skill <path>for each skill in agent config - Writes the agent system prompt to a temp file and passes
--append-system-prompt - Sends the command content as the task input
- Collects JSON events from stdout
- Extracts the final assistant
message_endtext - Sends that text back to the parent conversation with
triggerTurn: true
Shell interpolation ($(command)) and file references (@file.txt) are expanded
before the content is sent to the subprocess.
Timeout: 5 minutes. The subprocess receives SIGTERM, then SIGKILL after 5 seconds.
Argument substitution
Section titled “Argument substitution”Fork commands support the same argument substitution as inline commands:
$ARGUMENTS— full argument string$@— same as$ARGUMENTS$1,$2,$3— individual positional arguments${@:2}— all arguments starting from the 2nd${@:2:3}— 3 arguments starting from the 2nd
Example:
---name: searchdescription: Search codebase with agentcontext: forkagent: searchermodel: haiku---
Find all occurrences of "$1" in the codebase and explain the pattern.Focus on: $2Usage: /search DatabaseConnection usage patterns
Example: research agent fork
Section titled “Example: research agent fork”---name: researchdescription: Deep research task with isolationcontext: forkagent: researchermodel: sonnet---
Research the following topic in depth. Use web search, read documentation,and synthesize findings into a structured report.
Topic: $ARGUMENTSAgent config at ~/.tallow/agents/researcher.md:
---name: researcherdescription: Research specialist with web accesstools: bash, readskills: ~/.tallow/skills/web-searchmodel: haiku---
You are a research specialist. Your job is to gather information frommultiple sources, cross-reference facts, and produce clear, cited reports.
Always include sources and confidence levels for claims.When you run /research quantum computing, the extension:
- Loads the researcher agent config
- Resolves model: command says
sonnet, agent sayshaiku→ sonnet wins - Spawns pi subprocess with
--tools bash,read --skill ~/.tallow/skills/web-search - Injects the researcher system prompt
- Sends “Research the following topic in depth… Topic: quantum computing”
- Collects final output
- Sends it back to the main conversation
Extension order
Section titled “Extension order”This extension must hook input before command-prompt and minimal-skill-display
to intercept fork commands. Alphabetically, context-fork comes before both, which
is correct.
The extension returns { action: "handled" } for fork commands, preventing other
extensions from processing them inline.
Relationships with other extensions
Section titled “Relationships with other extensions”context-fork enhances command-prompt by adding fork execution mode. When a command
has context: fork frontmatter, context-fork intercepts it before command-prompt
can expand it inline.
Same enhancement for skills. Skills with context: fork spawn subprocesses instead
of inline expansion.
context-fork must run before minimal-skill-display to intercept fork skills first. Extension load order is alphabetical, which ensures correct priority.
Agent loading scans both .tallow/agents/ and .claude/agents/ directories.
.tallow/ wins on name collision.