Skills Capture and Retrieval

Skills Capture and Retrieval

Optional learned procedure storage and prompt injection. Implemented in local-ai-skills and wired when local-ai-core[skills] is installed and skills.enabled: true.

Install

pip install -e "packages/local-ai-core[skills]"

Configuration

skills:
  enabled: true
  capture_mode: "off"        # off | success_only
  max_suggestions: 3
  storage_dir: skills

Skills are stored as JSON envelopes under <storage_dir>/ relative to workspace when configured, otherwise under runtime_data_dir.

Behavior

Retrieval: SkillsRetriever token-overlaps the user query against stored situation fields and injects top matches into context (via SkillsRetrieverProtocol in AgentLoop). Log event: SKILL_RETRIEVAL.

Capture: SkillsCapture listens to agent loop events (run_start, tool_start, final, loop_abort). When capture_mode: success_only, completed runs are persisted with tool step traces. Log event: SKILL_STORED.

When skills are disabled or the package is not installed, NullSkillsRetriever returns empty context.

Wiring

build_skills_stack(config, guard) returns SkillsStack with store, retriever, and capture.on_event wired into AgentLoop.

See AGENTS.md for tests: packages/local-ai-skills/tests/test_skills.py.