bootstrap and turn-loop build stateful sessions against the mirrored inventories. The five remote-mode commands simulate different connection modes supported by the Claude Code agent harness.
bootstrap
Builds a full runtime-style session report from the mirrored inventories for a given prompt.
Arguments
The prompt to use as the session seed. The runtime routes this prompt, executes matched command and tool shims, streams a turn event sequence, and persists the session.
Maximum number of routed matches to consider when selecting commands and tools to execute.
Output sections
bootstrap prints the RuntimeSession.as_markdown() output, which contains the following sections:
| Section | Contents |
|---|---|
| Context | Python file count and archive availability flag from build_port_context() |
| Setup | Python version, implementation, platform, and test command |
| Startup Steps | Six-step prefetch and init sequence performed by WorkspaceSetup.startup_steps() |
| System Init | System init message generated by build_system_init_message(trusted=True) |
| Routed Matches | Each match formatted as [kind] name (score) — source_hint |
| Command Execution | Output messages from each matched command shim’s execute() call |
| Tool Execution | Output messages from each matched tool shim’s execute() call |
| Stream Events | Raw stream event types emitted by stream_submit_message() |
| Turn Result | The formatted output of the final submit_message() turn |
| Persisted session path | File path where the session JSON was saved under .port_sessions/ |
| History log | Timestamped log of context, registry, routing, execution, and session store events |
Example
turn-loop
Runs a small stateful multi-turn loop against the mirrored runtime.
Arguments
The initial prompt. Turn 1 uses this prompt verbatim. Subsequent turns append
[turn N] to form the turn prompt.Maximum number of routed matches to use when selecting commands and tools. Routing runs once before the loop begins; all turns share the same matched command and tool names.
Number of turns to execute. The loop stops early if any turn’s
stop_reason is not completed.When set, each turn’s output is serialised as JSON instead of plain text.
Per-turn output format
Each turn is printed as:| Reason | Description |
|---|---|
completed | Turn processed normally; the loop continues to the next turn |
max_turns_reached | The engine’s internal turn counter hit max_turns before the prompt was processed |
max_budget_reached | Projected token usage exceeded the engine’s max_budget_tokens (default 2000) |
Example
remote-mode
Simulates remote-control runtime branching.
Identifier for the remote control target (hostname, URL, or arbitrary label).
ssh-mode
Simulates SSH runtime branching.
SSH target string (e.g.
user@hostname).teleport-mode
Simulates Teleport runtime branching (resume or create a Teleport session).
Teleport node name or session identifier.
direct-connect-mode
Simulates direct-connect runtime branching.
Target label for the direct connection (e.g. a Unix socket path or named pipe).
deep-link-mode
Simulates deep-link runtime branching.
Deep-link URI or target identifier (e.g.
claude://open?session=abc123).Remote mode output format
remote-mode, ssh-mode, and teleport-mode return a RuntimeModeReport with three fields:
| Field | Type | Description |
|---|---|---|
mode | string | One of remote, ssh, teleport |
connected | boolean | Always True in the current placeholder implementation |
detail | string | Human-readable description of the prepared connection |
direct-connect-mode and deep-link-mode return a DirectModeReport:
| Field | Type | Description |
|---|---|---|
mode | string | One of direct-connect, deep-link |
target | string | The target argument as provided |
active | boolean | Always True in the current placeholder implementation |