# elelem-socket

> Adds elelem --sock PATH, which serves a session on a Unix socket for another terminal, an editor or a script.

Maturity: alpha. Install: `gem install elelem-socket`. Source: https://github.com/elelem-sh/socket/


Serves a session on a Unix socket, so you can leave it running and talk to
it from another terminal, an editor or a script.

## Install

```bash
gem install elelem-socket
mkdir -p ~/.agents/plugins
echo 'require "elelem/socket"' > ~/.agents/plugins/socket.rb
```

[`elelem-shell`](https://elelem.sh/plugins/shell/) installs and loads it.

## Use

```bash
elelem --sock /tmp/elelem.sock
elelem --sock /tmp/elelem.sock "what changed?"
```

With no prompt, `--sock PATH` serves the session there. With a prompt, it
asks the session there and prints the reply.

One client at a time talks to the session; another is told `busy`. The
conversation carries over between clients, and a client that hangs up
mid-turn can reconnect once the turn ends.

> **Warning:** Connecting gives the powers of a shell. The socket is open to
> its owner alone (mode 0600), and it is removed when the session ends.

## Limits

- One client at a time.
- A socket file left by a crash is cleaned up on the next start.


Canonical: https://elelem.sh/plugins/socket/

