dominds 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/context-health.md +15 -10
- package/dist/docs/context-health.zh.md +9 -0
- package/dist/minds/load.js +12 -0
- package/dist/minds/system-prompt-parts.js +26 -6
- package/dist/minds/system-prompt.js +28 -8
- package/dist/shared/i18n/driver-messages.js +10 -10
- package/dist/tools/ctrl.js +2 -2
- package/dist/tools/prompts/control/en/principles.md +2 -2
- package/dist/tools/prompts/control/en/tools.md +2 -2
- package/dist/tools/prompts/control/zh/index.md +1 -1
- package/dist/tools/prompts/control/zh/principles.md +3 -3
- package/dist/tools/prompts/control/zh/tools.md +4 -4
- package/package.json +1 -1
|
@@ -116,9 +116,11 @@ Levels are derived from the two thresholds:
|
|
|
116
116
|
### Continuation package
|
|
117
117
|
|
|
118
118
|
The remediation workflow centers around a _continuation package_ (a scannable, actionable bundle of
|
|
119
|
-
context that survives a new course).
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
context that survives a new course). The agent must not self-assess whether it is “still
|
|
120
|
+
clear-headed” or “already muddled” because that judgment is not reliable or auditable. The only
|
|
121
|
+
mechanical branch is whether the system has put the current course into `caution` / `critical`
|
|
122
|
+
remediation. Outside remediation, prefer **one structured reminder**. During remediation, rough
|
|
123
|
+
multi-reminder carry-over is acceptable as a bridge.
|
|
122
124
|
|
|
123
125
|
Recommended structure (multi-line but compact; focus on details not covered in Taskdoc):
|
|
124
126
|
|
|
@@ -130,10 +132,13 @@ Recommended structure (multi-line but compact; focus on details not covered in T
|
|
|
130
132
|
Rules:
|
|
131
133
|
|
|
132
134
|
- Keep normal reminders concise and few.
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
- Do not let the agent branch on subjective self-assessment such as “clear-headed” vs “muddled”.
|
|
136
|
+
- When the current course is not under `caution` / `critical` remediation, prefer compressing into
|
|
137
|
+
one structured continuation-package reminder.
|
|
138
|
+
- When the system has put the current course into `caution` / `critical` remediation, prioritize
|
|
139
|
+
preserving volatile information even via multiple rough reminders; in the current course, only
|
|
140
|
+
preserve info and `clear_mind`. Once the system actually starts the next course, the first step
|
|
141
|
+
is to review, merge, and delete redundancy.
|
|
137
142
|
- Do not duplicate Taskdoc content except for a short bridge when strictly needed.
|
|
138
143
|
- Do not paste long raw logs/tool outputs into the continuation package.
|
|
139
144
|
|
|
@@ -150,7 +155,7 @@ Current behavior:
|
|
|
150
155
|
generations; configurable per model).
|
|
151
156
|
- Each inserted prompt requires the agent to **curate reminders** (at least one call):
|
|
152
157
|
- `update_reminder` (preferred) / `add_reminder`
|
|
153
|
-
-
|
|
158
|
+
- Default to one structured continuation-package reminder; if the current course is already under remediation and one structured reminder cannot be produced directly from already observed facts, rough multi-reminder carry-over is acceptable
|
|
154
159
|
- Then `clear_mind` when it becomes scannable/actionable
|
|
155
160
|
|
|
156
161
|
### Critical (red)
|
|
@@ -159,7 +164,7 @@ When `level === 'critical'`, the driver enters a **countdown remediation** (max
|
|
|
159
164
|
|
|
160
165
|
- On each turn, the driver records a **role=user prompt** (persisted as a user message) that is
|
|
161
166
|
visible in the UI as a user prompt. This prompt tells the agent to:
|
|
162
|
-
- curate reminders via `update_reminder` / `add_reminder`, preferably into a continuation-package reminder but allowing rough multi-reminder carry-over when already
|
|
167
|
+
- curate reminders via `update_reminder` / `add_reminder`, preferably into a continuation-package reminder but allowing rough multi-reminder carry-over when the current course is already under remediation and a single structured reminder cannot be produced directly from already observed facts, and
|
|
163
168
|
- then call `clear_mind` to start a new course.
|
|
164
169
|
- The prompt includes a countdown: after **N** turns the system will automatically clear.
|
|
165
170
|
- When the countdown reaches 0, the driver **automatically calls** `clear_mind` (with empty args; no
|
|
@@ -226,7 +231,7 @@ Additional constraints:
|
|
|
226
231
|
- `caution`: driver inserts a persisted role=user prompt (UI-visible user instruction).
|
|
227
232
|
On entering `caution` it inserts once; while still `caution` it reinserts on a cadence (default: every
|
|
228
233
|
10 generations; configurable per model). Each time, the agent must call at least one of
|
|
229
|
-
`update_reminder` / `add_reminder` and preserve a continuation package. A single structured reminder is preferred,
|
|
234
|
+
`update_reminder` / `add_reminder` and preserve a continuation package. A single structured reminder is preferred when the current course is not under remediation pressure; during remediation, multiple rough reminders are acceptable if they can be written directly from already observed facts without further reading/analysis. In the new course the agent should reconcile them first, then `clear_mind` when ready.
|
|
230
235
|
- `critical`: driver runs a countdown remediation (max 5 turns) using **recorded role=user prompts**.
|
|
231
236
|
Each prompt includes a countdown and instructs reminder curation + `clear_mind`. When the countdown
|
|
232
237
|
reaches 0, the driver auto-executes `clear_mind` and starts a new course (no Q4H, no suspension).
|
|
@@ -107,6 +107,15 @@ Dominds 计算比率:
|
|
|
107
107
|
- 运行/验证(命令、端口、环境变量)
|
|
108
108
|
- 容易丢失的临时细节(路径/ID/URL/示例输入)
|
|
109
109
|
|
|
110
|
+
规则:
|
|
111
|
+
|
|
112
|
+
- 普通提醒项保持简短且少量。
|
|
113
|
+
- 不允许智能体靠主观感觉判断自己“头脑清楚”还是“已经发乱”;这两种说法没有可靠、可审计的客观判据。
|
|
114
|
+
- 机制性分流规则只有一个:看**系统是否已将当前程置于上下文健康处置态**。若当前没有 `caution/critical` 处置指令,则默认优先压缩成一个结构化接续包提醒项。
|
|
115
|
+
- 一旦系统已将当前程置于 `caution/critical` 处置态,当前程的目标就切换为“保住易丢信息并尽快 `clear_mind`”,此时允许多条粗略提醒项过桥;系统真正开启新一程后,第一步再复核、合并并删除冗余。
|
|
116
|
+
- 除非确有必要,不要重复差遣牒已覆盖的内容。
|
|
117
|
+
- 不要把长原始日志/大段 tool output 直接塞进接续包。
|
|
118
|
+
|
|
110
119
|
### 警告(黄色)
|
|
111
120
|
|
|
112
121
|
当 `level === 'caution'` 时,驱动程序在**下一个** LLM 生成轮次自动插入一条 **role=user** 指导提示,并**将其持久化为普通用户消息**,以便 UI 将其渲染为正常的用户指令。
|
package/dist/minds/load.js
CHANGED
|
@@ -235,6 +235,16 @@ async function loadAgentMinds(agentId, dialog, options) {
|
|
|
235
235
|
const agentHasPersonalMemoryTools = funcTools.some((t) => isPersonalMemoryToolName(t.name));
|
|
236
236
|
const isSubdialog = dialog !== undefined && dialog.supdialog !== undefined;
|
|
237
237
|
const taskdocMaintainerId = dialog && dialog instanceof dialog_1.SubDialog ? dialog.rootDialog.agentId : agent.id;
|
|
238
|
+
const contextHealthSnapshot = dialog?.getLastContextHealth();
|
|
239
|
+
const contextHealthPromptMode = contextHealthSnapshot &&
|
|
240
|
+
contextHealthSnapshot.kind === 'available' &&
|
|
241
|
+
contextHealthSnapshot.level === 'critical'
|
|
242
|
+
? 'critical'
|
|
243
|
+
: contextHealthSnapshot &&
|
|
244
|
+
contextHealthSnapshot.kind === 'available' &&
|
|
245
|
+
contextHealthSnapshot.level === 'caution'
|
|
246
|
+
? 'caution'
|
|
247
|
+
: 'normal';
|
|
238
248
|
const promptdocContext = {
|
|
239
249
|
language: workingLanguage,
|
|
240
250
|
agentId: agent.id,
|
|
@@ -246,6 +256,7 @@ async function loadAgentMinds(agentId, dialog, options) {
|
|
|
246
256
|
agentHasShellTools,
|
|
247
257
|
agentHasReadonlyShell,
|
|
248
258
|
shellSpecialistMemberIds,
|
|
259
|
+
contextHealthPromptMode,
|
|
249
260
|
};
|
|
250
261
|
const policyText = [
|
|
251
262
|
(0, system_prompt_parts_1.buildShellPolicyPrompt)(promptdocContext),
|
|
@@ -260,6 +271,7 @@ async function loadAgentMinds(agentId, dialog, options) {
|
|
|
260
271
|
const systemPrompt = (0, system_prompt_1.buildSystemPrompt)({
|
|
261
272
|
language: workingLanguage,
|
|
262
273
|
dialogScope: isSubdialog ? 'sideline' : 'mainline',
|
|
274
|
+
contextHealthPromptMode,
|
|
263
275
|
agent,
|
|
264
276
|
persona,
|
|
265
277
|
knowledge,
|
|
@@ -136,6 +136,26 @@ function buildShellPolicyPrompt(ctx) {
|
|
|
136
136
|
}
|
|
137
137
|
function getMemoryPromptCopy(ctx) {
|
|
138
138
|
const runtimeMarkers = (0, inter_dialog_format_1.getRuntimeTransferMarkers)(ctx.language);
|
|
139
|
+
const contextHealthLineZh = ctx.contextHealthPromptMode === 'critical'
|
|
140
|
+
? '当前上下文处于系统告急处置态:立即停止继续大实现/大阅读。本程只做保信息、提醒项提炼与 `clear_mind`。'
|
|
141
|
+
: ctx.contextHealthPromptMode === 'caution'
|
|
142
|
+
? '当前上下文处于系统吃紧处置态:不要继续扩张上下文。本程优先提炼提醒项并尽快 `clear_mind`,不要继续大实现/大阅读。'
|
|
143
|
+
: '当前没有生效中的上下文健康处置指令,按正常工作流推进。';
|
|
144
|
+
const taskdocLogLineZh = ctx.contextHealthPromptMode === 'critical'
|
|
145
|
+
? '不要把长日志/大段 tool output 直接塞进差遣牒;差遣牒只写结论+下一步;提醒项也只留可扫读摘录。当前是告急处置态:本程允许先保留多条粗略提醒项求稳,但不要在当前程提前做“新一程清醒复核”。系统真正开启新一程后,第一步再复核整理:删除冗余、纠正偏激/失真思路,再收敛成高质量提醒项。'
|
|
146
|
+
: ctx.contextHealthPromptMode === 'caution'
|
|
147
|
+
? '不要把长日志/大段 tool output 直接塞进差遣牒;差遣牒只写结论+下一步;提醒项也只留可扫读摘录。当前是吃紧处置态:本程优先压缩/提炼提醒项并尽快 `clear_mind`;若一时来不及,可先保留多条粗略提醒项过桥,但不要在当前程提前做“新一程清醒复核”。系统真正开启新一程后,第一步再复核整理:删除冗余、纠正偏激/失真思路,再收敛成高质量提醒项。'
|
|
148
|
+
: '不要把长日志/大段 tool output 直接塞进差遣牒;差遣牒只写结论+下一步;提醒项也只留可扫读摘录。接续包提醒项默认应保持结构化、便于快速恢复。';
|
|
149
|
+
const contextHealthLineEn = ctx.contextHealthPromptMode === 'critical'
|
|
150
|
+
? 'Current context is under system critical remediation: stop large implementations/reads immediately. In this course, do only preserve-info work, reminder distillation, and `clear_mind`.'
|
|
151
|
+
: ctx.contextHealthPromptMode === 'caution'
|
|
152
|
+
? 'Current context is under system caution remediation: do not keep expanding context. In this course, prioritize reminder distillation and `clear_mind`; do not continue large implementations/reads.'
|
|
153
|
+
: 'There is no active context-health remediation instruction in effect right now; proceed with the normal workflow.';
|
|
154
|
+
const taskdocLogLineEn = ctx.contextHealthPromptMode === 'critical'
|
|
155
|
+
? 'Do not paste long logs/tool outputs into Taskdoc; Taskdoc should record decisions + next steps; reminders should also keep only scannable excerpts. Current mode is critical remediation: in this course, rough multi-reminder bridge notes are acceptable, but do not perform the new-course “clear-headed review” early. Once the system actually starts the new course, the first step is to review/rewrite them: remove redundancy, correct biased or distorted bridge notes, then compress them into high-quality reminders.'
|
|
156
|
+
: ctx.contextHealthPromptMode === 'caution'
|
|
157
|
+
? 'Do not paste long logs/tool outputs into Taskdoc; Taskdoc should record decisions + next steps; reminders should also keep only scannable excerpts. Current mode is caution remediation: in this course, prioritize compressing/distilling reminders and clearing soon; if needed, rough multi-reminder bridge notes are acceptable, but do not perform the new-course “clear-headed review” early. Once the system actually starts the new course, the first step is to review/rewrite them: remove redundancy, correct biased or distorted bridge notes, then compress them into high-quality reminders.'
|
|
158
|
+
: 'Do not paste long logs/tool outputs into Taskdoc; Taskdoc should record decisions + next steps; reminders should also keep only scannable excerpts. Keep continuation-package reminders structured and fast to resume from by default.';
|
|
139
159
|
if (ctx.language === 'zh') {
|
|
140
160
|
return {
|
|
141
161
|
title: '### 记忆系统(重要)',
|
|
@@ -146,7 +166,7 @@ function getMemoryPromptCopy(ctx) {
|
|
|
146
166
|
progressLine: '- 其中 `progress` 是全队共享公告牌:用于“阶段性进度快照”(关键决策/当前状态/下一步),不是流水账。',
|
|
147
167
|
injectedTaskdocLine: '- 重要:差遣牒内容会被系统以内联形式注入到上下文中(本轮生成视角下即为最新;注入内容不包括全局约束)。需要回顾时请直接基于上下文里的差遣牒内容回顾与决策,不要试图用通用文件工具读取 `*.tsk/` 下的文件(会被拒绝)。',
|
|
148
168
|
constraintsLine: '- 约定:`constraints` 只写任务特有的硬要求,不得写入系统提示/工具文档里已明确且由系统强制执行的通用规则(例如 `*.tsk/` 封装禁止通用文件工具)。一经发现重复,必须删除并告知用户。',
|
|
149
|
-
remindersLine: '- 提醒项(即编号提醒,工作集):当前对话的高频工作记录/关键细节(偏私有,不作为全队公告);默认保持少量(常见 1–3 条),优先 `update_reminder` 压缩/合并,不再需要就 `delete_reminder`。准备 `clear_mind`
|
|
169
|
+
remindersLine: '- 提醒项(即编号提醒,工作集):当前对话的高频工作记录/关键细节(偏私有,不作为全队公告);默认保持少量(常见 1–3 条),优先 `update_reminder` 压缩/合并,不再需要就 `delete_reminder`。准备 `clear_mind` 开启新一程对话时,默认整理成“结构化接续包提醒项”;其中只保留差遣牒未覆盖、但恢复工作容易丢的细节(如第一步、关键定位、运行/验证信息、临时 ids/路径)。若系统已把当前程切到吃紧/告急处置态,则允许先保留多条粗略提醒项把信息带过桥;当前程只做保信息 + clear_mind;只有系统实际开启新一程后,第一步才是以清醒头脑复核并整理这些接续包/粗略提醒项:删除冗余、纠正偏激或失真的过桥思路、压缩成高质量提醒项。',
|
|
150
170
|
teamMemoryLine: '- 团队记忆:稳定的团队约定/工程规约(跨任务共享)。',
|
|
151
171
|
personalMemoryLine: '- 个人记忆:稳定的个人习惯/偏好与职责域知识;记忆会在每次生成时自动注入上下文,应保持少量且准确(关键文档/代码的精确路径 + 最小必要事实)。不要记录具体任务状态。',
|
|
152
172
|
subdialogDutyLine: `你当前处于支线对话:此处不允许 \`change_mind\`。当你判断需要更新差遣牒(尤其是 progress 公告牌)时,请在合适时机直接诉请差遣牒维护人 \`@${ctx.taskdocMaintainerId}\` 执行更新,并给出你已合并好的“新全文/替换稿”(用于替换对应章节全文)。不要声称已更新,除非看到回执。`,
|
|
@@ -156,8 +176,8 @@ function getMemoryPromptCopy(ctx) {
|
|
|
156
176
|
personalMemoryHintLine: `提示:你具备个人记忆工具(\`add_personal_memory\` / \`replace_personal_memory\` / \`drop_personal_memory\` / \`clear_personal_memory\`)。个人记忆仅对当前智能体可见,且系统会自动按成员隔离到 \`.minds/memory/individual/<member-id>/...\`;因此 \`path\` 不应包含你的成员 id(不要写 \`${ctx.agentId}/...\`)。首次创建时直接用 \`add_personal_memory\` 即可,目录会由系统自动创建。记忆会在每次生成时自动注入上下文:保持少量、保持准确、按“未来会一起更新的内容”合并;写稳定事实(关键路径 + 最小必要约定),不要写任务进度/当天状态;一旦你修改了相关文件或发现记忆过期/冲突,立刻用 \`replace_personal_memory\` 更新。`,
|
|
157
177
|
subdialogWorkflowLine: `工作流:先做事 → 再提炼(\`update_reminder\`;必要时整理差遣牒更新提案并诉请 \`@${ctx.taskdocMaintainerId}\` 合并写入)→ 然后 \`clear_mind\` 清空噪音。`,
|
|
158
178
|
mainlineWorkflowLine: '工作流:先做事 → 再提炼(`update_reminder` + `change_mind(progress)`)→ 然后 `clear_mind` 清空噪音。',
|
|
159
|
-
contextHealthLine:
|
|
160
|
-
taskdocLogLine:
|
|
179
|
+
contextHealthLine: contextHealthLineZh,
|
|
180
|
+
taskdocLogLine: taskdocLogLineZh,
|
|
161
181
|
};
|
|
162
182
|
}
|
|
163
183
|
return {
|
|
@@ -169,7 +189,7 @@ function getMemoryPromptCopy(ctx) {
|
|
|
169
189
|
progressLine: '- Taskdoc `progress` is the team’s shared bulletin board: distilled milestone snapshots (key decisions/current status/next steps), not raw logs.',
|
|
170
190
|
injectedTaskdocLine: '- Important: the Taskdoc content is injected inline into the context (the latest as of this generation; injected content excludes global constraints). Review the injected Taskdoc instead of trying to read files under `*.tsk/` via general file tools (they will be rejected).',
|
|
171
191
|
constraintsLine: '- Convention: Taskdoc `constraints` must contain task-specific requirements only; do not include global, system-enforced rules already stated in system prompt/tool docs (e.g. `.tsk/` encapsulation bans general file tools). If duplication is found, you MUST remove it and notify the user.',
|
|
172
|
-
remindersLine: '- Reminders (i.e. numbered reminders, working set): your high-frequency per-dialog worklog + critical details (not a team bulletin board); keep it small by default (often 1–3 items), prefer `update_reminder` to compress/merge, and delete when obsolete. When preparing `clear_mind` to start a new course,
|
|
192
|
+
remindersLine: '- Reminders (i.e. numbered reminders, working set): your high-frequency per-dialog worklog + critical details (not a team bulletin board); keep it small by default (often 1–3 items), prefer `update_reminder` to compress/merge, and delete when obsolete. When preparing `clear_mind` to start a new course, default to a structured continuation-package reminder that keeps only details not already covered by Taskdoc but easy to lose during resume (first step, key pointers, run/verify info, volatile ids/paths). If the system has already put the current course into caution/critical remediation, rough multi-reminder bridge notes are acceptable; in the current course, only preserve volatile information and clear_mind. Only after the system actually starts the new course does the mandatory first step become reviewing and rewriting those continuation/rough reminders with a clear head: remove redundancy, correct biased or distorted bridge notes, and compress them into high-quality reminders.',
|
|
173
193
|
teamMemoryLine: '- Team memory: stable shared conventions (cross-task).',
|
|
174
194
|
personalMemoryLine: '- Personal memory: stable personal habits/preferences and responsibility-scope knowledge. Memory is automatically injected into context on each generation: keep it small and accurate (exact key doc/code paths + minimal key facts); do not store per-task state.',
|
|
175
195
|
subdialogDutyLine: `You are currently in a subdialog: \`change_mind\` is not allowed here. When Taskdoc should be updated (especially the shared progress bulletin board), tellask the Taskdoc maintainer \`@${ctx.taskdocMaintainerId}\` with a fully merged replacement draft (full-section replacement). Do not claim it is updated until you see a receipt.`,
|
|
@@ -179,8 +199,8 @@ function getMemoryPromptCopy(ctx) {
|
|
|
179
199
|
personalMemoryHintLine: `Hint: you have personal-memory tools (\`add_personal_memory\` / \`replace_personal_memory\` / \`drop_personal_memory\` / \`clear_personal_memory\`). Personal memory is private to the current agent and is automatically isolated under \`.minds/memory/individual/<member-id>/...\`; therefore \`path\` MUST NOT include your member id (do not write \`${ctx.agentId}/...\`). For first-time setup, just call \`add_personal_memory\`—the directory will be created automatically. Memory is automatically injected into context on each generation: keep it small, keep it accurate, and group facts that are updated together. Store stable facts (exact key paths + minimal contracts), not daily state/progress. If you changed those files or detect staleness/conflicts, immediately \`replace_personal_memory\` to keep it accurate.`,
|
|
180
200
|
subdialogWorkflowLine: `Workflow: do work → distill (\`update_reminder\`; when Taskdoc needs updates, draft a merged replacement and ask \`@${ctx.taskdocMaintainerId}\`) → then \`clear_mind\` to drop noise.`,
|
|
181
201
|
mainlineWorkflowLine: 'Workflow: do work → distill (`update_reminder` + `change_mind(progress)`) → then `clear_mind` to drop noise.',
|
|
182
|
-
contextHealthLine:
|
|
183
|
-
taskdocLogLine:
|
|
202
|
+
contextHealthLine: contextHealthLineEn,
|
|
203
|
+
taskdocLogLine: taskdocLogLineEn,
|
|
184
204
|
};
|
|
185
205
|
}
|
|
186
206
|
function buildMemorySystemPrompt(ctx) {
|
|
@@ -38,16 +38,36 @@ function formatTeamIntro(team, selfAgentId, language) {
|
|
|
38
38
|
function pickLocalized(language, localized) {
|
|
39
39
|
return language === 'zh' ? localized.zh : localized.en;
|
|
40
40
|
}
|
|
41
|
-
function buildFbrContextHealthScopeRule(scope, language) {
|
|
41
|
+
function buildFbrContextHealthScopeRule(scope, language, contextHealthPromptMode) {
|
|
42
|
+
if (contextHealthPromptMode === 'critical') {
|
|
43
|
+
return pickLocalized(language, {
|
|
44
|
+
zh: scope === 'mainline'
|
|
45
|
+
? '- 当前上下文处于系统告急处置态:本程禁止发起 FBR。先按处置要求保信息、维护提醒项,并立即 `clear_mind`;系统真正开启新一程并完成接续包复核后,再恢复 FBR 与差遣牒更新。'
|
|
46
|
+
: '- 当前上下文处于系统告急处置态:本程禁止发起 FBR。先按处置要求保信息、维护提醒项,并立即 `clear_mind`;系统真正开启新一程并完成接续包复核后,再恢复 FBR。',
|
|
47
|
+
en: scope === 'mainline'
|
|
48
|
+
? '- Current context is under system critical remediation: do not start FBR in this course. Preserve volatile information, maintain reminders, and clear immediately; resume FBR and Taskdoc updates only after the system starts the new course and the continuation package has been reviewed.'
|
|
49
|
+
: '- Current context is under system critical remediation: do not start FBR in this course. Preserve volatile information, maintain reminders, and clear immediately; resume FBR only after the system starts the new course and the continuation package has been reviewed.',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (contextHealthPromptMode === 'caution') {
|
|
53
|
+
return pickLocalized(language, {
|
|
54
|
+
zh: scope === 'mainline'
|
|
55
|
+
? '- 当前上下文处于系统吃紧处置态:本程不要发起 FBR。先按处置要求提炼提醒项并尽快 `clear_mind`;系统真正开启新一程并完成接续包复核后,再恢复 FBR 与差遣牒更新。'
|
|
56
|
+
: '- 当前上下文处于系统吃紧处置态:本程不要发起 FBR。先按处置要求提炼提醒项并尽快 `clear_mind`;系统真正开启新一程并完成接续包复核后,再恢复 FBR。',
|
|
57
|
+
en: scope === 'mainline'
|
|
58
|
+
? '- Current context is under system caution remediation: do not start FBR in this course. Distill reminders and clear soon; resume FBR and Taskdoc updates only after the system starts the new course and the continuation package has been reviewed.'
|
|
59
|
+
: '- Current context is under system caution remediation: do not start FBR in this course. Distill reminders and clear soon; resume FBR only after the system starts the new course and the continuation package has been reviewed.',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
42
62
|
if (scope === 'mainline') {
|
|
43
63
|
return pickLocalized(language, {
|
|
44
|
-
zh: '-
|
|
45
|
-
en: '-
|
|
64
|
+
zh: '- 当前没有生效中的上下文健康处置指令,可以按正常流程进行 FBR。完成 FBR 后,基于当前可观测事实调用 \\`change_mind\\` 更新差遣牒,体现任务最新进展情况。FBR 自诉请正文不要冗余包含差遣牒已有信息。',
|
|
65
|
+
en: '- There is no active context-health remediation instruction in effect, so FBR may proceed normally. After FBR, call \\`change_mind\\` based on currently observable facts to update the Taskdoc with the latest progress; do not redundantly include information already present in the Taskdoc in the FBR body.',
|
|
46
66
|
});
|
|
47
67
|
}
|
|
48
68
|
return pickLocalized(language, {
|
|
49
|
-
zh: '-
|
|
50
|
-
en: '-
|
|
69
|
+
zh: '- 当前没有生效中的上下文健康处置指令,可以按正常流程进行 FBR。随后基于当前可观测事实分析是否与差遣牒内容存在差异,并将发现的情况包含在 FBR 自诉请正文中。',
|
|
70
|
+
en: '- There is no active context-health remediation instruction in effect, so FBR may proceed normally. Then analyze whether currently observable facts differ from the Taskdoc, and include the findings in the FBR body.',
|
|
51
71
|
});
|
|
52
72
|
}
|
|
53
73
|
function buildFbrPhaseContract(language) {
|
|
@@ -181,8 +201,8 @@ function buildTellaskCollaborationProtocol(language, dialogScope) {
|
|
|
181
201
|
}
|
|
182
202
|
return lines.join('\n');
|
|
183
203
|
}
|
|
184
|
-
function buildFbrGuidelines(language, dialogScope) {
|
|
185
|
-
const fbrContextHealthRule = buildFbrContextHealthScopeRule(dialogScope, language);
|
|
204
|
+
function buildFbrGuidelines(language, dialogScope, contextHealthPromptMode) {
|
|
205
|
+
const fbrContextHealthRule = buildFbrContextHealthScopeRule(dialogScope, language, contextHealthPromptMode);
|
|
186
206
|
const fbrPhaseContract = buildFbrPhaseContract(language);
|
|
187
207
|
const lines = pickLocalized(language, {
|
|
188
208
|
zh: [
|
|
@@ -258,7 +278,7 @@ function buildFunctionToolRules(language, funcToolRulesText) {
|
|
|
258
278
|
}
|
|
259
279
|
function buildSystemPrompt(input) {
|
|
260
280
|
const collaborationProtocol = buildTellaskCollaborationProtocol(input.language, input.dialogScope);
|
|
261
|
-
const fbrGuidelines = buildFbrGuidelines(input.language, input.dialogScope);
|
|
281
|
+
const fbrGuidelines = buildFbrGuidelines(input.language, input.dialogScope, input.contextHealthPromptMode);
|
|
262
282
|
const tellaskInteractionRules = buildTellaskInteractionRules(input.language);
|
|
263
283
|
const functionToolRules = buildFunctionToolRules(input.language, input.funcToolRulesText);
|
|
264
284
|
if (input.language === 'zh') {
|
|
@@ -31,13 +31,13 @@ function formatNewCourseStartPrompt(language, args) {
|
|
|
31
31
|
? `你刚清理头脑,开启了第 ${args.nextCourse} 程对话。`
|
|
32
32
|
: `系统因上下文已告急(critical)而自动开启了第 ${args.nextCourse} 程对话。`;
|
|
33
33
|
return (`${prefix} ` +
|
|
34
|
-
'
|
|
34
|
+
'现在已经进入新一程:第一步先复核并整理接续包提醒项,以清醒头脑删除冗余、纠正偏激或失真的过桥思路、压缩成高质量提醒项;再继续推进任务。');
|
|
35
35
|
}
|
|
36
36
|
const prefix = args.source === 'clear_mind'
|
|
37
37
|
? `This is course #${args.nextCourse} of the dialog. You just cleared your mind.`
|
|
38
38
|
: `System auto-started course #${args.nextCourse} of the dialog because context health is critical.`;
|
|
39
39
|
return (`${prefix} ` +
|
|
40
|
-
'
|
|
40
|
+
'You are now in a new course: your first step is to review and rewrite any continuation-package reminders with a clear head, remove redundancy, correct biased or distorted bridge notes, compress them into high-quality reminders, and then continue the task.');
|
|
41
41
|
}
|
|
42
42
|
function formatReminderItemGuide(language, index, content, options) {
|
|
43
43
|
function isRecord(value) {
|
|
@@ -195,9 +195,9 @@ function formatAgentFacingContextHealthV3RemediationGuide(language, args) {
|
|
|
195
195
|
'',
|
|
196
196
|
'影响:对话历史中的工具调用/结果信息很多已经过时,成为你的思考负担。',
|
|
197
197
|
'',
|
|
198
|
-
'
|
|
198
|
+
'行动:先尽量保住易丢信息,并优先把已经掌握的事实压缩成结构化接续包提醒项(下一步行动 + 关键定位信息 + 运行/验证信息 + 容易丢的临时细节);若不额外继续阅读/分析就做不到,允许先记成多条粗略提醒项。',
|
|
199
199
|
'',
|
|
200
|
-
'
|
|
200
|
+
'当前已处于吃紧处置阶段:不要继续扩张上下文,也不要提前进入“按接续包做清醒复核”的模式;那是系统真正开启新一程后的第一步。接续包只保留差遣牒未覆盖、但恢复工作会丢的信息。然后主动 clear_mind,开启新一程对话继续工作。',
|
|
201
201
|
'',
|
|
202
202
|
'操作:',
|
|
203
203
|
'- update_reminder({ "reminder_no": 1, "content": "..." })(推荐)',
|
|
@@ -209,14 +209,14 @@ function formatAgentFacingContextHealthV3RemediationGuide(language, args) {
|
|
|
209
209
|
'',
|
|
210
210
|
`系统最多再提醒你 ${args.promptsRemainingAfterThis} 次,之后将自动清理头脑开启新一程对话。`,
|
|
211
211
|
'',
|
|
212
|
-
'行动:尽快保住易丢信息,然后 clear_mind
|
|
212
|
+
'行动:尽快保住易丢信息,然后 clear_mind。若能直接基于已掌握事实压缩成结构化接续包提醒项,就这样做;否则先保留多条粗略提醒项也可以。',
|
|
213
213
|
'',
|
|
214
214
|
'操作:',
|
|
215
215
|
'- update_reminder({ "reminder_no": 1, "content": "..." })',
|
|
216
216
|
'- add_reminder({ "content": "..." })',
|
|
217
217
|
'- clear_mind({})',
|
|
218
218
|
'',
|
|
219
|
-
'接续包要点:下一步行动 + 关键定位信息 + 运行验证方式 +
|
|
219
|
+
'接续包要点:下一步行动 + 关键定位信息 + 运行验证方式 + 容易丢的临时细节;不要重复差遣牒已有内容。当前处于告急处置阶段时,不要提前做“新一程清醒复核”;系统真正开启新一程后,第一步才是重新审视并整理:删除冗余、纠正偏激/失真思路、压缩成高质量提醒项。',
|
|
220
220
|
].join('\n');
|
|
221
221
|
}
|
|
222
222
|
if (args.kind === 'caution' && args.mode === 'soft') {
|
|
@@ -225,9 +225,9 @@ function formatAgentFacingContextHealthV3RemediationGuide(language, args) {
|
|
|
225
225
|
'',
|
|
226
226
|
'Impact: stale call/results in dialog history are creating cognitive noise.',
|
|
227
227
|
'',
|
|
228
|
-
'Action: first preserve easy-to-lose information
|
|
228
|
+
'Action: first preserve easy-to-lose information, and prefer compressing already observed facts into a structured continuation-package reminder (next step + key pointers + run/verify info + easy-to-lose volatile details). If that cannot be done without more reading/analysis, rough multi-reminder carry-over is acceptable.',
|
|
229
229
|
'',
|
|
230
|
-
'
|
|
230
|
+
'You are already in caution remediation for the current course, so do not keep expanding context and do not switch early into “clear-headed continuation-package review” mode; that is the first step only after the system actually starts the new course. Keep only details not already covered by Taskdoc. Then proactively clear_mind to start a new dialog course.',
|
|
231
231
|
'',
|
|
232
232
|
'Operations:',
|
|
233
233
|
'- update_reminder({ "reminder_no": 1, "content": "..." })',
|
|
@@ -239,14 +239,14 @@ function formatAgentFacingContextHealthV3RemediationGuide(language, args) {
|
|
|
239
239
|
'',
|
|
240
240
|
`System will remind you ${args.promptsRemainingAfterThis} more time(s), then automatically clear mind.`,
|
|
241
241
|
'',
|
|
242
|
-
'Action: preserve easy-to-lose information, then clear_mind.
|
|
242
|
+
'Action: preserve easy-to-lose information, then clear_mind. If you can compress already observed facts into one structured continuation-package reminder without more reading/analysis, do that; otherwise multiple rough reminders are acceptable as a bridge.',
|
|
243
243
|
'',
|
|
244
244
|
'Operations:',
|
|
245
245
|
'- update_reminder({ "reminder_no": 1, "content": "..." })',
|
|
246
246
|
'- add_reminder({ "content": "..." })',
|
|
247
247
|
'- clear_mind({})',
|
|
248
248
|
'',
|
|
249
|
-
'Continuation package: next step + key pointers + run/verify info + easy-to-lose volatile details. Do not duplicate Taskdoc content.
|
|
249
|
+
'Continuation package: next step + key pointers + run/verify info + easy-to-lose volatile details. Do not duplicate Taskdoc content. During critical remediation in the current course, do not start the new-course cleanup early; once the system actually starts the new course, the first step is to reconcile rough bridge reminders by removing redundancy, correcting biased or distorted bridge notes, and compressing them into high-quality reminders.',
|
|
250
250
|
].join('\n');
|
|
251
251
|
}
|
|
252
252
|
function formatDomindsNoteDirectSelfCall(language) {
|
package/dist/tools/ctrl.js
CHANGED
|
@@ -427,8 +427,8 @@ exports.clearMindTool = {
|
|
|
427
427
|
name: 'clear_mind',
|
|
428
428
|
description: 'Clear dialog mind and start a new course, optionally adding a reminder.',
|
|
429
429
|
descriptionI18n: {
|
|
430
|
-
en: 'Clear dialog mind and start a new course. If needed, pass reminder_content so you can resume quickly.
|
|
431
|
-
zh: '清理头脑并开启新一程对话。若需要,可传入 reminder_content
|
|
430
|
+
en: 'Clear dialog mind and start a new course. If needed, pass reminder_content so you can resume quickly. Default to a structured "Continuation Package"; if the current course is already under system caution/critical remediation, rough bridge notes are acceptable and can be reorganized in the new course.',
|
|
431
|
+
zh: '清理头脑并开启新一程对话。若需要,可传入 reminder_content 以便快速接续。默认整理成结构化"接续包";若当前程已被系统置于吃紧/告急处置态,粗略过桥笔记也可以,进入新一程后再重新整理。',
|
|
432
432
|
},
|
|
433
433
|
parameters: {
|
|
434
434
|
type: 'object',
|
|
@@ -35,7 +35,7 @@ Reminders are **session-level** temporary working-set information for tracking p
|
|
|
35
35
|
- Automatically cleared after dialog ends
|
|
36
36
|
- Can be added, modified, or deleted at any time
|
|
37
37
|
- Should stay compact, scannable, and directly actionable by default
|
|
38
|
-
- Before `clear_mind`,
|
|
38
|
+
- Before `clear_mind`, default to a structured continuation-package reminder; if the current course is already under system remediation, rough multi-reminder carry-over is acceptable
|
|
39
39
|
|
|
40
40
|
**Difference from memory:**
|
|
41
41
|
| Feature | reminder | memory |
|
|
@@ -88,7 +88,7 @@ Taskdoc is a **task contract** defining goals, constraints, and progress.
|
|
|
88
88
|
|
|
89
89
|
- Keep concise: reminders are often 1-3 items; prefer `update_reminder` to compress/merge
|
|
90
90
|
- Separate carriers: shared decisions/status belong in Taskdoc; reminders keep local resume details
|
|
91
|
-
- Collapse before clearing:
|
|
91
|
+
- Collapse before clearing: default to a structured continuation-package reminder; if the current course is already under system remediation, rough multi-reminder carry-over is acceptable but must be reconciled first in the new course
|
|
92
92
|
- Avoid raw-material dumps: do not paste long logs or large tool outputs into reminders
|
|
93
93
|
|
|
94
94
|
## Limitations and Notes
|
|
@@ -199,7 +199,7 @@ message: <error message>
|
|
|
199
199
|
## Reminder Content Guidance
|
|
200
200
|
|
|
201
201
|
- Normal reminders should stay concise, fresh, and directly actionable; often 1-3 items total
|
|
202
|
-
- For a continuation package,
|
|
203
|
-
- If already
|
|
202
|
+
- For a continuation package, use structured notes by default: next step, key pointers, run/verify, easy-to-lose volatile details
|
|
203
|
+
- If the current course is already under caution/critical remediation, rough multi-reminder bridge notes are acceptable; in the current course only preserve info + `clear_mind`, and reconcile them as the first step only after the system actually starts the new course
|
|
204
204
|
- Keep only details not already covered by Taskdoc; do not repeat team-shared status
|
|
205
205
|
- Do not paste long logs, large tool outputs, or raw material into reminders
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
- 对话结束后自动清除
|
|
36
36
|
- 可随时添加、修改、删除
|
|
37
37
|
- 默认应保持少量、可扫读、可直接指导下一步
|
|
38
|
-
- 准备 `clear_mind`
|
|
38
|
+
- 准备 `clear_mind` 时,默认优先压缩成结构化接续包提醒项;若当前程已被系统置于吃紧/告急处置态,也可先保留多条粗略提醒项过桥
|
|
39
39
|
|
|
40
40
|
**与 memory 的区别:**
|
|
41
41
|
| 特性 | reminder | memory |
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
|
|
77
77
|
- **当前工作集**:当前下一步、阻塞、关键定位信息
|
|
78
78
|
- **易丢细节**:临时路径、id、命令、样例输入
|
|
79
|
-
- **换程接续**:在 `clear_mind`
|
|
79
|
+
- **换程接续**:在 `clear_mind` 前整理接续包;若当前程已被系统置于吃紧/告急处置态,可先保留多条粗略提醒项
|
|
80
80
|
|
|
81
81
|
### 2. 差遣牒更新时机
|
|
82
82
|
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
|
|
89
89
|
- 保持简洁:默认提醒项常见 1–3 条,优先 `update_reminder` 压缩/合并
|
|
90
90
|
- 区分载体:团队共享决策/状态写入差遣牒,提醒项只留本地恢复所需细节
|
|
91
|
-
-
|
|
91
|
+
- 换程前收束:默认优先整理成结构化接续包提醒项;若系统已把当前程切到吃紧/告急处置态,则先保留多条粗略提醒项过桥也可以;当前程只做保信息 + `clear_mind`,系统真正开启新一程后第一步再收敛
|
|
92
92
|
- 拒绝原料堆积:不要把长日志/大段 tool output 直接塞进提醒项
|
|
93
93
|
|
|
94
94
|
## 限制与注意事项
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
**适用:**
|
|
27
27
|
|
|
28
28
|
- 添加新的临时工作集条目
|
|
29
|
-
- 若准备 `clear_mind
|
|
29
|
+
- 若准备 `clear_mind`,也可新建接续包提醒项;若当前程已被系统置于吃紧/告急处置态,先记粗略过桥信息也可以
|
|
30
30
|
|
|
31
31
|
**参数:**
|
|
32
32
|
|
|
@@ -70,7 +70,7 @@ deleted_at: <删除时间戳>
|
|
|
70
70
|
**适用:**
|
|
71
71
|
|
|
72
72
|
- 压缩/合并现有提醒项
|
|
73
|
-
-
|
|
73
|
+
- 把换程前需要保留的信息整理成接续包;若当前程已被系统置于吃紧/告急处置态,也可先保留多条粗略提醒项
|
|
74
74
|
- 删除已写入差遣牒、无需在提醒项重复保留的内容
|
|
75
75
|
|
|
76
76
|
**参数:**
|
|
@@ -199,7 +199,7 @@ message: <错误消息>
|
|
|
199
199
|
## 提醒项内容建议
|
|
200
200
|
|
|
201
201
|
- 默认提醒项应保持短、新、能直接指导下一步,常见 1–3 条
|
|
202
|
-
-
|
|
203
|
-
-
|
|
202
|
+
- 若用于接续包,默认优先结构化内容:下一步行动、关键定位、运行/验证、容易丢的临时细节
|
|
203
|
+
- 若已吃紧/告急,先保留多条粗略提醒项也可以;当前程只做保信息 + `clear_mind`,系统真正开启新一程后第一步再收敛整理
|
|
204
204
|
- 接续包只保留差遣牒未覆盖的细节;不要重复团队共享状态
|
|
205
205
|
- 不要把长日志、大段 tool output、原始材料直接塞进提醒项
|