talking-stick 0.1.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # Talking Stick
2
+
3
+ An MCP coordination server that lets multiple AI coding agents share a single workspace without stepping on each other. One agent holds the stick at a time; handoffs carry structured context so the next agent doesn't have to re-derive it.
4
+
5
+ **Version:** 0.1.0-alpha. Multi-process-safe (SQLite WAL), liveness-aware, no daemon. Supports Claude Code, Codex CLI, Gemini CLI, and OpenCode out of the box.
6
+
7
+ ## Quickstart
8
+
9
+ Three commands from zero to coordinated agents. No repo clone required.
10
+
11
+ ```bash
12
+ # 1. Install the `tt` binary straight from GitHub
13
+ npm i -g github:mostlydev/talking-stick
14
+
15
+ # 2. Register Talking Stick as an MCP server + install the coordination skill
16
+ # across every harness detected on your machine
17
+ tt install --all
18
+ tt install-skill --all
19
+
20
+ # 3. Restart your agent harness (Claude Code, Codex, Gemini, OpenCode).
21
+ # The `talking_stick` tools now appear in any workspace.
22
+ ```
23
+
24
+ That's it. The next time two agents `cd` into the same repo, they see each other as members of one room, take turns automatically, and hand off structured context when they release the stick.
25
+
26
+ ### Install options
27
+
28
+ | Method | Command | Notes |
29
+ |---|---|---|
30
+ | **From GitHub** | `npm i -g github:mostlydev/talking-stick` | Works today. Requires Node ≥ 22. Builds on install via the `prepare` hook. |
31
+ | **From npm registry** | `npm i -g talking-stick@alpha` | Planned — registry publish pending. |
32
+ | **From source** | `git clone … && npm install && npm link` | For contributors. |
33
+
34
+ All three produce a `tt` binary on your `PATH`. Everything else below works identically.
35
+
36
+ ### Verify without installing
37
+
38
+ Want to see exactly what `tt install`/`tt install-skill` would change before touching anything?
39
+
40
+ ```bash
41
+ tt install --all --print
42
+ tt install-skill --all --print
43
+ ```
44
+
45
+ ### Install into a subset
46
+
47
+ ```bash
48
+ tt install claude-code codex
49
+ tt install-skill gemini
50
+ ```
51
+
52
+ ### Remove
53
+
54
+ ```bash
55
+ tt uninstall --all
56
+ tt uninstall-skill --all
57
+ ```
58
+
59
+ ## What it gives your agent
60
+
61
+ Once installed, each agent harness sees these tools:
62
+
63
+ ```
64
+ list_rooms — which rooms exist under a path
65
+ join_path — join the room for this workspace
66
+ wait_for_turn — block until the stick is available, with takeover signals
67
+ heartbeat — prove liveness while holding the stick
68
+ release_stick — normal handoff to the next member, with structured Handoff
69
+ pass_stick — explicit handoff to a named agent
70
+ takeover_stick — deliberate claim when the prior holder is gone/stuck
71
+ get_room_state — authoritative state projection
72
+ get_room_events — audit log of turn transitions
73
+ ```
74
+
75
+ A workspace maps to a room — usually the `git` root or nearest project marker — so two agents `cd`'d anywhere under the same repo join the same room automatically.
76
+
77
+ The skill complements the MCP tools:
78
+
79
+ - MCP gives the harness the coordination surface
80
+ - the global skill tells the model when to join, wait, heartbeat, take over, and hand off
81
+
82
+ ## How installation works per harness
83
+
84
+ `tt install` prefers each harness's own `mcp add` subcommand when available (so the server ends up in the right user-global config with the right schema), and falls back to direct JSON editing when it isn't.
85
+
86
+ | Harness | Scope | Under the hood |
87
+ |---------------|--------------|-----------------------------------------------------------------------------|
88
+ | claude-code | user | `claude mcp add -s user talking-stick -- tt mcp` |
89
+ | codex | user | `codex mcp add talking-stick -- tt mcp` |
90
+ | gemini | user | `gemini mcp add -s user -t stdio talking-stick tt mcp` |
91
+ | opencode | user | Merge `mcp.talking-stick` into `$XDG_CONFIG_HOME/opencode/opencode.json` |
92
+
93
+ All four install into **user-global scope**, not project-local. A coordination server is only useful if every workspace your agent enters can see the same rooms — project-scoped MCP would defeat the point.
94
+
95
+ If you'd rather register it by hand, run `tt install --print <harness>` to see the exact command or JSON edit, then apply it yourself.
96
+
97
+ ## How skill installation works per harness
98
+
99
+ Talking Stick also ships with a portable `talking-stick` skill:
100
+
101
+ - Claude Code: copied or linked into `~/.claude/skills/talking-stick`
102
+ - Codex: copied or linked into `~/.codex/skills/talking-stick`
103
+ - Gemini: installed with `gemini skills install ... --scope user` or linked with `gemini skills link ... --scope user`
104
+ - OpenCode: copied or linked into `~/.opencode/skills/talking-stick`
105
+
106
+ By default, `tt install-skill` links the bundled skill into each harness so local updates are picked up immediately. Pass `--copy` if you want a standalone snapshot instead.
107
+
108
+ ## Human CLI
109
+
110
+ The same `tt` binary also works as a human CLI, useful for watching or participating in a room from your terminal:
111
+
112
+ ```text
113
+ tt list [path] # list rooms
114
+ tt join [path] [--force-new] # join the room for path
115
+ tt wait [path] [--timeout 30s] # block until your turn
116
+ tt try [path] # non-blocking claim attempt
117
+ tt state [path] # full room state
118
+ tt events [path] [--after N] [--limit N] # room event log
119
+ tt release [path] --status TEXT --next-action TEXT # normal handoff
120
+ tt pass [target] [path] --status TEXT --next-action TEXT # explicit handoff
121
+ tt takeover [path] --reason TEXT # deliberate takeover
122
+ tt mcp # run the MCP stdio server
123
+ tt install <harness...> | --all [--print] # register MCP server
124
+ tt uninstall <harness...> | --all [--print] # remove MCP server
125
+ tt install-skill <harness...> | --all [--print] [--copy] [--link] # install global talking-stick skill
126
+ tt uninstall-skill <harness...> | --all [--print] # remove global talking-stick skill
127
+ ```
128
+
129
+ Human CLI commands use a stable identity like `human:<username>`. When `tt wait` or `tt takeover` wins the turn, a small background guardian keeps the lease alive on your behalf until you release or pass it.
130
+
131
+ ## Design highlights
132
+
133
+ - **Workspace-root room resolution.** An agent at any depth under `/repo/` joins the `/repo/` room automatically. Nested rooms require explicit `force_new`.
134
+ - **Structured handoffs.** `release_stick` and `pass_stick` carry a typed `Handoff` with required `status` / `next_action` and optional `artifacts[]` pointing at specific files and line ranges.
135
+ - **Fencing tokens.** `lease_id` + `turn_id` make stale writes impossible — an agent who lost their turn cannot commit anything under the room's name.
136
+ - **Liveness-aware recovery.** Dead or crashed holders are detected with OS-level process checks; claim-timeout takeover skips the prior owner when another active member is waiting.
137
+ - **Multi-process safe.** Shared SQLite with WAL mode, `BEGIN IMMEDIATE` writes, 250 ms polling for `wait_for_turn`. No daemon required.
138
+ - **Per-call identity derivation.** MCP callers don't supply `agent_id`; the adapter derives identity from the spawning harness process. Human CLI callers get a stable `human:<username>` identity.
139
+
140
+ ## Storage
141
+
142
+ The coordination database lives at:
143
+
144
+ - Linux/macOS: `~/.local/share/talking-stick/rooms.sqlite` (or `$XDG_DATA_HOME/talking-stick/rooms.sqlite`)
145
+ - Windows: `%APPDATA%\talking-stick\rooms.sqlite`
146
+
147
+ Override with `TALKING_STICK_DATA_DIR` if you want to keep per-project state.
148
+
149
+ ## Development
150
+
151
+ ```bash
152
+ npm install
153
+ npm test
154
+ npm run typecheck
155
+ npm run build
156
+ ```
157
+
158
+ ## Read next
159
+
160
+ - [`docs/talking-stick-plan.md`](docs/talking-stick-plan.md) — full protocol, state transitions, persistence model, design rationale, and open questions.
161
+ - [`docs/ambient-presence.md`](docs/ambient-presence.md) — design sketch for shell-prompt awareness, event streaming, and agent skills that make room state ambient rather than appointment-only.
162
+ - [`skills/talking-stick/SKILL.md`](skills/talking-stick/SKILL.md) — the portable skill installed into global harness skill directories.
163
+
164
+ ## License
165
+
166
+ Unlicensed WIP. To be decided before the first release.