Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

One daemon, so the menu bar icon shows; say what "restart" means

Lars Talian2f443b1ce3f4
diff --git a/Cargo.lock b/Cargo.lock
index ea1ccff..ae1cadf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3608,7 +3608,7 @@ dependencies = [
[[package]]
name = "tincan"
-version = "0.5.3"
+version = "0.5.4"
dependencies = [
"anyhow",
"blake3",
diff --git a/Cargo.toml b/Cargo.toml
index 2eac656..812a4a9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "tincan"
-version = "0.5.3"
+version = "0.5.4"
edition = "2024"
description = "Team directory and message bus for coding agents across machines"
license = "MIT OR Apache-2.0"
diff --git a/README.md b/README.md
index 693f3eb..90b5b27 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,8 @@ a terminal, type their name, and they're in. The same link works for everyone an
the group chat and forget about it. `tincan link` shows it again; `tincan link --new` replaces it (removing
someone replaces it too).
-Then restart agent sessions that were already running and ask one: "who's on the team?" Plain `tincan` shows
+Agent sessions that were already open don't have tincan yet (agents load their tools at startup): reopen them
+(`claude --continue` keeps the conversation), then ask one: "who's on the team?" Plain `tincan` shows
who's around; `tincan setup` changes which agents are on tincan and how messages are handled.
There's no server and no host: every machine talks to the others directly, and any teammate's machine can let a
diff --git a/site/join/index.html b/site/join/index.html
index bb98bda..0fa3cad 100644
--- a/site/join/index.html
+++ b/site/join/index.html
@@ -50,7 +50,7 @@
</li>
<li>Type your name when it asks. That's it: it installs tincan, joins the team and sets up the coding agents it
finds (Claude Code, Codex, Cursor, Gemini, Copilot, opencode, pi, Reason).</li>
- <li>Restart agent sessions you already had open, then ask one: <em>"who's on the team?"</em></li>
+ <li>Agent sessions you already had open don't have tincan yet: reopen them (<code>claude --continue</code> keeps the conversation), then ask one: <em>"who's on the team?"</em></li>
</ol>
<div class="card">
<p class="muted">Your teammates will see your name, your machine, and what your agent sessions are working on
diff --git a/src/client.rs b/src/client.rs
index 84f2197..e9cc95d 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -156,7 +156,11 @@ async fn connect_or_start(start: bool) -> Result<UnixStream> {
if !start {
bail!("the tincan daemon isn't running");
}
- start_daemon()?;
+ // With the background service installed, the service starts it, so there is only ever its daemon.
+ let by_service = crate::setup::service_installed() && std::env::var_os("TINCAN_NO_SERVICE").is_none() && crate::setup::start_service();
+ if !by_service {
+ start_daemon()?;
+ }
for _ in 0..60 {
tokio::time::sleep(Duration::from_millis(50)).await;
if let Ok(s) = UnixStream::connect(&sock).await {
diff --git a/src/daemon/mod.rs b/src/daemon/mod.rs
index 57a6e89..f0bb0c0 100644
--- a/src/daemon/mod.rs
+++ b/src/daemon/mod.rs
@@ -55,7 +55,8 @@ pub async fn run(service: bool) -> Result<()> {
{
log(&format!("network not started: {e:#}"));
}
- if service && daemon.cfg.tray() {
+ // Normally the service's daemon; a daemon started some other way stands in for it while it runs.
+ if (service || crate::setup::service_installed()) && daemon.cfg.tray() {
tokio::spawn(tray());
}
if daemon.cfg.reason {
diff --git a/src/setup.rs b/src/setup.rs
index 7844b07..0cc184d 100644
--- a/src/setup.rs
+++ b/src/setup.rs
@@ -184,7 +184,7 @@ fn claude(exe: &Path, remove: bool, dry: bool) -> Result<Option<Report>> {
}
}
r.lines.push("added the tincan MCP server (user scope)".into());
- r.notes.push("Claude Code: new sessions pick it up; restart running ones to join tincan.".into());
+ r.notes.push("Claude Code: new sessions get tincan; reopen running ones (`claude --continue` keeps the conversation).".into());
}
Ok(Some(r))
}
@@ -467,6 +467,18 @@ pub fn service_installed() -> bool {
service_path().exists()
}
+/// Asks the service manager to start the daemon now (rather than a stray one of our own, which would hold the
+/// lock and leave the service's daemon waiting, without its menu bar icon). True if it accepted.
+pub fn start_service() -> bool {
+ let out = if cfg!(target_os = "macos") {
+ let uid = unsafe { libc::getuid() };
+ Command::new("launchctl").args(["kickstart", &format!("gui/{uid}/{}", service_name())]).output()
+ } else {
+ Command::new("systemctl").args(["--user", "start", &format!("{}.service", service_name())]).output()
+ };
+ out.is_ok_and(|o| o.status.success())
+}
+
fn service_path() -> PathBuf {
if cfg!(target_os = "macos") {
home().join(format!("Library/LaunchAgents/{}.plist", service_name()))
diff --git a/src/wizard.rs b/src/wizard.rs
index 10d7dca..d9e8bff 100644
--- a/src/wizard.rs
+++ b/src/wizard.rs
@@ -110,14 +110,14 @@ pub async fn onboard(start: Option<bool>, team: Option<String>, invite: Option<S
if start {
let url = show_link(false).await?;
- outro("Then restart agent sessions that were already running and ask one: \"who's on the team?\"")?;
+ outro("Agent sessions that were already open don't have tincan yet: reopen them (`claude --continue` keeps the conversation), then ask one: \"who's on the team?\"")?;
// Outside the frame, so the terminal copies it whole.
println!("\n{url}\n");
} else {
if let Ok(t) = Link::new(None).call::<TeamInfo>(Request::Team).await {
note("Your team", render::team(&t).trim_end())?;
}
- outro("You're in. Restart agent sessions that were already running, then ask one: \"who's on the team?\"")?;
+ outro("You're in. Agent sessions that were already open don't have tincan yet: reopen them (`claude --continue` keeps the conversation), then ask one: \"who's on the team?\"")?;
}
Ok(())
}
@@ -262,6 +262,6 @@ pub async fn invite() -> Result<()> {
pub async fn setup_agents() -> Result<()> {
intro(" tincan setup ")?;
agents_and_preferences().await?;
- outro("Restart agent sessions that were already running to pick up changes.")?;
+ outro("Agent sessions that were already open pick this up once you reopen them.")?;
Ok(())
}