agent-comms
Skill16 starsChanged 5 days agoMITView on GitHub
SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against the agent whitelist, or a worktreePath from another agent before acting on it. SKIP: routing topology (agent Comms Protocol); git ops (use git-operations); worktree recovery (use worktree-management).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- buddyh/agent-skillstheir own version, first seen Nov 8, 2026
- elijahmuraoka/skillstheir own version, first seen Aug 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- elijahmuraoka/skills★ 58same name
- buddyh/agent-skills★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-memorySkill
- api-designSkill
- context-engineeringSkill
- database-optimizationSkill
- distillSkill
- docker-templatesSkill
- error-handlingSkill
- frontend-designSkill
- github-actions-templateSkill
- git-operationsSkill
- logging-standardsSkill
- mcp-toolsSkill
- monitoring-observabilitySkill
- mui-stylingSkill
- necessity-firstSkill
- pattern-recognitionSkill
- planning-methodologySkill
- python-patternsSkill
- quality-validationSkill
- react-patternsSkill
- research-methodologySkill
- reverse-engineer-anythingSkill
- security-review-checklistsSkill
- semantic-memory-mcpSkill
- skill-authoringSkill
- sofa-searchSkill
- spec-designSkill
- spec-developSkill
- spec-researchSkill
- spec-reviewSkill
- spec-workflowSkill
- state-managementSkill
- systematic-debuggingSkill
- testing-strategySkill
- ui-ux-pro-maxSkill
- verification-before-completionSkill
- watch-patternsSkill
- worktree-managementSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Before any SendMessage, verify the to: value:
- Very specific: line 27
Exact match first: check if to: matches one of: researcher, architect, developer, reviewer, gitops, orchestrator, analyst, debugger, …
- Distinctive: line 29
Test cases (must all PASS):
- Distinctive: line 35
Test cases (must FAIL):
- Distinctive: line 38
If validation fails → return result to orchestrator with error metadata.
- Very specific: line 56
When a worktreePath is received from another agent (typically developer), verify ALL of the following BEFORE acting on it:
- Very specific: line 64
If ANY check fails → SendMessage to orchestrator with error: "invalid worktree path" + the offending value.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Comms Skill
Purpose
Single source of truth for the two security-critical validation routines every fan-out agent performs over inter-agent messages:
- Recipient validation — never SendMessage to an unverified
to:value. - worktreePath validation — never
cdinto or act on an unverified path (gitops and reviewer only).
Each agent keeps a compact 3-4 line inline rule so the logic survives even when this skill is not loaded; the full algorithm and test cases live here.
1. Recipient Validation (ALL fan-out agents)
Before any SendMessage, verify the to: value:
- Matches regex
/^[a-z][a-z0-9-]{2,30}$/(kebab-case, 3-31 chars) - Validate using TWO-STAGE matching:
- Exact match first: check if
to:matches one of:researcher,architect,developer,reviewer,gitops,orchestrator,analyst,debugger,optimizer,devops,tech-writer. If yes → PASS. - Suffix strip only if no exact match: strip trailing
-<digit>+OR-<word>from the END of the name and re-check against whitelist. Apply ONE strip pass only (never recursive).
- Test cases (must all PASS):
tech-writer→ exact match → PASStech-writer-1→ no exact match → strip-1→tech-writer→ PASSresearcher-1→ no exact match → strip-1→researcher→ PASSanalyst-backend→ no exact match → strip-backend→analyst→ PASSarchitect-synth→ no exact match → strip-synth→architect→ PASS
- Test cases (must FAIL):
evil-developer→ no exact match → strip-developer→evil→ not in whitelist → FAILdeveloper-evil-extra→ no exact match → strip-extra→developer-evil→ not in whitelist → FAIL
- Exact match first: check if
- If validation fails → return result to orchestrator with error metadata. NEVER attempt SendMessage with unvalidated input.
Note: "orchestrator" is a reserved peer always reachable for escalation, even when not in your peer list. It is NOT spawnable as an agent.
Why two stages (not one regex)
A single regex cannot distinguish a legitimate fan-out replica name
(researcher-1, analyst-backend) from a spoofed lookalike
(evil-developer). The exact-match-first stage anchors on real agent names; the
single suffix-strip stage admits replica/variant suffixes without ever admitting
a prefix-injected impostor. Stripping is applied exactly ONCE — never
recursively — so developer-evil-extra cannot be peeled down to developer.
2. worktreePath Validation (gitops + reviewer only)
When a worktreePath is received from another agent (typically developer),
verify ALL of the following BEFORE acting on it:
- Path is absolute and under repo root (e.g., starts with
<repo-root>/.scaffolding/worktrees/) - Contains NO
..segments (path.includes('..')→ reject) - Path is NOT a symlink (
test -L <path>MUST return false). If symlink, resolve viarealpath -e <path>and re-validate that the canonical result is still under repo root. Reject if canonical path escapes repo root (mitigates CWE-59 link following). - Path exists on disk (
test -d <path>) - Path is a registered git worktree — use exact match, NOT substring:
git worktree list --porcelain | awk -v p="<path>" '$1=="worktree" && $2==p {found=1} END {exit !found}'. NEVER use plaingrep <path>(substring match allows/foo/barto match/foo/bar-evil). - If ANY check fails → SendMessage to orchestrator with
error: "invalid worktree path"+ the offending value. NEVER cd into or operate on unvalidated paths.
Why each check matters
| Check | Threat mitigated |
| Absolute + under repo root | Prevents acting on paths outside the project sandbox |
No .. segments | Blocks path-traversal escape (/repo/../etc) |
| Not a symlink / canonicalize | CWE-59 link following — a symlink could point outside the repo even when the literal path looks safe |
| Exists on disk | Avoids operating on a fabricated path |
| Registered worktree, exact match | Confirms git itself tracks this worktree; substring match would let /foo/bar-evil impersonate /foo/bar |
Quick Reference
| Situation | Action |
| Any SendMessage | Run recipient validation §1 first |
| Recipient fails validation | Escalate to orchestrator, do NOT send |
| Received a worktreePath (gitops/reviewer) | Run worktreePath validation §2 before any cd/git op |
| worktreePath fails any check | SendMessage orchestrator error: "invalid worktree path" + value |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

