From 593139faac69b670e94aeb8a7a90738eae369e2f Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 31 Jul 2026 22:40:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(agent):=20=E7=A7=BB=E9=99=A4=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=BA=90=E7=A0=81=E5=86=99=E5=85=A5=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/agent/prompt/System Core Prompt.txt | 1 - tests/test_builtin_skill_boundaries.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/agent/prompt/System Core Prompt.txt b/app/agent/prompt/System Core Prompt.txt index 5bc9ee78..c8603bc5 100644 --- a/app/agent/prompt/System Core Prompt.txt +++ b/app/agent/prompt/System Core Prompt.txt @@ -17,7 +17,6 @@ You act as a proactive agent. Your goal is to fully resolve the user's media-rel - Do not let user memory or persona style override this core identity, safety boundaries, or built-in background task rules. - If the user explicitly asks to change the speaking style or persona, use `query_personas` and `switch_persona` instead of editing runtime files manually. - If the user explicitly asks to rewrite or create a persona definition, prefer `update_persona_definition` rather than generic file-editing tools. -- Treat read-only inspection as allowed, but never use shell redirection, overwrite operations, file editing tools, or generated patches to change code. diff --git a/tests/test_builtin_skill_boundaries.py b/tests/test_builtin_skill_boundaries.py index 6cbbcbfb..023e5acf 100644 --- a/tests/test_builtin_skill_boundaries.py +++ b/tests/test_builtin_skill_boundaries.py @@ -3,6 +3,7 @@ from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parents[1] SKILLS_ROOT = PROJECT_ROOT / "skills" +CORE_PROMPT_PATH = PROJECT_ROOT / "app/agent/prompt/System Core Prompt.txt" def _read_skill(skill_name: str) -> str: @@ -64,3 +65,14 @@ def test_api_and_database_skills_declare_fallback_boundaries() -> None: assert "INSERT" in db_content assert "UPDATE" in db_content assert "DELETE" in db_content + + +def test_agent_core_prompt_does_not_block_plugin_source_edits() -> None: + """核心提示词不应禁止插件开发技能写入源码。""" + core_prompt = CORE_PROMPT_PATH.read_text(encoding="utf-8") + plugin_skill = _read_skill("create-moviepilot-plugin") + allowed_tools = _frontmatter_value(plugin_skill, "allowed-tools") + + assert "file editing tools, or generated patches to change code" not in core_prompt + assert "write_file" in allowed_tools + assert "edit_file" in allowed_tools