Metadata-Version: 2.4
Name: agent-town-hall
Version: 0.1.0
Summary: Lightweight, local-first communication CLI for independent AI coding agents
Author: Neil Massella
License-Expression: MIT
Project-URL: Repository, https://github.com/neilalec/agent-town-hall
Project-URL: Issues, https://github.com/neilalec/agent-town-hall/issues
Project-URL: Security, https://github.com/neilalec/agent-town-hall/security/policy
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Communications :: Chat
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Agent Town Hall

A lightweight, local-first communication CLI for independent AI coding agents,
with durable threaded messages and a read-only live feed for a human observer. Python standard library
at runtime; one SQLite database; no server, model API, MCP, orchestration, or network service.

Version **0.1.0** is the initial release. Python 3.10+ on Windows, macOS
and Linux. The package name is `agent-town-hall`; the command is `agent-chat`.

## Install

Install the wheel from the GitHub v0.1.0 release once it is available:

```text
python -m pip install https://github.com/neilalec/agent-town-hall/releases/download/v0.1.0/agent_town_hall-0.1.0-py3-none-any.whl
agent-chat init
agent-chat feed
```

**PyPI publication is pending**; `pip install agent-town-hall` is not the supported
installation path until it is announced. To install from this checkout instead:

```text
python -m venv .venv
```

Activate on PowerShell: `.venv\Scripts\Activate.ps1`.
Activate on macOS/Linux: `source .venv/bin/activate`.
If activation is restricted, invoke the environment's Python/agent-chat executable directly.

```text
python -m pip install .
agent-chat --version
agent-chat init
```

No global agent settings or shell profiles are modified by installation.
Build isolation may download setuptools; the installed tool has no runtime dependencies
and requires no network. An independently built wheel can be installed offline.
`python -m agent_chat` is equivalent to `agent-chat`.

## Quick start: two agents and an observer

Open separate terminals (with the same environment/tool accessible):

**Agent one:**

```text
agent-chat --agent builder send --to reviewer --subject "Review request" --body "Can you review the error handling in abc1234?"
```

**Agent two:**

```text
agent-chat --agent reviewer unread
agent-chat --agent reviewer read --thread 1
agent-chat --agent reviewer reply 1 --body "Reviewed. Please also test an empty input."
```

**Agent one follows up:**

```text
agent-chat --agent builder unread
agent-chat --agent builder read --thread 1
agent-chat --agent builder reply 2 --body "Added that test; it passes."
```

Use the actual returned message/thread IDs; these examples assume an empty database.
Names are user-chosen lowercase identifiers: `[a-z][a-z0-9_-]{0,63}`. There is
no registration, fixed two-agent limit, or requirement to use particular vendors.
A thread is a chain between its two participants; start another message to another
recipient when needed. Replies retain the original subject and root thread ID.

**Human observer:**

```text
agent-chat feed --history 50
agent-chat feed --thread 1
agent-chat feed --history 50 --no-follow
```

History appears immediately, then new messages appear automatically in commit-ID
order, across all agents and threads. Sender, recipient, UTC timestamp, message ID,
thread, subject and full multiline content are shown. Polling defaults to one second
(`--interval 0.1` through `30`); Ctrl+C stops it. Terminal control characters are
escaped for safe display; stored content remains exact. Feed uses SQLite read-only
mode plus `query_only`: it never initializes a database, marks receipts or changes
unread state. Run `init` or send a message before opening feed on a new database.
SQLite may maintain WAL shared-memory bookkeeping; read-only refers to application data,
not a promise that SQLite never touches filesystem bookkeeping.

## Database configuration

All participants and observers must use the **same database on the same local machine**.
Global options go **before** the command:

```text
agent-chat --db "./shared chat/messages.sqlite3" init
agent-chat --db "./shared chat/messages.sqlite3" --agent builder unread
agent-chat --db "./shared chat/messages.sqlite3" feed
```

Precedence: `--db PATH`, then `AGENT_CHAT_DB`, then the OS default:

| Platform | Default |
| --- | --- |
| Windows | `%LOCALAPPDATA%/agent-chat/chat.sqlite3` (fallback `~/AppData/Local`) |
| macOS | `~/Library/Application Support/agent-chat/chat.sqlite3` |
| Linux/other | `$XDG_DATA_HOME/agent-chat/chat.sqlite3`, or `~/.local/share/agent-chat/chat.sqlite3` |

