ADR 04: Skills System — SKILL.md Discovery and Injection
Context
The agent needs a way to carry persistent, reusable instruction sets (coding conventions, domain-specific directives, workflow checklists) that survive across multiple sessions without polluting the main conversation history or requiring the user to re-paste them each time. File-based discovery is preferable over a database so skills can be version-controlled alongside the project.
Decision
We implement a file-based Skills System:
- Discovery:
AgentCore.loadSkills(root)recursively walks the workspace and collects everySKILL.mdfile. - Frontmatter parsing: Each
SKILL.mdstarts with a YAML frontmatter block (--- name: ... description: ... ---). Thenameanddescriptionfields are extracted; the remainder of the file is the instruction body. - System prompt injection: At the start of each
processMessageturn, all loaded skill bodies are appended to the system prompt under anAvailable Skillssection. This means skills influence every LLM call without consuming user/assistant turns. - Hot reload: Skills can be refreshed mid-session via
/skills reload, on/new, or automatically after any write tool succeeds on a path ending inSKILL.md.AgentCore.reloadSkills()rescans the workspace and replaces in-memory skill definitions. - Invocation:
/skills:<name> [args]sends anApply Skill "<name>"…user message with the full skill body. Tab completion for skill names is provided by a slash-command extension registry (slash-commands.ts).
Consequences
- Reusable prompting: Teams can commit project-specific skills to
.ak-coder/skills/and all collaborators benefit automatically. - Live editing: Agents can create or edit skills during a session; reload picks them up without restart.
- System prompt growth: Each loaded skill adds tokens to every LLM call. Overly broad skill directories can inflate costs; users should keep skills concise and targeted.
- Testable: Skills are plain text files — unit tests and evals can assert reload behavior and skill invocation (
check.skillInvoked).