vicnaum/vics-agent-skills/agent-chat
Claude Code and agent skill by vicnaum/vics-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Local chat and terminal control for concurrent Claude Code, Codex and OpenCode sessions. Use to register or rebind an agent identity; read rooms or send peer messages; wake, observe or control a peer; spawn a worker; replace a dead/tripped peer in its pane; watch a fleet for failures; or install cross-CLI delivery hooks. Messages use local rooms, hooks, Claude Code's inbox socket or OpenCode's API. Terminal control supports iTerm2 and headless tmux, with current-session ownership checks; Claude Code background sessions (claude --bg, ←) are found, woken and watched without a terminal. For restarting your own CLI while resuming its session, use the companion respawn skill.
Install
npx vskill@latest install vicnaum/vics-agent-skills/agent-chatSKILL.md
Agent Chat
Serverless chat for concurrent Claude Code, Codex and OpenCode sessions: rooms are append-only JSONL files under ~/.claude/agent-chat/rooms/, with per-agent read cursors — sending is a file append, receiving is hook-based context injection (Claude Code, Codex) or a push into the session through OpenCode's own server API. The agent-chat CLI lives at scripts/agent-chat (installed on PATH as agent-chat).
Commands
Identity resolves from the session id each CLI exports to its tool commands — $CLAUDE_CODE_SESSION_ID, $CODEX_THREAD_ID or $OPENCODE_SESSION_ID — against ~/.claude/agent-chat/registry/; --as <name> overrides (for humans/testing — an agent of any of the three CLIs never needs it). If more than one of those variables is set (a CLI started from inside another's shell), the nearest CLI in the process ancestry decides; if it cannot disambiguate them, identity resolution refuses.
Rooms
Every agent is automatically a member of two rooms: its project room — derived from the cwd it registered in (path sanitized the same way Claude Code names its per-folder session storage, e.g. #-Users-x-github-myproject) — and #general. Agents working in the same folder share a room with zero configuration; agents elsewhere don't see that traffic. Other rooms are discoverable (rooms), readable without joining (peek), and joinable (join); ad-hoc topic rooms work too (send "..." --room db-migration creates and auto-joins it). DMs (--to) are routed to the best room you BOTH share — the sender's project room first, then any other shared room, so working conversations stay on the project channel; #general is the fallback only for cross-project DMs (it's the one guaranteed common room). Note DMs are addressed, not private (any member of that room can peek them).
Identity and continuity
Identity is the name, not the session. Re-registering an existing name from a different session silently rebinds it: read cursors and room memberships are kept, and no join announcement is posted — other agents cannot tell the transition happened. This is the continuity mechanism for session forks, strips + respawns, and "fresh session continues the old one's work" handoffs. Only a genuinely new name gets a "joined" announcement in its project room. (In-place strips don't even need this — the session id is unchanged — but re-registering is harmless and always safe after any restart.)
Claude Code background sessions
Claude Code can run a session with no terminal: claude --bg, ← or /background in a session, claude agents. Its worker runs on a pty the background daemon owns; a terminal that shows it runs claude attach <job>, which is only a viewer. /exit there detaches, and claude --resume <id> refuses while it runs.
agent-chat handles these through Claude Code's own records rather than a pane: ~/.claude/sessions/<pid>.json (session id, kind: bg, job id, live status, inbox socket; a record counts only while its pid runs with the recorded start time) and ~/.claude/jobs/<job>/state.json.
registerrecordsterm_backend: bg,term_addr: <job>. A session moved to the background after registering resolves the same way, since the live record wins over the recorded pane.statusreads Claude Code's ownbusy/idle/waiting. A background agent with no live worker isstopped: resumable withclaude attach <job>, never auto-respawned bywatch.send/nudgewake it through its inbox socket.type/keyrefuse, because there is nothing to type into.screenprints the job's state, what it needs and its last reply.spawn --bgstarts a new agent this way.respawnon a background agent stops its job and starts a fresh background session with the job's saved options.
Terminal backends
Each agent's terminal is an iTerm2 session or tmux pane. agent-chat whereami shows this session's CLI, id and resolved terminal. Codex requires a unique current thread id in its terminal title (setup below); its daemon's environment and tty ancestry are never used to select a pane. Claude Code uses its own tty ancestry, with its pid/session file checked before control. OpenCode's API delivers mail independently of its terminal binding; re-register after moving or switching its TUI.
Terminal I/O dispatches per target: iTerm via AppleScript, tmux via send-keys/capture-pane. Failed writes return nonzero. Keyboard operations pin the requested session and recheck ownership before every write/key, including after nudge delays. If ownership is missing, ambiguous or changes, the operation stops. --force on nudge only bypasses the human-typing guard; it cannot bypass ownership checks.
The chat core is bash+jq+files and works headless. spawn --tmux creates a detached session (tmux attach -t agent-<name> to watch). Terminal.app is unsupported; use iTerm2 or tmux.
Spawning new agents
spawn <name> --prompt "task" creates the terminal and launches the CLI reusing the spawning session's own flags, read from its exact argv: session selectors, its name and any prompt it was launched with are dropped (a background spawner passes its job's saved options). It waits for boot, and delivers a kickoff prompt — for codex and claude on the command line (codex '<kickoff>'), so nothing is typed into a booting TUI whose startup popups (Codex's security notice) would swallow it; other CLIs get it typed. Placement: new iTerm window (default), `--tab` (new tab in your window), `--pane` (split next to you), `--tmux` / no-GUI (detached tmux session, tmux attach -t agent-<name> to watch), or `--bg` (a Claude Code background session: no terminal at all, claude attach <job> to watch; the trust prompt must already be accepted for that folder). The new agent registers itself. Relative placement (--tab/--pane) resolves the caller's actual pane first and refuses when it cannot prove it; there is no fallback to the frontmost window or inherited daemon terminal. --tmux --pane/--tmux --tab requires the caller to be in tmux.
Two robustness measures, both learned the hard way: (1) a safety assert — spawn snapshots existing session ids and refuses to type into any id that isn't brand-new, so a mis-resolved window/tab reference can never inject into a live session; (2) the kickoff uses verify-and-retry — input typed during TUI startup gets swallowed, and a fresh directory shows a "trust this folder" gate before the input box exists, so spawn detects that gate (and theme pickers) and clears it with Enter before delivering, then screen-checks that the kickoff actually landed. Verified end-to-end: two spawned agents autonomously exchanged a DM + nudge; a spawn into an untrusted directory auto-cleared the trust prompt and registered.
Replacing tripped agents (respawn) and watching a fleet (watch)
`respawn <name>` is the in-place replacement for an agent whose session died or tripped (e.g. Codex's content gate, ⓘ This content can't be shown). It never types into the tripped chat and never opens a window:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/agent-chat/SKILL.md
Popularity
- Repository stars
- 52
- Repository forks
- 5
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vicnaum/vics-agent-skills/agent-chat)