Multiplexer and Decorator¶
For: people writing their own tools or debugging why a command was or was not understood. After this page you know how act(cmd, stdin) is parsed, which mistakes are repaired for the model and how @tool turns a Python function into a command.
The multiplexer is the single door between the model and everything it can do. It splits cmd into a command and arguments, repairs trivial quirks, and answers a wrong call with a short usage hint instead of an error. The decorator builds the usage text from your function's type hints and docstring. Why there is only one action is in One action for everything; how to write a tool is in Give the model a tool of your own.
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
¶
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
¶
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.