Skip to content

feat: nudge session-start toward on-demand skill search - #103

Merged
getappz merged 1 commit into
masterfrom
feat/skill-on-demand-nudge
Jul 8, 2026
Merged

feat: nudge session-start toward on-demand skill search#103
getappz merged 1 commit into
masterfrom
feat/skill-on-demand-nudge

Conversation

@getappz

@getappz getappz commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Claude Code auto-lists every enabled skill's name+description on every session regardless of relevance, which compounds token cost as skill count grows. skill_search/skill_load (agentflare's MCP tools, verified working in dogfooding) already scan skill directories independent of Claude Code's own listing mechanism, making them a viable on-demand replacement for the always-on list — but nothing told the model to actually reach for them.

  • Adds one line to session_start's output: nudge toward skill_search(query) then skill_load(name) before assuming a relevant skill doesn't exist.
  • Extracted the message-building into session_start_message() (mirrors the _sync helper pattern already used in mcp_server.rs) so the nudge text has direct test coverage instead of only an indirect "doesn't panic" check.

Context on the "disable all skills" half of this

Claude Code's --disable-slash-commands flag suppresses the always-on skill listing while MCP tools (including skill_search/skill_load) stay fully functional — verified empirically:

claude --disable-slash-commands -p "list every tool you have access to"

shows no skill listing, but mcp__agentflare__* tools remain available. However, it's a launch-time CLI flag — no persistent settings.json key or environment variable equivalent was found, so making it the default for every session requires a shell-level wrapper/alias around the claude binary, which is outside this repo's scope to configure.

Test plan

  • cargo build --workspace, cargo test --workspace (196 passed, +1 new)
  • cargo clippy --workspace --all-targets — no new findings (pre-existing collapsible-if warnings elsewhere in hook.rs, unrelated to this diff)

Summary by CodeRabbit

  • New Features
    • Updated the session-start guidance shown at launch with a new “skills load on demand” reminder, including references to skill search and loading commands.
  • Bug Fixes
    • Improved how the session-start message is assembled so the displayed text is generated more consistently.

Claude Code auto-lists every enabled skill's name+description every
session regardless of relevance, which compounds token cost as the
skill count grows. agentflare's skill_search/skill_load MCP tools
(already scan skill dirs independent of Claude Code's own listing)
are the intended replacement for that always-on list, but nothing
told the model to actually reach for them.

Add one line to session_start's output pointing at skill_search then
skill_load before assuming a relevant skill doesn't exist. Extracted
the message-building into session_start_message() (mirroring
mcp_server.rs's _sync helper pattern) so the nudge text has direct
test coverage instead of only an indirect "doesn't panic" check.

Note: Claude Code's own `--disable-slash-commands` flag suppresses
the always-on skill listing while MCP tools stay fully functional
(verified empirically) — but it's a launch-time CLI flag with no
persistent settings.json/env-var equivalent found, so making it the
default for every session needs a shell-level wrapper around the
`claude` binary, outside this repo's scope.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c4cad07c-6501-44b5-84b2-92e49f81e37b

📥 Commits

Reviewing files that changed from the base of the PR and between 6d0f4b6 and 57c9253.

📒 Files selected for processing (1)
  • src/hook.rs

📝 Walkthrough

Walkthrough

The session_start function in src/hook.rs was refactored to delegate message building to a new session_start_message function, which returns a string instead of printing directly. A new line prompting skill_search(query) and skill_load(name) usage was added, and tests were updated accordingly.

Changes

Session-start message refactor

Layer / File(s) Summary
Extract message builder and add skill nudge
src/hook.rs
session_start now delegates to session_start_message(agent), which returns the composed string (joined lines) including a new "Skills load on demand..." instruction referencing skill_search(query) and skill_load(name); tests updated and a new test added to verify this content.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: nudging session start toward on-demand skill search.
Description check ✅ Passed The description covers the summary and test plan and includes extra context, but the reviewer notes section is not filled out.
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 feat/skill-on-demand-nudge

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

@getappz
getappz merged commit ea37f9c into master Jul 8, 2026
9 checks passed
@getappz
getappz deleted the feat/skill-on-demand-nudge branch July 8, 2026 12:42
getappz added a commit that referenced this pull request Jul 8, 2026
Two independent additions to the init component pattern, both aimed
at replacing Claude Code's always-on skill-description listing with
agentflare's on-demand skill_search/skill_load (already merged: #102
exposes them as MCP tools, #103 nudges the model toward them):

- agentflare-mcp: registers agentflare's own MCP server (skill_search/
  skill_load) with claude-code (native `claude mcp add`), cline,
  continue, and opencode — same 4 hosts + same merge_json/
  merge_opencode_mcp/write_if_absent helpers the engram component
  already uses for its own manual-registration branches. Other hosts
  report satisfied until their MCP config format is verified here.

- skill-overrides-sync: Claude Code only (other agents have no
  equivalent per-skill mechanism). Scans every skill agentflare's
  registry knows about (crates/skill-registry gets a new
  Registry::list_all_names(), since search() requires a query and
  there was no "list everything" path) and sets
  settings.json:skillOverrides["<name>"] = "name-only" for any skill
  missing an entry — Claude Code's own mechanism for listing a skill's
  name without its description (verified against the live settings
  schema, not assumed). Never touches a skill the user already
  configured differently. Not consent-gated, so it also re-syncs on
  every session-start as new skills appear, not just during `init`.

crates/skill-registry's `skills_db_path()` was duplicated between
mcp_server.rs and the new component; moved to paths.rs as the single
shared definition.

Verified end-to-end: fresh `agentflare init --agent claude-code`
registered the MCP server (`claude mcp list` shows it connected) and
set 57 skills to name-only in one pass; re-running init is a clean
no-op on both.
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