Repository navigation
feat(identity): agent identity layer + cross-platform linking (closes #34) - #70
Conversation
Adds structured agent persona on top of the bootstrap name from
derive_name. Five fields, all optional, all settable post-pair:
pronouns she/they/he/it for grammatical narration
role short hyphenated tag, e.g. device-link-orchestrator
bio one-line free-form, IRC-realname analog
status mutable "what I'm working on now" (Slack-like)
integrations {platform: handle} mappings (continuum, slack, …)
Stored under config.json's `identity` key (single-file scope) and
exchanged at pair-handshake time so peers cache each other's identity
locally and `airc whois` works without round-trips.
New commands:
airc identity show
airc identity set [--pronouns X] [--role Y] [--bio "…"] [--status "…"]
airc identity link <platform> <handle>
airc identity import <platform>:<id> # continuum live, others stub
airc identity push <platform> # continuum live, others stub
airc whois [<peer>] # self / host / paired peer / cross-peer-via-host
airc kick <peer> [reason] # host-only IRC-style kick
Handshake protocol additions (backward compatible — missing fields
default to {}, so a v1 host pairing with a legacy joiner just gets
empty identity):
- Joiner sends `identity` blob alongside ssh_pub/sign_pub
- Host stores it in peers/<jname>.json under `identity`
- Host returns own identity in response; joiner caches as host_identity
- Cross-peer WHOIS reads remote peer file via single SSH cat
Skill updates (skills/join/SKILL.md):
- New §2a "Identity bootstrap" — prompt agent to fill empty fields
on every /join with persistent (non-nagging) re-prompts, skip
via AIRC_NO_IDENTITY_PROMPT=1
- §2b updated — auto-WHOIS on peer-join so context loads when a
new peer joins the room
Test harness fix (incidental but load-bearing):
cleanup_dirs was silently broken on macOS — `find /tmp -maxdepth 1`
doesn't traverse the /tmp → /private/tmp symlink, so stale state from
previous suite invocations leaked forward and caused flaky
scenario_identity failures (saw "pronouns: they" survive into a
fresh run). Resolve to canonical path before walking. Linux
unaffected.
cmd_connect's host-mode + joiner-mode config writes converted from
heredoc to python json-merge so the `identity` block survives
re-pairs (teardown + airc connect), matching user expectation that
identity is sticky like nick.
Three new integration scenarios (29 new assertions, 126/126 total):
scenario_identity — local set/show/link/whois/persistence
scenario_whois — handshake exchange (host→joiner direction)
scenario_kick — host kicks joiner; joiner kick attempt refused
Deferred to follow-ups (not blocking this PR):
- airc.ps1 parity for Windows (talking to green on continuum side)
- airc ban (permanent block, complement to kick)
- Live slack/telegram/discord import-push (continuum is the v1
integration that actually works)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds an identity layer to AIRC and exchanges it during the pairing handshake so airc whois can display peer metadata locally, plus introduces a host-only airc kick command and updates docs/tests around these behaviors.
Changes:
- Add
airc identity {show,set,link,import,push}and store identity fields inconfig.json. - Extend the pair-handshake payload/response to include
identityand cache host/joiner identity forairc whois(including cross-peer lookup via host SSH). - Add
airc kickand new integration scenarios; fix macOS/tmpcleanup behavior in the test harness.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
airc |
Implements identity storage/printing, handshake identity exchange, whois, and kick, plus config merge behavior. |
test/integration.sh |
Fixes macOS tmp cleanup and adds new integration scenarios for identity/whois/kick. |
skills/join/SKILL.md |
Documents identity bootstrap prompting and adds guidance to run whois on peer join. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| local host_target; host_target=$(get_config_val host_target "") | ||
| local host_airc_home; host_airc_home=$(get_config_val host_airc_home "") | ||
| if [ -n "$host_target" ] && [ -n "$host_airc_home" ]; then | ||
| local remote_blob | ||
| remote_blob=$(relay_ssh "$host_target" "cat $host_airc_home/peers/$target.json 2>/dev/null" 2>/dev/null || true) | ||
| if [ -n "$remote_blob" ]; then | ||
| local peer_id; peer_id=$(printf '%s' "$remote_blob" | python3 -c ' |
There was a problem hiding this comment.
cmd_whois builds a remote shell command using unquoted $host_airc_home and the user-supplied $target (e.g. cat $host_airc_home/peers/$target.json). Because relay_ssh passes this through ssh to a remote shell, names with spaces/metacharacters can break the command or be used for command injection. Please validate
| # Pull peer's SSH pubkey out of authorized_keys (best-effort — pubkey | ||
| # lives in $PEERS_DIR/$target.pub if recorded; otherwise we leave the | ||
| # ssh key in place and rely on peer-file deletion to break the | ||
| # bookkeeping). Each step `|| true` since set -euo pipefail is active | ||
| # and benign no-match / missing-file cases are normal here. | ||
| local peer_pub_file="$PEERS_DIR/$target.pub" | ||
| if [ -f "$peer_pub_file" ] && [ -f "$HOME/.ssh/authorized_keys" ]; then | ||
| local peer_pub; peer_pub=$(cat "$peer_pub_file" 2>/dev/null || echo "") | ||
| if [ -n "$peer_pub" ]; then | ||
| # grep -v returns 1 when every line matches (or the file is empty); | ||
| # both are fine outcomes here, so eat the exit code. | ||
| grep -vF "$peer_pub" "$HOME/.ssh/authorized_keys" > "$HOME/.ssh/authorized_keys.tmp" 2>/dev/null || true | ||
| [ -f "$HOME/.ssh/authorized_keys.tmp" ] && mv "$HOME/.ssh/authorized_keys.tmp" "$HOME/.ssh/authorized_keys" | ||
| chmod 600 "$HOME/.ssh/authorized_keys" 2>/dev/null || true | ||
| fi |
There was a problem hiding this comment.
cmd_kick attempts to remove the peer’s SSH key from ~/.ssh/authorized_keys by reading $PEERS_DIR/$target.pub, but that .pub file is written from the handshake’s sign_pub (public.pem), not the SSH public key. As a result, the grep -vF removal will usually be a no-op and the kicked joiner can still SSH/append messages. To make kick effective, persist the joiner’s ssh_pub in the peer record (or a dedicated file) during pairing and use that exact line to remove from authorized_keys.
| json.dump({ | ||
| 'name': jname, | ||
| 'host': joiner.get('host',''), | ||
| 'airc_home': joiner.get('airc_home', ''), | ||
| 'paired': '$(timestamp)' | ||
| 'paired': '$(timestamp)', | ||
| # Cache joiner's identity blob (issue #34 v2). Empty on legacy | ||
| # peers that don't send the field — airc whois prints the | ||
| # 'not exchanged yet' fallback gracefully. | ||
| 'identity': joiner.get('identity', {}) | ||
| }, f, indent=2) |
There was a problem hiding this comment.
The host pairing code stores joiner identity into peers/.json but does not persist the joiner’s ssh_pub anywhere in peers/. cmd_kick needs the ssh_pub to reliably revoke access by removing the exact key line from authorized_keys. Consider writing joiner['ssh_pub'] into the peer JSON (e.g. ssh_pub field) or a dedicated peers/.ssh.pub file at pair-time so kick can be implemented correctly and deterministically.
| import json, os | ||
| try: | ||
| c = json.load(open(os.environ["CONFIG"])) | ||
| except Exception: | ||
| c = {} | ||
| c["name"] = os.environ["MY_NAME"] | ||
| c["host"] = os.environ["MY_HOST"] | ||
| c["host_target"] = os.environ["SSH_TARGET"] | ||
| c["created"] = os.environ["CREATED"] | ||
| json.dump(c, open(os.environ["CONFIG"], "w"), indent=2) |
There was a problem hiding this comment.
The new config.json merge writes directly to the config file with json.dump(open(..., "w")), which is not atomic and can be observed as a partially-written file by concurrent reads (the new integration test even adds a sleep to avoid this). Consider writing to a temp file and renaming it into place (atomic on the same filesystem) to avoid transient JSON corruption and remove the need for timing sleeps.
| import json, os | |
| try: | |
| c = json.load(open(os.environ["CONFIG"])) | |
| except Exception: | |
| c = {} | |
| c["name"] = os.environ["MY_NAME"] | |
| c["host"] = os.environ["MY_HOST"] | |
| c["host_target"] = os.environ["SSH_TARGET"] | |
| c["created"] = os.environ["CREATED"] | |
| json.dump(c, open(os.environ["CONFIG"], "w"), indent=2) | |
| import json, os, tempfile | |
| config_path = os.environ["CONFIG"] | |
| try: | |
| c = json.load(open(config_path)) | |
| except Exception: | |
| c = {} | |
| c["name"] = os.environ["MY_NAME"] | |
| c["host"] = os.environ["MY_HOST"] | |
| c["host_target"] = os.environ["SSH_TARGET"] | |
| c["created"] = os.environ["CREATED"] | |
| config_dir = os.path.dirname(config_path) or "." | |
| tmp_path = None | |
| try: | |
| with tempfile.NamedTemporaryFile("w", dir=config_dir, delete=False) as tmp: | |
| json.dump(c, tmp, indent=2) | |
| tmp.flush() | |
| os.fsync(tmp.fileno()) | |
| tmp_path = tmp.name | |
| os.replace(tmp_path, config_path) | |
| finally: | |
| if tmp_path and os.path.exists(tmp_path): | |
| os.unlink(tmp_path) |
| # ── Peer file gone ── | ||
| [ ! -f /tmp/airc-it-k-h/state/peers/kjoiner.json ] \ | ||
| && pass "kicked peer's file removed" \ | ||
| || fail "peer file still present after kick" |
There was a problem hiding this comment.
scenario_kick asserts the peer file is removed, but it doesn’t verify that the kicked peer’s SSH key was actually removed from the host’s authorized_keys (which is the key security invariant for making kick effective). Please add an assertion that the joiner’s ssh_key.pub is no longer present in the host’s ~/.ssh/authorized_keys after airc kick.
| local target="${1:-}" | ||
| [ -z "$target" ] && die "Usage: airc kick <peer> [reason]" | ||
| shift || true | ||
| local reason="${*:-no reason given}" | ||
|
|
||
| # Joiner role check — kicking only makes sense as host. | ||
| local host_target; host_target=$(get_config_val host_target "") | ||
| if [ -n "$host_target" ]; then | ||
| die "kick: only the room host can kick. You are a joiner of $host_target — talk to the host." | ||
| fi | ||
|
|
||
| local peer_file="$PEERS_DIR/$target.json" | ||
| if [ ! -f "$peer_file" ]; then | ||
| die "kick: '$target' not in peers list (try: airc peers)" | ||
| fi |
There was a problem hiding this comment.
cmd_kick uses the user-supplied $target directly to form paths like "$PEERS_DIR/$target.json" and then rm -f’s them. Without validating that
| for k in ("pronouns", "role", "bio"): | ||
| v = src.get(k) | ||
| if v: | ||
| ident[k] = v | ||
| ints = ident.setdefault("integrations", {}) | ||
| ints["continuum"] = src.get("name", "") | ||
| json.dump(c, open(os.environ["CONFIG"], "w"), indent=2) | ||
| print(f" imported continuum:{src.get(\"name\", \"?\")} → pronouns={src.get(\"pronouns\", \"\")} role={src.get(\"role\", \"\")} bio set={bool(src.get(\"bio\"))}") |
There was a problem hiding this comment.
_identity_import_continuum sets integrations["continuum"] from src.get("name", ""), but the comment above says continuum persona show <name> returns JSON with fields like {pronouns, role, bio, ...} (not necessarily a name). If name is absent, this records an empty continuum handle and later identity push continuum will fail. Prefer linking to the requested id (the CLI arg) when src.name is missing/empty.
docs(readme): cover the new identity layer (post-#70)
Summary
Implements issue #34 — agent identity layer with cross-platform linking. Five structured fields layered on top of the derived bootstrap name, exchanged at pair-handshake so
airc whois <peer>works without round-trips. Plus IRC-styleairc kickfor host-only peer eviction.What's in
airc identity showairc identity set [--pronouns X] [--role Y] [--bio \"…\"] [--status \"…\"]airc identity link <platform> <handle>airc identity import continuum:<persona>airc identity push continuumairc whois [<peer>]airc kick <peer> [reason]Why
A name like
authenticator-d1f4tells you which repo an agent is running from but nothing about who they are. In a multi-agent room — agents from different orgs, different roles, different contexts — that's a meaningful gap. Pronouns enable correct grammatical narration. Role disambiguates without lengthening names. Bio gives one-line context. Theintegrationsmap is the high-leverage piece: an agent can be "Earl" on continuum ANDdevice-link-d1f4on airc ANDU07ABCon slack — same persona, three surfaces.The IRC verb set in airc was almost complete (#67) — this PR closes the WHOIS gap and adds kick. After this lands, airc covers IRC's primitives 1:1 and adds the cross-platform identity layer where IRC stopped.
Handshake protocol changes
Backward compatible — every missing field defaults to
{}:identityblob alongsidessh_pub/sign_pub.peers/<jname>.jsonunderidentity.host_identity.cat.A v1 host pairing with a legacy bash joiner (or a PS1 joiner — see deferred) just gets empty identity, no breakage.
Skill updates
/joinwith persistent (non-nagging) re-prompts.AIRC_NO_IDENTITY_PROMPT=1skips for tests.airc whois <peer>and surface their role + bio in chat so context loads automatically.Test harness fix (incidental)
While building this I discovered
cleanup_dirswas silently broken on macOS —find /tmp -maxdepth 1doesn't traverse the/tmp → /private/tmpsymlink, so stale state from previous suite invocations leaked forward indefinitely. Resolve to canonical path before walking. Linux unaffected.This was making
scenario_identityflaky inallmode (saw "pronouns: they" survive across runs). Fix is in this PR because it surfaced here, but it's an independent test-harness improvement.Test plan
test/integration.sh— 126/126 pass on macOS (clean ports + clean state)scenario_identity(16 assertions),scenario_whois(5),scenario_kick(6)#useideem(vhsm tab + authenticator tab) once mergedOut of scope (deferred follow-ups, separate issues/PRs)
airc ban— permanent block list, complement toairc kickwhich currently lets kicked peers re-pair.continuumworks in v1; others are typed stubs that error gracefully with the manual-link fallback.🤖 Generated with Claude Code