• …_DIR move, stray files
    
    - CLAUDE.md: document DevLoop subsystem (spec-first workflow, project root/git-vault,
      mock mode, L1 loop, unit layout, audit trail) and add missing test commands
    - server/routes/agent-chat.js, server/services/task-service.js: TASK_META_DIR moved
      from system/agents/.tasks to system/tasklog
    - system/agents/master/.claude/scheduled_tasks.json: scheduled task state update
    - remove stray memory/daily/2026-04-02.md and a garbled-filename artifact left under
      system/agents/digester-youtube-crawler/
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »

  • Implements the §P2 acceptance gate from plan-migration.md: a single
    POST /api/devloop/projects/:pid/run?only=todo-be drives the L1 inner
    loop (Coder → Tester → fail → Coder → Tester → pass), with the second
    Coder pass demonstrably reflecting on the first failure.
    
    Mock protocol — stateful sequences:
    - packages/acp-core/protocol/ClaudeCliProtocol.js
      * Mock fixtures now support `sequence: [{chunks,result,files}, ...]`.
        Each protocol.connect() + sendPrompt() consumes the next variant;
        sticks on the last entry after exhausted.
      * Static `ClaudeCliProtocol.resetMockState()` clears counters between
        test runs.
    
    Fixtures:
    - fixtures/devloop-mock/devloop-architect.json — units.json now has
      status:pending + retries:0 + retry_budget per unit, plus
      units/{todo-be,todo-db,todo-fe}/spec.json so Tester has acceptance
      criteria to read.
    - fixtures/devloop-mock/devloop-coder.json — sequence: implement (with
      intentional missing 400 branch) → retry (reflective fix, coder.log
      attempt:2 has last_failure/last_cause/this_fix/rationale).
    - fixtures/devloop-mock/devloop-tester.json — sequence: fail (1/3
      failure with hint pointing at missing body validation) → pass (3/3).
    
    LoopController:
    - server/src/core/devloop/loop-controller.js — adds:
      * runUnit(pid, unitId, opts) — drives the L1 loop via unit-registry
        FSM (pending → coding → testing → failed → coding → testing →
        passed/blocked). Calls Coder then Tester per attempt; on failure,
        builds a retry context summarizing prior coder.log + tester
        failures and feeds it into the next Coder prompt.
      * _buildRetryContext + _findLatestTesterResult helpers.
      * callAgent now rewrites units.json.project_id to the real pid after
        mock writes (so unit-registry validation passes).
    
    Route:
    - server/routes/devloop.js — adds POST /projects/:pid/run?only=<unitId>.
      Without ?only, returns 501 (full project run lands in P3).
    
    Acceptance:
    - scripts/phase2-verify.js — 6 steps:
      1. POST /projects (PM + Architect)
      2. POST /run?only=todo-be returns ok=true, attempts=2, final=passed
      3. FSM trail matches expected 6-step transition sequence
      4. coder.log second entry has all 4 reflection fields
      5. runs/ has ≥2 result.json with first.ok=false, last.ok=true
      6. sandbox cross-unit + prd writes blocked by ToolSandboxError
    
    Tests (5 new cases):
    - server/tests/devloop/run-unit.test.js (4) — FSM trail, coder.log
      reflection, runs/ result chain, sandbox enforcement.
    - server/tests/devloop/routes.test.js (+3) — POST /run validation,
      full P2 loop, 404 on unknown unit.
    
    Results:
    - phase0-verify: 8/8
    - phase0-test-call: 7/7
    - phase1-verify: 7/7
    - phase2-verify: 6/6
    - vitest devloop+acp-core: 181/181 (was 174 → +7)
    
    Specs:
    - docs/prd/newfunction/_spec/plan-migration.md · P2 验收
    - docs/prd/newfunction/_spec/loops-l1.md (retryWithReflection)
    - docs/prd/newfunction/_spec/agents-coder.md
    - docs/prd/newfunction/_spec/agents-tester.md
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »
  • Implements the §P1 acceptance gate from plan-migration.md: a single
    POST /api/devloop/projects produces a runnable todo-demo project with
    multi-page PRD/SDD sites, units.json, integration spec, agent-state,
    and history snapshots — all via mock agents (no real Claude CLI cost).
    
    Code additions:
    - packages/acp-core/protocol/ClaudeCliProtocol.js
      * mock mode now emits an extra `mock/files` acp_event when the fixture
        contains a files[] array. LoopController applies it to the project
        root, letting mock agents produce real outputs.
    - server/src/core/devloop/loop-controller.js (now ~280 lines)
      * callAgent(pid, agentName, prompt, opts) — single-agent invocation:
        reads system/templates/{agent}/prompt.md, runs mock protocol,
        applies fixture files[], timeline-logs, auto-commits.
      * runDocsPhase(pid, requirement) — orchestrates PM → Architect with
        `docs.complete` timeline marker.
      * getProjectState(pid) — returns project.json + units + prd_rev/sdd_rev
        + timeline tail for the GET /state endpoint.
    - server/routes/devloop.js (new)
      * POST /api/devloop/projects — createProject + runDocsPhase
      * GET  /api/devloop/projects
      * GET  /api/devloop/projects/:pid/state
    - server/index.js / server/agent-server.js — mount /api/devloop.
    
    Mock fixtures (drive the full acceptance file tree):
    - fixtures/devloop-mock/devloop-pm.json
      * 14 files: prd/{index,reading-guide,product/*,feature/*,flow/*,prototype/*}.html,
        prd/assets/{shell.css,shell.js,search-index.json},
        agent-state/{pm.json,pm-todo.json}, history/prd-rev-001.html.
    - fixtures/devloop-mock/devloop-architect.json
      * 13 files: sdd/{index,mvcp/*}.html, sdd/assets/*,
        units.json (3 units, DAG), integration/spec.json,
        agent-state/{architect.json,architect-todo.json}, history/sdd-rev-001.html.
    
    Acceptance:
    - scripts/phase1-verify.js — spins ephemeral express app, POSTs the
      todo-demo project, asserts 23 expected paths exist + 3 units with
      l2_rounds/l2_budget + git ≥4 commits + timeline events.
    
    Tests (12 new cases):
    - server/tests/devloop/loop-controller.test.js (7) — callAgent +
      runDocsPhase + state.
    - server/tests/devloop/routes.test.js (5) — POST validation, full
      POST, GET state, 404 on unknown pid.
    
    Results:
    - phase0-verify: 8/8
    - phase0-test-call: 7/7
    - phase1-verify: 7/7
    - vitest devloop+acp-core: 174/174 (was 162 → +12)
    
    Specs: docs/prd/newfunction/_spec/plan-migration.md · P1 Docs MVP
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »

  • 1. Evolver agent.md: Added token budget rules
       - No re-reading unchanged files between iterations
       - Use head/grep instead of cat for large files
       - Concise output only (scores + diff summary, no full SKILL.md)
       - Cap at 5 iterations per session (was 10)
       - Early stop if score change < 2 points for 2 consecutive rounds
    
    2. agent-chat.js: System prompt size guards
       - MAX_PROMPT_FILE_SIZE = 15KB per file (auto-truncate with warning)
       - MAX_TOTAL_PROMPT_SIZE = 100KB total (safety net)
       - Prevents runaway files from inflating context ever again
    yibo authored
     
    Browse Dir »
  • When a task completes and triggers a callback to the parent agent,
    previously it always created a new convId (callback-{taskId}), spawning
    a fresh CLI process with full system prompt re-injection.
    
    Now it checks the sessions pool for an existing connected session of the
    target agent and reuses its convId. This avoids creating a new CLI
    process and saves the system prompt overhead (~30K tokens for master).
    
    Falls back to creating new session if no active one exists.
    yibo authored
     
    Browse Dir »
  • Layer 1 (P0): Per-agent session mutex
    - heartbeat-service.js: skip heartbeat if previous session still active (30min safety valve)
    - agent-chat.js: reject concurrent /chat requests for same agentId with different convId (429)
      Multi-turn conversations on same convId still work normally
    
    Layer 2 (P1): Advisory file lock utility
    - server/utils/file-lock.js: O_EXCL-based .lock file mechanism
      Auto-cleanup stale locks, graceful degradation on timeout
    
    Root cause: HeartbeatService creates new convId per heartbeat, spawning
    independent Claude CLI processes that concurrently write config.json and
    SKILL.md, causing rollbacks and FRAUDULENT scores.
    yibo authored
     
    Browse Dir »










  • 1. 根治所有模板 Agent残留的过往公司(LemonV)私人记忆,使其诞生即为全新白纸状态。
    2. 提取出统一的 `methodology.md` 基类 Prompt,通过 `agent-chat.js` 强力注入。
    3. 从 Master 到各路 Agent 都将强制遵循【从大脑到小脑】的不硬编码理念。
    4. 全面引入统一的基础方法论(Harness):学习(Research) -> 规划(Planning) -> 执行(Execute) -> 验证(Verify)
    yibo authored
     
    Browse Dir »
  • 修复 Claude CLI 遇到严重 API 错误 (如 Http 429) 时,输出的不是合法 JSON,而是像
    'MiniMax 检查失败: HTTP 429: {...}' 这样的纯文本行。
    旧版本在 JSON.parse 失败后直接忽略。
    新版本增加 fallback,匹配非 JSON 行中的错误关键字并强制中断死等和前端展示。
    yibo authored
     
    Browse Dir »
  • - 当底层模型 (MiniMax等) 抛出 API 错误时,Claude CLI 不会崩溃也不会输出 stderr,而是通过 stdout 输出 event.type='error' 的 JSON 块。
    - 未处理该事件导致协议层无法等到 result 事件,引发 Promise 永久挂起。
    - 修复:在_handleStreamEvent 拦截 error 块,主动抛出错误打断等待链,前端即可正常展示 ❌ API 请求失败。
    yibo authored
     
    Browse Dir »
  • - ClaudeCliProtocol: stderr 检测 rate_limit/429/401 等致命错误时自动 reject sendPrompt Promise
    - agent-chat.js: 监听 stderr/disconnected 事件并通过 SSE 推送到前端
    - AgentChat.vue: error 事件停止 thinking 状态 + ACP 日志面板显示错误
    yibo authored
     
    Browse Dir »
  • - 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 Dir »