mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5084] [GUI] 功能需求:加一个"全局规则"编辑框,写入 harness 已在读的 AGENTS.md 并每轮注入(桌面版 / 网页模式 / 命令行共用同一份) #2369
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2369
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xvcezrqpbxtpzblrt on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5084
English TL;DR: Strata already ships a working global-instruction channel — the harness plugin
@deepseek-ai/dsh-agent-instructionsis enabled in the app's preset, and it loadsAGENTS.mdfrom two user-global roots plus the workspace. What is missing is any GUI entry point: the built-in system prompt is compiled in (apps/host/server/index.mjs:588), and the three in-app "instructions" surfaces (Settings → Tools → "Follow my instructions", Skills, Tasks) are all on-demand/trigger-matched, not always injected. This asks for a "global rules" editor that writes into that sameAGENTS.md, shared by desktop, browser mode and CLI. The same request was filed as #738 and closed asnot_plannedby the automated "issues older than three days" sweep (two users+1'd it), so it is not a design rejection — it is simply unimplemented.Area
[GUI] 桌面应用 + 网页模式(同一份 Web UI);顺带影响命令行启动的同一 host
想要什么(收窄成一句)
在设置里加一个全局规则编辑框(纯文本,支持"说人话"的约束/特殊要求/禁止事项),保存时写进 harness 已经在读的那份
AGENTS.md,让助手每一轮都带上这些规则;桌面版、--browser网页模式、命令行启动的 host 共用同一份,不需要三处各写一遍。现状(全部核到 tag v0.2.10 =
ffa80d73,与你安装的产物时间 06:37:26 一致)1. 我自己守的那套规则在代码里,不是文件
apps/host/server/index.mjs:588逐字拼出系统提示:(代理路径用
SYSTEM_PROMPT,见:655、:685)。用户改不了,也没有任何文件承载它。2. 全局规则的文件通道已经存在,而且 app 已经启用
apps/host/server/agent/preset.mjs:27(列表含'agent-instructions'),:77配置{ id: 'agent-instructions', name: '@deepseek-ai/dsh-agent-instructions', config: { maxBytes: 65536 } }→ 上限 64 KBharness/node_modules/@deepseek-ai/dsh-agent-instructions/lib/index.js:17const DEFAULT_INSTRUCTION_FILE_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];:168const USER_GLOBAL_FILE = "AGENTS.md";,:161USER_GLOBAL_DIRECTORIES = [USER_GLOBAL_DIRECTORY, AGENTS_GLOBAL_DIRECTORY](顺序固定),项目级从 cwd 沿祖先目录往上找(:674)@deepseek-ai/dsh-home-paths/lib/index.js::11DSH_HOME_DIR_NAME = ".dsh",:15可用环境变量DSH_HOME覆盖;Strata 在apps/host/server/agent/harness-runtime.mjs:82就设了DSH_HOME: this.home→ 本机实际是C:\Users\123\.strata\data\agent\home\:17AGENTS_HOME_DIR_NAME = ".agents",:21可用DSH_AGENTS_HOME覆盖 →C:\Users\123\.agents\C:\Users\123\.strata\data\agent\home\AGENTS.md(Strata 的 agent 全局档)C:\Users\123\.agents\AGENTS.md(各家 AI 工具共用的全局档)C:\Users\123\Documents\Strata\Workspace\AGENTS.md(项目级)Test-Path四条全 False;…\data\agent\home\下只有attachments / profiles / sessions / storages / .credentials.yaml)→ 现在没有任何用户规则被注入,用户想让助手守规矩只能在对话里临时说,换会话就没了3. 界面里已有的三个"指令"入口,都不是"每轮注入"
apps/host/src/components/SettingsTools.tsx:56;apps/host/server/agent/tools-settings.mjs:19,56-58mcp__strata-instructions__<name>,必须助手主动调用才读得到(界面文案见apps/host/server/agent/events.mjs:113,120:Reading your instructions)apps/host/server/index.mjs:1637-1647(POST /api/skills,写SKILL.md)apps/host/server/skill-selection.mjs)apps/host/server/tasks.mjs:13第一行是最容易被误会的:名字写着 "Follow my instructions",用户写完以为它是全局规则,实际它躺在一个工具里,助手不点开门就永远看不见。触发词命中也不稳定。
4. 这条需求不是新提的
state_reason = not_planned,2026-10-13 关闭,关闭理由是维护者的自动清扫("closing issues older than three days"),评论区有两位用户+1(sinand99、avkwok)。不是设计否决,是没做为什么"按需读取"不能代替全局规则
写规则的人要的是"每次都算数"(称呼、语言、格式、禁止事项、安全约束)。走工具/触发词的通道有三个问题:①助手要主动调用,不调用就不生效;②触发词没命中就不生效;③界面上没有任何地方显示"这一轮到底注入了什么",用户无法验证。第三点最伤信任。
建议设计(5 条,尽量复用已有机制,不新造一套)
C:\Users\<user>\.strata\data\agent\home\AGENTS.md(即DSH_HOME下那份),不新建第二条通道;顺带提供"打开所在文件夹"。AGENTS.md)/ 仅本会话(临时,不落盘)。界面按 harness 已有的顺序讲清user-global→agents-global→ 项目级谁赢(代码里USER_GLOBAL_DIRECTORIES就是这个顺序,instructionCandidateGroup还把前两者当同一候选组去重,index.js:161,197-199)。maxBytes: 65536目前会静默截断(truncateUtf8,index.js:131-134),编辑器要在保存时给出字数与剩余,别让人写完发现被切了。验证状态(按 CONTRIBUTING 区分)
preset.mjs:27,77);文件发现逻辑与两个全局根已核(dsh-agent-instructions/lib/index.js:17,161,168,175-176;dsh-home-paths/lib/index.js:11,15,17,21);Strata 设DSH_HOME已核(harness-runtime.mjs:82);本机四个候选路径不存在已实测;GUI 三个入口的上限与生效方式已核到源码与界面文案;#738 的关闭方式已核AGENTS.md→ 发一条消息 → 在请求日志里确认 system 段带上它)。这条是验收标准,应由实现者/维护者跑;我这边需要重启 agent 才能注入,会打断当前会话,所以没做影响面
桌面版(主窗口)、
--browser/STRATA_UI=browser的网页模式、命令行起的同一个 host —— 三者共用同一份文件,这条需求的价值主要就在这里:写一次,三处生效。相关已有讨论(先查过仓库)
AGENTS.md、global instructions、custom instructions、system prompt、全局规则、global rules user;除 #738 外没有覆盖"GUI 编辑全局规则 → 写入 AGENTS.md → 每轮注入"的开放 issue本报告未包含
truncateUtf8只读了源码,未实测);把规则注入后对引擎提示缓存 / token 计量的影响(需要实测);与 #4981 那条里"编造路径"现象的关系(未验证,不作为本条依据)