From 4f11a444c16d4092f206ea1eb3f919f54a86b629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=AA=E7=A8=8B=E4=BC=9F?= Date: Mon, 8 Jun 2026 10:45:47 +0800 Subject: [PATCH] feat(agents): manage AGENTS.md from the agent editor + clarify context-file roles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a friendly AGENTS.md section editor inside the edit-agent modal's "高级" (Advanced) collapsible, alongside the existing additional-instructions field. New AgentGuideEditor reuses MemorySection cards, parses the file into ## sections, and saves whole-file via the workspace API (no backend change). Empty files offer a "create" scaffold flow. Reword the collapsible to a generic "高级" and add a role-clarifying note that fixes the boundary: factory identity goes in the form fields, evolving memory/rules go in the context files. Also fix the additional-instructions textarea so it fills the form width. Closes matevip/mateclaw#290 --- mateclaw-ui/src/i18n/locales/en-US.ts | 13 +- mateclaw-ui/src/i18n/locales/zh-CN.ts | 13 +- mateclaw-ui/src/views/Agents.vue | 11 +- .../Agents/components/AgentGuideEditor.vue | 157 ++++++++++++++++++ 4 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 mateclaw-ui/src/views/Agents/components/AgentGuideEditor.vue diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index e9568074..4850d7f6 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -1221,7 +1221,8 @@ export default { taglinePreview: 'Card preview:', backstory: 'Backstory', backstoryHint: 'Invisible to users, felt in every conversation. Their experience, beliefs, and working principles.', - extraInstructions: 'Advanced: Additional Instructions', + advanced: 'Advanced', + extraInstructions: 'Additional Instructions', extraInstructionsHint: 'Optional. Use for output format, process checklists, or boundary rules.', maxIterations: 'Max Iterations', defaultThinkingLevel: 'Default Thinking Level', @@ -1235,6 +1236,16 @@ export default { tagUndo: 'Undo', enabled: 'Enabled', }, + guide: { + summary: 'Behavior Guide (AGENTS.md)', + desc: "This is the employee's behavior handbook (AGENTS.md): when to write memories, what goes in each file, and which memory tools are available. The Role/Goal/Backstory above are the employee's factory identity; evolving memories like PROFILE/MEMORY live in the Memory menu.", + empty: 'This employee has no behavior guide (AGENTS.md) yet.', + create: 'Create Behavior Guide', + saved: 'Saved', + addSection: 'Add Section', + addSectionPlaceholder: 'Section title', + scaffold: '## When to Write Memories\n\n(Describe when this employee should record to MEMORY.md / PROFILE.md.)\n\n## File Responsibilities\n\n(Describe what belongs in SOUL.md / PROFILE.md / MEMORY.md.)\n', + }, thinkingLevels: { auto: 'Follow Model', off: 'Off', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index 0d58b607..7a440674 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -1113,7 +1113,8 @@ export default { taglinePreview: '卡片预览:', backstory: '背景(Backstory)', backstoryHint: '用户看不见,但每一次对话都能感觉到。写他的经验、信念、做事原则。', - extraInstructions: '高级:补充指令', + advanced: '高级', + extraInstructions: '补充指令', extraInstructionsHint: '可选。用于细化输出格式、流程清单或边界规则。', maxIterations: '最大迭代次数', defaultThinkingLevel: '默认思考深度', @@ -1127,6 +1128,16 @@ export default { tagUndo: '撤销', enabled: '启用', }, + guide: { + summary: '行为指南(AGENTS.md)', + desc: '这里是该员工的行为手册(AGENTS.md):规定何时写记忆、各文件放什么、可用的记忆工具。上方的岗位/目标/背景是员工的出厂身份;PROFILE/MEMORY 等可演化的记忆在「记忆」菜单管理。', + empty: '该员工还没有行为指南(AGENTS.md)。', + create: '创建行为指南', + saved: '已保存', + addSection: '新增小节', + addSectionPlaceholder: '小节标题', + scaffold: '## 何时写记忆\n\n(说明这个员工在什么情况下应当记录到 MEMORY.md / PROFILE.md。)\n\n## 文件职责\n\n(说明 SOUL.md / PROFILE.md / MEMORY.md 各自该放什么内容。)\n', + }, thinkingLevels: { auto: '跟随模型', off: '关闭', diff --git a/mateclaw-ui/src/views/Agents.vue b/mateclaw-ui/src/views/Agents.vue index 06f3d3b1..a75d7125 100644 --- a/mateclaw-ui/src/views/Agents.vue +++ b/mateclaw-ui/src/views/Agents.vue @@ -341,10 +341,16 @@
- {{ t('agents.fields.extraInstructions') }} + {{ t('agents.fields.advanced') }} +

{{ t('agents.fields.extraInstructionsHint') }}

+
+ +

{{ t('agents.guide.desc') }}

+ +
@@ -669,6 +675,7 @@ import type { Agent } from '@/types/index' import SkillIcon from '@/components/common/SkillIcon.vue' import SkillIconPicker from '@/components/common/SkillIconPicker.vue' import LivePanel from '@/components/live/LivePanel.vue' +import AgentGuideEditor from './Agents/components/AgentGuideEditor.vue' import { emptyProfile, parsePrompt, @@ -1957,6 +1964,8 @@ html.dark .seg-count.warn { } .advanced-prompt[open] > .advanced-prompt__summary { padding: 0 0 8px; border-bottom: 1px solid var(--mc-border-light); margin-bottom: 8px; } .advanced-prompt[open] > .advanced-prompt__summary::before { transform: rotate(90deg); } +.advanced-prompt .form-textarea { width: 100%; box-sizing: border-box; } +.advanced-guide { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--mc-border-light); } .modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--mc-border-light); } @media (max-width: 900px) { diff --git a/mateclaw-ui/src/views/Agents/components/AgentGuideEditor.vue b/mateclaw-ui/src/views/Agents/components/AgentGuideEditor.vue new file mode 100644 index 00000000..92dec50f --- /dev/null +++ b/mateclaw-ui/src/views/Agents/components/AgentGuideEditor.vue @@ -0,0 +1,157 @@ + + + + +