pranali प्रणाली

pranali

प्रणाली “channel, conduit” · MCP pipe for AI agents

One tiny pipe from any AI agent to a tool's long-running daemon.

आपूर्यमाणमचलप्रतिष्ठं समुद्रमापः प्रविशन्ति यद्वत् ।
तद्वत्कामा यं प्रविशन्ति सर्वे स शान्तिमाप्नोति न कामकामी ॥

As the waters enter the ocean, which is filled from every side yet stays unmoved in its place, so the one whom all desires enter attains peace, not the one who desires desires. Bhagavad Gītā 2.70
InstallSource on GitHubWhat's new in v0.1.0
v0.1.0 latest1 releaseMIT license

#pranali

Pranali (प्रणाली) is Sanskrit for "channel, conduit": the channel every agent's stream runs through to reach a tool's daemon.

One tiny stdio pipe from any AI agent's MCP client to a tool's long-running daemon. An agent (Claude Code, Codex, Gemini CLI, anything that speaks MCP over stdio) runs pranali narada; pranali joins its stdin and stdout to narada's daemon at $XDG_RUNTIME_DIR/narada/mcp.sock, and keeps the agent's session alive across the daemon's restarts.

It replaces four per-tool pipes that did the same job (narada's, darshan's, sutradhar's and ekatva's) with one implementation, one hello and one reconnect state machine. Rust, standard library only: a ~400 KB binary that sits at about 170 KB of its own memory and never wakes up while idle.

#Install

From kosha:

kosha install pranali

Or from source (Rust 1.88 or newer):

make install          # builds and installs to ~/.local/bin/pranali
make install PREFIX=/usr/local

#Use it in an agent

Point the agent's MCP server at pranali instead of the tool:

# Codex: ~/.codex/config.toml
[mcp_servers.narada]
command = "pranali"
args = ["narada"]

Claude Code (.mcp.json or ~/.claude.json):

{ "mcpServers": { "narada": { "command": "pranali", "args": ["narada"] } } }
pranali <tool> [--agent NAME] [--fallback CMD ARGS...]

The socket is $PRANALI_SOCKET if set, else $XDG_RUNTIME_DIR/<tool>/mcp.sock, else ${XDG_STATE_HOME:-~/.local/state}/<tool>/run/mcp.sock. A daemon run with a state directory of its own (darshan's DARSHAN_HOME, say) is reached by setting PRANALI_SOCKET in the agent's MCP config env. pranali refuses a socket whose directory isn't yours alone (a real directory owned by you, mode 0700: never a shared /tmp), and paths over 107 bytes.

#How it works

The full contract, daemon side included, is docs/PROTOCOL.md. In short:

  1. Hello. pranali sends one JSON line before MCP: who it is and where the agent runs (tool, agent, pid, cwd, and TMUX, TMUX_PANE, DISPLAY, WAYLAND_DISPLAY, XAUTHORITY, PATH when set), so the daemon can name the agent in its log, open approval popups in the agent's terminal and run commands with its PATH. The daemon answers {"pranali":1,"ok":true} (or ok:false and why). Then the connection is plain MCP, one JSON-RPC message per line.
  2. Restarts. systemd owns the socket (<tool>-mcp.socket), so during a restart connections wait in its backlog. If the daemon goes away anyway, every call it had gets an error saying it may or may not have happened (code -32001); pranali reconnects (100 ms doubling to 2 s, rounds of 60 s), replays the agent's initialize under its own id, waits for its answer (and swallows it), replays initialized, and only then sends what queued up meanwhile. The agent never re-initializes. Calls that only queued and never reached a daemon get -32002 ("not run, retry it") instead. A daemon that accepts and closes, or that crashes right after the handshake, can't make it spin: the backoff only resets once a reconnected session has stayed up for 10 s.
  3. Endings. pranali exits only when the agent closes stdin: it half-closes the socket and still copies the daemon's last answers for up to 5 s. A closed stdout ends it quietly.

#Numbers

Measured on the release build against the test suite's fake daemon (cargo test --release -- --ignored --nocapture measure):

binary410 KB, stripped, std only
idle memoryRss 2.4 MB (mostly shared libc), Pss_Anon 172 KB
idle wakeups0 over 10 s (every thread blocked in a read)
start to first initialize answer5.0 ms median of 20

#Develop

make check    # cargo fmt --check, clippy -D warnings, all tests
make build    # target/release/pranali
python3 scripts/build-site.py   # the website in docs/, after README or CHANGELOG changes

The tests run pranali against a fake daemon in their own directories under target/tmp (via PRANALI_SOCKET): hello, refusals, two pipes at once, a daemon killed mid-call, accept-then-close, a failed round, the stdin drain, the fallback, the directory check, megabyte lines, string and number ids. PRANALI_ROUND_MS and PRANALI_DRAIN_MS shorten the 60 s round and the 5 s drain for them; nothing else should set them.

#License

MIT