Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
Default metacognition prompts + reflection digest to English
aiservice8c6b555ba087
diff --git a/src/core-agent/src/evolution/metacognition.ts b/src/core-agent/src/evolution/metacognition.tsindex 782ef963..78c702cd 100644--- a/src/core-agent/src/evolution/metacognition.ts+++ b/src/core-agent/src/evolution/metacognition.ts@@ -165,7 +165,9 @@ export function shouldReflect(* listed in COMPETENCE.md. Simple keyword matching.*/function hitsKnownWeakness(metrics: RunMetrics, competence: string): boolean {- // Look for a "已知弱点" or "weaknesses" section in competence+ // Look for a "weaknesses" section (or its Chinese equivalent "已知弱点",+ // kept so user-authored COMPETENCE.md from earlier zh-default builds still+ // matches without a migration pass).const weaknessSection = extractSection(competence, ['已知弱点', 'weaknesses', 'weak']);if (!weaknessSection) return false;@@ -218,83 +220,83 @@ export function buildAdaptiveReviewPrompt(skillHealthReport?: string,conversationDigest?: string,): string {- const base = '根据以下对话摘要,考虑改进你的技能和自我认知。\n\n'- + '**重要:网络超时、连接中断、速率限制等瞬态错误是环境问题,不是技能或能力缺陷。'- + '遇到这类错误时不要在 COMPETENCE.md 标记为弱点,不要修改或删除相关技能,'- + '不要在 LEARNING_STRATEGIES.md 建议回避该工具。**\n\n';+ const base = 'Based on the conversation digest below, consider improving your skills and self-awareness.\n\n'+ + '**Important: transient errors (network timeouts, dropped connections, rate limits) are environmental issues, not skill or capability deficits. '+ + 'Do not mark them as weaknesses in COMPETENCE.md, do not modify or delete the related skills, '+ + 'and do not advise avoiding the tool in LEARNING_STRATEGIES.md.**\n\n';let focus: string;switch (primaryFocus) {case 'error_recovery':- focus = '你在这个任务中从错误中恢复了。'- + '请把解决方法提取为可复用的技能,重点记录让恢复成功的非显而易见的步骤。';+ focus = 'You recovered from an error during this task. '+ + 'Extract the resolution into a reusable skill, focusing on the non-obvious steps that made recovery succeed.';break;case 'user_correction':- focus = '用户纠正了你的做法。'- + '请识别你做错了什么,创建/更新技能来记录正确的做法。'- + '同时更新 COMPETENCE.md 记录这个弱点。';+ focus = 'The user corrected your approach. '+ + 'Identify what you got wrong, then create or update a skill that captures the correct way. '+ + 'Also update COMPETENCE.md to record this weakness.';break;case 'skill_ineffective':- focus = '你加载的技能没有帮到这个任务。'- + '分析原因:技能过时了?太泛化?还是不匹配?'- + '请修补或删除无效的技能。';+ focus = 'A skill you loaded did not help on this task. '+ + 'Diagnose why: outdated? too generic? mismatched? '+ + 'Patch or delete the ineffective skill.';break;case 'known_weakness':- focus = '这个任务命中了你的已知弱点。'- + '重点加强这个领域。如果你成功了,更新 COMPETENCE.md 反映进步。';+ focus = 'This task hit one of your known weaknesses. '+ + 'Strengthen this area. If you succeeded, update COMPETENCE.md to reflect the progress.';break;case 'weakness_succeeded':- focus = '你之前标记为弱点的能力在这次任务中表现正常。'- + '请更新 COMPETENCE.md:移除或降级该弱点条目。'- + '不要修改或删除相关技能——它们工作正常。';+ focus = 'A capability you previously flagged as a weakness performed normally on this task. '+ + 'Update COMPETENCE.md: remove or downgrade that weakness entry. '+ + 'Do not modify or delete the related skills — they are working as expected.';break;case 'periodic_review':- focus = '距离上次反思已经过了一段时间,做一次定期回顾。'- + '查看 COMPETENCE.md 和 LEARNING_STRATEGIES.md:'- + '合并相近条目、删除已经不再适用或重复的内容、'- + '把近期反复出现的稳定模式提炼成新技能。'- + '如果近期没有新的可保存内容,直接说"无需保存",不要为了反思而反思。';+ focus = 'Some time has passed since the last reflection — do a periodic review. '+ + 'Look at COMPETENCE.md and LEARNING_STRATEGIES.md: '+ + 'merge similar entries, drop content that no longer applies or is duplicated, '+ + 'and distill recently-recurring stable patterns into new skills. '+ + 'If there is nothing new worth saving, just say "nothing to save" — do not reflect for the sake of reflecting.';break;case 'complexity':default:- focus = '这是一个复杂的任务。'- + '考虑是否有值得保存为技能的方法或模式。';+ focus = 'This is a complex task. '+ + 'Consider whether any approach or pattern is worth saving as a skill.';break;}const parts = [base,- `**重点**: ${focus}`,+ `**Focus**: ${focus}`,];if (conversationDigest) {parts.push('',- '**对话摘要**:',+ '**Conversation digest**:',conversationDigest,);}parts.push('',- '**当前自我评估 (COMPETENCE.md)**:',- competence || '(尚无自我评估 — 请考虑创建一份。)',+ '**Current self-assessment (COMPETENCE.md)**:',+ competence || '(No self-assessment yet — consider creating one.)','',- '**可用学习策略 (LEARNING_STRATEGIES.md)**:',- strategies || '(尚无策略记录 — 请自行判断。)',+ '**Available learning strategies (LEARNING_STRATEGIES.md)**:',+ strategies || '(No strategy log yet — use your own judgment.)',);if (skillHealthReport) {- parts.push('', '**技能健康度报告**:', skillHealthReport);+ parts.push('', '**Skill health report**:', skillHealthReport);}parts.push('',- '反思完成后,你可以:',- '1. 通过 skill_manage 工具创建/修补/删除技能',- '2. 通过 metacognition 工具更新 COMPETENCE.md',- '3. 通过 metacognition 工具更新 LEARNING_STRATEGIES.md',- '4. 如果没有值得保存的内容,直接说"无需保存"',+ 'After reflecting, you can:',+ '1. Create / patch / delete skills via the skill_manage tool',+ '2. Update COMPETENCE.md via the metacognition tool',+ '3. Update LEARNING_STRATEGIES.md via the metacognition tool',+ '4. If nothing is worth saving, just say "nothing to save"',);return parts.join('\n');diff --git a/src/core-agent/test/metacognition.test.ts b/src/core-agent/test/metacognition.test.tsindex 75fda034..97d524c3 100644--- a/src/core-agent/test/metacognition.test.ts+++ b/src/core-agent/test/metacognition.test.ts@@ -292,86 +292,86 @@ describe('shouldReflect', () => {describe('buildAdaptiveReviewPrompt', () => {it('builds error_recovery focused prompt', () => {const prompt = buildAdaptiveReviewPrompt('error_recovery', '', '');- expect(prompt).toContain('从错误中恢复');+ expect(prompt).toContain('recovered from an error');expect(prompt).toContain('skill_manage');expect(prompt).toContain('metacognition');});it('builds user_correction focused prompt', () => {const prompt = buildAdaptiveReviewPrompt('user_correction', '', '');- expect(prompt).toContain('纠正');+ expect(prompt).toContain('corrected your approach');expect(prompt).toContain('COMPETENCE');});it('builds skill_ineffective focused prompt', () => {const prompt = buildAdaptiveReviewPrompt('skill_ineffective', '', '');- expect(prompt).toContain('没有帮到');- expect(prompt).toContain('修补或删除');+ expect(prompt).toContain('did not help');+ expect(prompt).toContain('Patch or delete');});it('builds known_weakness focused prompt', () => {const prompt = buildAdaptiveReviewPrompt('known_weakness', '', '');- expect(prompt).toContain('已知弱点');- expect(prompt).toContain('加强');+ expect(prompt).toContain('known weaknesses');+ expect(prompt).toContain('Strengthen');});it('builds complexity default prompt', () => {const prompt = buildAdaptiveReviewPrompt('complexity', '', '');- expect(prompt).toContain('复杂');+ expect(prompt).toContain('complex task');});it('includes competence content', () => {- const prompt = buildAdaptiveReviewPrompt('complexity', '我擅长 Python', '');- expect(prompt).toContain('我擅长 Python');- expect(prompt).not.toContain('尚无自我评估');+ const prompt = buildAdaptiveReviewPrompt('complexity', 'I am strong at Python', '');+ expect(prompt).toContain('I am strong at Python');+ expect(prompt).not.toContain('No self-assessment yet');});it('shows placeholder when no competence', () => {const prompt = buildAdaptiveReviewPrompt('complexity', '', '');- expect(prompt).toContain('尚无自我评估');+ expect(prompt).toContain('No self-assessment yet');});it('includes strategies content', () => {- const prompt = buildAdaptiveReviewPrompt('complexity', '', '错误提取法');- expect(prompt).toContain('错误提取法');- expect(prompt).not.toContain('尚无策略记录');+ const prompt = buildAdaptiveReviewPrompt('complexity', '', 'Error extraction pattern');+ expect(prompt).toContain('Error extraction pattern');+ expect(prompt).not.toContain('No strategy log yet');});it('includes skill health report when provided', () => {const report = '- docker-debug: effectiveness 0.83, healthy';const prompt = buildAdaptiveReviewPrompt('complexity', '', '', report);- expect(prompt).toContain('技能健康度报告');+ expect(prompt).toContain('Skill health report');expect(prompt).toContain('docker-debug');});it('omits skill health section when not provided', () => {const prompt = buildAdaptiveReviewPrompt('complexity', '', '');- expect(prompt).not.toContain('技能健康度报告');+ expect(prompt).not.toContain('Skill health report');});it('includes conversation digest when provided', () => {- const digest = '使用的工具: bash, read_file\n加载的技能: docker-debug\n--- 对话最终回复 ---\n修复了 Docker 容器无法启动的问题';+ const digest = 'Tools used: bash, read_file\nSkills loaded: docker-debug\n--- final reply ---\nFixed Docker container that failed to start';const prompt = buildAdaptiveReviewPrompt('error_recovery', '', '', undefined, digest);expect(prompt).toContain('docker-debug');- expect(prompt).toContain('Docker 容器');- expect(prompt).toContain('对话最终回复');+ expect(prompt).toContain('Docker container');+ expect(prompt).toContain('final reply');});it('omits conversation digest content when not provided', () => {const prompt = buildAdaptiveReviewPrompt('complexity', '', '');- expect(prompt).not.toContain('对话最终回复');+ expect(prompt).not.toContain('final reply');});it('builds weakness_succeeded focused prompt', () => {const prompt = buildAdaptiveReviewPrompt('weakness_succeeded', '', '');- expect(prompt).toContain('表现正常');- expect(prompt).toContain('移除或降级');- expect(prompt).toContain('不要修改或删除相关技能');+ expect(prompt).toContain('performed normally');+ expect(prompt).toContain('remove or downgrade');+ expect(prompt).toContain('Do not modify or delete the related skills');});it('includes transient error guidance in all prompts', () => {const prompt = buildAdaptiveReviewPrompt('complexity', '', '');- expect(prompt).toContain('瞬态错误是环境问题');- expect(prompt).toContain('不要在 COMPETENCE.md 标记为弱点');+ expect(prompt).toContain('transient errors');+ expect(prompt).toContain('Do not mark them as weaknesses in COMPETENCE.md');});});diff --git a/src/main/features/reflection-digest.ts b/src/main/features/reflection-digest.tsindex fab876fe..8bd674ef 100644--- a/src/main/features/reflection-digest.ts+++ b/src/main/features/reflection-digest.ts@@ -92,25 +92,25 @@ export function aggregateSession(messages: any[], into: SessionMetrics): void {export function formatDigest(metrics: SessionMetrics, sinceMs: number, nowMs: number): string {if (metrics.sessionsAnalyzed === 0) {- return `近期 (${isoDate(sinceMs)} 至 ${isoDate(nowMs)}) 无新增对话活动。`;+ return `No new conversation activity in the range ${isoDate(sinceMs)} to ${isoDate(nowMs)}.`;}const parts: string[] = [];- const range = `${isoDate(metrics.earliestTs ?? sinceMs)} 至 ${isoDate(metrics.latestTs ?? nowMs)}`;- parts.push(`基于 ${metrics.sessionsAnalyzed} 个会话 (${range}):`);+ const range = `${isoDate(metrics.earliestTs ?? sinceMs)} to ${isoDate(metrics.latestTs ?? nowMs)}`;+ parts.push(`Based on ${metrics.sessionsAnalyzed} session(s) (${range}):`);const sortedTools = Object.entries(metrics.toolCalls).sort((a, b) => b[1] - a[1]).slice(0, TOOL_TOP_N);if (sortedTools.length) {parts.push('');- parts.push('**工具调用**:');- for (const [name, n] of sortedTools) parts.push(`- ${name}: ${n} 次`);+ parts.push('**Tool calls**:');+ for (const [name, n] of sortedTools) parts.push(`- ${name}: ${n}`);}if (metrics.errorCount > 0) {parts.push('');- parts.push(`**错误总数**: ${metrics.errorCount}`);+ parts.push(`**Total errors**: ${metrics.errorCount}`);if (metrics.errorSamples.length) {- parts.push('**错误样本**:');+ parts.push('**Error samples**:');for (const s of metrics.errorSamples) parts.push(`- ${s}`);}}@@ -118,7 +118,7 @@ export function formatDigest(metrics: SessionMetrics, sinceMs: number, nowMs: nuconst sortedSkills = Object.entries(metrics.skillsLoaded).sort((a, b) => b[1] - a[1]).slice(0, SKILLS_TOP_N);if (sortedSkills.length) {parts.push('');- parts.push('**加载的技能**:');+ parts.push('**Skills loaded**:');for (const [id, n] of sortedSkills) parts.push(`- ${id}${n > 1 ? ` (${n}x)` : ''}`);}diff --git a/test/main/features/reflection-digest.test.ts b/test/main/features/reflection-digest.test.tsindex 290b7c9f..2b6f0d52 100644--- a/test/main/features/reflection-digest.test.ts+++ b/test/main/features/reflection-digest.test.ts@@ -128,7 +128,7 @@ describe('reflection-digest › formatDigest', () => {it('returns "no activity" when nothing was analyzed', async () => {const mod = await loadModule();const out = mod.formatDigest(mod.emptyMetrics(), Date.parse('2026-04-21'), Date.parse('2026-04-23'));- expect(out).toMatch(/无新增对话活动/);+ expect(out).toMatch(/No new conversation activity/);});it('formats a populated digest with all sections', async () => {@@ -143,10 +143,10 @@ describe('reflection-digest › formatDigest', () => {m.latestTs = Date.parse('2026-04-23T10:00:00Z');const out = mod.formatDigest(m, m.earliestTs, Date.now());- expect(out).toContain('3 个会话');- expect(out).toContain('bash: 5 次');- expect(out).toContain('web_search: 2 次');- expect(out).toContain('错误总数**: 2');+ expect(out).toContain('3 session');+ expect(out).toContain('bash: 5');+ expect(out).toContain('web_search: 2');+ expect(out).toContain('Total errors**: 2');expect(out).toContain('rate limit');expect(out).toContain('recover-foo (3x)');});@@ -157,8 +157,8 @@ describe('reflection-digest › formatDigest', () => {m.sessionsAnalyzed = 1;m.toolCalls = { bash: 1 };const out = mod.formatDigest(m, Date.now() - 1000, Date.now());- expect(out).not.toContain('错误总数');- expect(out).not.toContain('错误样本');+ expect(out).not.toContain('Total errors');+ expect(out).not.toContain('Error samples');});it('caps tool list at top-N most-called', async () => {@@ -208,7 +208,7 @@ describe('reflection-digest › buildAgentReflectionDigest', () => {it('returns "no activity" when no matching conversations exist', async () => {const mod = await loadModule();const out = await mod.buildAgentReflectionDigest(TEST_UID, '_default', Date.now() - 86400000);- expect(out).toMatch(/无新增对话活动/);+ expect(out).toMatch(/No new conversation activity/);});it('aggregates only conversations matching the target agent_id', async () => {@@ -243,7 +243,7 @@ describe('reflection-digest › buildAgentReflectionDigest', () => {const mod = await loadModule();const since = Date.now() - 86400000; // last 24hconst digest = await mod.buildAgentReflectionDigest(TEST_UID, '_default', since);- expect(digest).toMatch(/无新增对话活动/);+ expect(digest).toMatch(/No new conversation activity/);});it('tolerates malformed jsonl lines and missing files', async () => {