diff --git a/README.md b/README.md index a961cd7f..69a4e5f9 100644 --- a/README.md +++ b/README.md @@ -78,26 +78,21 @@ Same brain. Same memory. Same tools. Different doors. You hire coworkers, not chat boxes. Each one has a **Role**, a **Goal**, a **Backstory**, a pixel-art avatar, and a color of their own — five career templates ship ready (Product Researcher · Customer Support · Knowledge Curator · Data Analyst · Executive Assistant). **ReAct** drives iterative reasoning, **Plan-and-Execute** decomposes complex multi-step work, employees can delegate to one another in parallel. Dynamic context pruning, smart truncation, stale-stream cleanup — the boring stuff that makes long conversations actually work. ### Knowledge & memory -- **LLM Wiki** — raw materials digest into linked pages with citations; the **hot cache** auto-injects into every employee's system prompt. **Transformations engine** (1.3.0+) turns the Wiki from a search index into a processing pipeline +- **LLM Wiki** — raw materials digest into linked pages with citations; the **hot cache** auto-injects into every employee's system prompt - **Workspace memory** — `AGENTS.md`, `SOUL.md`, `PROFILE.md`, `MEMORY.md`, daily notes -- **Memory lifecycle** — post-conversation extraction, scheduled consolidation, Dreaming workflows. Workflows can also write directly into an employee's `MEMORY.md` via the `write_memory` step +- **Memory lifecycle** — post-conversation extraction, scheduled consolidation, Dreaming workflows ### Skills · MCP · ACP — three ways to extend capability - **SKILL.md packages** — manifest + prompt + tool list + **LESSONS.md (gets smarter the more you use it)**. Eight starter templates plus a five-step creation wizard, with **Pre-flight checks** that tell you what's missing before install -- **MCP** — stdio / SSE / Streamable HTTP, plug into any external tool server. **Per-employee binding** (1.3.0+) means a tool you install for one employee doesn't bleed into another's toolbox +- **MCP** — stdio / SSE / Streamable HTTP, plug into any external tool server - **ACP** — bring top-tier coding agents like Claude Code and Codex in as employees, auto-bridged to skill cards with wrapper tools - **Tool Guard** — RBAC + approval flow + path protection. Capability needs boundaries -### Business orchestration (1.3.0+) -- **Workflow** — compose multiple employees plus system actions (approval / channel dispatch / write-memory) into a publishable, triggerable, replayable linear DSL. Seven step modes (`sequential` / `fan_out` / `collect` / `conditional` / `await_approval` / `dispatch_channel` / `write_memory`). JSON-first authoring with Monaco + schema validation, or natural-language → draft generation -- **Triggers** — wire system events to workflows or to employee conversations. Six pattern types (`cron` / `webhook` / `channel_message` / `agent_lifecycle` / `content_match` / `workflow_completion`). Default-on event governance: dedup, per-trigger rate limit, bot-self filter, recursion guard, fail-closed unknown patterns -- **Wiki Transformations** — Wiki stops being retrieval-only. User-authored templates run against raw materials or existing pages, with cross-material map-reduce aggregation, reverse-citation extraction, JSON output mode, and per-template model picker - ### You see what every employee is doing **Admin Runtime Console** (`Settings → System → Runtime`) — who's running, what step they're on, how many tokens, one-click force-recycle when stuck. Streaming is staged honestly (thinking / tool / answer), per-event SSE IDs make reconnects safe, multi-employee delegation no longer fights itself, long tasks demand evidence-grounded answers. ### Multimodal creation -Text-to-speech · Speech-to-text · Image · Music · Video · 3D. First-class, not add-ons. **Sidecar routing** (1.3.0+) means a text-only main model + an image attachment no longer dead-ends — a configured vision model describes the image, and the main model answers. **Image edit** lands too: refer to an earlier conversation attachment by `msg::` and ask the model to recolor or restyle it. Four **document-generation tools** (`DocxRenderTool` / `XlsxRenderTool` / `PptxRenderTool` / `PdfRenderTool`) render Markdown straight to Office files inside the JVM — no subprocess, no Office install. +Text-to-speech · Speech-to-text · Image · Music · Video · 3D. First-class, not add-ons. ### Enterprise-ready RBAC + JWT. **Personal Access Tokens** for headless scripts and CI. **HMAC-SHA-256 outbound webhook signing**. **Distributed Cron lock** so multi-instance deployments don't double-fire. Full audit trail. Flyway-managed schema that auto-heals on upgrade. One JAR to ship. MySQL in production, H2 for dev — nothing to change in your code. @@ -197,8 +192,7 @@ Desktop binaries ship via [GitHub Releases](https://github.com/matevip/mateclaw/ |---|---| | Backend | Spring Boot 3.5 · Spring AI Alibaba 1.1 · MyBatis Plus · Flyway | | Digital Employee Runtime | StateGraph · ReAct + Plan-Execute · Role / Goal / Backstory · LESSONS self-evolution | -| Orchestration | Workflow (7 step modes · Pebble DSL) · Triggers (6 pattern types · event governance) · Wiki Transformations (1.3.0+) | -| Capability Extension | SKILL.md packages · MCP (stdio / SSE / HTTP · per-agent binding) · ACP bridge (Claude Code / Codex) | +| Capability Extension | SKILL.md packages · MCP (stdio / SSE / HTTP) · ACP bridge (Claude Code / Codex) | | Database | H2 (dev) · MySQL 8.0+ (prod) | | Auth | Spring Security + JWT | | Frontend | Vue 3 · TypeScript · Vite · Element Plus · TailwindCSS 4 | @@ -213,9 +207,7 @@ Full docs at **[claw.mate.vip/docs](https://claw.mate.vip/docs)** — setup, arc ## Roadmap -**v1.3.0 (shipped 2026-05-13)** — Workflow engine · 6-pattern trigger system · Wiki transformations · per-agent MCP binding · multimodal sidecar routing · four JVM-native document generation tools · image edit. See the [v1.3.0 release notes](https://claw.mate.vip/docs/en/releases/1.3.0) for the full story. - -**Next** — Drag-to-edit workflow canvas · run replay timeline · `loop` and `invoke_skill` step modes · trigger priorities and event replay · industry scenario marketplace · more ACP upstream integrations. +Sharper multi-employee collaboration · Smarter model routing · Deeper multimodal understanding · Longer-lived memory · A richer ClawHub · More ACP upstream integrations. ## Contributing diff --git a/README_zh.md b/README_zh.md index eb5e6d73..a5be3b4e 100644 --- a/README_zh.md +++ b/README_zh.md @@ -78,26 +78,21 @@ MateClaw 的 **LLM Wiki** 把它消化成结构化页面,页面之间自己长 你雇佣员工,不是开聊天框。每位有**角色**、**目标**、**背景故事**,像素艺术头像、专属配色——5 个职业模板(产品研究员 · 客户支持 · 知识管理员 · 数据分析师 · 行政助理)开箱可用。**ReAct** 做迭代推理,**Plan-and-Execute** 做复杂多步任务,员工之间可以并行委派。动态上下文裁剪、智能截断、僵死流清理——让长对话真正能用的那些"不起眼"的基础设施。 ### 知识与记忆 -- **LLM Wiki** — 原始材料消化成有链接、带引用的结构化页面;**热点缓存**自动注入到员工的 system prompt。**加工器引擎**(1.3.0+)把 Wiki 从"搜索索引"升级为"处理流水线" +- **LLM Wiki** — 原始材料消化成有链接、带引用的结构化页面;**热点缓存**自动注入到员工的 system prompt - **工作区记忆** — `AGENTS.md` / `SOUL.md` / `PROFILE.md` / `MEMORY.md` / 每日笔记 -- **记忆生命周期** — 对话后自动提取 · 定时整理 · Dreaming 工作流。工作流也可以通过 `write_memory` step 直接写进员工的 `MEMORY.md` +- **记忆生命周期** — 对话后自动提取 · 定时整理 · Dreaming 工作流 ### 技能 · MCP · ACP — 三种"接外部能力"的方式 - **SKILL.md 技能包** — 一份 manifest + prompt + 工具列表 + **LESSONS.md(用得越多越聪明)**。8 个起步模板 + 5 步创作向导,安装前自动跑 **Pre-flight 检查**告诉你缺什么 -- **MCP** — stdio / SSE / Streamable HTTP 三种传输,接入任意外部工具服务器。**每位员工独立绑定**(1.3.0+)——一位员工装的工具不会渗到其他人的工具栏里 +- **MCP** — stdio / SSE / Streamable HTTP 三种传输,接入任意外部工具服务器 - **ACP** — 把 Claude Code、Codex 这种顶级编码 Agent 以"员工"身份接入,桥接成技能卡 + 包装工具 - **Tool Guard** — RBAC + 审批流 + 文件路径保护。能力必须有边界 -### 业务流程编排(1.3.0+) -- **工作流(Workflow)** — 把多位员工 + 系统动作(审批 / 渠道分发 / 写记忆)按线性 step DSL 编排成一条可发布、可触发、可重放的业务流程。7 种 step mode(`sequential` / `fan_out` / `collect` / `conditional` / `await_approval` / `dispatch_channel` / `write_memory`)。JSON-first 编辑(Monaco + JSON schema + Pebble 静态检查),或者用一句话生成草稿 -- **触发器(Trigger)** — 把"系统里发生的事"自动接到工作流或员工对话上。6 种 pattern type(`cron` / `webhook` / `channel_message` / `agent_lifecycle` / `content_match` / `workflow_completion`)。事件治理默认开:去重、per-trigger 限速、bot 自循环过滤、A→B→A 递归保护、未知 pattern fail-closed -- **Wiki 加工器** — Wiki 不再只是被动检索。用户自定义模板对原料或现有页面跑模板,跨原料 map-reduce 聚合,reverse-citation 绑定到源 chunk,JSON 输出 + 可选 JSON Schema,每个模板独立选模型 - ### 你看得见每位员工正在干什么 **Admin 运行时控制台**(`后台 → 系统 → 运行时`)——谁在跑、跑到哪一步、占多少 token、卡住了一键回收。流式分阶段显示(思考 / 工具 / 回答),SSE 每事件 ID 支持安全重连,多员工协作不打架,长任务必须有真实证据才回答。 ### 多模态创作 -语音合成 · 语音识别 · 图片 · 音乐 · 视频 · 3D。一等公民,不是附加插件。**多模态旁路**(1.3.0+)让纯文本主模型遇到图片附件时自动调用配置好的视觉模型转描述,主对话保持便宜。**图像编辑**也到位:用 `msg::` 引用会话里更早的某张图,让模型改色、改风格。**4 个文档生成工具**(`DocxRenderTool` / `XlsxRenderTool` / `PptxRenderTool` / `PdfRenderTool`)在 JVM 内把 Markdown 直接渲染成 Office 文件——不 fork 子进程、不依赖 npm、不需要装 Office。 +语音合成 · 语音识别 · 图片 · 音乐 · 视频 · 3D。一等公民,不是附加插件。 ### 企业就绪 RBAC + JWT。**Personal Access Token** 给无人值守脚本和 CI 用。**Webhook 出站 HMAC-SHA-256 签名**。**Cron 分布式锁**多实例不双发。完整审计事件流。Flyway 管理数据库 schema,升级时自愈。一个 JAR 交付。生产用 MySQL,开发用 H2,代码零改动。 @@ -197,8 +192,7 @@ mateclaw/ |---|---| | 后端 | Spring Boot 3.5 · Spring AI Alibaba 1.1 · MyBatis Plus · Flyway | | 数字员工运行时 | StateGraph · ReAct + Plan-Execute · 角色 / 目标 / 背景故事 · LESSONS 自我进化 | -| 业务编排 | 工作流(7 step mode · Pebble DSL)· 触发器(6 pattern type · 事件治理)· Wiki 加工器(1.3.0+)| -| 能力扩展 | SKILL.md 包 · MCP(stdio / SSE / HTTP · per-agent 绑定)· ACP 桥接(Claude Code / Codex) | +| 能力扩展 | SKILL.md 包 · MCP 协议(stdio / SSE / HTTP)· ACP 桥接(Claude Code / Codex) | | 数据库 | H2(开发)· MySQL 8.0+(生产)| | 认证 | Spring Security + JWT | | 前端 | Vue 3 · TypeScript · Vite · Element Plus · TailwindCSS 4 | @@ -213,9 +207,7 @@ mateclaw/ ## 路线图 -**v1.3.0(2026-05-13 发布)** — 工作流引擎 · 6 种 pattern 触发器 · Wiki 加工器 · 每员工独立 MCP 绑定 · 多模态旁路路由 · 4 个 JVM 原生文档生成工具 · 图像编辑。完整故事见 [v1.3.0 release notes](https://claw.mate.vip/docs/zh/releases/1.3.0)。 - -**下一步** — 工作流画布可拖拉编辑 · 运行回放时间线 · `loop` / `invoke_skill` step mode · 触发器优先级 + 事件回放 · 行业场景应用市场 · 更多 ACP 上游集成。 +更强的多员工协作 · 更智能的模型路由 · 更深度的多模态理解 · 更长久的记忆 · 更繁荣的 ClawHub · 更多 ACP 上游集成。 ## 参与贡献 diff --git a/assets/architecture-biz-en.svg b/assets/architecture-biz-en.svg index 424421a5..d3341aa7 100644 --- a/assets/architecture-biz-en.svg +++ b/assets/architecture-biz-en.svg @@ -55,7 +55,7 @@ LLM Wiki KB Structured + Backlinks Citations + Soft Archive - + Transformations (1.3.0+) + Lazy ingest · On-demand A library, not a vector store @@ -98,19 +98,13 @@ - - - Orchestration · Workflow + Trigger - Events → multi-employee → approval / dispatch / memory - Provider Pool · Failover Cloud + Local · 14+ providers Health Tracker · Auto-switch - - - + + Mate is companion. Claw is capability. diff --git a/assets/architecture-biz-zh.svg b/assets/architecture-biz-zh.svg index 25133463..0fb490eb 100644 --- a/assets/architecture-biz-zh.svg +++ b/assets/architecture-biz-zh.svg @@ -57,7 +57,7 @@ LLM Wiki 知识库 结构化消化 + 双向链接 引用溯源 + 软归档 - + 加工器流水线(1.3.0+) + lazy 入库 · 按需出页 是图书馆,不是向量库 @@ -105,19 +105,14 @@ - - - 业务编排 · 工作流 + 触发器 - 事件触发 → 多员工协作 → 审批 / 分发 / 写记忆 - 模型池 · Failover 云端 + 本地 · 14+ 供应商 健康追踪 · 自动切换 - - - + + + diff --git a/assets/architecture-tech-en.svg b/assets/architecture-tech-en.svg index 1c5afd41..71b7f8de 100644 --- a/assets/architecture-tech-en.svg +++ b/assets/architecture-tech-en.svg @@ -74,15 +74,15 @@ - Reasoning Engines - ReAct · Think→Act→Observe - Plan-Execute · Decompose + ReAct Agent + Think → Act → Observe + Iterative Reasoning Loop - - Workflow + Trigger - 7 step modes · 6 patterns - Business orchestration (1.3.0+) + + Plan-Execute + Decompose → Step Execute + Complex Task Orchestration @@ -99,8 +99,8 @@ Wiki KB - Knowledge digest - + Transforms (1.3) + Knowledge + Digestion @@ -178,9 +178,9 @@ - Cron · Event Bus - ShedLock distributed - Ambient AI · Proactive + Cron → Channel + Ambient AI + Proactive Delivery diff --git a/assets/architecture-tech-zh.svg b/assets/architecture-tech-zh.svg index 6fbe8be7..e5eaf93d 100644 --- a/assets/architecture-tech-zh.svg +++ b/assets/architecture-tech-zh.svg @@ -77,15 +77,15 @@ - 推理双引擎 - ReAct · 思考→行动→观察 - Plan-Execute · 计划分解 + ReAct Agent + 思考 → 行动 → 观察 + 循环推理引擎 - - 工作流 + 触发器 - 7 step mode · 6 pattern - 业务流程编排(1.3.0+) + + Plan-Execute + 计划分解 → 逐步执行 + 复杂任务编排 @@ -103,7 +103,7 @@ Wiki KB 知识消化 - + 加工器(1.3.0) + 结构化页面 @@ -181,9 +181,9 @@ - Cron · 事件总线 - ShedLock 分布式锁 - 主动交付 · Ambient AI + Cron → 渠道 + Ambient AI + 主动交付 diff --git a/mateclaw-server/src/main/java/vip/mate/agent/AgentGraphBuilder.java b/mateclaw-server/src/main/java/vip/mate/agent/AgentGraphBuilder.java index 053544a2..a18560d1 100644 --- a/mateclaw-server/src/main/java/vip/mate/agent/AgentGraphBuilder.java +++ b/mateclaw-server/src/main/java/vip/mate/agent/AgentGraphBuilder.java @@ -1063,6 +1063,7 @@ public class AgentGraphBuilder { Do not assume you cannot access local resources - try calling the appropriate tool first. If a tool requires approval due to security policies, the system will prompt the user for confirmation. Only state you cannot access something if no relevant tool is available. + Do not claim a tool-generated file, URL, UUID, path, task id, or success result before the corresponding tool call has completed. If a tool is needed, call the tool first, then report only the actual returned result. ## Multi-Part Question Guidelines When the user asks multiple questions or requests multiple tasks in a single message: diff --git a/mateclaw-server/src/main/java/vip/mate/tool/builtin/EditFileTool.java b/mateclaw-server/src/main/java/vip/mate/tool/builtin/EditFileTool.java index ca1fbe45..8eed7643 100644 --- a/mateclaw-server/src/main/java/vip/mate/tool/builtin/EditFileTool.java +++ b/mateclaw-server/src/main/java/vip/mate/tool/builtin/EditFileTool.java @@ -20,8 +20,8 @@ import java.nio.file.Paths; *

