Delegate

From fritzprix/libr-agent · View interactive version

Delegate is an AI agent skill from the GitHub repository fritzprix/libr-agent. Delegate work between LibrAgent AI agent sessions using sub-agent sessions. Use when an agent needs to spawn, brief, monitor, or troubleshoot a child session with `agent__spawnSession`, `agent__checkSession`, or `agent__messageToSession`, especially when deciding whether the child really needs paren

How to use this skill

Skill file

Delegate

Runtime Tool Names

LibrAgent exposes builtin tools as server__tool (for example agent__spawnSession). Use the exact names from the current session tool list when calling tools. Bare shorthand like spawnSession will fail at runtime.

agent__spawnSession and agent__messageToSession require complexity (low | normal | high). Choose the minimum sufficient level. Mapped models come from Settings → Sub-Agent Model Routing; unset levels keep the normal parent/default model chain.

Treat sub-agent delegation as session orchestration, not magic inheritance.

A plain child session keeps lineage to its parent, but it does not automatically inherit the parent's workspace, workspace instruction files, or workspace-local skills. When the child must see caller deliverables, share the workspace on purpose: pass workspaceOverride="current" (also "." or "inherit") — the absolute workspace root is listed under Agent Runtime Identity — or inline the needed file contents in the task. Org children inherit the org root workspace by default.

Read references/delegation-patterns.md when you need concrete handoff templates, troubleshooting patterns, or a quick matrix for what the child session can actually see.

Skill Routing

| Need | Skill |

| --- | --- |

| Spawn, isolation, workspace/handoff mechanics | this skill (delegate) |

| Strict acceptance criteria, proof-before-done, reject/re-steer loop | delegation-eval-loop (parent = evaluator, child = generator) |

| Parallel independent pieces | divide-conquer |

| Multi-perspective review of one question | consensus-delegation |

Do not paste the full eval protocol into every delegation. Use light checks in §5 for casual handoffs; load delegation-eval-loop when the user or task requires verifiable completion.

Delegation Workflow

  1. Decide whether delegation is appropriate.
  2. Inspect existing child sessions and reuse a suitable idle session with the same assistant configuration when possible.
  3. Choose the child's effective context.
  4. Prepare a handoff that includes everything the child actually needs.
  5. Start a new child only when no suitable session exists or separate role, parallel, or workspace isolation is needed.
  6. Monitor or steer it with follow-up messages.
  7. Merge the result back into the parent flow.

1. Decide Whether to Delegate

Sequential imperatives (for example "X를 다른 애한테 시켜놓고 우리는 딴 거 하자", "have another agent do X while we do Y")

mean: call agent__spawnSession for X now, in the background, then continue with the parent task.

Do not assume X was already handed off. Do this only when X's goal and deliverable can be written into

the brief (see section 3: the child cannot see the parent's scratchpad or workspace, so inline the context

it needs). Pick the assistant with agent__listAgents(type="configs") and pass its configId, with

waitForResult=false (see section 4). If X is ambiguous or depends on context you cannot inline, ask one

question instead.

Delegate when the work is bounded, parallelizable, or benefits from a specialized assistant.

Good delegation targets:

Scratchpad notes (scratchpad__*) are always session-private — children cannot read them. Copy any required notes into the task text.

When the child must rely on parent workspace files, instructions, or workspace-local skills, do not abandon delegation. Fix the handoff:

Never silently replace a user-requested third-party review or audit with a parent self-evaluation. If the child cannot access dependencies, re-spawn with a correct workspace binding, inline the missing content, or report the blockage to the user.

When the child finishes, require deliverables in its final text response. Parent recovery uses that text (agent__checkSession / waitForResult), not scratchpad IDs — child scratchpad notes are invisible to the parent.

After agent__checkSession, read the Metadata workspace: line: SHARED with caller means relative paths in the parent root are safe; ISOLATED means the parent cannot workspace__readFile that path — rely on Result text or agent__messageToSession, and do not assume sibling sessions share a workspace.

2. Choose the Child's Effective Context

Assume these rules:

If the parent is running inside a task-force workspace, check .libragent/teamwork.json before delegating:

Important limitations:

3. Prepare the Handoff

Make the task self-contained. The child should not need to guess what the parent meant.

Always include:

If the child needs a specific skill workflow, prefer one of these approaches:

Say "use the same workspace as this session" only when you intentionally started the child in that shared workspace.

4. Start and Manage the Child Session

Use the builtin agent tools deliberately:

Default to waitForResult=false unless the parent truly has nothing useful to do while waiting.

Deliverable review / audit handoff

When the user asks another agent to audit or review existing workspace deliverables:

  1. Spawn (or reuse) a child with workspaceOverride="current" so Metadata reports SHARED with caller.
  2. Point the task at relative paths that exist in the shared root (or inline contents if you intentionally keep isolation).
  3. Wait for the child's final text; present that as the independent review.
  4. If the child reports missing files under ISOLATED, fix the binding and re-spawn — do not grade your own work as a substitute.

5. Review the Result (Parent Owns Acceptance)

Do not blindly trust the child. The child generates; the parent accepts. A child's "done" / "tests pass" claim is a hypothesis until the parent has evidence.

Casual handoff (this skill only) — after agent__checkSession returns idle:

Strict / high-stakes handoff — stop here and follow delegation-eval-loop:

Incomplete, cancelled, circuit-broken, or evidence-free runs are not successes even if the prose sounds finished.

6. Troubleshooting Heuristics

If the child cannot find a file, a local skill, or a workspace rule, assume isolation first.

Common causes:

When in doubt, re-spawn with workspaceOverride="current" or restate the missing context in the task. Do not silently finish a requested delegation as a parent self-audit.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.