Skip to content

[Draft] feat: add workspace-local skills support#7508

Draft
Soulter wants to merge 1 commit intomasterfrom
draft/workspace-skills-support
Draft

[Draft] feat: add workspace-local skills support#7508
Soulter wants to merge 1 commit intomasterfrom
draft/workspace-skills-support

Conversation

@Soulter
Copy link
Copy Markdown
Member

@Soulter Soulter commented Apr 13, 2026

This PR introduces workspace-local skills support and automatic workspace initialization for local runtime mode. See full description in commit message.

This commit adds support for workspace-local skills and automatic workspace
initialization:

1. New init_workspace() function in util.py:
   - Creates workspace with EXTRA_PROMPT.md and skills/ subdirectory
   - Called automatically when using local runtime shell

2. SkillManager enhancements:
   - Added workspace_skills_root parameter for two-tier skill storage
   - list_skills() now scans both global and workspace skills
   - install_skill_from_zip() supports install_to_workspace parameter

3. Local mode system prompt updates:
   - Added EXTRA_PROMPT.md customization instructions
   - Added skill installation location preference hint

Changes:
- astrbot/core/tools/computer_tools/util.py: add init_workspace()
- astrbot/core/tools/computer_tools/shell.py: use init_workspace()
- astrbot/core/skills/skill_manager.py: workspace skills support
- astrbot/core/astr_main_agent.py: update system prompt
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces workspace-local skills and customizable system prompt instructions via an EXTRA_PROMPT.md file. The SkillManager has been updated to support a workspace_skills_root for isolated skill management, and a new init_workspace utility handles the creation of necessary workspace files and directories. Review feedback recommends joining system prompt instructions with newlines instead of spaces for improved clarity and suggests limiting workspace-local skill scanning to the local runtime to avoid path access issues within sandboxed environments.

Comment on lines +364 to +376
lines = [
"You have access to the host local environment and can execute shell commands and Python code.",
f"Current operating system: {system_name}.",
shell_hint,
"",
"You can write and modify the EXTRA_PROMPT.md file in the current workspace",
"to customize your own system prompt instructions. This file will be automatically",
"loaded and applied to your system prompt in subsequent conversations.",
"",
"When installing skills, unless explicitly specified otherwise, prefer installing",
"them to the workspace/skills directory for better isolation and portability.",
]
return " ".join(lines)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The system prompt instructions in _build_local_mode_prompt are joined using a single space. Since the list includes empty strings and distinct instructional sentences, joining with newlines (\n) would provide a much clearer structure for the LLM, making the instructions easier to follow and maintain.

Suggested change
lines = [
"You have access to the host local environment and can execute shell commands and Python code.",
f"Current operating system: {system_name}.",
shell_hint,
"",
"You can write and modify the EXTRA_PROMPT.md file in the current workspace",
"to customize your own system prompt instructions. This file will be automatically",
"loaded and applied to your system prompt in subsequent conversations.",
"",
"When installing skills, unless explicitly specified otherwise, prefer installing",
"them to the workspace/skills directory for better isolation and portability.",
]
return " ".join(lines)
lines = [
"You have access to the host local environment and can execute shell commands and Python code.",
f"Current operating system: {system_name}.",
shell_hint,
"",
"You can write and modify the EXTRA_PROMPT.md file in the current workspace",
"to customize your own system prompt instructions. This file will be automatically",
"loaded and applied to your system prompt in subsequent conversations.",
"",
"When installing skills, unless explicitly specified otherwise, prefer installing",
"them to the workspace/skills directory for better isolation and portability.",
]
return "\n".join(lines)

Comment on lines +438 to +439
# Scan workspace-local skills (if workspace_skills_root is set)
if self.workspace_skills_root and os.path.isdir(self.workspace_skills_root):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Workspace-local skills are currently scanned and added to the prompt regardless of the runtime setting. However, the paths provided for these skills (line 454) are absolute host paths. If the runtime is set to "sandbox", the agent will not be able to access these host paths, which will lead to errors when the agent tries to read the skill files. Consider restricting workspace-local skills to the "local" runtime or ensuring they are correctly mapped for sandbox use.

Suggested change
# Scan workspace-local skills (if workspace_skills_root is set)
if self.workspace_skills_root and os.path.isdir(self.workspace_skills_root):
# Scan workspace-local skills (if workspace_skills_root is set and runtime is local)
if runtime == "local" and self.workspace_skills_root and os.path.isdir(self.workspace_skills_root):

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