• 界面走查(真 server + HTTP + 真 AgentManager,底层 mock 协议)已把
    manual 模式全流程点通:org 节点起子图 → 下钻 work graph → 单步 →
    第 3 步触发回退(徽标 0/3→1/3、run 级 1/5 双层计数同时可见)→
    归因记录与 remediation_note 完整送达 → 收敛后父节点结算、左栏前移。
    
    mock 侧补两处缺失接线(都是「四环漏一环」,非新功能)
    - ClaudeCliProtocol._sendMockPrompt 按 agent 类型查 fixture:图执行侧的
      agent 名带公司前缀(resolveAgentName 返回 {cid}:{id}),fixture 不该
      按公司复制一份。DevLoop 侧名字不含冒号,行为不变
    - graph-engine.defaultAgentExecutor 接住 mock/files 事件:此前只有
      DevLoop 的 loop-controller 接,图执行侧没接,于是 mock 下
      readNodeProduct 永远找不到 attempt-{n}.json,validator 系节点恒 blocked。
      写入限制在节点产物目录内,越界丢弃并留痕
    
    新增 5 份 P3 fixture(workgraph-planning / prd-planning / sdd-planning /
    coder-validator / validator-triager),coder-validator 用 sequence 演示
    一次回退。图必须放 chunks 不能只放 result——callAgent 的 output 来自
    流式 chunks,session/result 的文本不进 output。
    
    控制台入口:CompanyDashboard 加「🕸️ 执行控制台」按钮(路由早已注册,
    此前无任何入口,只能手敲 URL)。
    
    scripts/p3-demo-setup.js:手工测试准备脚本(雇人+写图+起 run),头部
    写明它是两个已知缺口的绕行,缺口修好后第 1 步即可删。
    
    _registry.json 补齐 6 条本体登记(brd/prd/sdd-planning、goal-benchmark、
    benchmark/testdata-validator)——同轮新增的 template-refs 防线测试正是
    因为缺这 6 条而变红,防线抓到了「交付与报告不符」。
    
    文档
    - 27-REQ R-18:招聘归 workgraph-planning(方案 a)、停用 mock 改真 CLI
    - 27-P3B 真实运行前置(新增):11 个工作项分三批,含现状核实 10 条证据
      (seedTemplates 无运行时调用方、10 条悬空 company_hired 行、
       FAILING_VERDICTS 不含 "fail" 导致验收假放行等)
    
    测试 719/719 全绿(66 文件)。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »

  • Two parallel pieces of plumbing — neither has been exercised end-to-end yet
    (real CLI gated on `claude /login`; Projects list view served alongside
    existing pages):
    
    ──── real-CLI wire-up (REAL.1 + REAL.2) ────
    
    LemonBoss now has a clean toggle between mock & real Claude CLI:
    
    - packages/acp-core/protocol/ClaudeCliProtocol.js
      * `options.systemPrompt` → `--append-system-prompt <prompt>` so each
        devloop agent receives its role-specific prompt.md without losing
        Claude's default tool-use conventions.
      * `options.maxBudgetUsd` → `--max-budget-usd` (note: only effective in
        `--print` mode; documented inline).
    
    - server/src/core/devloop/loop-controller.js
      * callAgent now branches on `opts.mock`:
        - mock (P1-P5 path, untouched): fixture sequence + `mock/files` event
        - real: read system/templates/{agent}/prompt.md, pass as systemPrompt,
          snapshot project file mtimes pre-call, diff post-call to compute
          `files_written` — no fixture, no mock/files needed.
      * `_snapshotMtimes(root)` helper walks the project tree (skipping
        .git / node_modules / .cache / .tmp) and returns Map<relPath,mtime>.
      * timeline event payload now carries `real: true` flag.
    
    - scripts/real-pm-smoke.js — minimal real-CLI sanity:
      spawns claude, injects PM prompt, prints which files were written +
      git commit sha. Hard timeout 5min. Single agent → expected spend
      $0.10-0.30 per run when authenticated.
    
    Current status: process spawn + system-prompt injection + stream-json
    flow all verified up to the `Not logged in · Please run /login` gate.
    Auth is the only remaining blocker for executing the real smoke.
    
    ──── project CRUD routes ────
    
    server/routes/devloop.js + server/services/devloop/path-resolver.js
    add the lifecycle pieces the Projects list view needs:
    
    - GET    /projects?include_archived=true   list w/ archive filter
    - PATCH  /projects/:pid                    edit name + idea_summary
    - DELETE /projects/:pid                    soft delete (archive)
    - DELETE /projects/:pid?hard=true          hard delete (rm -rf sandbox;
                                                unregister linked)
    - POST   /projects/:pid/restore            un-archive
    
    path-resolver exposes matching helpers: listProjects({includeArchived}),
    patchProjectMeta(pid,patch), hardDeleteProject(pid).
    
    ──── UI ────
    
    - web/src/views/DevLoopProjects.vue (320 lines, new)  — Projects list
    - web/src/router/index.js — adds `/devloop` → DevLoopProjects
    - web/src/components/devloop/DashboardHeader.vue — back-link now points
      to `/devloop` (project list) instead of `/company`.
    
    ──── housekeeping ────
    
    - CLAUDE.md / start.sh — start.sh now boots server/index.js (full route
      surface incl. /api/devloop) instead of the historical agent-server.js;
      docs updated to reflect this.
    
    ──── tests (+12) ────
    
    - server/tests/devloop/routes-crud.test.js — 12 cases:
      PATCH validation (4) · soft DELETE + list filter (4) · POST /restore
      (1) · hard DELETE (2) · GET /projects default behavior (1).
    
    Results:
    - phase0-verify .. phase5-verify: 8+7+7+6+9+9+7 all pass
    - vitest devloop+acp-core: 230/230 (was 218 → +12)
    
    Specs:
    - docs/prd/newfunction/_spec/arch-acp-bridge.md · Mock Mode
    - docs/prd/newfunction/_spec/plan-migration.md · "自举乐趣" (real path
      prep)
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »
  • Implements the §P3 acceptance gate from plan-migration.md: a single
    POST /api/devloop/projects/:pid/run drives the full project from L1
    through L2 with 4 distinct BugTriager branches, observability via SSE
    stream + bugs.ndjson + changelog.ndjson, and a tiny static status page.
    
    Mock protocol — fallback dir:
    - packages/acp-core/protocol/ClaudeCliProtocol.js
      * New options.mockFallbackDir: when scenario dir lacks a per-agent
        fixture, fall back to the baseline fixtures/devloop-mock/.
        Enables scenario dirs to override only the agents that differ
        (Integrator + Triager + sometimes Architect).
    
    Scenario fixtures — 4 L2 branches:
    - fixtures/devloop-mock-scenarios/contract_mismatch/
      * Architect: sequence[init, patch] — patch bumps sdd_rev → 2,
        units.json l2_rounds → 1, marks todo-be back to pending.
      * Integrator: sequence[fail (500 vs 201), pass].
      * Triager: contract_mismatch confidence 0.85 with proposed_sdd_patch.
    - fixtures/devloop-mock-scenarios/impl_bug/
      * Integrator: sequence[fail (ReferenceError), pass].
      * Triager: impl_bug confidence 0.78 affected=[todo-be], proposed=null.
    - fixtures/devloop-mock-scenarios/spec_ambiguous/
      * Triager: confidence 0.4 → LoopController emits human_intervention.
    - fixtures/devloop-mock-scenarios/infra_flake/
      * Integrator: sequence[crashed (EADDRINUSE), pass].
      * Triager: infra_flake confidence 0.95 affected=[].
    - Each scenario also includes a 1-unit (todo-be) Architect.init fixture
      so baseline Coder/Tester (todo-be) can drive L1.
    
    LoopController:
    - server/src/core/devloop/loop-controller.js — adds:
      * runProject(pid, opts) — wave-scheduled L1 via _groupUnitsByWave,
        runIntegrator (devloop-integrator), runTriager (devloop-triager),
        then branch dispatch:
          - contract_mismatch+conf≥0.5 → Architect(patch) writes new
            units.json (already pending, l2_rounds++); emits sdd.updated +
            changelog sdd_rev entry; loop back to L1.
          - impl_bug+conf≥0.5 → unitRegistry.reset(affected); loop, no
            budget burn.
          - spec_ambiguous OR conf<0.5 → emit human_intervention_needed
            SSE, exit l2_blocked.
          - infra_flake → loop directly (no reset, no budget burn).
      * runDocsPhase + runUnit + callAgent all thread opts.mockFixtureDir
        through to the protocol.
      * Auto-attaches sseBroker to unit-registry and bug-tracker on module
        load — every FSM transition + bug op fires an SSE event.
      * bug_open at integration failure, bug_transition → fixed when
        subsequent L2 round passes.
    
    Routes:
    - server/routes/devloop.js:
      * POST /projects/:pid/run now defaults to full runProject; ?only=<id>
        still drills into single-unit runUnit (P2 compatibility).
      * GET  /projects/:pid/stream — SSE with Last-Event-ID replay.
      * GET  /projects/:pid/bugs?status=&unit_id=&severity= — bug list.
    - server/index.js + agent-server.js mount /public for static assets.
    
    Static status page:
    - server/public/devloop-status.html (~100 lines) — pure HTML, polls
      GET /state every 2s, renders unit DAG with status pills + timeline
      tail. URL ?pid= or input box.
    
    Acceptance:
    - scripts/phase3-verify.js — 9 steps across 4 scenarios + observability:
      ① contract_mismatch ships at sdd_rev=2 l2_rounds=1, sdd.updated SSE,
        changelog sdd_rev entry, bug open → fixed.
      ② impl_bug ships, sdd_rev=1, l2_rounds=0 (no budget burn).
      ③ spec_ambiguous → l2_blocked + human_intervention_needed SSE.
      ④ infra_flake ships, rerun_integrator action, l2_rounds=0.
      ⑤ Observability: timeline/bugs/changelog/stream.log present.
      ⑥ SSE replay from Last-Event-ID returns ≥2 historical events.
    
    Tests (+13 cases):
    - server/tests/devloop/run-project.test.js (11) — 4 scenarios end to
      end + SSE event capture.
    - server/tests/devloop/routes.test.js (+2) — full-project mode + bugs
      404. Updated P2 ?only stub test → full-project 404 on unknown pid.
    
    Results:
    - phase0-verify: 8/8
    - phase0-test-call: 7/7
    - phase1-verify: 7/7
    - phase2-verify: 6/6
    - phase3-verify: 9/9
    - vitest devloop+acp-core: 194/194 (was 181 → +13)
    
    Specs:
    - docs/prd/newfunction/_spec/plan-migration.md · P3 验收
    - docs/prd/newfunction/_spec/loops-l2.md (failure attribution + budget)
    - docs/prd/newfunction/_spec/agents-integrator.md
    - docs/prd/newfunction/_spec/agents-triager.md
    
    Co-Authored-By: Claude Opus 4.7 <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 »
  • Final P0 deliverables to make the system bootable in mock mode and
    pass `scripts/phase0-verify.js` + `scripts/phase0-test-call.js` end-to-end.
    
    ClaudeCliProtocol (mock mode):
    - LEMONBOSS_CLAUDE_MODE=mock or { mock: true } in constructor enables
      mock mode. connect() becomes a no-op; sendPrompt reads fixtures from
      fixtures/devloop-mock/{agentName}.json and emits scripted session_update
      chunks + session/result(mock=true). Falls back to default.json.
    
    Agent registry:
    - 6 entries added to system/templates/_registry.json (devloop-pm,
      devloop-architect, devloop-coder, devloop-tester, devloop-integrator,
      devloop-triager).
    - Per-agent dirs system/templates/devloop-{role}/ with:
      * prompt.md   — auto-extracted from agents-{role}.html §2.2
      * config.json — cli.toolPolicy.allowedTools + sandbox.writeAllowList
    
    Tooling:
    - scripts/extract-agent-prompts.js  — regex-extracts §2.2 system prompts
      from 6 agent HTML pages to system/templates/devloop-{role}/prompt.md.
    - server/src/tools/devloop/index.js — central export (tools Map,
      bashHooks, dispatch).
    - server/src/core/devloop/loop-controller.js (P0 skeleton) — exposes
      createProject (sandbox alloc + git init + first commit + timeline) and
      commitAfterAgent (per-agent kind-routed git commit + timeline event).
    
    Mock fixtures:
    - fixtures/devloop-mock/default.json + devloop-pm.json
    
    Acceptance scripts:
    - scripts/phase0-verify.js   — 8 static checks (35 tools loadable,
      6 agents registered, prompt+config wired, bash guard exported, services
      require, fixtures present, git-vault interface, loop-controller).
    - scripts/phase0-test-call.js — 7 end-to-end steps under mock mode
      (createProject → CLI connect → sendPrompt chunks → no-op commit returns
      null → real write commits → git log ≥2 → timeline has both events).
    
    vitest.config.js: include packages/**/*.test.js so the mock smoke test
    runs in the suite.
    
    Results:
    - 162/162 devloop + acp-core tests pass (up from 159).
    - phase0-verify: 8/8.
    - phase0-test-call: 7/7.
    
    Specs: docs/prd/newfunction/_spec/plan-migration.md · Quick-Start step 7
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »


  • Architecture fix for long-running tool execution:
    
    1. ClaudeCliProtocol: Two-tier idle timeout
       - Chat mode: 45s (detect API hang/silent rate limit)
       - Tool execution mode: 5min (Bash long tasks like pip install)
       - Automatically switches on tool_use_start / content_block_stop events
    
    2. Provision API: POST /templates/:templateId/provision
       - Runs shell commands directly via child_process.exec
       - Bypasses Claude ACP entirely (no idle timeout issue)
       - 10min per-command timeout, security blocklist
       - Frontend button with prompt for custom commands
    
    3. Template UI: Added 🔧 安装依赖 button (teal)
    yibo authored
     
    Browse Dir »


  • yibo authored
     
    Browse Dir »
  • 核心发现:当底层 API (如 MiniMax) 发生 429 时,Claude CLI 内部会自动开启一段漫长的 exponential backoff 重试逻辑(期间完全静默,耗时可达 3 分钟之久)。
    如果最终依然失败,它会抛出一个合法的 JSON 格式的 `type: "result"` 报文,此时 `is_error: true`。
    
    旧版本会将这个 result 报文当做正常的 Agent 文本流式处理,导致把错误输出混进正常消息里。
    新版本增加逻辑,在解析到 result 且 is_error 为 true 时,不进行正常 resolve,而是立即 reject Promise 抛给上层,中断一切任务并给前台报红。
    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 »
  • Claude CLI 遇到 API rate limit/hang 时可能既不输出 stdout 也不输出 stderr,
    导致 sendPrompt Promise 永远挂起,前端卡在思考中状态。
    
    - 新增 120s 空闲超时:无 stdout 活动自动 reject
    - 有 stdout 活动时重置计时器(避免长任务误判)
    - result 到达时清理计时器
    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 »

  • - Implement OKR GoalsService with hierarchical node tracking
    - Add /api/goals routes and integrate with dispatch/report APIs
    - Create Innovator agent with Hunt→Digest→Evolving pipeline
    - Create Hunter (l3-hunt), Digester (l2-digest), Evolver (evolving) meta agents
    - Copy L1/L2 dependency skills into each agent's .claude/skills/
    - Fix buildSystemPrompt to scan ALL skill subdirectories (critical)
    - Fix agent list sorting: master pinned top, rest by lastActiveAt
    - Rename master-001→master, innovator-001→innovator
    - Establish meta agent output convention: write to target agent dir
    - Add CXO agent base class for management agents
    - Update CEO agent with delegation-first management model
    yibo authored
     
    Browse Dir »

  • - Agent as Micro-Container: each agent lives in data/agents/{id}/ with full encapsulation
    - Persona vs Capability split: agent.md (identity) + .claude/skills/main_skill/SKILL.md (workflow)
    - Conversations co-located: data/agents/{id}/conversations/ replaces global dir
    - Meta Skills renamed: meta_hunt, meta_digest, meta_creator, meta_evolving, meta_benchmark, meta_research
    - Dynamic Hot-Reload: AgentManager.getAgentConfig() falls back to filesystem scan
    - Parallel Sub-Agent orchestration via Promise.all with multi-terminal UI
    - Removed SQLite dependency, global skills/ directory, and legacy conversations/
    - Full architecture docs: 18-local-filesystem-first-agent-encapsulation.md
    yibo authored
     
    Browse Dir »