Return to a running task
Use a named PTY session rather than losing the state of an interactive terminal between turns.
Skill
Keep terminal work alive, visible and testable.
For people and agents driving CLIs and terminal apps. Forge gives a persistent session a name, lets you inspect its screen and output, and keeps a clear test and cleanup path when the conversation moves on.
Session: demo-tui-smoke Tag: disposable-check Start: launch the selected TUI in its project folder Observe: rendered screen and incremental output Accept: the agreed ready label is visible Cleanup: close demo-tui-smoke For a one-shot build: use exec and retain its exit code.
Fictional test plan. No terminal daemon or session was started for this illustration.
Use a named PTY session rather than losing the state of an interactive terminal between turns.
Read rendered screens, wait for a specific state and assert what appeared.
Use the optional relay ledger when several workers need an inspectable handoff and acceptance gate.
The film
In 62 seconds, an agent starts a long job in the terminal, the chat moves on, and nobody knows if it finished. Forge names the session, calls it back, reads the screen, waits for ready, checks what is really there and closes only what this task opened. Captions are on the player; a transcript is below.
Your agent starts a long job in the terminal.
Then the chat moves on, and the job slides out of sight.
Down here, nobody knows if it finished, or if it passed.
Forge gives the session a name.
Call it back any time.
Read the screen. Wait for ready. Check what’s actually there.
Then close what this task opened. Only that.
It needs the Forge daemon. The doctor checks first.
On screen: Name it. Watch it. Close it.
Forge. Keep terminal work alive, visible and testable.
The terminals and jobs are a fictional example. The film shows how the skill behaves; it does not report results.
Fictional test plan. No terminal daemon or session was started for this illustration.
Run the helper’s doctor before a real operation; it can start or repair the local Forge daemon.
Create a tagged terminal, send commands or keys and inspect the returned screen or output.
Record the actual exit code or screen condition, then close the session or only the tag you created.
Fictional example
The brief Use Forge to plan a disposable TUI smoke test. Check daemon availability first, create one named session, wait for the ready screen, capture the observed state and close only the session created for this test. Do not change permissions or launch additional agents.
A background process has no inspectable session or exit result.
A tagged PTY is observed, asserted and closed after acceptance.
Persistent state and explicit assertions make terminal work reviewable.
A task needs persistent PTYs, terminal apps or cross-harness terminal supervision.
An app needs an interactive terminal.
A tagged session and observed terminal state.
Several terminal workers share an artifact gate.
A resumable ledger and verified artifact transitions.
A command or TUI task needs acceptance evidence.
Actual exit code or asserted screen state plus cleanup.
All commands below use the helper at tools/forge.py **relative to this skill's
directory** (the folder containing this SKILL.md — resolve it first and export
FORGE=<skill-dir>/tools/forge.py). It is stdlib-only python3; it talks to the
forge daemon over HTTP, so it works even where forge's MCP tools are not
connected.
For artifact-gated multi-agent work, also resolve
RELAY=<skill-dir>/tools/relay.py. It maintains a private, resumable ledger and
drives forge.py; use it instead of reconstructing relay state in chat.
Run doctor before creating or driving a Forge session. Skip it when only
reading this skill's references or reviewing source files.
python3 "$FORGE" doctor # starts daemon if down; auto-fixes node-pty spawn-helper exec bit
doctor may start a local daemon and write its MCP session cache under the
user's cache directory. If Codex blocks localhost access or an out-of-workspace
repair, request only the permission needed for that operation. Do not bypass
the Codex sandbox globally.
SID=$(python3 "$FORGE" new --name myapp --cwd /repo --tag batch1) # sleep 2 before first cmd
python3 "$FORGE" run "$SID" "npm run dev" --wait 5 # type + enter + cleaned output
python3 "$FORGE" screen "$SID" # rendered viewport — TUIs
python3 "$FORGE" read "$SID" # incremental stream — logs
python3 "$FORGE" wait "$SID" "Ready in" --timeout 29000 # regex; exit 1 on timeout
python3 "$FORGE" grep "$SID" "error" --max 20 # single words only: ANSI can
# split phrases in the buffer
python3 "$FORGE" close "$SID" # or: close-tag batch1
Rules:
wait timeouts are capped ~30s server-side — loop wait calls for longer waits.exec (real exit code, auto-cleanup), not a session: python3 "$FORGE" exec "pytest -q" --cwd /repo --timeout 300000
type + key (enter, escape, ctrl+c, up, down, tab...). key has a fixed list; other control chars via type raw bytes: "$(printf '\x11')".
reap the whole batch with close-tag.
Forge natively wraps Claude Code, Codex, and Gemini (interactive or one-shot,
optional isolated git worktrees). OpenCode is driven as a generic PTY.
Inside Codex, prefer native subagents for ordinary parallel code work. Use
Forge when the task specifically needs persistent PTYs, TUI interaction,
cross-harness agents, isolated terminal sessions, or processes that must
survive a turn. Loading this skill alone does not authorize delegation; follow
the user's request and the active AGENTS.md delegation policy.
# Fire-and-collect (blocks up to --timeout, returns output + sessionId):
python3 "$FORGE" delegate claude "fix the failing test" --cwd /repo --model haiku
python3 "$FORGE" delegate codex "review this diff" --cwd /repo # permissions not explicit
python3 "$FORGE" codex-exec "fix the failing test" --cwd /repo --sandbox workspace-write
python3 "$FORGE" delegate claude "start refactor" --cwd /repo --mode interactive
AGENT_SID=SESSION_ID # copy sessionId from the JSON result above
python3 "$FORGE" delegate claude "now add tests" --session "$AGENT_SID" # follow-up
# Long-lived interactive agents (returns session id immediately):
SID=$(python3 "$FORGE" spawn-claude --cwd /repo --prompt "audit this repo" --tag agents)
python3 "$FORGE" submit "$SID" "focus on the auth module" # Claude: Escape+Enter
SID=$(python3 "$FORGE" new --cwd /repo --program "$(command -v codex)" \
--arg=--sandbox --arg=workspace-write --tag agents) # explicit Codex permissions
python3 "$FORGE" history "$SID" # agent tool-call history
# Isolated parallel work: --worktree --branch feature/x (per agent git worktree)
# OpenCode (generic PTY; headless run is simplest):
python3 "$FORGE" exec "opencode run 'explain this codebase'" --cwd /repo --timeout 300000
Gotchas (verified):
interactive wrapper has been observed launching in YOLO mode. Do not use
those wrappers when the permission boundary matters. Use codex-exec, a
generic PTY with literal --arg=--sandbox, or relay start ... --sandbox;
reserve danger-full-access for an externally isolated environment.
screen after spawning an interactive agent. First-run trust, auth,update, or hook-review gates can consume the initial prompt; resolve the gate
and resubmit only when the prompt is absent.
codex exec refuses to run outside a git repo (--skip-git-repo-check or use a repo cwd).delegate is more reliable than screen-scraping spawn --one-shot.references/driving-claude-code.md and
references/driving-codex-opencode.md.
When the user asks agents to work together, use artifact-gated handoffs rather
than marker-only demos or independent fan-out. Read
references/multi-agent-relay.md and follow
its planner → implementer → reviewer → resolver → acceptor protocol.
Initialize the controller with the exact files and test command, then retain
the printed state path across turns:
STATE=$(python3 "$RELAY" init --cwd /repo --tag ticket-123 --goal "build X" \
--implementation-artifact src/x.py --implementation-artifact tests/test_x.py \
--test-command "python3 -m unittest discover -s tests -v")
python3 "$RELAY" preflight --state "$STATE" --harness claude --harness codex
python3 "$RELAY" start planner --state "$STATE" --harness claude
python3 "$RELAY" send planner --state "$STATE"
python3 "$RELAY" wait planner --state "$STATE" --attempts 10
python3 "$RELAY" gate planner --state "$STATE"
Repeat start → send → wait → gate for each role and harness. Codex
starts require an explicit --sandbox value; use workspace-write only for
authorized implementation roles and read-only for review. Use
status to resume after interruption, cost for provider charges, evidence
for the final report, and close unless the user wants dashboard sessions left
open. Inspect the initial and post-send screens; resolve first-run gates before
continuing. Never advance when gate exits nonzero.
Use a shared Git workspace for sequential roles and isolated worktrees for
concurrent editors. Advance only when all three gates pass: the expected file
exists, the agent emitted its completion marker, and an independent command
verified the artifact. Freeze specifications with a hash, pass raw files rather
than summaries, require a written review verdict and resolution, and leave a
final acceptance ledger. A timeout is an observation point, not permission to
advance: inspect screen, then continue waiting or intervene explicitly.
SID=$(python3 "$FORGE" new --name amp --cwd /project); sleep 2
python3 "$FORGE" type "$SID" "amplifier"; python3 "$FORGE" key "$SID" enter
# boot composes bundles: 1-3 min cold
for i in 1 2 3 4 5 6; do python3 "$FORGE" wait "$SID" "Amplifier Interactive Session" --timeout 29000 && break; done
python3 "$FORGE" type "$SID" "/status"; python3 "$FORGE" key "$SID" enter
python3 "$FORGE" wait "$SID" 'Turn: \$' --timeout 29000 # cost footer = turn complete
# Scriptable (two separate examples, not a pipe):
# amplifier run --output-format json "prompt"
# amplifier run --bundle ./bundle.md "smoke"
Watch costs: heavy bundles can reach 100k+ token system prompts (>$1/turn uncached; the
footer prints per-turn and session cost). Multi-line input: Ctrl-J newline,
Enter submits. Long-running processes (attractor pipelines, evaluation batches,
resolve instances): poll their file ledgers (checkpoint.json, state.json,
events.jsonl) with exec, not the screen.
| Topic | File |
|---|---|
| Amplifier CLI: install, run/continue/resume, sessions, bundles, settings, JSON output | references/using-amplifier.md |
| Building bundles/agents/skills/modes/tools, mount plans, conformance | references/building-with-amplifier.md |
| Condensed expert-verified builder reference (exact schemas + CLI) | references/expert-bundle-reference.md |
| Long-running loops: evaluation, attractor, resolve | references/long-running-processes.md |
| Superpowers workflow: brainstorm→plan→execute→verify→finish, debug | references/superpowers-lifecycle.md |
| Claude Code CLI: headless flags, TUI keys, state detection, sessions | references/driving-claude-code.md |
| Codex CLI + OpenCode: exec/run modes, TUI keys, auth, comparison table | references/driving-codex-opencode.md |
| Multi-agent coordination: shared-artifact relay, gates, review, resolution, acceptance | references/multi-agent-relay.md |
| Deep orchestration playbook: TUI testing method, failure modes, ledger babysitting | references/orchestration-playbook.md |
Fresher ground truth for Amplifier lives in ~/.amplifier/cache/amplifier-foundation-*/docs/
and the in-app experts (amplifier:amplifier-expert, foundation:foundation-expert,
core:core-expert).
Try one disposable terminal task, then inspect and close the session you created.
The download contains the complete skill folder. Extract it into the skills directory supported by your agent, keeping its references and license together. Or use the source installer below. Python 3.11+ is required for that installer.
git clone https://github.com/michaeljabbour/amplifier-skill-forge.git
cd amplifier-skill-forgepython3 scripts/capability.py install --dest ~/.agents/skillspython3 tools/forge.py doctorThese commands are for the optional native surface. Follow its installation guide and prerequisites; portable method installation is separate.
Keep the complete skill folder together, including its references and license. The host applies the method in your context; the skill does not start a background service.
Use Forge to plan a disposable TUI smoke test. Check daemon availability first, create one named session, wait for the ready screen, capture the observed state and close only the session created for this test. Do not change permissions or launch additional agents.Use after installing in a host that loads skill folders. Supply your own task files and review the result.
Read the guide · License · Changes · Release metadata · CONSOLIDATION
Unit and isolated integration checks cover client and relay behavior. The portable release check deliberately does not start a daemon or prove that a particular TUI works.
34 native stdlib unit tests passed; no daemon was started for acceptance.
No live model, real desktop transaction, invitation, deployment or production data migration was performed by this functional baseline.
Source and conformance checks are separate from demonstrated benefit. Comparative effectiveness and outside-user outcomes are not established by this site.
Fictional examples explain the capability. Tests check the stated behavior. Outside-user outcomes need their own evidence.