apero-kit-cli 2.2.5 → 2.4.0

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,306 @@
1
+ ---
2
+ name: train-prompt
3
+ description: Add new documents, links, or knowledge to train and expand bot capabilities
4
+ user-invocable: true
5
+ disable-model-invocation: false
6
+ metadata: {"openclaw": {"always": true}}
7
+ ---
8
+
9
+ # Train Prompt - Auto Learning System
10
+
11
+ ## Trigger Conditions
12
+
13
+ Activate when user:
14
+ - Says: "train", "learn", "add knowledge", "teach you"
15
+ - Provides: URL, document link, file path
16
+ - Requests: "remember this", "add this to your knowledge"
17
+ - Commands: "/train", "/learn", "/add-doc"
18
+
19
+ ## Input Types Supported
20
+
21
+ 1. **URLs** - Web pages, documentation, articles
22
+ 2. **Files** - Markdown, PDF, text files
23
+ 3. **Inline content** - Direct text/instructions
24
+ 4. **GitHub repos** - Repository documentation
25
+
26
+ ## Workflow
27
+
28
+ ### Step 1: Detect Input Type
29
+
30
+ ```
31
+ IF input contains URL → fetch_and_process_url
32
+ IF input contains file path → read_and_process_file
33
+ IF input is inline text → process_inline_content
34
+ IF input is GitHub URL → clone_and_extract_docs
35
+ ```
36
+
37
+ ### Step 2: Process Content
38
+
39
+ #### For URLs:
40
+ 1. Fetch URL content using `web_fetch` tool
41
+ 2. Extract main content (remove nav, ads, etc.)
42
+ 3. Convert to markdown format
43
+ 4. Identify key concepts and patterns
44
+
45
+ #### For Files:
46
+ 1. Read file content
47
+ 2. Parse based on file type (md, pdf, txt)
48
+ 3. Extract structured information
49
+
50
+ #### For Inline Content:
51
+ 1. Parse user's instructions
52
+ 2. Identify intent and knowledge type
53
+ 3. Structure as skill or reference
54
+
55
+ ### Step 3: Generate Skill/Reference
56
+
57
+ Based on content type, create:
58
+
59
+ **A) New Skill** (if content describes a workflow/process):
60
+ ```
61
+ skills/<skill-name>/
62
+ ├── SKILL.md ← Generated skill definition
63
+ └── references/
64
+ └── source.md ← Original content
65
+ ```
66
+
67
+ **B) Reference Document** (if content is documentation):
68
+ ```
69
+ skills/<parent-skill>/
70
+ └── references/
71
+ └── <doc-name>.md ← Extracted knowledge
72
+ ```
73
+
74
+ **C) Bootstrap Update** (if content is identity/rules):
75
+ ```
76
+ Append to SOUL.md or AGENTS.md
77
+ ```
78
+
79
+ ### Step 4: Skill Generation Template
80
+
81
+ For new skills, generate:
82
+
83
+ ```yaml
84
+ ---
85
+ name: {extracted-name}
86
+ description: {one-line-summary}
87
+ user-invocable: true
88
+ metadata: {"openclaw": {"always": true, "source": "{original-url-or-path}"}}
89
+ ---
90
+
91
+ # {Skill Title}
92
+
93
+ ## Purpose
94
+ {extracted-purpose}
95
+
96
+ ## Trigger Conditions
97
+ Activate when user mentions:
98
+ {extracted-keywords}
99
+
100
+ ## Workflow
101
+ {extracted-steps}
102
+
103
+ ## Reference
104
+ Source: {original-source}
105
+ Added: {timestamp}
106
+ ```
107
+
108
+ ### Step 5: Confirm & Save
109
+
110
+ 1. Show preview of generated skill/reference
111
+ 2. Ask user to confirm or edit
112
+ 3. Save to appropriate location
113
+ 4. Update skill index
114
+
115
+ ## Commands
116
+
117
+ ### /train <url>
118
+ Fetch and learn from a URL.
119
+
120
+ Example:
121
+ ```
122
+ /train https://docs.example.com/api-guide
123
+ ```
124
+
125
+ ### /train:file <path>
126
+ Learn from a local file.
127
+
128
+ Example:
129
+ ```
130
+ /train:file ./docs/coding-standards.md
131
+ ```
132
+
133
+ ### /train:inline
134
+ Learn from inline content.
135
+
136
+ Example:
137
+ ```
138
+ /train:inline
139
+ When handling API errors:
140
+ 1. Log the error with context
141
+ 2. Return appropriate HTTP status
142
+ 3. Never expose internal details
143
+ ```
144
+
145
+ ### /train:github <repo-url>
146
+ Extract knowledge from GitHub repository.
147
+
148
+ Example:
149
+ ```
150
+ /train:github https://github.com/example/repo
151
+ ```
152
+
153
+ ### /train:list
154
+ Show all trained knowledge sources.
155
+
156
+ ### /train:remove <skill-name>
157
+ Remove a trained skill.
158
+
159
+ ## Output Format
160
+
161
+ After training:
162
+
163
+ ```markdown
164
+ ## Training Complete
165
+
166
+ **Source:** {url-or-path}
167
+ **Type:** {skill|reference|bootstrap}
168
+ **Location:** {saved-path}
169
+
170
+ ### Generated Knowledge
171
+
172
+ **Skill:** {skill-name}
173
+ **Description:** {description}
174
+ **Triggers:** {keyword-list}
175
+
176
+ ### Next Steps
177
+ - Test with: "{example-trigger}"
178
+ - Edit at: {file-path}
179
+ - View all: /train:list
180
+ ```
181
+
182
+ ## Storage Structure
183
+
184
+ ```
185
+ .discord/
186
+ ├── skills/
187
+ │ ├── trained/ ← Auto-generated skills
188
+ │ │ ├── api-docs-example/
189
+ │ │ │ ├── SKILL.md
190
+ │ │ │ └── references/
191
+ │ │ │ └── source.md
192
+ │ │ └── coding-standards/
193
+ │ │ └── SKILL.md
194
+ │ └── train-prompt/ ← This skill
195
+ │ └── SKILL.md
196
+ ├── knowledge/ ← Reference documents
197
+ │ ├── sources.json ← Index of all sources
198
+ │ └── docs/
199
+ │ ├── doc-001.md
200
+ │ └── doc-002.md
201
+ └── SOUL.md ← Updated with rules
202
+ ```
203
+
204
+ ## Knowledge Index (sources.json)
205
+
206
+ ```json
207
+ {
208
+ "sources": [
209
+ {
210
+ "id": "src-001",
211
+ "type": "url",
212
+ "source": "https://docs.example.com/api",
213
+ "skill": "api-docs-example",
214
+ "added": "2024-01-15T10:30:00Z",
215
+ "keywords": ["api", "rest", "endpoints"]
216
+ }
217
+ ],
218
+ "stats": {
219
+ "total_skills": 5,
220
+ "total_references": 12,
221
+ "last_updated": "2024-01-15T10:30:00Z"
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## Advanced Features
227
+
228
+ ### Auto-Refresh
229
+ For URLs, optionally set up periodic refresh:
230
+ ```
231
+ /train <url> --refresh=daily
232
+ ```
233
+
234
+ ### Merge Knowledge
235
+ Combine multiple sources into one skill:
236
+ ```
237
+ /train:merge skill-a skill-b --into=combined-skill
238
+ ```
239
+
240
+ ### Export Training
241
+ Export all trained knowledge:
242
+ ```
243
+ /train:export --format=zip
244
+ ```
245
+
246
+ ## Security Notes
247
+
248
+ - Only fetch from trusted URLs
249
+ - Sanitize all external content
250
+ - Don't execute code from external sources
251
+ - Review generated skills before enabling
252
+
253
+ ## Examples
254
+
255
+ ### Example 1: Train from API Documentation
256
+ ```
257
+ User: /train https://stripe.com/docs/api
258
+
259
+ Bot: Fetching Stripe API documentation...
260
+
261
+ Training Complete!
262
+
263
+ **Skill:** stripe-api
264
+ **Triggers:** "stripe", "payment", "checkout", "subscription"
265
+ **Capabilities:**
266
+ - Create payment intents
267
+ - Handle webhooks
268
+ - Manage subscriptions
269
+
270
+ Test with: "How do I create a Stripe checkout session?"
271
+ ```
272
+
273
+ ### Example 2: Train Custom Workflow
274
+ ```
275
+ User: /train:inline
276
+ Our deployment process:
277
+ 1. Run tests: npm test
278
+ 2. Build: npm run build
279
+ 3. Deploy staging: ./deploy.sh staging
280
+ 4. Smoke test staging
281
+ 5. Deploy prod: ./deploy.sh prod
282
+
283
+ Bot: Training Complete!
284
+
285
+ **Skill:** deployment-workflow
286
+ **Triggers:** "deploy", "release", "staging", "production"
287
+
288
+ Test with: "Help me deploy to staging"
289
+ ```
290
+
291
+ ### Example 3: Train from GitHub
292
+ ```
293
+ User: /train:github https://github.com/company/styleguide
294
+
295
+ Bot: Cloning repository...
296
+ Found: README.md, CONTRIBUTING.md, docs/*.md
297
+
298
+ Training Complete!
299
+
300
+ **Skills Generated:**
301
+ 1. code-style (from style-guide.md)
302
+ 2. git-workflow (from CONTRIBUTING.md)
303
+ 3. project-setup (from README.md)
304
+
305
+ Test with: "What's our code style for TypeScript?"
306
+ ```