Skip to content

feat(rooms): default-on #general sidecar — every join lands in BOTH rooms (closes #121) - #122

Merged
joelteply merged 1 commit into
canaryfrom
feat/general-sidecar
Apr 26, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/general-sidecar

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Closes #121.

Bare airc join from a project repo now subscribes the tab to both the auto-scoped project room (#useideem from useideem/*, #cambriantech from CambrianTech/*) and #general — simultaneously. This realizes the IRC mental model Joel called out: agents in their natural domain-specific room AND the lobby, so cross-project AI-to-AI coordination happens through the substrate without forcing tabs to leave their project context.

"all ais are in general AND their own domain specific room ... seems more ideal." — Joel, 2026-04-26

How it works

Sidecar-scope architecture (Option B from the design discussion in #121):

  • Primary scope at $cwd/.airc hosts/joins the project room as today.
  • A child airc connect --room general is forked with AIRC_HOME=$primary.general. Same visible nick (AIRC_NAME passed through), independent ssh_key + peer records.
  • Recursion prevented via AIRC_GENERAL_SIDECAR=1 (the spawned sidecar reads this at the top of cmd_connect to skip its own sidecar).
  • Stdout naturally distinguishes via the python formatter's [#room] prefix — [#useideem] vhsm: hi and [#general] continuum-b741: hi interleave through the same Monitor.
  • cmd_teardown extended to clean both scopes (primary's gist + sidecar's gist + sidecar's pidfile).

Flag semantics — split from prior alias

Flag Behavior
(none) Auto-scoped project room + #general sidecar (NEW default)
--room NAME Explicit room + #general sidecar
--room-only NAME Explicit room only, no sidecar
--no-general NEW — project room only (skip sidecar)
--no-room Legacy 1:1 invite mode (no substrate at all)
AIRC_NO_GENERAL=1 env var equivalent of --no-general

The old --no-general/--no-room alias is gone. Test harness + integration READMEs + /list skill rewritten to --no-room for legacy semantics; functionally equivalent to old behavior.

Tests

scenario_general_sidecar_default — 12 assertions, all green:

  • Default-on: sidecar banner fires, .general scope dir created with room_name=general, sidecar PID appended to primary airc.pid and alive
  • Teardown: primary's teardown reaps sidecar bash + pidfile
  • --no-general: no sidecar banner, no .general scope
  • --room-only NAME: hosts named room, no sidecar

All existing scenarios still pass (the global AIRC_NO_GENERAL=1 in the test harness keeps them sidecar-free).

Test plan

  • bash test/integration.sh general_sidecar_default — 12/12
  • bash test/integration.sh auto_scope — still 4/4 (regression check)
  • bash test/integration.sh resume_prints_connected_banner — still 2/2
  • Mac dogfood: bare airc join from useideem/* repo lands in both #useideem and #general; events from both interleave through the Monitor
  • WSL/Windows dogfood (next)

Out of scope (future PRs)

  • airc msg --room NAME for cross-room broadcast from one tab
  • airc dm @peer auto-resolving peer's current host across subscribed rooms
  • Multi-room daemon mode

🤖 Generated with Claude Code

…ooms (closes #121)

Bare 'airc join' from a project repo now subscribes the tab to BOTH
the auto-scoped project room (e.g. #useideem from useideem/*) AND
#general simultaneously. This is the IRC mental model Joel called for:
agents in their natural domain-specific room AND the lobby, so cross-
project AI-to-AI coordination happens through the substrate without
requiring tabs to leave their project context.

Joel, 2026-04-26: 'all ais are in general AND their own domain
specific room ... seems more ideal' / 'cross-pollinate between projects
and ais can always leave any room or join or create others' /
'agents in charge of their own airc, intuitively, esp since it is so
similar to IRC.'

## Implementation: sidecar-scope sibling

The primary scope at AIRC_WRITE_DIR runs the project room as today.
A child 'airc connect --room general' is forked with AIRC_HOME pointed
at a sibling .general scope. The sidecar shares the visible nick
(AIRC_NAME passed through) but has its own ssh_key and peer records.
Recursion is prevented by AIRC_GENERAL_SIDECAR=1 which the spawned
sidecar reads at the top of cmd_connect to skip its own sidecar.

Stdout naturally distinguishes events: the python formatter prefixes
each line with [#room_name], so '[#useideem] vhsm: ...' and
'[#general] continuum-b741: ...' interleave through the same Monitor.

cmd_teardown extended to clean BOTH scopes — primary's gist (existing
logic) AND sidecar's gist + pidfile. Without this, killing the
primary would orphan the #general gist and leave a sidecar process
under the kernel reaper.

## Flag semantics (split from old --no-general alias)

  --no-room        : disable substrate entirely; legacy 1:1 invite
                     mode (use_room=0). Same as before. spawn_host etc
                     in test harness uses this.
  --no-general     : NEW — keep the project room but skip the lobby
                     sidecar. Project-only focus mode. Previously this
                     was an alias for --no-room — those have different
                     meanings now and there's no graceful overlap.
  --room-only NAME : combo — explicit project room + no sidecar.
                     Equivalent to --room NAME --no-general.
  AIRC_NO_GENERAL=1: env-var equivalent of --no-general. The test
                     harness exports this globally (only sidecar tests
                     unset it for their scope).

Migration: spawn_host and other --no-general usages in test/integration.sh
+ integration READMEs + skills/list/SKILL.md were rewritten to use
--no-room. Functionally equivalent to old behavior; just renamed for
the new semantic split.

## Tests

scenario_general_sidecar_default — 12 assertions:
  - Default-on: sidecar banner fires, .general scope dir created with
    room_name=general, sidecar PID is appended to primary's airc.pid
    and is alive.
  - Teardown: primary's teardown reaps the sidecar bash + pidfile.
  - --no-general: no sidecar banner, no .general scope dir.
  - --room-only NAME: hosts the named room, no sidecar.

All other existing tests still pass (the global AIRC_NO_GENERAL=1
suppresses sidecar in their scope; verified scenario_auto_scope and
scenario_resume_prints_connected_banner explicitly).

## Next (out of scope here)

- airc msg --room <name> for cross-room broadcast from a single tab
- airc dm @<peer> auto-resolving the peer's current host across rooms
- Multi-room as the default for daemon installs (right now opt-in via
  the same --no-general semantics on the daemon's connect line)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 26, 2026 17:40
@joelteply
joelteply merged commit 3718d6b into canary Apr 26, 2026
1 check passed
@joelteply
joelteply deleted the feat/general-sidecar branch April 26, 2026 17:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements issue #121’s default multi-room presence by making airc join/connect subscribe to the auto-scoped project room plus a #general “sidecar” running in a sibling scope, and updates docs/tests for the new flag semantics.

Changes:

  • Add a #general sidecar subprocess + sidecar-scope cleanup in airc, with new flag semantics (--no-general, --room-only, --no-room).
  • Update integration test harness to globally disable the sidecar (opt-in per scenario) and add a dedicated sidecar scenario.
  • Refresh skills + integration READMEs to replace legacy --no-general (old alias) with --no-room.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
airc Adds sidecar spawn helper, new room/sidecar flags, and teardown cleanup for sidecar scope.
test/integration.sh Disables sidecar by default for tests; adds scenario_general_sidecar_default; updates legacy flag usage.
skills/join/SKILL.md Updates join skill contract/docs for new default (project room + #general) and opt-outs.
skills/list/SKILL.md Updates legacy invite-mode wording to --no-room.
README.md Updates legacy fallback wording to --no-room.
integrations/*/README.md Updates legacy invite-mode instructions to use --no-room.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread airc
Comment on lines +847 to +852
[ -n "$_primary_name" ] && _env_args+=("AIRC_NAME=$_primary_name")
# Unset primary's AIRC_PORT so sidecar doesn't fight for the same port —
# primary has it bound already, sidecar's auto-bump-loop would land on
# +1, but better to start the sidecar from the canonical default and
# let it find its own free port without the conflict-detect dance.
( env -u AIRC_PORT "${_env_args[@]}" "$0" connect --room general ) &

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sidecar subprocess doesn’t inherit the user’s --no-gist choice from the primary. If the user runs airc connect --no-gist ..., the primary won’t publish, but the sidecar still runs connect --room general with use_gist=1 and may create/delete a #general gist unexpectedly. Consider propagating the no-gist intent into the sidecar invocation (e.g., pass --no-gist when use_gist=0, or add an env toggle the sidecar can read).

Suggested change
[ -n "$_primary_name" ] && _env_args+=("AIRC_NAME=$_primary_name")
# Unset primary's AIRC_PORT so sidecar doesn't fight for the same port —
# primary has it bound already, sidecar's auto-bump-loop would land on
# +1, but better to start the sidecar from the canonical default and
# let it find its own free port without the conflict-detect dance.
( env -u AIRC_PORT "${_env_args[@]}" "$0" connect --room general ) &
local _sidecar_cmd=("$0" connect --room general)
[ -n "$_primary_name" ] && _env_args+=("AIRC_NAME=$_primary_name")
[ "${use_gist:-1}" = "0" ] && _sidecar_cmd+=(--no-gist)
# Unset primary's AIRC_PORT so sidecar doesn't fight for the same port —
# primary has it bound already, sidecar's auto-bump-loop would land on
# +1, but better to start the sidecar from the canonical default and
# let it find its own free port without the conflict-detect dance.
( env -u AIRC_PORT "${_env_args[@]}" "${_sidecar_cmd[@]}" ) &

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +4223 to +4226
# kill there. Without this, killing the primary leaves an orphan
# #general gist on the gh account AND an orphan sidecar process that
# the primary's pidfile descendant-walk wouldn't catch (sidecar's
# bash isn't a child of cmd_teardown — it was forked detached).

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says the primary pidfile descendant-walk wouldn’t catch the sidecar process, but the sidecar PID is appended to the primary scope’s airc.pid in spawn_general_sidecar_if_wanted, so it will be included in the main scope-aware kill. Updating the comment would avoid future confusion about why the extra sidecar-scope cleanup is needed (it’s mainly for sidecar gist + sidecar pidfile cleanup / flush semantics, not because teardown can’t see the PID).

Suggested change
# kill there. Without this, killing the primary leaves an orphan
# #general gist on the gh account AND an orphan sidecar process that
# the primary's pidfile descendant-walk wouldn't catch (sidecar's
# bash isn't a child of cmd_teardown — it was forked detached).
# cleanup there as well. The sidecar PID is also appended to the
# primary scope's airc.pid, so the main scope-aware kill can still
# reach it; this extra block exists mainly to clean up sidecar-
# specific gist/pidfile state and to preserve sidecar-scope flush
# semantics.

Copilot uses AI. Check for mistakes.
Comment thread test/integration.sh
Comment on lines +2281 to +2286
grep -qE '^[0-9]+$' "$home1/airc.pid" \
&& pass "primary airc.pid has at least one entry" \
|| fail "primary airc.pid empty or malformed"

# Sidecar bash should be alive
local _sc_pid; _sc_pid=$(tail -1 "$home1/airc.pid" 2>/dev/null)

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this scenario the primary process is in HOST mode, where airc writes multiple PIDs on a single line ("$$ $PAIR_PID $_hb_pid" > airc.pid). grep -qE '^[0-9]+$' "$home1/airc.pid" will fail even when the pidfile is valid. Consider validating by extracting numeric tokens (e.g. tr ' ' '\n') or by checking the first field is numeric instead of requiring a whole line of digits.

Suggested change
grep -qE '^[0-9]+$' "$home1/airc.pid" \
&& pass "primary airc.pid has at least one entry" \
|| fail "primary airc.pid empty or malformed"
# Sidecar bash should be alive
local _sc_pid; _sc_pid=$(tail -1 "$home1/airc.pid" 2>/dev/null)
tr ' ' '\n' < "$home1/airc.pid" 2>/dev/null | grep -qE '^[0-9]+$' \
&& pass "primary airc.pid has at least one entry" \
|| fail "primary airc.pid empty or malformed"
# Sidecar bash should be alive
local _sc_pid; _sc_pid=$(tr ' ' '\n' < "$home1/airc.pid" 2>/dev/null | grep -E '^[0-9]+$' | tail -1)

Copilot uses AI. Check for mistakes.
Comment thread skills/join/SKILL.md
Comment on lines +17 to +21
Defaults (issue #121 multi-room presence):
- `airc join` (no args) puts you in **two rooms simultaneously**:
1. The **project room** auto-scoped from the current cwd's git remote org (e.g. `useideem/authenticator` → `#useideem`, `cambrian/continuum` → `#cambriantech`). If no git remote, falls back to `#general`.
2. `#general` (the lobby) — runs as a **sidecar** in a sibling scope so AIs cross-pollinate between projects. The visible nick is shared across both rooms.
- Auto-discovery: if a room already has a host on your gh account, the new tab joins. Otherwise it becomes the host.

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs state that airc join always puts you in two rooms simultaneously, but the implementation intentionally skips spawning a sidecar when the primary room resolves to general (fallback when there’s no git remote / auto-scope). In that case you’ll only have a single #general subscription. Suggest softening this wording (e.g. “project room + #general when the project room is not already general”).

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +1509 to +1512
# used to alias --no-room (disable substrate entirely); the
# behaviors are now distinct because dual-room presence is
# default and users need a way to opt out of just the lobby
# part without dropping back to legacy 1:1 invites.

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that --no-general no longer disables the substrate (it only disables the #general sidecar), there are still user-facing strings later in cmd_connect that instruct --no-general for the legacy 1:1 flow. For example, the “Host a new mesh” hint printed when multiple invite gists exist currently suggests ... airc connect --no-general, but the correct flag is --no-room. Those messages/comments should be updated to match the new flag semantics to avoid sending users into the wrong mode.

Suggested change
# used to alias --no-room (disable substrate entirely); the
# behaviors are now distinct because dual-room presence is
# default and users need a way to opt out of just the lobby
# part without dropping back to legacy 1:1 invites.
# no longer aliases --no-room. Users who want the legacy 1:1
# flow / no substrate behavior must use --no-room; --no-general
# now only opts out of the #general sidecar while preserving the
# project room presence.

Copilot uses AI. Check for mistakes.
Comment thread test/integration.sh
Comment on lines +22 to +27
# Suppress the #general sidecar globally for the test suite (issue #121).
# Default behavior on canary spawns a sibling .general scope alongside
# every airc connect; for tests that don't care about lobby presence
# the sidecar adds latency, port pressure, and stdout noise. Tests that
# DO exercise sidecar behavior `unset AIRC_NO_GENERAL` for their scope.
export AIRC_NO_GENERAL=1

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new sidecar scope layout, sidecar pidfiles live at paths like /tmp/airc-it-*/state.general/airc.pid, but cleanup_procs currently only walks /tmp/airc-it-*/state/airc.pid. If a sidecar process survives (e.g. a teardown regression, or the scenario fails mid-run), cleanup_dirs will delete the pidfile without killing the sidecar, leaving an orphan process that can interfere with later scenarios. Consider expanding the pidfile glob to also include sibling *.general (or more generally state*/airc.pid).

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +815 to +818
[ "$room_name" = "general" ] && return 0
[ "$use_room" = "1" ] || return 0

local _primary_scope="$AIRC_WRITE_DIR"

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spawn_general_sidecar_if_wanted decides whether to spawn based on the local room_name variable. On resume, room_name can be auto-scoped from the current cwd before the resume branch runs, which can diverge from the persisted room in $AIRC_WRITE_DIR/room_name (e.g., resuming a prior #general session from inside a repo). This can cause the sidecar to be spawned when it shouldn’t (double-joining #general) or skipped when it should run. Prefer checking the persisted room (read $AIRC_WRITE_DIR/room_name when present) or explicitly setting room_name from that file before calling the sidecar helper on the resume/join/host paths.

Suggested change
[ "$room_name" = "general" ] && return 0
[ "$use_room" = "1" ] || return 0
local _primary_scope="$AIRC_WRITE_DIR"
local _primary_scope="$AIRC_WRITE_DIR"
local _effective_room="${room_name:-}"
if [ -f "$_primary_scope/room_name" ]; then
_effective_room=$(cat "$_primary_scope/room_name")
fi
[ "$_effective_room" = "general" ] && return 0
[ "$use_room" = "1" ] || return 0

Copilot uses AI. Check for mistakes.
joelteply added a commit that referenced this pull request Apr 26, 2026
…pe (#123)

fix(send): honor --room <name> flag instead of letting it fall through to body

Pre-fix: 'airc send --room general "lobby ping"' (or 'airc msg --room')
was treated by the argparse as 'first positional = --room', then
'second positional = general', and the message body became literal
'--room general lobby ping'. Silent mis-routing to the current scope's
room. Caught by vhsm-Claude on 2026-04-26 dogfooding the #122
multi-room sidecar: 'BOTH --room general and --room cambriantech from
your tab arrived at my monitor as literal text starting with --room
<name> in [#useideem]. the flag is being treated as message body.'

This is exactly the evidence-eating shape the project rejects: send
returns 0, message LANDED, but in the wrong room. From the receiver's
side it looks like a sender mistake; from the sender's side it looks
like the substrate works. Neither knows the room got crossed.

Fix:
- Parse --room <name> at the top of cmd_send (before the @-or-not
  positional check). If --room names a sibling sidecar scope under the
  .airc.<name> convention, re-exec ourselves with AIRC_HOME pointing
  at that scope so the rest of the function runs there.
- If --room names a room we're NOT subscribed to, die loudly with a
  list of rooms we ARE in. Never fall through silently.
- Recursion guard via AIRC_SEND_REROUTED=1 prevents loops if a sibling
  scope is misconfigured (can happen mid-bounce when a sibling's
  room_name file is empty).
- Determine project scope by stripping a trailing .<word> from the
  current AIRC_WRITE_DIR, so 'airc send --room general' from inside
  .airc.general/ correctly resolves the project scope as the source
  of truth for what rooms are subscribed.

Test: scenario_send_room_flag — 8 assertions, all green:
  - --room <current>: no-op route (lands in current scope's log)
  - --room <sibling>: re-routes to sibling .general scope
  - No double-write to primary scope on re-route
  - --room <unsubscribed>: exits non-zero with structured stderr
  - stderr says 'not subscribed in this scope', lists subscribed rooms
  - --room <r> @peer DM also re-routes correctly

Also updates README.md's auto-scope section to document the dual-room
default (auto-scoped project + #general sidecar) introduced in #122,
and explains the new send --room flag with examples.

Platform: re-exec via 'env' is POSIX-standard. No platform-specific
change.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Apr 26, 2026
fix(part): IRC /part semantics — leave one room, keep sidecar alive

Pre-fix: 'airc part' from a primary scope (e.g. #useideem) called
cmd_teardown which (post-#122) cleaned BOTH the primary scope AND
the #general sidecar — so leaving #useideem also dropped the lobby
unintentionally. IRC convention: /part leaves ONE channel; the lobby
should persist. Caught while testing the multi-room model after #122
landed.

Two related issues fixed:

1. cmd_teardown's pgrep-children walker would catch the sidecar bash
   (forked from primary) and kill it via the descendant tree even
   though the sidecar's PID isn't in primary's airc.pid (after #122
   we stopped appending it). Added AIRC_TEARDOWN_PART_ONLY=1 guard:
   when set, cmd_teardown's exclusion list reads sidecar's airc.pid
   + descendants and removes them from the kill set.

2. cmd_part now sets local AIRC_TEARDOWN_PART_ONLY=1 before calling
   cmd_teardown. This also short-circuits the explicit sidecar-block
   in cmd_teardown (gist + pidfile cleanup for the .general scope),
   so part is fully scope-local.

Also: removed the redundant 'echo $sidecar_pid >> primary/airc.pid'
from spawn_general_sidecar_if_wanted. The sidecar already has its
own scope's airc.pid, and cmd_teardown's explicit sidecar-block
walks that pidfile directly. Appending was unnecessary AND was
exactly what made cmd_part nuke the sidecar via the primary's
pidfile walk in pre-#122 testing.

Test: scenario_part_keeps_sidecar — 6 assertions:
  - primary + sidecar both running pre-part
  - airc part removes primary's airc.pid
  - sidecar's main bash PID still alive after primary's part (the
    load-bearing assertion — was the regression)
  - sidecar scope dir + pidfile preserved
  - sidecar room_name preserved
  - subsequent 'airc teardown' (no flag) DOES reap the sidecar
    (verifies full-kill semantic still works for the explicit case)

Test bugfix included: read first PID from sidecar's airc.pid via
awk '{print \$1; exit}' instead of head -1. host-mode airc.pid is
'\$\$ PAIR_PID hb_pid' on one line, so head -1 returned the whole
line and kill -0 failed on the multi-PID string.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Apr 27, 2026
…143)

chore(readme,skills): bring docs to spec for canary→main

README updates:
- Integration suite count: 88 assertions / 11 scenarios → ~245 / 32
- Core Commands: add `airc msg --room <name>` (sibling-room send) and
  `airc away` / `airc back` (IRC /away alias)
- Default Rooms: document /part stickiness (parted_rooms persists in
  primary scope's config) and `airc join --general` re-opt-in flag
- Skills table: add /whois, /away, /kick rows so the table covers
  every IRC verb in the IRC↔airc table (no more "documented in table,
  missing from skills")

New skills (install.sh auto-symlinks; no installer changes):
- skills/away/SKILL.md — IRC /away alias for status set/clear
- skills/whois/SKILL.md — identity lookup + cross-scope walk note
- skills/kick/SKILL.md — host-only peer eviction with SSH key drop

Why now: vhsm and continuum drove the IRC-table audit through QA.
README and skills were the last surfaces still claiming the
pre-#122/#138/#139 shape. Closing the gap before promoting canary
to main so the merged tree presents a coherent story.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants