<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rulesets/.ai/scripts/agent-roster, branch main</title>
<subtitle>Claude Code skills, rules, and language bundles
</subtitle>
<id>https://git.cjennings.net/rulesets/atom?h=main</id>
<link rel='self' href='https://git.cjennings.net/rulesets/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/rulesets/'/>
<updated>2026-06-15T06:14:46+00:00</updated>
<entry>
<title>feat(ai): add agent-roster detection script with tests</title>
<updated>2026-06-15T06:14:46+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-06-15T06:14:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/rulesets/commit/?id=f8bdf302fd71ba73ae1424d86275e1e223f09cf3'/>
<id>urn:sha1:f8bdf302fd71ba73ae1424d86275e1e223f09cf3</id>
<content type='text'>
agent-roster is the single detection primitive for concurrent same-project Claude sessions: pgrep -x claude, resolve each pid's cwd from /proc, keep those at or inside the project root, and drop the scanner's own ancestry. It exits 0 when alone, 1 when other agents are present (printed pid + cwd), and 2 when the roster can't run. Both the helper launcher and the in-session startup check will call this rather than re-scanning.

pgrep and /proc are the system boundary, so I made them injectable (ROSTER_PGREP, ROSTER_PROC, ROSTER_SELF_PID) and the bats exercise the real include/exclude logic against fixtures, no agents spawned. The unavailable paths (no /proc, or pgrep absent) report on stderr and exit 2 rather than a false "alone".

This is the first slice of the helper-instance task. Startup and ai --helper wiring follow.
</content>
</entry>
</feed>
