delegation-intelligence
Skill51 starsChanged 7 months agoMITView on GitHub
Guides subagent delegation patterns. Covers parallel vs sequential dispatch, export_cycle usage, and team coordination.
In this repository17 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .github/get-shit-done/templates/copilot-instructions.mdCopilot instructions
- context-first-gatekeepingSkill
- debug-orchestrationSkill
- hivefiver-bilingual-tutorSkill
- hivefiver-domain-pack-routerSkill
- hivefiver-gsd-compatSkill
- hivefiver-mcp-research-loopSkill
- hivefiver-persona-routingSkill
- hivefiver-ralph-taskingSkill
- hivefiver-skill-auditorSkill
- hivefiver-spec-distillationSkill
- hivemind-architect-strategistSkill
- hivemind-governanceSkill
- parallel-debugging-hivemindSkill
- sequential-orchestrationSkill
- systematic-debugging-hivemindSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Before ANY delegation, load and apply:
- Distinctive: line 43
When using sequential delegation, you MUST:
- Distinctive: line 48
REROUTE: if domain boundaries crossed
- Distinctive: line 71
Core principle: Every subagent cycle exports intelligence.
- Distinctive: line 116
Every task delegation MUST include ALL of these:
- Distinctive: line 195
After 5 cycles with proper export:
- Distinctive: line 215
Without export: After compaction, all subagent intelligence is gone.
≈ “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
Delegation Intelligence
⚠️ PRIORITY: SEQUENTIAL IS SAFER
Default to SEQUENTIAL delegation unless ALL of these conditions are met:
- ✅ Tasks have ZERO file overlap (different directories)
- ✅ Tasks have ZERO state dependency (no shared variables)
- ✅ Tasks have ZERO output dependency (no task needs another's result)
- ✅ Failure of one task does NOT block others
When in doubt → SEQUENTIAL
Integration with Context-First Gatekeeping
Before ANY delegation, load and apply:
skill("context-first-gatekeeping")This ensures:
- Hierarchy chain is unbroken
- Planning is retrieved from memory
- Domain boundaries are respected
Result Awaiting (MANDATORY for Sequential)
When using sequential delegation, you MUST:
- AWAIT the result before proceeding
- PROCESS the outcome (success/partial/failure)
- RETUNE the plan based on actual results
- REROUTE if domain boundaries crossed
- EXPORT intelligence via
export_cycle
// CORRECT - Sequential with result awaiting
const result = await task({ ... })
if (result.outcome === "success") {
export_cycle({ outcome: "success", findings: result.findings })
// Proceed to next task
} else if (result.outcome === "partial") {
// RETUNE: Adjust based on partial progress
save_mem({ shelf: "partial", content: result.findings })
// Decide: continue or reroute?
} else {
// STOP - Do not proceed
save_anchor({ key: "failure", value: JSON.stringify(result) })
// Escalate to user
}Core principle: Every subagent cycle exports intelligence. Parallel when independent. Sequential when dependent. Never ignore a return.
When to Use
- About to dispatch 2+ tasks
- Deciding whether to do work yourself or delegate
- Subagent just returned a result
- Managing a batch of parallel subagents
- Planning implementation order for multiple changes
Decision: Parallel vs Sequential
⚠️ DEFAULT: SEQUENTIAL — Parallel requires explicit justification
digraph delegation {
"N tasks to do" [shape=doublecircle];
"All 4 parallel conditions met?" [shape=diamond];
"Sequential (default)" [shape=box, style=bold, penwidth=2];
"Parallel subagents" [shape=box];
"Research first, then decide" [shape=box];
"Enough info to start?" [shape=diamond];
"N tasks to do" -> "Enough info to start?";
"Enough info to start?" -> "Research first, then decide" [label="no"];
"Research first, then decide" -> "N tasks to do" [label="findings saved"];
"Enough info to start?" -> "All 4 parallel conditions met?" [label="yes"];
"All 4 parallel conditions met?" -> "Sequential (default)" [label="no (default)"];
"All 4 parallel conditions met?" -> "Parallel subagents" [label="yes (rare)"];
}The 4 Parallel Conditions (ALL must be true)
| # | Condition | Check |
| 1 | Zero file overlap | Tasks touch completely different directories |
| 2 | Zero state dependency | No shared variables, config, or runtime state |
| 3 | Zero output dependency | No task needs another's result |
| 4 | Independent failure | Failure of one doesn't block others |
If ANY condition fails → SEQUENTIAL
⚠️ EXPLICIT DELEGATION MANDATORY
Every task delegation MUST include ALL of these:
| Element | Required | Example |
| Task | ✅ | "Fix bug in auth.ts" (NOT "fix auth") |
| Scope | ✅ | "Only touch auth.ts, don't modify token.ts" |
| Return format | ✅ | "Return: { outcome, findings, files_changed }" |
| Success metric | ✅ | "Test passes: npm test -- auth.test.ts" |
| Acceptance criteria | ✅ | "All 5 auth tests pass, no new errors" |
| Constraints | ✅ | "Don't refactor, only bugfix; stay within 10 lines" |
| Evidence | ✅ | "Capture: what failed, why, how fixed" |
BAD: "Fix the auth bug" GOOD:
Task: Fix JWT token refresh bug in src/auth.ts line 45
Scope: Only auth.ts. Do NOT touch token.ts or session.ts
Return: { outcome: "success|partial|failure", findings: "...", files_changed: [...] }
Success: npm test -- auth.test.ts shows 0 failures
Acceptance: All 5 JWT tests pass
Constraints: No refactoring, max 10 lines changed
Evidence: Capture error message, root cause, fix rationaleCommon Patterns
Parallel-safe (dispatch simultaneously):
- Writing tests for different modules
- Researching independent topics
- Reading/analyzing separate files
- Creating independent utility functions
Must be sequential (wait between each):
- Schema change → tools that use schema → tests that verify tools
- Foundation module → modules that import it
- Config change → hooks that read config
- Any chain where file B imports from file A
Hybrid (batch by dependency layer):
Layer 1 (parallel): schema.ts + types.ts + config.ts
↓ wait, verify all pass
Layer 2 (parallel): tool-a.ts + tool-b.ts (both import from layer 1)
↓ wait, verify all pass
Layer 3 (parallel): test-a.ts + test-b.ts
↓ wait, verify all pass
Layer 4 (sequential): integration test → full ecosystem checkAfter EVERY Subagent Returns — Mandatory
// Parse the return. Was it truly successful?
// Then call export_cycle. NO EXCEPTIONS.
export_cycle({
outcome: "success" | "partial" | "failure",
findings: "What was learned or decided (1-3 sentences)"
})What export_cycle does internally (zero cooperation needed):
- Updates hierarchy tree — action node → complete/blocked
- Saves findings to mems brain — shelf
cycle-intel, tagged with timestamp - Links to timestamp chain — grep-able across all artifacts forever
- Clears failure flag if present — stops the system prompt warning
What the hook auto-captures (even without export_cycle):
- Last message from subagent (first 500 chars) →
brain.cycle_log[] - Failure signal detection →
brain.metrics.pending_failure_ack - Turn count of the cycle → tracked automatically
export_cycle adds RICHER intelligence on top of auto-capture:
- Your interpretation of the outcome (not just raw text)
- Structured findings saved as mems (survive compaction + sessions)
- Hierarchy tree updated (shows decision trail visually)
Reward — What Good Delegation Gets You
After 5 cycles with proper export:
# See the full decision trail
node bin/hivemind-tools.cjs state hierarchy
# t_30141102026 — Build auth system [ACTIVE]
# └── tc_45141102026 — JWT middleware [ACTIVE]
# ├── a_00151102026 — Token validator [COMPLETE]
# │ └── cycle: success — "jose library, 12 tests"
# ├── a_15151102026 — Refresh logic [BLOCKED]
# │ └── cycle: partial — "rotation works, Redis fails"
# └── a_30151102026 — Integration [ACTIVE] ← cursor
# Recall ALL intelligence from subagent work
recall_mems({ shelf: "cycle-intel" })
# Trace everything linked to a specific cycle
node bin/hivemind-tools.cjs session trace 15151102026
# Shows: hierarchy node + mem + session log — full chainWithout export: After compaction, all subagent intelligence is gone. You have a vague "it was done" but no decisions, no failures, no rationale.
Consequence — What Bad Delegation Costs
| Pattern | Cost |
Dispatch without map_context first | No hierarchy node → cycle results orphaned |
Skip export_cycle after return | Intelligence lost on compaction, tree not updated |
| Ignore failure signal in result | pending_failure_ack flag → warning every turn |
| Claim "complete" over a partial result | False confidence, bug surfaces 10x harder later |
| Parallel when files overlap | Git conflicts, race conditions, corrupted state |
| Sequential when independent | 3x slower than necessary, wasted context |
Subagent Prompt Engineering
When dispatching, include:
- Specific task — what to do (not "figure out what to do")
- File context — which files to read/modify (don't make subagent discover)
- Verification — how to confirm success (test command, expected output)
- Return format — what to report back (outcome + findings + files changed)
BAD: "Fix the auth system"
GOOD: "In src/auth/middleware.ts, the JWT validation on line 45 throws
on expired tokens instead of refreshing. Fix the validation to
call refreshToken() first. Verify: npm test -- auth.test.ts
should show 0 failures. Report: outcome + which lines changed."Red Flags
| Thought | Reality |
| "Subagent said done, moving on" | Parse the result. Check for caveats. Call export_cycle. |
| "The failure is minor, I'll note it later" | You won't. Call export_cycle({ outcome: "partial" }) NOW. |
| "I'll summarize all cycles at the end" | Compaction fires when it wants. Export each one as it returns. |
| "These tasks are independent enough" | Check: do they share ANY files? If yes, sequential. |
| "I'll do it all myself, faster" | 3 independent tasks × 5 min = 15 min. Or 5 min parallel. Delegate. |
| "The subagent can figure out the context" | No it can't. Provide files, constraints, verification commands. |
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.

