#5018

WIP: feat(skills): support explicit context loading

Draftbingqilinweimaotaiwants to merge intofrom

Problem

nanobot already exposes a skill_names input on ContextBuilder, but the value was ignored when building the system prompt. As a result, direct callers could not preload explicitly requested skills; only always: true skills were injected automatically, while ordinary skills remained in the progressive-loading summary. Prompt construction also repeatedly read and parsed the same SKILL.md frontmatter, and the generated skill summary embedded machine-specific absolute paths. That added avoidable filesystem/YAML work and made the system prompt less stable across workspaces.

Current approach

  • validate explicitly supplied skill_names, rejecting missing, disabled, or unavailable skills
  • merge requested skills with always: true skills, inject their full content under # Active Skills, and remove them from the remaining skill summary
  • cache parsed SKILL.md content and metadata by file modification time and size, invalidating the entry when the file changes
  • return defensive copies of cached metadata so callers cannot mutate the cached value
  • use stable skills/<name>/SKILL.md paths in progressive-loading summaries instead of host-specific absolute paths

Validation

  • 221 passed across skill loading, context, prompt-cache, command, filesystem, subagent, and WebUI route tests
  • ruff check nanobot/agent/skills.py nanobot/agent/context.py tests/agent/test_skills_loader.py tests/agent/test_context_builder.py
  • git diff --check origin/main...HEAD

Activity

2

This pull request is a draft

Merging is unavailable until it is marked ready for review.