• 此前只有人类对话路径 agent-chat.js 会写 memory.md,图执行的验收反馈从不进
    memory.md,Dream 天天扫全是空转。runClaimedNode 结算后新增 recordNodeOutcomeMemory
    桥接点,只在真派发(isRealDispatch)且 systemAgentId 对应本体已雇佣(bodyDir 存在)
    时才记一行 success/fail 摘要,避免测试夹具/假 executor 用例把假地址写进真实
    system/agents/ 目录。memory-service.appendToMemoryMd 补 mkdirSync,因为这条新调用方
    不像既有的 saveSessionSummary 那样先建过 memory/ 目录。
    
    从原本混在墙钟看门狗改动里的工作区 diff 中拆出,两个特性互不相关。
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    yibo authored
     
    Browse File »

  • 29-DREAM §四 的五步里先落两步。
    
    ## 步骤 4:本体定义文件的 git 历史闸门(决策 B.3)
    
    用户定案:soul.md / agent.md **直接落盘**,但写之前必须确认这份文件已经在
    git 历史里 —— 别导致直接修改而没有历史。
    
    definition-write-gate.js 两条判据都满足才放行:
    ① 文件被 git 跟踪;② 该文件没有未提交改动。
    判不出来(不在仓库 / git 不可用)一律拒绝 —— fail-closed。
    
    **为什么是「拒绝并报告」而不是「脏就先替它提交一把」**:后者看着更顺手,
    但那正是本仓库记过的一类事故 —— 多会话共用同一个 worktree(27-P3C §15.4)。
    一份未提交的改动很可能是**另一个会话正在写的东西**,替它提交等于把别人的
    半成品写进 main 且署错名。把「要不要提交」留给人。
    
    守卫 5 例,含「拒绝时必须给出下一步」那条 —— 撞上闸门的人(或 agent)
    要能照着做,否则只能猜。
    
    ## 步骤 1:memory.md 的自动写入不再冒充「关键事实」
    
    原实现取任务与结果的第一行、砍到 80/100 字符,写进 `## 关键事实`。
    那不是提炼,是搬运 + 截断。实测产物(cto/_global/memory/memory.md):
    
        - [2026-08-20] [SYSTEM HEARTBEAT] → 🔧 [TOOL_CALL] Bash (ID: toolu_01RsQ3gh...)
    
    **工具调用 id 被当成了「关键事实」**,而 memory.md 会被注入每一轮提示词。
    28 §5.6b 点名的错误版本是「自动把原文写进共享 SKILL.md」——
    这套已经是那个错误的单公司版,只是还没跨公司共享所以还没造成泄漏。
    
    改法:
    · 换段 —— 自动写入落到「原始记录(未提炼)」,`## 关键事实` 只由提炼产物填。
      读的人和 agent 一眼分得清「日志」和「结论」;这一段同时是 dream 的输入面。
    · 滤掉确定的噪声(工具调用标记 / 空结果 / 只有心跳标记的任务),
      但**不猜「哪条重要」**——猜重要性需要理解内容,那是 dream 的活,
      在这里做等于把提炼下放到一个正则里。
    · 不再截成半句:上限放宽到 200 并取完整第一行。截断残渣读起来像事实、
      其实缺主语,比不留更坏。
    
    ⚠️ 踩到一条:噪声判据初版有「任务与结果都短于 8 个字符就丢」。那是按英文长度
    想出来的阈值 —— 中文 8 个字是一句完整的话,实测「结果甲甲甲甲甲」(7 字)
    整条被丢。已删该规则。**凡是拿长度当信息量代理的判据,先问一句这是按哪种文字算的。**
    
    全量:143 文件 / 1310 测试全绿。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse File »

  • 设计见 docs/done/system-design/28-agent-registry-unification.md。
    
    改造前 Agent 本体散在三处(system/agents/ 11 个、system/templates/ 50 个、
    data/companies/{id}/agents/ 17 个),同一个 AgentScaffold 被三个 baseDir 实例化。
    后果是同一角色在 N 家公司下有 N 份互不相干的副本,模板更新不会同步;
    org-coder / org-planner 这类走 hireFromBaseMetaAgent 造出来的本体
    legacy_path 指回自己公司目录,永远无法被第二家公司复用。
    
    本次:
    - G1 单一注册表:system/templates/ 整体并入 system/agents/,base → _base。
      7 个同名 id 逐个裁决,被丢弃的一份归档到 docs/_archive/ 而非删除。
      source_kind(template/global_agent/company_hired) → origin(builtin/created)。
    - G2 运行态下沉:CLI 的 cwd 从本体根改为 system/agents/{aid}/{cid}/{taskId}/。
      memory / conversations 落公司态 {aid}/{cid}/,按公司隔离不串。
      sessionPool 的 key 含 (companyId, taskId),两家公司调同一 agent 不复用会话。
    - G2b 产物不下沉:交付物仍落 data/companies/{cid}/,system/agents/ 只留运行痕迹。
      写入边界按链路分叉——graph 节点走节点私有目录(被 indexNodeOutputs 索引),
      chat 走公司 workspace,同一提示词里不再出现两条互斥指令。
    - G3 公司只存引用:data/companies/{id}/agents/ 删除,新增 company_agents 关联表。
      不复用 org_graph_nodes——后者是执行流图,work 层本体被雇时不写它,天生覆盖不全。
    - G4 缺则创建:本体缺失时从 _base 复制骨架进 system/agents/{id}/,
      agent-creator 填 agent.md/soul.md 后才从 draft 转 active(哨兵判据,
      骨架未填时哨兵仍在,不许被 hire)。产物即刻是全系统可复用的本体。
    
    新增 server/services/agent-locator.js 收编原先散在 6 处的寻址逻辑。
    
    边界守卫(graph-engine)的豁免从「本体根上五个文件名」放宽为整棵 system/agents/:
    新本体的骨架本来就要进 git,gitignore 挡不住 ?? system/agents/{newId}/,
    旧判据会把一个真正成功的招聘节点判成 boundary_escape fail。
    
    存量迁移见 scripts/migrate-agent-registry.js(幂等,备份到 data/_migration-backup-*)。
    
    真 Claude CLI E2E 已验证:新建公司 → orggraph-planning 自动规划 →
    自动招聘 org-planner/org-coder/org-validator 三节点流水线;
    data/companies/{cid}/agents/ 不存在,company_agents 4 行,
    system_agents 56→56(零新建私有本体,纯复用),git status 零增量。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse File »


  • - System agents: 只保留 master (data/system/agents/master)
    - Templates: 所有可复用 agent 模板 (data/system/templates/)
    - Companies: 公司创建时自动部署 5 个元 Agent (innovator/hunter/digester/evolver/agent-creator)
    
    路径修复:
    - agent-chat.js: /list 扫描路径修正 (system/agents + companies/*/agents)
    - agent-manager.js: 动态 agent 查找路径修正
    - skill-config-loader.js: 修正 agents root
    - pipeline-service.js: pipelines 输出到 companies/{id}/pipelines/
    - billing.log: 移至 companies/{id}/logs/ 下
    
    Skills 标准化:
    - 所有 template agent 建立 .claude/skills/main_skill/SKILL.md
    - company-service._copyTemplate() 新增 .claude/ 目录复制
    - innovator SKILL.md v3.0: 移除旧 l3-hunt/l2-digest 命名
    - 清理重复 agent_creator, 统一为 agent-creator
    
    清理:
    - 移除 data/agents, data/workspace, data/logs, data/goals 旧目录
    - 清除所有未使用的 DATA_DIR 声明
    - 清除 template 中的 conversations/logs/memory 运行态数据
    yibo authored
     
    Browse File »

  • yibo authored
     
    Browse File »
  • Phase 3 反馈进化闭环:
    
    1. DataSourceService (运营数据接入):
       - 新增 datasource-service.js: 抽象适配器模式
       - MockAdapter: 模拟运营数据 (开发调试)
       - FileAdapter: 从本地 JSON 文件读取数据
       - 可扩展: 预留 WechatAdapter/DouyinAdapter 接口
       - API: GET /data/metrics, /data/trending, /data/attribution
    
    2. 归因分析引擎:
       - analyzeAttribution(): 自动对比两个时间段指标
       - 计算变化百分比和趋势方向
       - 自动提取显著变化维度并生成洞察文本
       - API: GET /api/company/:id/data/attribution
    
    3. Know-how 自动更新 (memory-service.js):
       - 新增 updateAgentKnowhow() 函数
       - autoReflect 产出的 patterns/lessons 自动写回 SKILL.md
       - 在 SKILL.md 末尾维护'经验教训(自动沉淀)'段落
       - 保留最近 20 条记录,自动清理过旧条目
       - 闭环: Agent执行 → 反思 → 经验写入SKILL → 下次读取改进行为
    yibo authored
     
    Browse File »
  • …ter Agent cognitive auto-recovery loop
    
    - Refactored CompanyDashboard into read-only Observer UI
    - Enforced strict companyId:roleId namespacing across Node APIs and AgentManager
    - Added dynamic <env_status> injection to PromptBuilder for robust context
    - Introduced bin/lemon.js CLI for structured LLM tool execution
    - Implemented in-stream error interceptors for implicit silent retry loop
    yibo authored
     
    Browse File »

  • …ze Chinese keyword extraction
    
    - Fix: The long trailing history in todo.md drowned out the actual current task keywords because English tokens (e.g. TASK, P2, from) padded the 30-keyword limit beforehand.
    - Updated extractKeywords: Process Chinese characters first as they carry more weight for NLP context intent.
    - Added userMessage prefix to searchText in buildSystemPrompt so newly dispatched tasks dominate keyword extraction.
    - End-to-end e2e test created and passed (27/27 asserts passed)
    yibo authored
     
    Browse File »
  • Phase 3 features:
    - autoReflect: auto-trigger on complex conversations (toolCount>=3 or duration>=60s)
      - Extracts patterns from successful conversations
      - Extracts lessons from failed conversations
      - Auto-solidifies cerebellum plans from 5+ tool-call successes
      - Writes reflection logs to memory/reflections/
      - Updates memory.md 'verified patterns' and 'lessons learned' sections
    - consolidateMemory: merge short-term sessions older than 7 days into long-term/
      - Extracts frequent keywords across merged sessions
      - Writes consolidated summary to long-term/consolidate-{date}.md
      - Updates long-term/patterns.md with high-frequency patterns
    - generateDailyReport: aggregate today's sessions and reflections into daily/{date}.md
    - API endpoints: POST /:agentId/memory/consolidate, POST /:agentId/memory/daily-report
    
    Test results: 16/16 passed (Phase 3 test suite)
    yibo authored
     
    Browse File »
  • - Hippocampus keyword matching engine (extractKeywords + score)
    - Cerebellum plan storage (saveCerebellumPlan)
    - Auto-sync hippocampus-index.json + hippocampus.md
    - POST /:agentId/memory/cerebellum API endpoint
    - buildSystemPrompt injects matched plans from hippocampus
    - Use count & lastUsed tracking on plan access
    - Chinese n-gram + English word tokenizer with stop words
    - Fix: score formula uses entry keyword count as denominator
    - Fix: useCount updates original index entry not spread copy
    - Verified: OKR plan matched + injected into CEO prompt
    yibo authored
     
    Browse File »
  • - New: server/services/memory-service.js
      - saveSessionSummary(): auto-save session summary to short-term/
      - loadRecentMemory(): inject last 5 sessions into system prompt
      - appendToMemoryMd(): auto-append key facts with size control
    - Modified: server/routes/agent-chat.js
      - buildSystemPrompt() now loads recent short-term sessions
      - Conversation completion triggers auto memory save
    - Verified: CEO Agent conversation creates session file + updates memory.md
    yibo authored
     
    Browse File »