* 安全说明: *

    - *
  • 编辑操作经过 ToolGuard 审批(DefaultToolGuard 对 file_edit 工具默认返回 NEEDS_APPROVAL)
  • - *
  • 每次编辑需要用户确认
  • + *
  • 编辑操作会经过 ToolGuard 安全检查;命中安全规则时会要求用户审批
  • + *
  • 路径边界由 {@code WorkspacePathGuard} 处理
  • *
* * @author MateClaw Team @@ -36,7 +36,8 @@ public class EditFileTool { @vip.mate.tool.ConcurrencyUnsafe("in-place file edit — must not race with reads/writes on the same path") @Tool(description = "Edit file content via find-and-replace. Finds exact match of old_text and replaces with new_text. " + "Returns structured JSON with filePath, replacements count. " - + "Requires user approval. Replaces first occurrence by default; set replaceAll=true for all.") + + "May require user approval when security rules flag the edit. " + + "Replaces first occurrence by default; set replaceAll=true for all.") public String edit_file( @ToolParam(description = "Absolute or relative file path") String filePath, @ToolParam(description = "Original text to find (exact match)") String oldText, diff --git a/mateclaw-server/src/main/java/vip/mate/tool/builtin/WriteFileTool.java b/mateclaw-server/src/main/java/vip/mate/tool/builtin/WriteFileTool.java index 352cda98..8bd6ce5b 100644 --- a/mateclaw-server/src/main/java/vip/mate/tool/builtin/WriteFileTool.java +++ b/mateclaw-server/src/main/java/vip/mate/tool/builtin/WriteFileTool.java @@ -20,8 +20,8 @@ import java.nio.file.Paths; *

* 安全说明: *

    - *
  • 写入操作经过 ToolGuard 审批(DefaultToolGuard 对 file_write 工具默认返回 NEEDS_APPROVAL)
  • - *
  • 覆写已有文件前需要用户确认
  • + *
  • 写入操作会经过 ToolGuard 安全检查;命中安全规则时会要求用户审批
  • + *
  • 路径边界由 {@code WorkspacePathGuard} 处理
  • *
* * @author MateClaw Team @@ -36,7 +36,7 @@ public class WriteFileTool { @vip.mate.tool.ConcurrencyUnsafe("file write — must serialize with reads/writes on overlapping paths") @Tool(description = "Write content to a file. Overwrites if exists, creates if not (auto-creates parent directories). " + "Returns structured JSON with filePath, bytesWritten. " - + "Requires user approval.") + + "May require user approval when security rules flag the write.") public String write_file( @ToolParam(description = "Absolute or relative file path") String filePath, @ToolParam(description = "Content to write to the file") String content) {