You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/design/agent-skills/agent-skills-spike.md
+65-27Lines changed: 65 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
**The problem**: Lightspeed Core has no mechanism for extending agent capabilities with specialized instructions or domain knowledge. Users cannot package reusable workflows, troubleshooting guides, or domain expertise into portable, discoverable units that the LLM can use on demand.
6
6
7
-
**The recommendation**: Implement the [Agent Skills open standard](https://agentskills.io) with filesystem-based discovery. Config specifies paths to skill directories; skill metadata (name, description) is read from `SKILL.md` frontmatter at startup. The LLM sees a skill catalog (name + description) in the system prompt and can request full instructions on demand via a dedicated tool.
7
+
**The recommendation**: Implement the [Agent Skills open standard](https://agentskills.io) with filesystem-based discovery. Config specifies paths to skill directories; skill metadata (name, description) is read from `SKILL.md` frontmatter at startup. The LLM discovers available skills via a `list_skills` tool and loads full instructions on demand via an `activate_skill` tool. The system prompt contains behavioral instructions for how to use these tools, not the skill catalog itself.
8
8
9
9
**PoC validation**: Not applicable for this spike. The feature is well-defined by the agentskills.io specification and has been implemented by 30+ agent products including Claude Code, GitHub Copilot, Cursor, and OpenAI Codex.
10
10
@@ -63,22 +63,48 @@ Architecture-level and implementation-level decisions.
63
63
64
64
| Option | Description |
65
65
|--------|-------------|
66
-
| A | System prompt injection (skill catalog in system prompt, LLM decides) |
67
-
| B |Dedicated tool (register `activate_skill` tool, LLM calls to load) |
66
+
| A | System prompt catalog (skill catalog embedded in system prompt, LLM decides) |
| C | Per-request parameter (client specifies which skills to activate) |
69
+
| D | Hybrid (catalog in system prompt if < N skills, tool-based discovery otherwise) |
69
70
70
-
**Recommendation**: **A** (System prompt injection) for the catalog, combined with **B** (dedicated tool) for loading full instructions. The system prompt contains the skill catalog (name + description, ~50-100 tokens per skill). When the LLM decides a skill is relevant, it calls the `activate_skill` tool to load the full instructions.
71
+
**Recommendation**: **B** (Tool-based discovery). This approach separates behavioral instructions from skill inventory:
The phase 2 extension requires only a tool implementation change, not an architectural change. The system prompt instructions and `activate_skill` tool remain unchanged.
90
+
91
+
**Alternative considered**: Option A (system prompt catalog) was considered but rejected because:
92
+
- Token cost grows linearly with skill count (~50-100 tokens/skill)
93
+
- Risk of overwhelming the model context with large skill catalogs
94
+
- No clean evolution path to search-based discovery
95
+
96
+
Option D (hybrid) remains viable for deployments with predictable skill counts, but adds complexity. Teams can revisit if phase 2 search proves unreliable for small catalogs.
71
97
72
98
### Decision 6: Skill context management
73
99
74
100
| Option | Description |
75
101
|--------|-------------|
76
102
| A | Always loaded (all skills' full instructions in every request) |
77
-
| B |Catalog + on-demand (only name/description upfront, full content loaded when LLM requests) |
103
+
| B |Progressive disclosure (catalog via tool, full content loaded when LLM requests) |
78
104
79
-
**Recommendation**: **B** (Catalog + on-demand). This follows the agentskills.io progressive disclosure pattern:
80
-
1.**Catalog** (~50-100 tokens/skill) - name + description always in system prompt
81
-
2.**Instructions** (<5000 tokens) - full `SKILL.md` body loaded via tool when needed
105
+
**Recommendation**: **B** (Progressive disclosure). This follows the agentskills.io pattern:
106
+
1.**Catalog** (~50-100 tokens/skill) - name + description returned by `list_skills` tool
107
+
2.**Instructions** (<5000 tokens) - full `SKILL.md` body loaded via `activate_skill`tool when needed
82
108
3.**Resources** (on-demand) - `references/` files loaded via file-read tool when referenced
83
109
84
110
This keeps the base context small while giving the LLM access to specialized knowledge on demand.
@@ -146,37 +172,39 @@ Follow the MCP server config pattern (ModelContextProtocolServer class, line 468
146
172
147
173
<!-- type: Task -->
148
174
<!-- key: LCORE-???? -->
149
-
### LCORE-???? Implement skill catalog injection
175
+
### LCORE-???? Implement list_skills tool
150
176
151
-
**Description**: Inject the skill catalog (name + description for each skill) into the system prompt so the LLM knows what skills are available.
177
+
**Description**: Register a `list_skills` tool that the LLM can call to discover available skills. Returns the skill catalog (name + description for each configured skill).
152
178
153
179
**Scope**:
154
180
155
-
- Create `src/utils/skills.py` module
156
-
- Implement `build_skill_catalog()` function that formats skills as XML/structured text
157
-
- Modify `get_system_prompt()` in `src/utils/prompts.py` to append skill catalog
158
-
- Add behavioral instructions telling the LLM how to use skills
181
+
- Create `src/utils/skills.py` module with skill catalog management
182
+
- Add `list_skills` tool registration in `prepare_tools()` in `src/utils/responses.py`
**Description**: Register a `activate_skill` tool that the LLM can call to load full skill instructions when it decides a skill is relevant.
207
+
**Description**: Register an `activate_skill` tool that the LLM can call to load full skill instructions when it decides a skill is relevant. This complements `list_skills` by providing the detailed instructions for a specific skill.
180
208
181
209
**Scope**:
182
210
@@ -190,7 +218,8 @@ src/utils/skills.py (new module).
190
218
- LLM can call `activate_skill(name="skill-name")` to load skill instructions
191
219
- Tool returns full `SKILL.md` body content (after frontmatter)
192
220
- Tool returns skill directory path so LLM can resolve relative references
193
-
- Tool returns error if skill name is invalid
221
+
- Tool returns list of available reference files if `references/` directory exists
222
+
- Tool returns error if skill name is invalid or not found in catalog
194
223
- Unit tests cover tool registration and invocation
195
224
196
225
**Agentic tool instruction**:
@@ -319,11 +348,11 @@ The agentskills.io spec recommends a three-tier loading strategy:
This keeps base context small while giving the LLM access to specialized knowledge on demand.
355
+
This keeps base context small while giving the LLM access to specialized knowledge on demand. The system prompt contains only behavioral instructions (~200 tokens) regardless of skill count.
327
356
328
357
### Adoption
329
358
@@ -354,14 +383,23 @@ OpenAI's SDK already includes `LocalSkill` and `Skill` types in its responses mo
**Note**: Google ADK's approach aligns with our recommendation. Their system prompt contains behavioral instructions (how to use the tools), not the skill catalog itself. The `list_skills` tool returns the catalog on demand.
357
389
358
390
### Alternative designs considered
359
391
360
392
**Full config-based definitions**: Rejected in favor of filesystem-based with config paths. Inlining full skill definitions (name, description, instructions) in `lightspeed-stack.yaml` would bloat the config CR in k8s deployments and couple skill content updates to config changes. Instead, config specifies paths and skill metadata is read from `SKILL.md` files.
361
393
362
394
**Inline content**: Rejected in favor of path-based. Inline content would clutter the YAML config for multi-skill deployments and doesn't support reference files.
363
395
364
-
**Always-loaded instructions**: Rejected in favor of catalog + on-demand. Loading all skill instructions upfront wastes context tokens and doesn't scale to many skills.
396
+
**Always-loaded instructions**: Rejected in favor of progressive disclosure. Loading all skill instructions upfront wastes context tokens and doesn't scale to many skills.
397
+
398
+
**System prompt catalog injection**: Rejected in favor of tool-based discovery (`list_skills`). Embedding the skill catalog directly in the system prompt:
399
+
- Increases token cost linearly with skill count (~50-100 tokens/skill)
400
+
- Risks overwhelming the model context with large skill catalogs
401
+
- Provides no clean evolution path to search-based discovery
402
+
The tool-based approach keeps the system prompt constant (behavioral instructions only) and allows phase 2 extension to semantic search without architectural changes.
0 commit comments