@pilllesss/yorn 1.0.128 → 1.0.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: "subagent"
3
+ description: "Delegate tasks, perform parallel research, or run focused subtasks using a stateless child Yorn agent via bash. Use when a task requires deep isolated research, executing tasks in parallel, running read-only code analysis without polluting current conversation context, or executing subtasks in a fresh unsaved session."
4
+ ---
5
+
6
+ # Subagent Task Delegation via Yorn CLI
7
+
8
+ This skill teaches how to spawn and manage child subagents using `yorn` CLI commands executed directly through the `bash` tool. Each subagent runs as an independent, stateless child session without persisting session history (`--no-session`), returning results directly to your bash output.
9
+
10
+ ---
11
+
12
+ ## 🚀 Core Command Patterns
13
+
14
+ ### 1. Direct Execution (Standard Delegation)
15
+ Run a self-contained subtask. The result prints directly to stdout in the bash tool result:
16
+
17
+ ```bash
18
+ yorn -p --no-session "Your complete, self-contained prompt here"
19
+ ```
20
+
21
+ ### 2. JSON Mode Output (Structured Output)
22
+ When you need machine-readable JSON output (message arrays, token usage, tool calls):
23
+
24
+ ```bash
25
+ yorn --mode json -p --no-session "Your prompt here"
26
+ ```
27
+
28
+ ### 3. Tool-Restricted Subagents
29
+ Restrict the child's available tools to limit scope and improve security (e.g. read-only search):
30
+
31
+ ```bash
32
+ # Read-only exploration agent
33
+ yorn -p --no-session --tools read,grep,find,ls "Search for authentication logic in src/ and summarize"
34
+
35
+ # Pure computation / reasoning (no tools allowed)
36
+ yorn -p --no-session --no-tools "Explain the time complexity and edge cases of this algorithm..."
37
+ ```
38
+
39
+ ### 4. Custom Model & Thinking Level
40
+ Use a faster or specialized model for lightweight tasks, or adjust reasoning effort:
41
+
42
+ ```bash
43
+ # Use a specific provider/model
44
+ yorn -p --no-session --model openrouter/anthropic/claude-3.5-sonnet "Refactor this function"
45
+
46
+ # Set thinking/reasoning level: off, minimal, low, medium, high
47
+ yorn -p --no-session --thinking high "Solve this complex architectural problem"
48
+ ```
49
+
50
+ ### 5. Custom Persona / System Prompt
51
+ Define a specialized role for the child agent:
52
+
53
+ ```bash
54
+ yorn -p --no-session \
55
+ --system-prompt "You are an expert security auditor. Review code strictly for OWASP vulnerabilities." \
56
+ "Audit the authentication endpoints in src/api/"
57
+ ```
58
+
59
+ ---
60
+
61
+ ## ⚡ Multiple Subtasks
62
+
63
+ When breaking down a large task into multiple independent subtasks, execute them sequentially or run them in separate bash tool calls to collect each result directly:
64
+
65
+ ```bash
66
+ yorn -p --no-session "Analyze package.json dependencies and identify potential security risks"
67
+ ```
68
+
69
+ ```bash
70
+ yorn -p --no-session "Check tsconfig.json and suggest compiler options for stricter type safety"
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 📋 Best Practices
76
+
77
+ 1. **Always use `--no-session` and `-p` (or `--mode json -p`):**
78
+ - `--no-session`: Prevents saving dummy sessions into `~/.yorn/agent/sessions/`.
79
+ - `-p` / `--print`: Runs in non-interactive print mode and outputs directly to stdout.
80
+
81
+ 2. **Direct Output (No File Redirection Needed):**
82
+ - The CLI outputs the answer straight to bash stdout. Do not pipe to temporary files unless you explicitly need to save the file for later use.
83
+
84
+ 3. **Provide Complete, Self-Contained Prompts:**
85
+ - The child agent **does not share or see the parent conversation history**.
86
+ - Include all necessary context, file paths, requirements, and formatting instructions in the prompt.
87
+
88
+ 4. **Quote Prompts Safely:**
89
+ - Wrap prompts in double quotes in bash, or pass multiline prompts via heredocs (`<<'EOF'`):
90
+
91
+ ```bash
92
+ yorn -p --no-session <<'EOF'
93
+ Review the following code and check for potential null pointer exceptions:
94
+ [Paste code or description here]
95
+ EOF
96
+ ```
97
+
98
+ 5. **Prevent Infinite Recursion:**
99
+ - Do not instruct child subagents to spawn further subagents.