Persistent telnet/MUD session manager you drive by hand or with an agent. No LLM, no API key.
Project description
AutoMUD
A persistent telnet/MUD session you drive with small, discrete commands. There is no
language model and no API key inside it: the intelligence is whoever runs it, a person, a
script, or an autonomous agent. It exists because a raw telnet session is interactive and
blocking, so it cannot be held open across separate shell commands. AutoMUD keeps the
connection alive in a small background daemon and exposes simple verbs against it.
Install
pipx install git+https://github.com/CharlesCNorton/automud
Or from a clone:
pip install .
Standard library only, Python 3.8+.
Use
automud connect --demo achaea # or: automud connect <host> <port>
automud send 2 # send a line, print the reply
automud send Maelvorn
automud recv # drain any new output
automud wait --for "You are hungry" # block until output matches a regex
automud state # structured game state (GMCP) as JSON
automud status
automud close
| verb | what it does |
|---|---|
connect HOST PORT / --demo NAME |
open a session and start the daemon (--tls, --encoding ENC, --idle-exit SEC, --debug) |
send [TEXT] |
send one line, print what comes back (omit TEXT for a blank line; --stdin reads the text from stdin) |
recv |
print any new output (--nowait returns whatever is buffered immediately) |
wait --for REGEX / --gmcp PKG |
block until output matches, or a GMCP package updates |
gmcp PACKAGE [JSON] |
send a GMCP message (e.g. Char.Skills.Get) |
state [--key PKG] [--times] |
captured GMCP state as JSON (--times: seconds since each package updated) |
status |
connection, options, vitals summary |
log [--tail N] |
session transcript (last N lines with --tail) |
close |
end the session and stop the daemon |
kill |
force-stop a wedged daemon and clear the session |
Built-in demo targets: achaea, zork (telehack.com), chess (freechess.org).
Every reading verb takes --json and prints one structured object (data, prompt,
connected, elapsed, ...) instead of raw text, which is the natural mode for driving it
from a program. A minimal agent loop is just:
automud connect example.com 4000 --json
automud send look --json # {"ok": true, "data": "...", "prompt": true, ...}
automud wait --for "^You (win|die)" --max 120 --json
Exit codes: 0 ok, 1 failure, 2 usage error, 3 the operation succeeded but the
connection is closed.
Behaviour
- Smart waiting.
sendandrecvreturn as soon as the server stops talking, either a telnet GA/EOR prompt marker or output going quiet, so you never guess a sleep duration.--maxcaps the wait and--quietsets the idle threshold.waitextends this to regex/GMCP conditions. - GMCP. It negotiates GMCP and parses the structured state modern MUDs push (health,
room, exits, skills) into JSON for
state. Standard list deltas (Room.AddPlayer,Char.Afflictions.Add, ...) are applied to their lists, andComm.Channel.Textis kept as a boundedComm.Channel.History. TTYPE, NAWS and CHARSET negotiation are answered; options it does not implement (compression, MSDP, MXP) are refused rather than mishandled. - Encodings and TLS.
--encodingsets the wire charset (defaultutf-8; uselatin-1orcp437for older servers), and telnet CHARSET negotiation can switch it when the server asks.--tlswraps the connection (--tls-insecurefor self-signed certificates). - One session per name, held by a background daemon; a new
connectreplaces it, and-s NAMEgives you independent parallel sessions. Session state and transcripts live under a per-user state directory (override withAUTOMUD_DIR); the previous session's transcript is kept asout.prev.log. - Robust lifecycle. TCP keepalive is enabled, a dead daemon is detected by pid and its
stale session cleared, concurrent connects are serialized by a lock, a wedged daemon is
force-killed on reconnect (or by
kill), and--idle-exitstops a forgotten daemon.
Security
The control channel is a localhost-only socket authenticated by a per-session random
token. State lives in a per-user directory ($XDG_RUNTIME_DIR/automud, else
<tempdir>/automud-<uid> on POSIX, %TEMP%\automud on Windows) that is created 0700
and refused if another user owns it. Prefer automud send --stdin for passwords: argv is
visible to other local processes, and shell history persists. Plain telnet is cleartext;
use --tls where the server offers it.
Tests
python -m unittest discover -s tests -t .
License
MIT. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file automud-0.2.0.tar.gz.
File metadata
- Download URL: automud-0.2.0.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daf48f36ca4e1c8e7ee7e00bc3112409e71d62e580f93d7eca5522c38d9c3db9
|
|
| MD5 |
3b7546f98cfc10435bd96d6dfb520f0b
|
|
| BLAKE2b-256 |
d6e3b75e6f9d929989113104e51f426887820346e2f96c96e527ef8d3d5724b8
|
Provenance
The following attestation bundles were made for automud-0.2.0.tar.gz:
Publisher:
publish.yml on CharlesCNorton/automud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
automud-0.2.0.tar.gz -
Subject digest:
daf48f36ca4e1c8e7ee7e00bc3112409e71d62e580f93d7eca5522c38d9c3db9 - Sigstore transparency entry: 2040758278
- Sigstore integration time:
-
Permalink:
CharlesCNorton/automud@76a433d4ae145daafa58079c1765414d87b0be5b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CharlesCNorton
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76a433d4ae145daafa58079c1765414d87b0be5b -
Trigger Event:
release
-
Statement type:
File details
Details for the file automud-0.2.0-py3-none-any.whl.
File metadata
- Download URL: automud-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6a22a6f74b413a351c5263b1b43b15fe3e822b6caf24c9b5fdbcebe2d59639e
|
|
| MD5 |
19e829968f790a1d4eb4f95dcb424333
|
|
| BLAKE2b-256 |
0120390311ae8fa26b780ad9b6d379b52274fb0d1538c2536873f02ed6b42e78
|
Provenance
The following attestation bundles were made for automud-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on CharlesCNorton/automud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
automud-0.2.0-py3-none-any.whl -
Subject digest:
d6a22a6f74b413a351c5263b1b43b15fe3e822b6caf24c9b5fdbcebe2d59639e - Sigstore transparency entry: 2040758735
- Sigstore integration time:
-
Permalink:
CharlesCNorton/automud@76a433d4ae145daafa58079c1765414d87b0be5b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CharlesCNorton
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76a433d4ae145daafa58079c1765414d87b0be5b -
Trigger Event:
release
-
Statement type: