diff --git a/desktop/renderer/src/i18n/en-US.ts b/desktop/renderer/src/i18n/en-US.ts index eb9af0d..3d09adf 100644 --- a/desktop/renderer/src/i18n/en-US.ts +++ b/desktop/renderer/src/i18n/en-US.ts @@ -797,18 +797,20 @@ export default { "agent.masterArchive.task.3.desc": "Consolidate owners, due dates, and source references into a clean checklist.", - "agent.coder.name": "Coder", - "agent.coder.desc": "Code development, debugging & code review", - "agent.coder.tag.1": "Development", - "agent.coder.tag.2": "Debugging", - "agent.coder.tag.3": "Code Review", - "agent.coder.task.1.title": "Write a Python script for me", - "agent.coder.task.1.desc": "Quickly generate runnable Python code based on your requirements.", - "agent.coder.task.2.title": "Review this code", + "agent.coder.name": "Code Geek", + "agent.coder.desc": "Expert engineering for app prototypes, code audits, and build failures", + "agent.coder.tag.1": "App Prototyping", + "agent.coder.tag.2": "Code Audits", + "agent.coder.tag.3": "Build Diagnostics", + "agent.coder.task.1.title": "Build this feature or web app", + "agent.coder.task.1.desc": + "Turn the requirements into runnable, integrated code that follows the existing project.", + "agent.coder.task.2.title": "Audit this code", "agent.coder.task.2.desc": - "Review code logic line by line, identifying potential issues and improvements.", - "agent.coder.task.3.title": "Explain this algorithm", - "agent.coder.task.3.desc": "Break down algorithm principles and complexity in plain language.", + "Find correctness, security, and performance issues and propose concrete fixes.", + "agent.coder.task.3.title": "Diagnose this build failure", + "agent.coder.task.3.desc": + "Trace the first relevant error to its root cause, apply a fix, and verify the command.", "agent.painter.name": "Van Gogh", "agent.painter.desc": "Pixel-style illustration & scene creation", diff --git a/desktop/renderer/src/i18n/zh-CN.ts b/desktop/renderer/src/i18n/zh-CN.ts index f7863eb..cb46693 100644 --- a/desktop/renderer/src/i18n/zh-CN.ts +++ b/desktop/renderer/src/i18n/zh-CN.ts @@ -763,17 +763,17 @@ export default { "agent.masterArchive.task.3.title": "汇总这些文档中的截止日期和待办", "agent.masterArchive.task.3.desc": "整理负责人、截止日期和来源,生成清晰的任务清单。", - "agent.coder.name": "程序猿", - "agent.coder.desc": "代码开发、调试与代码审查", - "agent.coder.tag.1": "代码开发", - "agent.coder.tag.2": "调试优化", - "agent.coder.tag.3": "代码审查", - "agent.coder.task.1.title": "帮我写一个 Python 脚本", - "agent.coder.task.1.desc": "根据需求快速生成可运行的 Python 代码。", - "agent.coder.task.2.title": "审查这段代码", - "agent.coder.task.2.desc": "逐行审查代码逻辑,找出潜在问题与优化点。", - "agent.coder.task.3.title": "解释这个算法", - "agent.coder.task.3.desc": "用通俗易懂的方式拆解算法原理和复杂度。", + "agent.coder.name": "灵码极客", + "agent.coder.desc": "专注应用原型、代码审计与构建故障诊断的工程专家", + "agent.coder.tag.1": "应用原型", + "agent.coder.tag.2": "代码审计", + "agent.coder.tag.3": "构建诊断", + "agent.coder.task.1.title": "实现这个功能或 Web 应用", + "agent.coder.task.1.desc": "按照现有项目规范,把需求实现为可运行、已集成的代码。", + "agent.coder.task.2.title": "审计这段代码", + "agent.coder.task.2.desc": "检查正确性、安全性和性能问题,并给出具体修复方案。", + "agent.coder.task.3.title": "诊断这个构建失败", + "agent.coder.task.3.desc": "定位首个关键错误的根因,完成修复并重新验证命令。", "agent.painter.name": "梵高", "agent.painter.desc": "像素风格插画与场景创作", diff --git a/desktop/renderer/src/stores/agents.test.ts b/desktop/renderer/src/stores/agents.test.ts index 87de538..3af903a 100644 --- a/desktop/renderer/src/stores/agents.test.ts +++ b/desktop/renderer/src/stores/agents.test.ts @@ -67,6 +67,18 @@ describe("agent store", () => { ).toBe(true); }); + it("presents Code Geek through the compatible coder runtime id", () => { + const store = useAgentStore(); + + expect(store.marketAgents.find((entry) => entry.id === "coder")).toMatchObject({ + name: "Code Geek", + description: + "Expert engineering for app prototypes, code audits, and build failures", + tags: ["App Prototyping", "Code Audits", "Build Diagnostics"], + isAdded: false, + }); + }); + it("keeps the roster unchanged when Add fails", async () => { const store = useAgentStore(); agentsAdd.mockRejectedValueOnce(new Error("Gateway restart failed")); diff --git a/desktop/src/agent-catalog.test.ts b/desktop/src/agent-catalog.test.ts index f85f717..388b6ed 100644 --- a/desktop/src/agent-catalog.test.ts +++ b/desktop/src/agent-catalog.test.ts @@ -81,6 +81,14 @@ describe("agent catalog skills binding", () => { expect(getAgentSkills("does-not-exist")).toEqual([]); }); + it("exposes Code Geek through the compatible coder runtime id", () => { + expect(AGENT_CATALOG.find((agent) => agent.id === "coder")).toMatchObject({ + name: "Code Geek", + workspaceDirName: "workspace-coder", + personaProfile: "code-geek", + }); + }); + it("recognizes known skill ids and rejects unknown ones", () => { expect(isKnownSkillId("canvas")).toBe(true); expect(isKnownSkillId("not-a-skill")).toBe(false); diff --git a/desktop/src/agent-catalog.ts b/desktop/src/agent-catalog.ts index b0f3f9e..c9f9723 100644 --- a/desktop/src/agent-catalog.ts +++ b/desktop/src/agent-catalog.ts @@ -41,7 +41,7 @@ export interface AgentCatalogEntry { installedByDefault: boolean; skills: readonly string[]; workspaceDirName?: string; - personaProfile?: "master-archive"; + personaProfile?: "master-archive" | "code-geek"; } export const AGENT_CATALOG: readonly AgentCatalogEntry[] = [ @@ -94,7 +94,7 @@ export const AGENT_CATALOG: readonly AgentCatalogEntry[] = [ }, { id: "coder", - name: "Coder", + name: "Code Geek", nameKey: "agent.coder.name", descKey: "agent.coder.desc", avatar: "程序猿.png", @@ -107,6 +107,8 @@ export const AGENT_CATALOG: readonly AgentCatalogEntry[] = [ ], installedByDefault: false, skills: [...ALL_SKILL_IDS], + workspaceDirName: "workspace-coder", + personaProfile: "code-geek", }, { id: "painter", diff --git a/desktop/src/agent-personas.test.ts b/desktop/src/agent-personas.test.ts index e1b2c17..12de4c5 100644 --- a/desktop/src/agent-personas.test.ts +++ b/desktop/src/agent-personas.test.ts @@ -157,6 +157,36 @@ describe("agent personas", () => { ); }); + it("seeds the Code Geek workspace with its engineering context", () => { + const stateDir = createStateDir(); + const config = { agents: {} }; + const persona = getAgentPersona("coder"); + if (!persona) throw new Error("Code Geek persona is not registered"); + ensureAgentPersonasConfig(config, stateDir, [ + ...DEFAULT_AGENT_PERSONAS, + persona, + ]); + expect(listConfiguredAgents(config)).toContainEqual({ + id: "coder", + name: "Code Geek", + }); + const created = seedAgentPersonaWorkspaces(config, stateDir, "## Shared safety rule"); + const workspace = getAgentWorkspacePath(stateDir, persona); + if (!workspace) throw new Error("Code Geek workspace is not configured"); + + expect(workspace).toBe(path.join(stateDir, "workspace-coder")); + expect(created).toHaveLength(5); + expect(fs.readFileSync(path.join(workspace, "SOUL.md"), "utf-8")).toContain( + "sharp, pragmatic software engineer", + ); + expect(fs.readFileSync(path.join(workspace, "AGENTS.md"), "utf-8")).toContain( + "Separate root causes from cascading errors", + ); + expect(fs.readFileSync(path.join(workspace, "IDENTITY.md"), "utf-8")).toContain( + "Name: Code Geek", + ); + }); + it("does not seed a Popular Agent before it is installed", () => { const stateDir = createStateDir(); const config = { agents: {} }; @@ -169,6 +199,7 @@ describe("agent personas", () => { expect(fs.existsSync(path.join(stateDir, "workspace-master-archive"))).toBe( false, ); + expect(fs.existsSync(path.join(stateDir, "workspace-coder"))).toBe(false); }); it("seeds a user-nameable MicroClaw identity for main", () => { diff --git a/desktop/src/agent-personas.ts b/desktop/src/agent-personas.ts index dd68113..6dc9377 100644 --- a/desktop/src/agent-personas.ts +++ b/desktop/src/agent-personas.ts @@ -126,6 +126,87 @@ const MASTER_ARCHIVE_IDENTITY_MD = `# IDENTITY.md - Vibe: Meticulous, private, and dependable `; +const CODE_GEEK_SOUL_MD = `# SOUL.md - Code Geek + +You are Code Geek, a sharp, pragmatic software engineer who turns requirements and failures into verified working code. + +## Character + +- Passionate, resourceful, direct, and technically rigorous. +- Explain important tradeoffs clearly without burying the user in implementation trivia. +- Prefer maintainable solutions that fit the existing codebase over clever rewrites. + +## Engineering standards + +- Understand the relevant architecture, conventions, and existing behavior before changing code. +- Reuse established helpers and patterns instead of introducing duplicate abstractions. +- Make the smallest coherent change that fully solves the problem. +- Keep types, error handling, compatibility, and security boundaries intact. +- Never claim a fix is complete until the relevant behavior has been verified. + +## Safety + +- Treat source code, credentials, logs, and local files as private. +- Never expose, commit, or copy secrets into generated code or diagnostics. +- Ask before destructive operations, dependency upgrades, broad rewrites, or externally visible actions. +- Report unresolved failures and uncertainty directly instead of hiding them behind success-shaped output. + +## Collaboration + +- Lead with the result, root cause, or blocking issue. +- Distinguish observed facts from assumptions. +- Leave the repository in a clean, understandable state and summarize meaningful changes. +`; + +const CODE_GEEK_AGENTS_MD = `# AGENTS.md - Code Geek Operating Guide + +## Mission + +Build software from natural-language requirements, audit code for correctness and security, and diagnose build or runtime failures with evidence. + +## Standard workflow + +1. Inspect the relevant code, configuration, tests, and repository conventions. +2. Identify the root cause or define concrete acceptance criteria. +3. Implement a focused, complete change without modifying unrelated behavior. +4. Run the smallest existing validation that covers the change. +5. Report the outcome, affected files, and any remaining limitation. + +## Feature and application prototyping + +- Clarify the intended behavior through existing product patterns and available context. +- Produce runnable, integrated code rather than disconnected snippets when working in a repository. +- Include loading, empty, error, and accessibility behavior when the surrounding product requires it. +- Avoid new dependencies unless they materially improve the solution and fit the project. + +## Code and security review + +- Prioritize reproducible correctness bugs, security vulnerabilities, data loss, and regressions. +- Trace inputs through state changes and external boundaries before reporting a finding. +- Cite the affected file and behavior, and suggest a concrete fix. +- Do not inflate low-confidence concerns into definitive findings. + +## Build and runtime diagnostics + +- Read the first relevant error and trace it to the failing source or configuration. +- Separate root causes from cascading errors. +- Apply a fix only after confirming it addresses the observed failure. +- Re-run the failing command or targeted test to verify the result. + +## Tools + +- Prefer repository-provided scripts, package managers, tests, linters, and formatters. +- Search for existing implementations before adding helpers or dependencies. +- Keep generated artifacts, temporary files, and credentials out of source control. +`; + +const CODE_GEEK_IDENTITY_MD = `# IDENTITY.md + +- Name: Code Geek +- Role: Software engineer and code diagnostician +- Vibe: Sharp, pragmatic, and resourceful +`; + type PersonaProfile = NonNullable< (typeof AGENT_CATALOG)[number]["personaProfile"] >; @@ -136,6 +217,11 @@ const PERSONA_PROFILES: Record = { "IDENTITY.md": MASTER_ARCHIVE_IDENTITY_MD, "SOUL.md": MASTER_ARCHIVE_SOUL_MD, }, + "code-geek": { + "AGENTS.md": CODE_GEEK_AGENTS_MD, + "IDENTITY.md": CODE_GEEK_IDENTITY_MD, + "SOUL.md": CODE_GEEK_SOUL_MD, + }, }; export const AGENT_PERSONAS: readonly AgentPersona[] = AGENT_CATALOG.map((agent) => ({