@nt-ai-lab/opencode-skillz 0.2.7 → 0.2.8
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.
- package/AGENTS.md +1 -0
- package/commands/confidence-honesty.md +245 -0
- package/commands/investigate.md +153 -0
- package/index.js +45 -2
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -11,6 +11,7 @@ Purpose: package OpenCode workflow assets as a plugin.
|
|
|
11
11
|
## Conventions
|
|
12
12
|
|
|
13
13
|
- Keep command files process-oriented (not tone-oriented).
|
|
14
|
+
- Remove all personality from commands and skill content when creating them.
|
|
14
15
|
- Put voice and persona behavior in agent prompts.
|
|
15
16
|
- Treat reusable skill content as command templates in `commands/`.
|
|
16
17
|
- Commands should be manually invoked by default.
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Force honest confidence assessment before claiming conclusions. Triggers on 'root cause identified', 'problem identified', 'complete clarity'. Express confidence as percentage, explain what's stopping 100%, validate assumptions before presenting."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Confidence Honesty
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
Detailed, well-structured analyses can *look* thorough, then get presented with phrases like "complete clarity" or "root cause identified." Users reasonably trust that confidence. They act on it, communicate it to stakeholders, and make decisions.
|
|
10
|
+
|
|
11
|
+
Then new evidence appears and invalidates the entire hypothesis.
|
|
12
|
+
|
|
13
|
+
**The harm:**
|
|
14
|
+
- User trusted a conclusion that was actually ~40% confident
|
|
15
|
+
- Time wasted on wrong direction
|
|
16
|
+
- Stakeholders were misinformed
|
|
17
|
+
- Trust in the analysis erodes
|
|
18
|
+
|
|
19
|
+
**Why this happens:** Explanation quality gets conflated with evidence quality. A thorough, well-reasoned analysis feels like certainty—but reasoning without verified evidence is just speculation with extra steps.
|
|
20
|
+
|
|
21
|
+
## The Solution
|
|
22
|
+
|
|
23
|
+
Force explicit confidence assessment before claiming conclusions:
|
|
24
|
+
1. Express confidence as a percentage (not vague certainty)
|
|
25
|
+
2. Show the math: what evidence adds confidence, what gaps subtract it
|
|
26
|
+
3. Mandatory "Why not 100%?" for anything below 95%
|
|
27
|
+
4. Self-validate: if more evidence can be gathered directly, do it before presenting
|
|
28
|
+
|
|
29
|
+
## Critical Rules
|
|
30
|
+
|
|
31
|
+
🚨 **EXPRESS CONFIDENCE AS A PERCENTAGE.** Every conclusion needs a specific confidence level, not vague certainty.
|
|
32
|
+
|
|
33
|
+
🚨 **EXPLAIN WHAT'S STOPPING 100%.** For any confidence below 95%, you MUST explain the gaps. Non-negotiable.
|
|
34
|
+
|
|
35
|
+
🚨 **VALIDATE BEFORE PRESENTING.** If more evidence can be gathered directly, DO IT. Do not present unvalidated hypotheses.
|
|
36
|
+
|
|
37
|
+
## When This Triggers
|
|
38
|
+
|
|
39
|
+
Auto-invoke when about to claim:
|
|
40
|
+
- "root cause is", "the problem is", "root cause identified"
|
|
41
|
+
- "complete clarity", "definitely", "certainly", "clearly the issue"
|
|
42
|
+
- Any conclusive claim during investigation
|
|
43
|
+
|
|
44
|
+
## Confidence Levels
|
|
45
|
+
|
|
46
|
+
| Range | Icon | Meaning |
|
|
47
|
+
|-------|------|---------|
|
|
48
|
+
| 0-30% | 🔴 | Speculation - needs significant validation |
|
|
49
|
+
| 31-60% | 🟡 | Plausible - evidence exists but gaps remain |
|
|
50
|
+
| 61-85% | 🟠 | Likely - strong evidence, minor gaps |
|
|
51
|
+
| 86-94% | 🟢 | High confidence - validated, minor uncertainty |
|
|
52
|
+
| 95-100% | 💯 | Confirmed - fully validated |
|
|
53
|
+
|
|
54
|
+
**Calibration:**
|
|
55
|
+
- **20%**: One possibility among several
|
|
56
|
+
- **40%**: Evidence points this direction but key assumptions unverified
|
|
57
|
+
- **60%**: Evidence supports this, alternatives not ruled out
|
|
58
|
+
- **80%**: Strong evidence, assumptions verified, alternatives less likely
|
|
59
|
+
- **95%**: Validated with direct evidence, alternatives ruled out
|
|
60
|
+
- **100%**: Mathematical/logical certainty only
|
|
61
|
+
|
|
62
|
+
## Pre-Conclusion Checkpoint
|
|
63
|
+
|
|
64
|
+
**Before claiming ANY conclusion, complete this:**
|
|
65
|
+
|
|
66
|
+
### 1. Evidence Inventory
|
|
67
|
+
- What hard evidence supports this?
|
|
68
|
+
- Direct evidence (code/logs that prove it)?
|
|
69
|
+
- Circumstantial evidence (patterns consistent)?
|
|
70
|
+
- What's the strongest piece of evidence?
|
|
71
|
+
|
|
72
|
+
### 2. Falsifiability Check
|
|
73
|
+
- What would INVALIDATE this theory?
|
|
74
|
+
- What data would prove me wrong?
|
|
75
|
+
- Has that data been checked?
|
|
76
|
+
- If no: WHY NOT?
|
|
77
|
+
|
|
78
|
+
### 3. Assumption Audit
|
|
79
|
+
- What is being assumed WITHOUT verification?
|
|
80
|
+
- List each assumption explicitly
|
|
81
|
+
- Mark: [VERIFIED] or [ASSUMED]
|
|
82
|
+
|
|
83
|
+
### 4. Alternative Possibilities
|
|
84
|
+
- What else could explain these symptoms?
|
|
85
|
+
- List at least 2 alternatives
|
|
86
|
+
- Why is my conclusion more likely?
|
|
87
|
+
|
|
88
|
+
### 5. Validation Opportunities
|
|
89
|
+
- Can the actual data be fetched/checked?
|
|
90
|
+
- Can the codebase be searched for confirming/denying evidence?
|
|
91
|
+
- Should the user be asked for confirming data?
|
|
92
|
+
|
|
93
|
+
## Confidence Scoring
|
|
94
|
+
|
|
95
|
+
**Start at 50% (neutral) and adjust:**
|
|
96
|
+
|
|
97
|
+
| Factor | Adjustment |
|
|
98
|
+
|--------|------------|
|
|
99
|
+
| Direct evidence (code/logs proving it) | +15-25% |
|
|
100
|
+
| Verified assumptions (checked, not assumed) | +10-15% |
|
|
101
|
+
| Alternatives ruled out with evidence | +10-15% |
|
|
102
|
+
| Falsifiability check completed | +5-10% |
|
|
103
|
+
| Unverified critical assumptions | -15-25% |
|
|
104
|
+
| Plausible alternatives not ruled out | -10-15% |
|
|
105
|
+
| No falsifiability check | -10% |
|
|
106
|
+
| Circumstantial evidence only | -10% |
|
|
107
|
+
|
|
108
|
+
**Example calculation:**
|
|
109
|
+
```
|
|
110
|
+
Starting: 50%
|
|
111
|
+
+ Code analysis shows the pattern: +15%
|
|
112
|
+
+ Error logs match signature: +10%
|
|
113
|
+
- CRITICAL: Assumed config unchanged (NOT VERIFIED): -25%
|
|
114
|
+
- Alternative not ruled out: -10%
|
|
115
|
+
|
|
116
|
+
Final: 40% 🟡
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Response Format
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
[Icon] [X%] Confidence: [One sentence finding]
|
|
123
|
+
|
|
124
|
+
Evidence:
|
|
125
|
+
- [+X%] [Evidence 1]
|
|
126
|
+
- [+X%] [Evidence 2]
|
|
127
|
+
|
|
128
|
+
Why not 100%:
|
|
129
|
+
- [-X%] [What's stopping full confidence]
|
|
130
|
+
|
|
131
|
+
To increase confidence: [What would raise % - can be checked directly or needs user input]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Examples
|
|
135
|
+
|
|
136
|
+
### 🔴 25% - Low confidence
|
|
137
|
+
```
|
|
138
|
+
🔴 25% Confidence: Database connection pool may be exhausted
|
|
139
|
+
|
|
140
|
+
Evidence:
|
|
141
|
+
- [+15%] Error pattern matches connection timeout
|
|
142
|
+
- [+10%] Load spike occurred around failure time
|
|
143
|
+
|
|
144
|
+
Why not 100%:
|
|
145
|
+
- [-25%] Haven't verified actual pool metrics
|
|
146
|
+
- [-15%] Haven't ruled out: network issues, DNS problems
|
|
147
|
+
- [-35%] This is mostly pattern matching, not direct evidence
|
|
148
|
+
|
|
149
|
+
To increase confidence: Connection pool metrics from the time of failure are needed.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 🟠 75% - Moderate-high confidence
|
|
153
|
+
```
|
|
154
|
+
🟠 75% Confidence: API request failing due to missing required field
|
|
155
|
+
|
|
156
|
+
Evidence:
|
|
157
|
+
- [+20%] Error message explicitly mentions "field required"
|
|
158
|
+
- [+15%] Code path analysis shows validation happens here
|
|
159
|
+
- [+10%] Field was recently added to validation rules
|
|
160
|
+
|
|
161
|
+
Why not 100%:
|
|
162
|
+
- [-10%] Haven't verified the actual request payload
|
|
163
|
+
- [-15%] Could be a different field than suspected
|
|
164
|
+
|
|
165
|
+
To increase confidence: Check the actual request payload from the failing call.
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 💯 98% - Near certain
|
|
169
|
+
```
|
|
170
|
+
💯 98% Confidence: Root cause is misconfigured environment variable
|
|
171
|
+
|
|
172
|
+
Evidence:
|
|
173
|
+
- [+25%] Environment variable is set to wrong value (verified)
|
|
174
|
+
- [+20%] Code directly uses this variable for the failing operation
|
|
175
|
+
- [+15%] Error message matches expected failure mode
|
|
176
|
+
- [+10%] Fixing the variable in staging resolved the issue
|
|
177
|
+
|
|
178
|
+
Why not 100%: Haven't deployed fix to production yet to confirm.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Anti-Patterns
|
|
182
|
+
|
|
183
|
+
### ❌ Premature Certainty
|
|
184
|
+
|
|
185
|
+
**What happens:**
|
|
186
|
+
```
|
|
187
|
+
Analysis: "Complete clarity on the root cause"
|
|
188
|
+
Assistant: [200 lines of detailed report]
|
|
189
|
+
User: [provides data that contradicts analysis]
|
|
190
|
+
Assistant: "This changes everything..."
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**What should happen:**
|
|
194
|
+
```
|
|
195
|
+
🟡 40% Confidence: The issue appears to be X
|
|
196
|
+
|
|
197
|
+
Evidence:
|
|
198
|
+
- [+15%] Code path analysis suggests this pattern
|
|
199
|
+
|
|
200
|
+
Why not 100%:
|
|
201
|
+
- [-25%] CRITICAL: Haven't verified actual system state
|
|
202
|
+
- [-15%] Alternative not ruled out
|
|
203
|
+
|
|
204
|
+
To increase confidence: Provide [specific data], or check it directly if available.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### ❌ Confidence in Explanation Quality
|
|
208
|
+
|
|
209
|
+
Building a detailed report ≠ having valid evidence.
|
|
210
|
+
|
|
211
|
+
Thoroughness of presentation has zero correlation with correctness.
|
|
212
|
+
|
|
213
|
+
**Violation sign:** "Complete clarity" based on reasoning, not evidence.
|
|
214
|
+
|
|
215
|
+
### ❌ Skipping Falsifiability
|
|
216
|
+
|
|
217
|
+
If the question "what would prove this wrong?" cannot be answered, the theory is not understood well enough.
|
|
218
|
+
|
|
219
|
+
## Self-Validation Rule
|
|
220
|
+
|
|
221
|
+
**Do not return to the user with questions that can be answered directly.**
|
|
222
|
+
|
|
223
|
+
Before presenting, ask:
|
|
224
|
+
```
|
|
225
|
+
Can more evidence be gathered directly?
|
|
226
|
+
├─ Search codebase for confirming/denying data?
|
|
227
|
+
├─ Fetch a file that validates an assumption?
|
|
228
|
+
├─ Spawn an agent to investigate further?
|
|
229
|
+
└─ Check actual state vs assumed state?
|
|
230
|
+
|
|
231
|
+
If YES → DO IT. Then reassess confidence.
|
|
232
|
+
If NO → Present with honest confidence + what is needed from the user.
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Critical:** If confidence is below 80% and more evidence can be gathered directly → DO IT.
|
|
236
|
+
|
|
237
|
+
## Summary
|
|
238
|
+
|
|
239
|
+
🚨 **Confidence is a percentage, not a feeling.**
|
|
240
|
+
|
|
241
|
+
🚨 **Below 95%? Explain what's stopping 100%.**
|
|
242
|
+
|
|
243
|
+
🚨 **Can validate yourself? Do it before presenting.**
|
|
244
|
+
|
|
245
|
+
The goal: Never claim "complete clarity" with 40% confidence and unverified assumptions.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Investigate technical problems systematically with evidence-first methods and explicit confidence reporting
|
|
3
|
+
compose_after: confidence-honesty
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Apply this command to:
|
|
7
|
+
$ARGUMENTS
|
|
8
|
+
|
|
9
|
+
# Technical Investigator
|
|
10
|
+
|
|
11
|
+
Investigate technical problems systematically. Do not guess—gather evidence until the problem is understood.
|
|
12
|
+
|
|
13
|
+
### Core Principles
|
|
14
|
+
|
|
15
|
+
**Solve the right problem.** Before investigating, be crystal clear about the problem being solved. Restate it. Verify understanding. A thorough answer to the wrong question is worthless. Keep asking: "Has the requested problem actually been solved?"
|
|
16
|
+
|
|
17
|
+
**Observability is the answer.** When system behavior is unclear, add instrumentation. Logs, metrics, traces, and debug output make the invisible visible. If guessing is still happening, observability is insufficient.
|
|
18
|
+
|
|
19
|
+
**Thoroughness over speed.** Do not rush to conclusions. Build a detailed picture of the problem—every component, every interaction, every timeline. Shallow investigation leads to wrong answers and repeated work.
|
|
20
|
+
|
|
21
|
+
**Evidence, not assumptions.** Every conclusion needs supporting evidence. Show the work. If no supporting data exists, the investigation is incomplete.
|
|
22
|
+
|
|
23
|
+
**Do the work.** Investigation is labor. Run the queries, read the logs, trace the requests, add the instrumentation. There are no shortcuts to understanding.
|
|
24
|
+
|
|
25
|
+
**Starting an investigation:**
|
|
26
|
+
- Define the problem precisely—what's expected vs what's happening
|
|
27
|
+
- Gather existing data before forming hypotheses
|
|
28
|
+
- Build a timeline of events with specific timestamps
|
|
29
|
+
- Identify unknowns (gaps in observability)
|
|
30
|
+
|
|
31
|
+
**When investigation hits a wall:**
|
|
32
|
+
- Add more observability—logs, metrics, debug output
|
|
33
|
+
- Don't guess—instrument and measure
|
|
34
|
+
- State what instrumentation is needed to understand the unknown
|
|
35
|
+
- Never present unproven claims as facts
|
|
36
|
+
|
|
37
|
+
**Before concluding:**
|
|
38
|
+
- Ask: "Has the original problem actually been solved?"
|
|
39
|
+
- Verify your answer addresses what was asked
|
|
40
|
+
- Don't settle for partial answers or adjacent solutions
|
|
41
|
+
- If the problem is not fully solved, say so and continue
|
|
42
|
+
|
|
43
|
+
**Forming conclusions:**
|
|
44
|
+
- Hypotheses must be testable
|
|
45
|
+
- Show the evidence chain
|
|
46
|
+
- Distinguish correlation from causation
|
|
47
|
+
- Verify fixes actually work—don't assume
|
|
48
|
+
|
|
49
|
+
## Core Investigation Methodologies
|
|
50
|
+
|
|
51
|
+
### 1. Scientific Method (Hypothesis-Driven)
|
|
52
|
+
|
|
53
|
+
**The Process:**
|
|
54
|
+
1. **Observe**: Gather data, identify patterns, note anomalies
|
|
55
|
+
2. **Hypothesize**: Form testable explanations for the observed evidence
|
|
56
|
+
3. **Experiment**: Design specific tests to validate/invalidate hypotheses
|
|
57
|
+
4. **Evaluate**: Analyze results, adjust hypotheses, iterate
|
|
58
|
+
|
|
59
|
+
**Key Principles:**
|
|
60
|
+
- Make assumptions explicit—never leave reasoning implicit
|
|
61
|
+
- Create falsifiable hypotheses that can be tested with specific experiments
|
|
62
|
+
- Follow the "10-minute rule": If ad-hoc inspection hasn't found the issue in 10 minutes, switch to systematic investigation
|
|
63
|
+
- Document your reasoning chain so others can follow your logic
|
|
64
|
+
|
|
65
|
+
### 2. Google SRE Practices
|
|
66
|
+
|
|
67
|
+
**Incident Response:**
|
|
68
|
+
- Mitigation first, understanding second (when systems are down)
|
|
69
|
+
- Declare incidents early—don't wait for certainty
|
|
70
|
+
- Maintain working records in real-time during investigation
|
|
71
|
+
- Use persistent communication channels as investigation logs
|
|
72
|
+
|
|
73
|
+
**Observability:**
|
|
74
|
+
- Monitor the "Four Golden Signals": Latency, Traffic, Errors, Saturation
|
|
75
|
+
- Leverage three pillars: Metrics (trends), Logs (sequences), Traces (components)
|
|
76
|
+
- Accept that future problems cannot be predicted—build systems to investigate the unknown
|
|
77
|
+
- Focus on high-cardinality data for distributed systems
|
|
78
|
+
|
|
79
|
+
### 3. Root Cause Analysis
|
|
80
|
+
|
|
81
|
+
**Techniques:**
|
|
82
|
+
- **5 Whys**: Ask "why" iteratively to uncover root causes (typically 5 levels deep)
|
|
83
|
+
- **Timeline Analysis**: Build detailed timelines with specific events and timestamps
|
|
84
|
+
- **Fault Tree Analysis**: Visual hierarchical breakdown of failure scenarios
|
|
85
|
+
- **Correlation vs Causation**: Distinguish between things that happen together vs things that cause each other
|
|
86
|
+
|
|
87
|
+
**Principles:**
|
|
88
|
+
- Symptoms are not causes—keep digging
|
|
89
|
+
- Root causes often involve multiple contributing factors
|
|
90
|
+
- Document evidence that supports your causal chain
|
|
91
|
+
- Verify root cause fixes actually prevent recurrence
|
|
92
|
+
|
|
93
|
+
### 4. Performance Analysis (USE Method)
|
|
94
|
+
|
|
95
|
+
Apply Brendan Gregg's systematic bottleneck identification:
|
|
96
|
+
|
|
97
|
+
**USE Method:**
|
|
98
|
+
- **Utilization**: How busy is the resource (% time doing work)?
|
|
99
|
+
- **Saturation**: How much work is queued/waiting?
|
|
100
|
+
- **Errors**: Count of error events
|
|
101
|
+
|
|
102
|
+
**Application:**
|
|
103
|
+
- Apply to all resources: CPU, memory, disk, network, database connections, etc.
|
|
104
|
+
- Systematic investigation prevents missing bottlenecks
|
|
105
|
+
- Collect baseline measurements to compare against
|
|
106
|
+
- Focus on resources with high utilization AND high saturation
|
|
107
|
+
|
|
108
|
+
## Investigation Workflow
|
|
109
|
+
|
|
110
|
+
### Phase 1: Problem Definition
|
|
111
|
+
- Define the problem statement clearly and specifically
|
|
112
|
+
- Identify what changed (if known)
|
|
113
|
+
- Establish baseline/expected behavior
|
|
114
|
+
- Determine impact and urgency
|
|
115
|
+
|
|
116
|
+
### Phase 2: Data Gathering
|
|
117
|
+
- Collect metrics: trends, patterns, anomalies
|
|
118
|
+
- Review logs: event sequences, errors, warnings
|
|
119
|
+
- Analyze traces: component interactions, latency distribution
|
|
120
|
+
- Query databases: aggregate data, identify outliers
|
|
121
|
+
- Check monitoring dashboards: Four Golden Signals
|
|
122
|
+
|
|
123
|
+
### Phase 3: Hypothesis Formation
|
|
124
|
+
- Based on data, form 2-4 testable hypotheses
|
|
125
|
+
- Make assumptions explicit
|
|
126
|
+
- Rank hypotheses by likelihood and test cost
|
|
127
|
+
- Document expected outcomes for each hypothesis
|
|
128
|
+
|
|
129
|
+
### Phase 4: Experimentation
|
|
130
|
+
- Design specific tests to validate/invalidate hypotheses
|
|
131
|
+
- Run experiments systematically (one variable at a time when possible)
|
|
132
|
+
- Document results meticulously
|
|
133
|
+
- Adjust hypotheses based on findings
|
|
134
|
+
|
|
135
|
+
### Phase 5: Documentation
|
|
136
|
+
- Build comprehensive timelines
|
|
137
|
+
- Document evidence chain
|
|
138
|
+
- Record reasoning and decision points
|
|
139
|
+
- Create actionable findings
|
|
140
|
+
|
|
141
|
+
### Investigation Documentation
|
|
142
|
+
|
|
143
|
+
**Real-Time Records:**
|
|
144
|
+
- Document during the investigation, not after
|
|
145
|
+
- Record hypotheses and reasoning
|
|
146
|
+
- Note dead ends—they prevent others from repeating them
|
|
147
|
+
- Build detailed timelines with timestamps
|
|
148
|
+
|
|
149
|
+
**Sharing Findings:**
|
|
150
|
+
- Present evidence clearly
|
|
151
|
+
- Show your reasoning chain
|
|
152
|
+
- Be direct about confidence levels
|
|
153
|
+
- Admit uncertainty when appropriate
|
package/index.js
CHANGED
|
@@ -40,10 +40,15 @@ function readMarkdownFiles(dirPath) {
|
|
|
40
40
|
.sort((a, b) => a.localeCompare(b))
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function normalizeCommandReference(value) {
|
|
44
|
+
if (!value || typeof value !== "string") return ""
|
|
45
|
+
return value.trim().replace(/_/g, "-")
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
function loadCommands() {
|
|
44
49
|
const commandsDir = path.join(pluginRoot, "commands")
|
|
45
50
|
const files = readMarkdownFiles(commandsDir)
|
|
46
|
-
const
|
|
51
|
+
const rawCommands = {}
|
|
47
52
|
|
|
48
53
|
for (const file of files) {
|
|
49
54
|
const name = file.replace(/\.md$/, "")
|
|
@@ -51,9 +56,47 @@ function loadCommands() {
|
|
|
51
56
|
const content = fs.readFileSync(fullPath, "utf8")
|
|
52
57
|
const { meta, body } = extractFrontmatter(content)
|
|
53
58
|
|
|
59
|
+
rawCommands[name] = {
|
|
60
|
+
meta,
|
|
61
|
+
body: body.trim(),
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const commands = {}
|
|
66
|
+
|
|
67
|
+
function buildComposedTemplate(name, stack = new Set()) {
|
|
68
|
+
const rawCommand = rawCommands[name]
|
|
69
|
+
if (!rawCommand) return ""
|
|
70
|
+
if (stack.has(name)) return rawCommand.body
|
|
71
|
+
|
|
72
|
+
stack.add(name)
|
|
73
|
+
|
|
74
|
+
let template = rawCommand.body
|
|
75
|
+
const composeAfterName = normalizeCommandReference(rawCommand.meta.compose_after)
|
|
76
|
+
const composedCommand = rawCommands[composeAfterName]
|
|
77
|
+
|
|
78
|
+
if (composeAfterName && composedCommand) {
|
|
79
|
+
const composedTemplate = buildComposedTemplate(composeAfterName, stack)
|
|
80
|
+
if (composedTemplate) {
|
|
81
|
+
template = [
|
|
82
|
+
template,
|
|
83
|
+
`In addition you must adhere to the following:\n\n${composedTemplate}`,
|
|
84
|
+
]
|
|
85
|
+
.filter(Boolean)
|
|
86
|
+
.join("\n\n")
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
stack.delete(name)
|
|
91
|
+
|
|
92
|
+
return template.trim()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
for (const [name, rawCommand] of Object.entries(rawCommands)) {
|
|
96
|
+
const { meta } = rawCommand
|
|
54
97
|
const command = {
|
|
55
98
|
description: meta.description || `Run /${name}`,
|
|
56
|
-
template:
|
|
99
|
+
template: buildComposedTemplate(name),
|
|
57
100
|
}
|
|
58
101
|
|
|
59
102
|
if (meta.agent) command.agent = meta.agent
|