Library Skill — mount, search
The Library is the agent's bookshelf: the Native store (Knowledge/, already in
recall) + mount points — references to external directories on the user's disk,
indexed in place, never copied (index-not-warehouse). This skill is the
agent-facing half of the mount engines (the +Add Folder button uses the same core
functions via the API).
Core principle: a mount stores a {path, kind} pointer + an index,
never a copy of the source. Recall lands on the pointer → you Read the LIVE
source (progressive load). An external directory is mounted; a single file
goes to the Inbox (not this skill); a URL goes to s_learn-content.
Tool
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/library.py <command> [options]
All commands operate on the real library_mounts registry + the same
core.library_mounts engines the API uses — this skill does NOT reinvent them.
Commands
mount — register + index an external directory
Judge the kind from the directory (code if it holds parseable source, else docs),
register it, and index:
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/library.py mount --path ~/Desktop/AI-Native/some-repo --scope SwarmAI
- code dir → builds a per-mount symbol graph (index in place). Done — symbols
are now recallable.
- docs dir → chunks every UTF-8 text file straight into the shared Knowledge
FTS5 (same engine as Knowledge/ itself), so recall reaches it IMMEDIATELY.
Binaries are skipped. No briefing step — mounting IS indexing.
search — see what recall would retrieve
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/library.py search --query "widget scoring" --scope SwarmAI
Runs the real recall path (library + codeintel domains) — the same thing the
Browse-tab search box shows.
list — show registered mounts + health
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/library.py list --scope SwarmAI
Workflow — "mount <path>"
- Run
mount --path <path>→ it judges kind, registers, AND indexes in one step
(code → symbol graph; docs → text chunked into the shared Knowledge FTS5).
- Confirm to the user: what was mounted, its kind, and the count indexed
(symbols for code, chunks for docs) — recall reaches it immediately.
Boundaries
- Never copy an external directory into the workspace — mount = pointer + index.
- A single file → submit through the Inbox endpoint, which validates it and
sends the complete content to S6; it does not copy the file. A URL the user
explicitly asks to save → s_learn-content, which submits a Reference through S1.
- Ownership is per-scope — a mount registered under one project scope does not
authorize another (the cross-project contamination guard stays intact).