Skip to content

Multiplexer and Decorator

tether.multiplexer

A command that is not enabled returns a self-healing error (unknown_cmd, no exception) listing the enabled tools and how to enable more (--tools, SDK tools=[...], skill tools:). A known built-in that is merely disabled (bash, web, edit, mem, skill, agent) is reported as disabled, not unknown. The text lives in the error response (history), never in the system prompt prefix.

Virtual CLI Multiplexer (act(cmd, stdin)) with 9B quirk normalization and JIT --help.

Multiplexer

Routes act(cmd, stdin) invocations across registered tools.

toolbox_index()

Render the ultra-compact 1-line-per-tool directory for the system prompt.

execute(cmd, stdin=None) async

Execute a virtual CLI command and return a DispatchResult.

register_normalizer(fn)

Append a command-quirk normalizer (str -> str) that runs after the built-in ones.

Use it to teach Tether a model's habit once for every model, e.g. stripping a vendor prefix. It must be deterministic and return its input unchanged when it does not apply.

normalize_cmd(raw_cmd)

Normalize common small-model CLI syntax quirks deterministically.

split_heredoc(cmd)

Split a trailing shell heredoc off cmd into stdin (models write edit ... <<'EOF').

unescape_literal_newlines(stdin)

Unescape literal \n/\t when a small model sent a whole payload on one line.

split_cli(cmd)

Split a CLI command string using POSIX shlex with graceful fallback on unclosed quotes.

tether.decorator

@tool decorator introspection and ultra-compact JIT --help synthesis.

ToolSpec dataclass

index_line()

Return a 1-line summary (strictly <= 12 tokens) for the static system prompt.

help_text()

Return ultra-compact --help output (target <= 60 tokens).

invoke(args, stdin=None) async

Parse CLI arguments against ParamSpecs and invoke the underlying function.

build_tool_spec(fn, *, name=None, description=None, custom_help=None, raw_dispatch=False)

Introspect a Python function into a ToolSpec.

tool(fn=None, *, name=None, namespace=None, description=None)

Decorator to register a sync or async Python function as a Tether virtual CLI tool.