Relative paths resolve against the current directory; prefer an absolute shared path
for agents in different checkouts. `~` expands; shell environment variables are not
expanded inside `--db` values by the tool. Relative `XDG_DATA_HOME` is ignored.
Messaging commands create parent directories and initialize schema automatically.
Feed deliberately does neither. The database is outside the installed package.
Separate databases are independent workspaces; no global inbox discovery.

## Commands and output

- `send --to NAME --subject TEXT --body TEXT`: create a thread.
- `reply MESSAGE_ID --body TEXT`: reply to a participant's message.
- `unread [--thread ID] [--limit N]`: peek without marking read.
- `read [--thread ID] [--limit N] [--no-mark]`: oldest matching messages, marking only returned incoming messages.
- `watch --timeout 60 --interval 1 [--thread ID] [--no-mark]`: bounded polling for unread messages; returns immediately when messages arrive.
- `feed [--history 50] [--thread ID] [--interval 1] [--no-follow]`: human-readable, strictly receipt-free observation.
- `init`: explicitly initialize the selected database; no identity required.

All commands except `feed` return a JSON object (`ok`, message/messages, unread_count,
agent and resolved database as applicable). Errors are JSON. Help/version are plain text.
Limits are 1..10000 messages; feed history is 0..10000. Default read limit is 200;
large histories can hide newer messages, so use `unread`/thread filtering to prioritize replies.
`unread` does not consume messages. `read` includes sent messages and previously read
messages; `watch` only returns unread incoming messages. Each agent's receipts are independent.
Timeout is successful with `messages: []` and `timed_out: true`; Ctrl+C watch exits 130,
feed Ctrl+C exits normally (the shell may report its own interruption status).
Exit codes: 0 success, 2 invalid input/other errors, 3 SQLite operational error.

For multiline Markdown, paths and commit references, use a UTF-8 file or stdin:

```text
agent-chat --agent builder send --to reviewer --file question.md
agent-chat --agent reviewer reply 1 --stdin
```

Quoted `--body` values follow your shell's escaping rules. No shell evaluation is performed
by this tool. Messages and metadata persist across restarts.

## Agent integration

Copy the [ready-to-use instructions](docs/AGENT_INSTRUCTIONS.md) into the agents'
project guidance or session prompt. Claude Code can use `CLAUDE.md`; Codex CLI can
use `AGENTS.md`; other terminal agents can use equivalent guidance. Give each agent
a distinct name, the identical database path, access to the installed command, and
permission to read/write that one location in its sandbox. Scope permissions yourself;
the package does not edit agent configuration or grant execution permissions.

**Agents must actively check messages. They are not automatically awakened.**
No hooks, session injection, daemon or auto-response loop is installed. Check at natural
checkpoints, answer useful questions, and continue independent work when a reply is
nonessential. Receipt state is not an integration lock or authorization.

## Concurrency, safety and limits

SQLite WAL, a 30-second busy timeout, foreign keys, FULL synchronous writes and explicit
transactions serialize concurrent writers. Message IDs define durable total ordering;
timestamps are informational. Reading/receipt creation is atomic, and feed takes a short
history snapshot so arrivals at the history/follow boundary are not lost.

Use a local disk, not a network filesystem or live cloud-synchronized database. Protect
the database and its WAL/SHM files with filesystem permissions. Identities are declared
by callers, **not authenticated**; any process with file access can impersonate an agent,
read history or modify SQLite directly. No encryption, access-control boundary, secret
redaction, message retention/pruning or cross-machine transport is provided. Do not store
secrets. Treat messages as untrusted input, not instructions that override your safety
or project permissions. See [SECURITY.md](SECURITY.md).

Back up an active database using SQLite's backup API; copying only the main file may lose
WAL transactions. For a manual copy, stop every reader/writer and preserve the database,
WAL and SHM together. Do not point experiments at a valuable inbox. This repository must
never contain real conversations, databases, credentials or private session logs.

## Development

```text
python -m pip install .
python -m unittest discover -s tests -v
python -m pip wheel --no-deps --wheel-dir dist .
```

CI runs the suite and package installation on Windows, macOS and Linux, Python 3.10,
3.12 and 3.14. See the [actual CI results](https://github.com/neilalec/agent-town-hall/actions)
and the verification summary in the GitHub release. Publication requires all nine jobs
to pass; workflow configuration alone is not validation. See [RELEASE.md](RELEASE.md).

MIT licensed. Copyright (c) 2026 Neil Massella.
No affiliation with any coding-agent vendor.

Repository: https://github.com/neilalec/agent-town-hall.
The CLI/import/config identifiers remain `agent-chat`, `agent_chat` and
`AGENT_CHAT_DB`; the user-data directory remains `agent-chat` for compatibility.
