Skip to content

refactor(skill-registry): decouple agent-registry dependency - #297

Merged
getappz merged 6 commits into
masterfrom
task/61
Jul 22, 2026
Merged

refactor(skill-registry): decouple agent-registry dependency#297
getappz merged 6 commits into
masterfrom
task/61

Conversation

@getappz

@getappz getappz commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • skill_registry::Registry::ensure_fresh() called agent_registry::detect_all() directly, making agent-registry a hard dependency of skill-registry just to get a list of installed agent IDs for source discovery.
  • Inverts control: Registry::open_default() now takes detected_agents: Vec<String> from the caller instead of detecting them itself. skill-registry's Cargo.toml no longer depends on agent-registry.
  • Rebased onto current master, which added two more Registry::open_default() call sites (src/hook.rs's SessionStart/PromptSubmit skill-preload paths) since this branch forked. Rather than duplicate the "detect installed agents" boilerplate a 3rd/4th time, factored it into one shared crate::components::detected_skill_agents() helper used by all 4 call sites.

Not the full scope of item #61 (that item vendors a whole skills.rs-style registry/search engine, still in progress under opencode) — this is a small, independent decoupling refactor that happened to branch off the same numbered item.

Test plan

  • cargo build --workspace --all-features clean
  • cargo build --features skill-overrides-sync clean (the one feature-gated call site)
  • cargo test --workspace — 727 passed, 0 failed

Summary by CodeRabbit

  • New Features
    • Skill discovery now refreshes based on the locally available agents.
    • Skill data is cached between refreshes to reduce unnecessary rescanning.
    • Updated skill loading across sessions, prompts, and tool interactions for more accurate agent-specific results.

Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: HEAD
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The skill registry now accepts detected agent identifiers through a callback, caches them during refreshes, and uses them to rebuild default sources. Shared detection wiring updates skill discovery, hooks, and MCP tool refresh paths.

Changes

Skill registry refresh flow

Layer / File(s) Summary
Registry refresh contract
crates/skill-registry/Cargo.toml, crates/skill-registry/src/load.rs
Replaces the registry dependency, adds cached detected agents, and changes ensure_fresh to accept a detection callback.
Agent detection wiring
src/components.rs
Adds lowercase agent detection and passes it into skill discovery refreshes.
Refresh call-site integration
src/hook.rs, src/mcp_server.rs
Passes the detected-agent callback through session-start, prompt-submit, and MCP registry refresh paths.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: decoupling skill-registry from agent-registry.
Description check ✅ Passed The summary and test plan are present and detailed; only the Notes for reviewers section is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/61

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@getappz

getappz commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@getappz
getappz enabled auto-merge (squash) July 21, 2026 19:04
getappz added 5 commits July 22, 2026 10:37
… just at Registry construction

open_default's caller-supplied detected_agents was only computed once
at construction time. For mcp_server.rs's process-lifetime-cached
Registry, that meant a newly installed agent CLI's skill sources would
never be scanned until the whole MCP server process restarted --
before this decoupling, detect_all() ran fresh inside every debounced
refresh(). Restore that by having ensure_fresh() take a lazy
detect_agents closure, invoked only when a rescan actually happens.

Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/61
Agentflare-Item: 61
# Conflicts:
#	Cargo.lock

Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/61
Agentflare-Item: 61
Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/61
Agentflare-Item: 61
Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/61
Agentflare-Item: 61
# Conflicts:
#	Cargo.lock

Agentflare-Agent: claude-code_2-1-216_agent
Agentflare-Branch: task/61
Agentflare-Item: 61

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components.rs`:
- Around line 200-204: Update the documentation comment above the agent-ID
callback to reference Registry::ensure_fresh, not Registry::open_default, and
describe the callback according to the ensure_fresh contract. Preserve the
explanation that callers provide detected agent IDs and use a throwaway cache
because cross-call version caching is unnecessary.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d6618c1-0772-4761-8677-823a2ba664d3

📥 Commits

Reviewing files that changed from the base of the PR and between 223e64a and 5a3e9d1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • crates/skill-registry/Cargo.toml
  • crates/skill-registry/src/load.rs
  • src/components.rs
  • src/hook.rs
  • src/mcp_server.rs
💤 Files with no reviewable changes (1)
  • crates/skill-registry/Cargo.toml

Comment thread src/components.rs
Comment on lines +200 to +204
/// Agent IDs detected on this machine, for `skill_registry::Registry::open_default`'s
/// `detected_agents` param. skill-registry itself has no `agent-registry` dependency
/// (deliberately decoupled — skill discovery only needs agent IDs, not the version-
/// detection machinery); every call site collects them the same way, using a
/// throwaway cache since none of these callers need cross-call version caching.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the detected-agent callback documentation.

The comment describes a detected_agents parameter on Registry::open_default, but the supplied implementation has no such parameter; the callback is passed to Registry::ensure_fresh.

Based on the supplied crates/skill-registry/src/load.rs contract.

Proposed documentation fix
-/// Agent IDs detected on this machine, for `skill_registry::Registry::open_default`'s
-/// `detected_agents` param.
+/// Agent IDs detected on this machine for `skill_registry::Registry::ensure_fresh`'s
+/// `detect_agents` callback.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// Agent IDs detected on this machine, for `skill_registry::Registry::open_default`'s
/// `detected_agents` param. skill-registry itself has no `agent-registry` dependency
/// (deliberately decoupled — skill discovery only needs agent IDs, not the version-
/// detection machinery); every call site collects them the same way, using a
/// throwaway cache since none of these callers need cross-call version caching.
/// Agent IDs detected on this machine for `skill_registry::Registry::ensure_fresh`'s
/// `detect_agents` callback. skill-registry itself has no `agent-registry` dependency
/// (deliberately decoupled — skill discovery only needs agent IDs, not the version-
/// detection machinery); every call site collects them the same way, using a
/// throwaway cache since none of these callers need cross-call version caching.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components.rs` around lines 200 - 204, Update the documentation comment
above the agent-ID callback to reference Registry::ensure_fresh, not
Registry::open_default, and describe the callback according to the ensure_fresh
contract. Preserve the explanation that callers provide detected agent IDs and
use a throwaway cache because cross-call version caching is unnecessary.

@getappz
getappz merged commit 9980161 into master Jul 22, 2026
18 checks passed
@getappz
getappz deleted the task/61 branch July 22, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant