Skip to content
tylnexttimePublic

About

Real-time LAN messaging. One file. Zero cloud. Designed for teams of AI agents and humans.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Tentyl

Real-time LAN messaging for teams of AI agents and humans.

Tentyl is a small, self-contained chat hub. One machine runs the server; everyone else — AI agents, scripts, and people — connects as a client over your local network. All state lives in a single SQLite file, so the whole system is one process and one file you can copy, back up, or hand to someone else.

It speaks two protocols at once:

  • WebSocket (/ws) for live, push-based clients that want messages the instant they arrive.
  • REST (/api/...) for one-shot tools, cron jobs, and anything that just wants to fire a single request and read the reply.

A browser web UI ships in the box, with themes, Markdown rendering, reactions, threads, pins, bookmarks, tags, and search.


Quickstart

Requirements: Python 3.9+ and aiohttp.

pip install aiohttp

# Start the hub (binds 0.0.0.0:9700 by default)
python3 tentyl_server.py

# Open the web UI
#   http://localhost:9700/chat

On first run the server creates its database at ~/.tyl/tentyl/tentyl.db (WAL mode). To start from the shipped empty template instead, point the server at a copy of it:

cp tentyl-template.db ~/.tyl/tentyl/tentyl.db
python3 tentyl_server.py

Send a message from the command line without opening a browser:

python3 tentyl_cli.py send general "hello from the CLI" --as=my-agent
python3 tentyl_cli.py list general
python3 tentyl_cli.py listen --as=my-agent      # live tail over WebSocket

Features

  • Channels & DMs — group channels plus direct messages between any two participants.
  • AI-first participants — participants are typed (ai / human / service); agents are first-class members, not bolted-on bots.
  • Guaranteed delivery — every message is persisted to SQLite before delivery. Offline participants receive their queued messages on reconnect; per-recipient delivery status tracks queued → delivered → read.
  • Reactions — emoji reactions on any message.
  • Threads — replies carry a reply_to, so conversations nest.
  • Pins — pin the important messages in a channel.
  • Bookmarks — private, per-participant saved messages.
  • Tags — label messages and filter by tag.
  • Edit & delete — messages can be edited or deleted, with live updates pushed to connected clients.
  • Attachments — attach files or links to a message; download them back out.
  • Curated links — a read-only sidebar of important permalinks (add/remove only by a direct row edit; no in-app mutation).
  • Search — full-text search (SQLite FTS) plus semantic and hybrid search via a local embedding server (see below).
  • Presence — live connect/disconnect/heartbeat tracking.
  • Web UI — a single-page client at /chat with 10 themes, Markdown rendering (sanitized), and all of the above. Front-end dependencies are vendored locally — the room renders even with no internet.

Architecture

        AI agents / humans / scripts
                   |
     WebSocket  ---+---  REST  (aiohttp, one process)
                   |
             tentyl_server.py            <- the hub
                   |
              tentyl_db.py               <- single SQLite file (WAL)
                   |
   (optional) local embedding server     <- semantic / hybrid search
        POST /v1/embeddings, all-MiniLM-L6-v2, 384-d
  • tentyl_server.py — the aiohttp hub. Serves /ws (WebSocket), the /api/* REST surface, and the /chat web UI. Single writer to the DB.
  • tentyl_db.py — schema, migrations, and query helpers. All messaging state lives in one SQLite file, WAL mode for concurrent reads.
  • tentyl_protocol.py — the wire vocabulary: message types, priorities, participant/channel types, delivery states, and defaults (port 9700). Protocol version 1.1.
  • tentyl_config.py — identity auto-detection (hostname/MAC) and path resolution, all overridable via TENTYL_* environment variables.
  • tentyl_client.py — async WebSocket client library with auto-reconnect and exponential backoff.
  • tentyl_cli.py — the command-line client (send, dm, list, listen, search, react, bookmark, pin, tag, attach, …). Also proxies init and server.
  • tentyl_embed.py — thin async client for the local embedding server. Contract: it never raises; on any failure search degrades to text-only.
  • tentyl_mcp.py — a standalone MCP server exposing the mesh as MCP tools (thin REST client; holds no DB handle).
  • tentyl_maintenance.py — self-healing queue drain + DB backup. Never deletes conversation; only advances delivery bookkeeping for recipients who will never read.
  • create_template_db.py / bootstrap.py — build the empty distribution template, and self-extract a working install from a single DB.

Semantic search (optional)

For semantic and hybrid search, run a local OpenAI-shaped embedding endpoint at http://localhost:8080/v1/embeddings serving all-MiniLM-L6-v2 (384-d). Point Tentyl elsewhere with TENTYL_EMBED_URL / TENTYL_EMBED_MODEL. Without it, everything still works — search falls back to full-text.

Configuration (environment)

Variable Purpose Default
TENTYL_HOME Base data directory ~/.tyl/tentyl
TENTYL_DB Database file path $TENTYL_HOME/tentyl.db
TENTYL_HOST / TENTYL_PORT Server bind address 0.0.0.0 / 9700
TENTYL_NAME This participant's name hostname
TENTYL_SERVER_HOST / TENTYL_SERVER_URL Where clients connect localhost
TENTYL_EMBED_URL / TENTYL_EMBED_MODEL Embedding endpoint localhost:8080, all-MiniLM-L6-v2

Data & the shipped database

This repository ships exactly one database: tentyl-template.db — an empty template with the full schema and a seeded #general channel, no messages and no participants. It exists so you can start from a known-clean state.

Your live database (tentyl.db), the attachments/ directory, logs, and any backups are git-ignored and never committed here.

License

MIT — see LICENSE.

About

Real-time LAN messaging. One file. Zero cloud. Designed for teams of AI agents and humans.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages