Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(skills): enforce managed routing across backends (#1866)

Call Whiteab2b601cfe4a
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.py
index 268e57b59..5e90b0617 100644
--- a/core/handlers/session_handler.py
+++ b/core/handlers/session_handler.py
@@ -79,7 +79,12 @@ if TYPE_CHECKING:
from modules.agents.model_hub import ModelHubLaunch
CLAUDE_NO_CONVERSATION_RE = re.compile(r"No conversation found with session ID:\s*(\S+)")
-CLAUDE_REMOTE_DISALLOWED_TOOLS = ["AskUserQuestion", "EnterPlanMode", "ExitPlanMode"]
+CLAUDE_REMOTE_DISALLOWED_TOOLS = [
+ "AskUserQuestion",
+ "EnterPlanMode",
+ "ExitPlanMode",
+ "Skill",
+]
CLAUDE_REMOTE_PERMISSION_MODE = "bypassPermissions"
CLAUDE_REMOTE_SANDBOX = {"enabled": False}
diff --git a/core/managed_skills.py b/core/managed_skills.py
index 6f54d3b98..2092d3d9e 100644
--- a/core/managed_skills.py
+++ b/core/managed_skills.py
@@ -1167,10 +1167,9 @@ def render_skill_catalog_prompt(skills: Sequence[ManagedSkill]) -> str:
if any(skill.disable_model_invocation for skill in skills):
return (
"\n\n## Skills\n\n"
- "If the user requests a skill by exact name, run "
+ "If the user requests a Skill by exact name, ensure its content is in context: "
+ "reuse an earlier successful load that remains in context; otherwise run "
"`vibe skill load -- <name>` before proceeding.\n"
- "When these rules require an Avibe-managed Skill, reuse an earlier successful "
- "`vibe skill load -- <name>` result for that name if it remains in the current context.\n"
"Otherwise, do not guess skill names."
)
return ""
@@ -1184,11 +1183,12 @@ def render_skill_catalog_prompt(skills: Sequence[ManagedSkill]) -> str:
return (
"\n\n## Skills\n\n"
"Skills provide specialized instructions and workflows for specific tasks.\n"
- "When a task matches a skill's description, run `vibe skill load -- <name>` before proceeding.\n"
- "If the user requests a skill by exact name, load that name directly.\n"
- "When these rules require an Avibe-managed Skill, reuse an earlier successful "
- "`vibe skill load -- <name>` result for that name if it remains in the current context.\n"
- "Otherwise, only load skill names listed here or returned by `vibe skill list`; do not guess names.\n\n"
+ "Before acting on a task covered by a listed Skill, ensure its content is in context: "
+ "reuse an earlier successful load that remains in context; otherwise run "
+ "`vibe skill load -- <name>`.\n"
+ "If the user requests a Skill by exact name, apply this rule to that name.\n"
+ "For non-explicit requests, only load Skill names listed here or returned by "
+ "`vibe skill list`; do not guess names.\n\n"
f"{later_page_guidance}"
"### Available skills\n"
f"{rows}"
diff --git a/docs/plans/managed-skills.md b/docs/plans/managed-skills.md
index 4d60ff478..c5d530478 100644
--- a/docs/plans/managed-skills.md
+++ b/docs/plans/managed-skills.md
@@ -182,10 +182,9 @@ When model-invocable Skills exist, Avibe injects this shape:
## Skills
Skills provide specialized instructions and workflows for specific tasks.
-When a task matches a skill's description, run `vibe skill load -- <name>` before proceeding.
-If the user requests a skill by exact name, load that name directly.
-When these rules require an Avibe-managed Skill, reuse an earlier successful `vibe skill load -- <name>` result for that name if it remains in the current context.
-Otherwise, only load skill names listed here or returned by `vibe skill list`; do not guess names.
+Before acting on a task covered by a listed Skill, ensure its content is in context: reuse an earlier successful load that remains in context; otherwise run `vibe skill load -- <name>`.
+If the user requests a Skill by exact name, apply this rule to that name.
+For non-explicit requests, only load Skill names listed here or returned by `vibe skill list`; do not guess names.
Use `vibe skill list --page 2` only when more discovery is useful; ordinary tasks do not require scanning every page.
### Available skills
@@ -206,8 +205,7 @@ and retains only exact-name guidance:
```md
## Skills
-If the user requests a skill by exact name, run `vibe skill load -- <name>` before proceeding.
-When these rules require an Avibe-managed Skill, reuse an earlier successful `vibe skill load -- <name>` result for that name if it remains in the current context.
+If the user requests a Skill by exact name, ensure its content is in context: reuse an earlier successful load that remains in context; otherwise run `vibe skill load -- <name>` before proceeding.
Otherwise, do not guess skill names.
```
@@ -310,7 +308,7 @@ consistency boundaries.
| Backend | Native isolation | Avibe prompt application |
| --- | --- | --- |
-| Claude Code | Configure the SDK with `skills=[]`. | Rebuild when the Skill Catalog changes and resume the same native Session. |
+| Claude Code | Configure the SDK with `skills=[]` and disallow the native `Skill` tool. | Rebuild when the Skill Catalog changes and resume the same native Session. |
| Codex | Set `skills.include_instructions=false`. | Apply the current developer instructions through `turn/start.collaborationMode` while retaining the same thread; use one developer-item fallback only when that API is unavailable. |
| OpenCode | Send `tools.skill=false` in every prompt request and runtime config override. | Send the current system prompt on every new Turn. |
diff --git a/tests/test_agent_tool_policy.py b/tests/test_agent_tool_policy.py
index 5d13caaaf..31fc864bc 100644
--- a/tests/test_agent_tool_policy.py
+++ b/tests/test_agent_tool_policy.py
@@ -291,6 +291,7 @@ def test_hooks_are_wired_when_the_sdk_supports_them(monkeypatch):
assert captured["hooks"] == [handler._guard_session_only_background_tools]
# The precise hook path owns enforcement, so nothing extra is denied by name.
assert handler._claude_disallowed_tools(hooks) == sh.CLAUDE_REMOTE_DISALLOWED_TOOLS
+ assert "Skill" in handler._claude_disallowed_tools(hooks)
def test_removed_environment_override_cannot_disable_claude_hooks(monkeypatch):
diff --git a/tests/test_claude_cli_path.py b/tests/test_claude_cli_path.py
index 3f7179d99..ab8932fb0 100644
--- a/tests/test_claude_cli_path.py
+++ b/tests/test_claude_cli_path.py
@@ -501,7 +501,7 @@ def test_session_handler_disallows_remote_unsafe_claude_tools(monkeypatch, tmp_p
_run_session(handler, context)
assert captured["connected"] is True
- expected = ["AskUserQuestion", "EnterPlanMode", "ExitPlanMode"]
+ expected = ["AskUserQuestion", "EnterPlanMode", "ExitPlanMode", "Skill"]
if not session_handler_module.CLAUDE_SDK_HOOKS_AVAILABLE or session_handler_module.HookMatcher is None:
expected.append("Workflow")
assert captured["options"].disallowed_tools == expected
diff --git a/tests/test_managed_skills.py b/tests/test_managed_skills.py
index c5b68471c..ba210a228 100644
--- a/tests/test_managed_skills.py
+++ b/tests/test_managed_skills.py
@@ -536,11 +536,12 @@ def test_catalog_paginates_stably_without_exposing_directories(tmp_path: Path) -
assert prompt.count("\n- skill-") == CATALOG_PAGE_SIZE
assert "`vibe skill list --page 2`" in prompt
assert "ordinary tasks do not require scanning every page" in prompt
- assert "load that name directly" in prompt
+ assert "Before acting on a task covered by a listed Skill" in prompt
assert (
- "When these rules require an Avibe-managed Skill, reuse an earlier successful "
- "`vibe skill load -- <name>` result for that name if it remains in the current context."
+ "reuse an earlier successful load that remains in context; otherwise run "
+ "`vibe skill load -- <name>`"
) in prompt
+ assert "For non-explicit requests, only load Skill names listed here" in prompt
assert render_skill_list(skills, page=2) == "- skill-25: Description 25"
assert str(tmp_path) not in prompt
assert render_skill_catalog_prompt([]) == ""
@@ -587,8 +588,8 @@ def test_manual_only_skill_is_loadable_but_not_advertised(tmp_path: Path) -> Non
manual_prompt = render_skill_catalog_prompt([manual])
assert "`vibe skill load -- <name>`" in manual_prompt
assert (
- "When these rules require an Avibe-managed Skill, reuse an earlier successful "
- "`vibe skill load -- <name>` result for that name if it remains in the current context."
+ "reuse an earlier successful load that remains in context; otherwise run "
+ "`vibe skill load -- <name>`"
) in manual_prompt
assert "- manual:" not in manual_prompt
assert "Run only when explicitly requested." not in manual_prompt