--- name: cpipe description: Use cpipe to discover, inspect, and send commands to named-pipe tool servers. allowed-tools: [Bash] --- Use `cpipe` to interact with `ToolServer` instances (servers following the `tool-*` pipe naming convention). Always activate the `named-pipes` conda environment first. ```bash conda activate named-pipes ``` ## Discover running servers ```bash cpipe --list # list tool pipes (tool-* convention) under /tmp (fast, no process scan) cpipe --pid # same, but also show which PIDs have each pipe open cpipe --clear # delete orphaned tool pipes (no live process) under /tmp ``` Pass an optional directory to search a different root (e.g. `cpipe --list /var/tmp`). ## Send commands to a tool server ```bash cpipe ``` `` is either a bare tool name (e.g. `chat`) — which resolves to `/tmp/tool-chat` — or a full pipe path. `` is the command to send. ### Built-in commands every tool supports ```bash cpipe chat ping # health check — responds with "pong" cpipe chat get_state # current state (e.g. "running", "loading", "idle") cpipe chat get_description # one-line description of when to use the tool cpipe chat get_help # full help text (the tool's HELP.md): commands, args, events cpipe chat get_config # current configuration (model, voice, pipeline, ...) cpipe chat list_interfaces # interfaces the tool implements, e.g. ["base", "chat"] cpipe chat get_interface -j '{"name":"chat"}' # machine-readable command/event schema cpipe chat stop # shut the server down gracefully ``` Before using an unfamiliar tool, read its `get_help` output — it lists the tool's own commands and the exact JSON fields they take. Unknown commands reply with `unknown command ''`. ### Sending data ```bash cpipe tts speak -d "Hello there." # -d / --data sets the "data" field cpipe tts speak "Hello there." # positional DATA works too cpipe chat chat -j '{"messages":[{"role":"user","content":"Hello"}]}' # merge extra top-level JSON fields ``` `DATA` is parsed as JSON if it can be, otherwise sent as a string, and always lands in the `"data"` field. Commands that take named arguments (e.g. `chat` needs `messages`) must use `-j`, which merges a JSON object into the request at the top level. ### Streaming responses `cpipe` detects streaming automatically. Chunks are printed as they arrive; the command exits after the final `{"done": true}` sentinel. ```bash cpipe chat chat -j '{"messages":[{"role":"user","content":"Tell me a joke"}]}' ``` ## Protocol flags | Flag | Effect | |---|---| | `--no-subscribe` | Skip the subscribe/unsubscribe handshake entirely | | `--tool` / `--basic` | Force the tool protocol or the basic `SUBSCRIBE`/`SUBSCRIBED` protocol (normally chosen from the pipe name) | | `-n` / `--no-wait` | Fire-and-forget; do not wait for a response | | `-t SECS` / `--timeout SECS` | Response timeout in seconds (default: 5.0) | | `-v` / `--verbose` | Print sent messages and status to stderr | ## Start servers Servers block their terminal, so run them in the background (or ask the user to start them): ```bash cpipe --serve chat # LLM on /tmp/tool-chat cpipe --serve tts # TTS on /tmp/tool-tts (--tts-model phonon, --no-speakers, ...) cpipe --serve stt # STT on /tmp/tool-stt (--asr, --vad, --turn, --denoiser, ...) cpipe --tts-models # TTS model catalogue with licences cpipe --stt-components # STT pipeline components ``` Model-backed servers load in the background; poll `get_state` (or wait for `idle` / `ready`) before sending work. `cpipe` with no arguments opens an interactive TUI — don't run that from a non-interactive shell. `cpipe` is one-shot. For continuous streams (e.g. live STT transcripts), write a small `named_pipes.ToolClient` script that stays subscribed. ## Examples ```bash cpipe --list # what's running? cpipe chat get_description # what does this tool do? cpipe chat get_help # full API reference cpipe tts text -d "Hello, world" # send a text chunk to the TTS server cpipe tts flush # drain the TTS buffer cpipe tts speak -d "Build finished." -n # speak a whole sentence cpipe tts cancel -n # stop speaking now cpipe tts set_voice -j '{"voice":"af_bella"}' # change voice (see list_voices) cpipe --tts-models # TTS models and their licences cpipe chat stop # shut down the LLM server cpipe --clear # clean up stale pipes after a crash ```