/scaffolding:agent-commsfrom scaffolding
Validates SendMessage recipients against an agent whitelist and verifies worktreePath safety (CWE-59) for inter-agent communication.
Ships in scaffolding. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Single source of truth for the two security-critical validation routines every fan-out agent performs over inter-agent messages:
to: value.cd into 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.
Before any SendMessage, verify the to: value:
/^[a-z][a-z0-9-]{2,30}$/ (kebab-case, 3-31 chars)to: matches one of: researcher, architect, developer, reviewer, gitops, orchestrator, analyst, debugger, optimizer, devops, tech-writer. If yes → PASS.-<digit>+ OR -<word> from the END of the name and re-check against whitelist. Apply ONE strip pass only (never recursive).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 → PASSevil-developer → no exact match → strip -developer → evil → not in whitelist → FAILdeveloper-evil-extra → no exact match → strip -extra → developer-evil → not in whitelist → FAILNote: "orchestrator" is a reserved peer always reachable for escalation, even when not in your peer list. It is NOT spawnable as an agent.
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.
When a worktreePath is received from another agent (typically developer),
verify ALL of the following BEFORE acting on it:
<repo-root>/.scaffolding/worktrees/).. segments (path.includes('..') → reject)test -L <path> MUST return false). If symlink, resolve via realpath -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).test -d <path>)git worktree list --porcelain | awk -v p="<path>" '$1=="worktree" && $2==p {found=1} END {exit !found}'. NEVER use plain grep <path> (substring match allows /foo/bar to match /foo/bar-evil).error: "invalid worktree path" + the offending value. NEVER cd into or operate on unvalidated paths.| 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 |
| 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 |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub komluk/scaffolding --plugin scaffolding39 skills in this plugin
/agent-memoryRepo-local file memory under .scaffolding/ (shared/agent/conversation tiers). TRIGGER when: reading or writing .scaffolding/ memory files, or choosing which file tier an insight belongs in. SKIP: vector memory / MCP search and store (use semantic-memory-mcp); distilling conversations (use distill)./api-designRESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new API endpoints, defining error response shapes, or adding pagination/filtering. SKIP: implementing FastAPI route code (use python-patterns); error-handling internals (use error-handling)./context-engineeringOptimize Claude Code context-window usage for accuracy and cost. TRIGGER when: hitting context limits, structuring prompts for an agent, or trimming what gets injected into a task. SKIP: persisting knowledge across sessions (use agent-memory); semantic recall tuning (use semantic-memory-mcp).Other plugins' skills for the same job