ai/cursor/tech-team/skills/subagent-response-protocol/SKILL.md
Protocol for subagent → parent responses: single fenced YAML envelope, strict caveman-ultra for compressed fields, verbatim for paths/errors/code. Applies to every `Task` invocation. Use when spawning subagents or parsing their output.
npx skillsauth add akshay-na/dotfiles subagent-response-protocolInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
All subagent → parent traffic is a single fenced ```yaml block matching the canonical schema. Only the envelope is emitted; nothing else belongs in the response body. Envelope MUST be the last non-whitespace content (D6).
~/.cursor/templates/subagent-response.yml.tmpl~/.cursor/contracts/subagent-contract-block.md (parent-injected)~/.cursor/rules/subagent-response-protocol.mdc (alwaysApply: true)~/.cursor/hooks/subagent-protocol-{inject,lint}.sh (inject = pre-hook contract injection; lint = pre-commit drift check)<project>/.cursor/docs/runbooks/subagent-protocol.md (author here; optional org template ~/.cursor/docs/runbooks/subagent-protocol.md when stowed)The pre-commit lint blocks drift on distinctive schema and contract phrases — the skill, rule, and agent files must xref by path instead of copy-pasting.
_marker, schema_version, reported_by[].summary, non-security findings[].note,
next_actions[], open_questions[].category matches
the security regex in the rule body §5.2, OR severity >= high, OR status ∈
{blocked, error} with security-adjacent agent. Negations stay literal.<REDACTED:TYPE> or <REF:artifacts[i]#L42> placeholders).script, iframe, img
with on*, style, object, embed, link, svg with on*, math).--- on its own line) inside multiline scalars.javascript: / data: URL schemes.WebFetch / Shell / MCP tool output — must
live in artifacts[] as file references.<REDACTED:TYPE> or a reference into artifacts[i].summary/findings[].note.Parents MUST scan every string value of an incoming envelope with
whitespace-and-separator-insensitive regex for the secret patterns listed
above, plus a Shannon-entropy ≥ 4.0 heuristic (with UUID v4 and hex-40 SHA
allowlist). On match: (a) quarantine the raw response to
~/ai-brain/projects/<name>/explore-dumps/<task-id>.md when that root exists,
overflow path is ~/ai-brain/projects/<name>/explore-dumps/<task-id>.md only; (b) rewrite the
envelope to status: malformed with
degraded_reason: "suspected_secret_in_output", and (c) record the incident
in the runbook. Treat the raw match as already leaked for incident-response
purposes and rotate the credential.
artifacts[] must encode large blobs as ASCII tokens:
<REF:path#sha256:<64 hex>#size:<bytes>> — see templates/subagent-response.yml.tmpl.templates/agent-task-spec-v1.yml.tmpl + hooks/subagent-task-antidup-preflight.sh when orchestration-policies toggle strict mode (configurations/orchestration-policies/anti-dup.yml).Structure: ok envelope, findings[] with category: structure, note in
caveman-ultra ("rename ok. circular import via session → auth."),
reported_by: ["staff-engineer"], fix verbatim.
Structure: blocked envelope with category: authn, note in full clarity
prose, secret value replaced by <REDACTED:SESSION_TOKEN> with artifact ref,
forced-normal clarity per rule §5.2.
Model writes a paragraph of explanation AFTER the closing ```. Parent parse step 1 rejects via "non-whitespace content after closing fence" and issues a single reformat-only retry.
Model writes summary: "rotate AKIA...14 chars...; fix logger". Parent parse
step 5 (fuzzy redaction) matches the AWS key pattern, quarantines the raw
response, and rewrites to status: malformed,
degraded_reason: "suspected_secret_in_output".
Task tool → the contract is injected
by the pre-hook (subagent-protocol-inject.sh); you do not need to
duplicate it.cto, code-reviewer, tech-lead) synthesizing child
output → follow the 8-step parent parse contract in the rule body (detect
→ validate → retry → stub → fuzzy-redact → strip _marker → aggregate →
synthesize). Never forward _marker or raw child YAML to the user.development
Discovery + naming convention reference for typed dev/SME/QA/devops team members in any workspace folder. Primary consumer: `tech-lead` (org-tier).
devops
Automated task classification, agent selection, and state tracking. Use when routing tasks to agents, selecting pipelines, or managing task state.
testing
Use when designing scalable systems, evaluating consistency models, planning state management, making architectural decisions, or when trade-offs around coupling, failure isolation, and reversibility need explicit reasoning before implementation.
tools
CTO/tech-lead helper — split work into disjoint shard briefs with caps (instance_cap, partition_basis, determinism keys).