fix(search): search installed skills across all agents - #87
Merged
harlan-zw merged 2 commits intoAug 13, 2026
Conversation
Search resolved the project lockfile through `detectTargetAgent()`, which returns null when a project contains more than one agent directory. With `.claude/` and `.agents/` both present it reported no indexed docs, even though the index existed. Indexes are keyed by package and version, not by agent, so scoping the lockfile to a single agent hid skills the project has. Read every agent's lockfile and merge, matching `iterateSkills`. `--agents` narrows to specific agents when that is wanted. `readProjectLock` moves to `core/skills.ts`, alongside the equivalent skill-directory resolution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
skilld searchreports nothing indexed when a project has more than one agent directory.readProjectLockresolved the lockfile throughdetectTargetAgent():detectTargetAgent()checks agent env vars first, then scans the project and returns null when several match:A project with
.claude/and.agents/produces null, solistLockPackages()returns[]and search bails. It only worked when run from inside an agent, where the env var short-circuits detection. From an ordinary terminal it always failed.Change
Indexes are keyed by package and version:
Nothing about them is agent-specific, so scoping the lockfile to one agent only hides skills the project has.
iterateSkillsin the same module already reads every agent by default, which is whyskilld listworks:Search now does the same, merged through the existing
mergeLocks, which prefers the most recentsyncedAtper skill. A skill installed for two agents resolves to one index, so the union deduplicates by construction.--agentsnarrows when that is wanted:Named
--agentsbecause the root command owns-a/--agentas an enum and citty validates parent args.readProjectLockmoves fromcommands/search-helpers.tstocore/skills.ts, next to the equivalent skill-directory resolution.Coverage
test/unit/project-lock.test.tscovers no lockfile, a single agent, merging across agents, deduplication by newestsyncedAt, narrowing by agent, an agent with no lockfile, and a shared.skillsdirectory taking precedence.Docs
README documents
--agentsin the command table, adds an example, and notes that search spans every agent by default.