• 此前 27 系列全部是对用户需求的转述与结构化解读,原话一句都没留存
    (搜 "judge-loop-jump"、"元 agent 架构来继承生成" 等关键短语均 0 命中)。
    转述会漂移,出现"当初到底怎么说的"争议时缺少可回溯的依据。
    
    格式与定位对齐仓库既有惯例 docs/prd/newfunction/_spec/requirement.md
    (DevLoop 的原始需求页:"用户提出的需求原话照搬,再做结构化解析")。
    
    内容:11 条需求原话逐条照搬(R-1..R-11),含笔误一律保留
    (validtor / syste agent / intergration / fin in / object-key result),
    每条标注落在哪份文档的哪一节,附"需求 → 设计落点"速查表。
    
    同时记录三处关键推翻关系,便于回溯设计演变:
    - R-7 推翻了"benchmark/test data 是系统基础设施"的误读
    - R-9.1 推翻了 P2 v0.1-v0.3 的静态汇报结构建模及 A/B/C 三个折中方案
    - R-9.4 使跨公司污染风险及其三个缓解方案全部作废
    
    另澄清 27-EXAMPLE 的「配图工厂」是为走查虚构的场景,非用户原始需求。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • 四处写 _registry.json 的地方都用 JSON.stringify(registry, null, 2) 直接落盘,
    不带末尾换行。文件在仓库里是带换行的,导致任何一次 hire()/depositTemplate()/
    模板增删改之后,git diff 都会多出一行 "\ No newline at end of file" 的噪音,
    把真实的数据变更淹掉。
    
    写入点:
    - company-service.js:374  depositTemplate()
    - company-service.js:824  _updateTemplateUsedCount()
    - routes/company.js:86    PATCH /templates/:templateId
    - routes/company.js:120   DELETE /templates/:templateId
    
    同时提交一次真实的运行时数据变更:qa-judge usedCount 7 → 8。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • 新增四份文档:
    
    - 27-e2e-task-execution-flow.md — 跨阶段总览:建公司 → 下达任务 → org graph
      逐节点执行 → work graph 规划与循环 → 验收收敛。核心发现:这套流程 70-80%
      已在 docs/prd/newfunction/_spec/ 里被完整设计(DevLoop 的 L1/L2/L3 三层循环、
      BugTriager 四分类归因、分级预算熔断、contract_hash 闸门),DevLoop 实为本
      架构唯一跑通的参考实现,通用引擎应从它抽象而来。
    - 27-example-dev-company-walkthrough.md — 参考场景走查,把架构在一家具体公司
      上跑一遍数(各阶段 JSON 形态、fan-out/fan-in 图、成本估算 ~44 次调用、
      按阻塞程度排序的 8 个断点清单),作为实现靶子与端到端验收场景。
    - 27-naming-conventions.md — 统一命名规范 {作用域}-{职能}。消歧三种 benchmark
      (skill- / agent- / task-);OKR 体系正名(goal → okr,第 1 层 Goal → Objective);
      规划类统一为 orggraph-planning / workgraph-planning / brd-prd-sdd-planning。
    - 27-p3-p4-work-graph-console.md — P3/P4 合并设计:Work Graph 执行引擎(支持
      启动/下一步/暂停/停止/重试,手动与自动共用同一 advance 原语)+ 执行控制台页面。
    
    重写 27-p2-org-graph.md 至 v0.4:Org Graph 从「静态汇报结构」重定位为
    「company 级别生成的 workflow」,与 Work Graph 同构(condition/edge_kind 执行流边),
    两层共用同一套 schema、执行引擎与画布组件。org_graph_edges 从未写入过数据,
    可直接 DROP 重建,零迁移负担;hire() 不再需要 reportsTo(图整体规划整体写入),
    P2 对 company-service.js 的侵入缩至零。
    
    同步修正总纲至 v0.3:Org Graph/Work Graph 术语定义、§3.1 架构图、§3.3 整节;
    标注 P1 已实现(226489d);P6「DevLoop 收编」从「可选」改为「应前置」。
    
    修正三处过期陈述:P1 已实现(非设计稿)、runProject 已完整实现(非 501)、
    UnitsDAG.vue 已实现 Kahn 分波 DAG 渲染(画布应扩展而非重写)。
    并记录一处待处理冲突:graph-service.js:44 已落地的全量唯一索引与 P2 需要的
    部分唯一索引冲突,实现 T1 时必须先 DROP。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • # Conflicts:
    #	system/agents/master/.claude/scheduled_tasks.json
    yibo authored
     
    Browse Code »
  • - New docs/README.md indexes the tree: done/ (shipped features + reference manuals),
      todo/ (current focus — Graph Agent architecture), todo/future/ (deprioritized
      roadmaps: FDE pipeline todo list, stale v1.1 milestones, harness engineering
      proposal — orthogonal to the Graph Agent work, not blocking it)
    - Move completed/reference docs into docs/done/ (LEMONBOSS-SYSTEM-DESIGN, architecture-v5,
      claude-code-cron, open-api-manual, qa_judge_req, task_timeline_design, user-guides/,
      system-design/01-26 minus the three moved to todo/future/) — verified against actual
      code (qa-judge template, Task Timeline route/service/view) before filing as done
    - Fix the two TOC links in LEMONBOSS-SYSTEM-DESIGN.md that would otherwise point at the
      old paths after the move
    - docs/todo/system-design/27-graph-agent-architecture.md: add the P2 Org Graph doc link
      in the roadmap table and 关联文档 section
    - Add docs/todo/system-design/27-p2-org-graph.md (P2 requirements & design, drafted in
      parallel while P0/P1 landed)
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • …_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 Code »
  • hire() now checks system_agents (source_kind='template') before provisioning a new
    company agent: if the role has a shared template row, skip copying agent.md and
    instead let AgentManager.getAgentConfig()/PromptBuilder.build() resolve the prompt
    from the shared legacy_path at call time, with per-company context assembled from a
    new company-context.md. Roles without a template row (including the 6 ids that exist
    in both system/agents/ and system/templates/, e.g. evolver-youtube-crawler) fall back
    to the existing full-copy behavior unchanged.
    
    - server/services/graph-service.js (new): lookupSharedAgentMd(), upsertOrgGraphNode()
    - server/services/company-service.js: hire() reference-mode branch, _provisionReferenceAgent()
    - server/src/core/agent-manager.js: getAgentConfig() resolves prompt/companyContextPath
    - server/src/core/prompt-builder.js: build() concatenates company-context.md
    - unit + integration tests covering all 6 acceptance criteria from
      docs/todo/system-design/27-p1-virtual-reference.md §6, including a regression test
      against the real idearun:evolver-youtube-crawler naming-collision case
    
    Full regression suite (587 tests) passes; independent adversarial review found 0
    blocking/major issues.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Adds server/services/graph-db.js (new data/graph.sqlite: system_agents,
    org_graph_nodes, org_graph_edges) and graph-seed-service.js, which scans
    system/agents/, system/templates/, and data/companies/*/company.json into
    seed rows without touching company-service.js's existing hire/copy path.
    
    Real repo data diverged from the design doc's original estimates (8 not 10
    global agents; 39 not 34 template dirs; system/agents/ and system/templates/
    turn out to share 6 ids describing the "same" agent from two different
    files) — documented in docs/todo/system-design/27-graph-agent-architecture.md
    section 7 for P1/P2 to resolve.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »

  • First successful real-CLI agent invocation. After REAL.1 (system-prompt
    injection) + REAL.2 (mtime-diff file detection) wired, the only remaining
    gate was Claude auth. Once CLAUDE_CODE_OAUTH_TOKEN was added to the
    project .env, scripts/real-pm-smoke.js completed cleanly:
    
      Wire-up status:
        ✓ process spawn
        ✓ stream chunks       (3)
        ✓ result text          (Claude returned "DONE")
        ✓ files written        (6: prd/index, feature-tree, user-flows,
                                  product/overview, assets/shell.{css,js})
        ✓ git commit           (8cb0493)
      5/5 checks passed · elapsed 163s
    
    PM output quality (real Claude, not mock):
    - valid <article data-doc="prd" data-rev="1"> + <section data-rev="1">
      structure per system prompt
    - nav links use correct relative paths across 4 chapters
    - pid (p-7gwlbl) embedded in HTML metadata
    - 中文 prose in the requested 克制 voice
    
    Spec-deviation confirmed (no MCP tool gateway yet — Claude only has
    built-in Read/Write/Bash):
    - ✗ agent-state/pm.json (no update_runtime_state tool)
    - ✗ agent-state/pm-todo.json (no write_todolist tool)
    - ✗ history/prd-rev-001.html (no archive_doc tool)
    - ✗ timeline.ndjson 'prd_drafted' event (no timeline_append tool)
    - ✓ core PRD site IS produced — sufficient to prove pipeline
    
    ──── code ────
    
    - scripts/real-pm-smoke.js — loads root .env via dotenv resolved
      from server/node_modules (script dir has no node_modules of its own).
    
    ──── ambient ────
    
    Files modified by user/linter while real-CLI work was in flight; merged
    without revert:
    - server/routes/devloop.js — new GET /:pid/requirements endpoint
    - server/services/devloop/path-resolver.js — listProjects() includes
      archived flag + helpers; supports project archive lifecycle
    - server/services/devloop/git-vault.js — commit() now accepts files[]
      to scope which paths the commit covers (avoids dragging linked-existing
      user's unstaged files into chore commits)
    - server/src/core/devloop/loop-controller.js — createProject uses
      explicit files:['project.json','timeline.ndjson'] for first chore
      commit (avoids same issue)
    - server/tests/devloop/path-resolver.test.js — coverage for archive/
      patch/hardDelete helpers
    - web/src/components/devloop/RequirementListSection.vue (new)
    - web/src/views/DevLoopNewRequirement.vue (new)
    - web/src/views/DevLoopDashboard.vue — mounts RequirementListSection
    - web/src/views/DevLoopProjects.vue — list page polish
    - web/src/router/index.js — adds /devloop/:pid/requirements/new route
    - web/src/components/devloop/DashboardHeader.vue — back link tweak
    
    Test results: 233/233 vitest pass (was 230 → +3 path-resolver cases).
    
    ──── ⚠ SECURITY NOTE ────
    
    .env is currently TRACKED in git (committed in b1a348b) even though
    .gitignore lists it. Existing committed contents include credentials for
    DOUBAO / FEISHU / GITHUB / GOOGLE / JWT. The CLAUDE_CODE_OAUTH_TOKEN +
    AZURE_OPENAI_API_KEY I just added to .env are NOT in this commit — they
    stay in your working tree only.
    
    Recommended follow-up (separate commit):
      git rm --cached .env
      git commit -m "chore: stop tracking .env (already gitignored)"
    And rotate every key that was in the previous committed .env.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • 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 Code »
  • Self-bootstrap demo: hits the same HTTP API a human would, asking
    DevLoop to add a /restart endpoint to itself. End-to-end:
      1. POST /projects  (PM + Architect scaffold)
      2. GET  /state
      3. POST /run        (L1 + L2 → ship)
      4. GET  /{bugs,timeline,changelog,units/todo-be}
      5. POST /feedback   (PM incremental → PRD rev 1→2)
      6. POST /run        (re-ship)
      7. POST /sign-off   (→ shipped-final)
      8. POST /feedback   (→ 400 InvalidProjectStatusTransition)
    
    Run: node scripts/self-bootstrap.js (artifacts retained for inspection)
    
    Output proves the three-layer Loop survives a real curl-equivalent
    session: 12 git commits auto-generated, 20 timeline events emitted,
    prd_rev bumped, sdd_rev unchanged (happy path), bugs.ndjson empty
    (no integration failures), .git contains full agent provenance.
    
    For production: drop LEMONBOSS_CLAUDE_MODE=mock — the protocol layer
    will route to real Claude CLI without any code change in
    LoopController / routes.
    
    Specs: docs/prd/newfunction/_spec/plan-migration.md · "自举乐趣"
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • …b-pages + UI endpoints)
    
    Completes the §P4 acceptance UI scope that was deferred in commit
    0594b1d. Adds the full Vue Dashboard + Ops sub-pages with live SSE
    stream + auto-reconnect, unit DAG with detail drawer, PRD/SDD diff
    panel, feedback modal, and 4 ops views (Bugs / Loops / Changelog /
    Progress).
    
    Vue surface (≈1480 lines):
    - web/src/views/DevLoopDashboard.vue (~110 lines)
      * 4-region grid: status header / loop bar / units DAG / live stream /
        PRD diff. Polls /state every 2.5s; opens feedback modal & unit
        drawer; mounts Sign Off / Abandon controls.
    - web/src/views/DevLoopOps.vue (~50 lines) — tab container.
    - web/src/components/devloop/DashboardHeader.vue
      * Status badge (7 states color-coded), NEW REQUIREMENT button,
        Sign Off / Abandon buttons (disabled per FSM), Ops nav link.
    - web/src/components/devloop/LoopStatusBar.vue
      * 4-phase pipeline (Docs → L1 → L2 → Ship), highlights active phase.
    - web/src/components/devloop/UnitsDAG.vue
      * SVG DAG rendered from topological waves; per-unit status color;
        click → emits select → opens UnitDrawer.
    - web/src/components/devloop/UnitDrawer.vue
      * Slide-in panel showing unit metadata + last 3 runs + result
        summary + coder.log tail (last 1KB).
    - web/src/components/devloop/LiveAgentStream.vue
      * EventSource subscriber listening to project.status,
        unit.state, integration.result, triage.result, sdd.updated,
        prd.updated, human_intervention_needed, etc. Manual 5s reconnect
        on disconnect (browser's built-in Last-Event-ID is honored).
    - web/src/components/devloop/PrdDiffPanel.vue
      * Reads changelog.ndjson, renders prd_rev / sdd_rev entries with
        trigger labels.
    - web/src/components/devloop/FeedbackModal.vue
      * POSTs /feedback with PM incremental — shows rev bump on success.
    - web/src/components/devloop/ops/BuglistView.vue
      * Filterable bug table; status badges; severity / category columns.
    - web/src/components/devloop/ops/LoopLogView.vue
      * Timeline grouped by L1 (unit.*) / L2 (integration/triage/sdd/l2_*) /
        L3 (project.status/shipped/prd.updated/human_intervention) /
        System (rest). Free-text substring filter.
    - web/src/components/devloop/ops/ChangelogView.vue
      * Tabular prd_rev/sdd_rev entries with by/trigger/summary columns.
    - web/src/components/devloop/ops/ProgressView.vue
      * 6 metric cards (status, PRD rev, SDD rev, units passed bar,
        L2 rounds bar, open bugs) + per-unit breakdown table.
    
    Router:
    - web/src/router/index.js — adds:
      * /devloop/:pid              → DevLoopDashboard
      * /devloop/:pid/ops/:tab(bugs|loops|changelog|progress) → DevLoopOps
    
    Backend UI-supporting endpoints (server/routes/devloop.js):
    - GET /api/devloop/projects/:pid/timeline?limit=N
        Reads timeline.ndjson, returns last N events reversed.
    - GET /api/devloop/projects/:pid/changelog
        Returns full changelog.ndjson entries reversed.
    - GET /api/devloop/projects/:pid/units/:unitId
        Returns { unit, runs (last 3 result.json), coder_log_tail }.
        404 on unknown unit.
    
    Tests (+5 cases):
    - server/tests/devloop/routes.test.js — new P5 UI endpoints block:
      * timeline / changelog / units happy-paths
      * 404 on unknown unit and unknown pid
    
    Acceptance:
    - scripts/phase5-verify.js — 7 steps:
      ① Vue build artifacts (DevLoopDashboard.js + DevLoopOps.js chunks)
      ② POST /projects → state returns status + units
      ③ GET /timeline returns events
      ④ GET /changelog returns entries
      ⑤ GET /units/todo-be returns unit + runs
      ⑥ GET /bugs returns bug list
      ⑦ SSE /stream delivers ≥1 event after a triggering feedback POST
    
    Vue build:
    - npm run web:build → DevLoopDashboard chunk 15.63 kB,
      DevLoopOps chunk 9.09 kB, both with co-loaded CSS bundles.
    
    Results — all 7 phase gates green:
    - phase0-verify: 8/8
    - phase0-test-call: 7/7
    - phase1-verify: 7/7
    - phase2-verify: 6/6
    - phase3-verify: 9/9
    - phase4-verify: 9/9
    - phase5-verify: 7/7
    - vitest devloop+acp-core: 218/218 (was 213 → +5)
    
    Specs: docs/prd/newfunction/_spec/plan-migration.md · P4 L3 + UI
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Implements the §P4 acceptance gate from plan-migration.md, with one
    scope adjustment confirmed up-front: full Vue Dashboard (~1650 lines)
    deferred to a future UI phase, replaced by extending the existing
    P3 static status page with Sign Off / Abandon / Feedback controls.
    All P4 backend acceptance criteria are scripted (phase4-verify.js).
    
    Project status FSM (project.json.status):
    - server/src/core/devloop/loop-controller.js
      * draft  →  running  →  shipped  →  shipped-final | abandoned
                    ↓             ↓
              l2_blocked    (feedback flips back to running)
              l2_exhausted
      * `_setProjectStatus` validates transitions via STATUS_TRANSITIONS,
        emits SSE `project.status`, writes timeline event.
      * createProject seeds status=draft; runDocsPhase end → running;
        runProject(shipped) → shipped; all dead-end branches (l2_blocked,
        l2_exhausted) also propagate to status via _safeSetStatus.
    
    L3 helpers:
    - signOff(pid, opts) — requires status=shipped → shipped-final; commits
      a `chore: sign-off` git entry; rejects other source states with
      InvalidProjectStatusTransition.
    - abandon(pid, opts) — any non-terminal → abandoned; commits + calls
      sseBroker.close(pid) to send SSE close frame to subscribers.
    - submitFeedback(pid, text, opts) — rejects in shipped-final/abandoned;
      invokes PM in incremental mode; on prd_rev bump writes
      changelog.ndjson prd_rev entry + emits prd.updated SSE; if prior
      status was shipped, flips back to running so next runProject can
      rebuild.
    
    PM incremental mock fixture:
    - fixtures/devloop-mock/devloop-pm.json — converted to sequence form:
      * sequence[0] (init) — original P1 fixture (PRD rev=1, 14 files).
      * sequence[1] (incremental) — appends a new section to
        prd/feature/feature-tree.html, bumps article data-rev to 2,
        writes history/prd-rev-002.html.
    
    Baseline happy-path Integrator:
    - fixtures/devloop-mock/devloop-integrator.json — single-shot pass.
      Makes vanilla runProject ship without a scenario override.
    
    P4 happy-path scenario:
    - fixtures/devloop-mock-scenarios/happy_path/devloop-architect.json —
      single-unit (todo-be only) Architect so end-to-end ship works with
      the baseline Coder/Tester (which only know todo-be paths).
    
    Routes:
    - server/routes/devloop.js:
      * POST /projects/:pid/sign-off — 400 InvalidProjectStatusTransition
        when status != 'shipped'; 200 returns { status }.
      * POST /projects/:pid/abandon  — body { by?, reason?, note? }; 400 on
        terminal state; 200 returns { status: 'abandoned' }.
      * POST /projects/:pid/feedback — body { text (req), by?,
        mockFixtureDir? }; 400 on missing text or shipped-final/abandoned;
        200 returns { prd_rev_before, prd_rev_after, status }.
      * POST /projects: now accepts optional `mockFixtureDir` so the same
        fixture dir threads through both the create call and later
        feedback (keeps mock-sequence counters aligned).
    
    Static status page (replaces full Vue Dashboard for P4):
    - server/public/devloop-status.html — adds:
      * Status badge in header (color-coded per status).
      * Sign Off / Abandon control buttons (disabled per current state).
      * Feedback textarea + Submit button → POST /feedback.
      * Buttons reflect FSM (signoff only when shipped; abandon/feedback
        locked at terminal states).
    
    Acceptance:
    - scripts/phase4-verify.js — 9 steps, full HTTP path:
      ① POST /projects → running
      ② POST /run → shipped
      ③ POST /feedback → PRD rev 1→2 + running (+ changelog entry)
      ④ POST /run again → shipped
      ⑤ POST /sign-off → shipped-final
      ⑥ POST /feedback (after sign-off) → 400
      ⑦ POST /sign-off (after sign-off) → 400
      ⑧ second project: POST /abandon → abandoned
      ⑨ POST /abandon (after abandon) → 400
    
    Tests (+19 cases):
    - server/tests/devloop/p4-l3-feedback.test.js
      * 14 FSM cases covering happy path + abandon path + signOff
        pre-conditions + empty feedback rejection.
      * 5 route cases via fetch on ephemeral express app.
    
    Results:
    - phase0-verify: 8/8
    - phase0-test-call: 7/7
    - phase1-verify: 7/7
    - phase2-verify: 6/6
    - phase3-verify: 9/9
    - phase4-verify: 9/9
    - vitest devloop+acp-core: 213/213 (was 194 → +19)
    
    Spec deviations explicit:
    - Full Vue DevLoopDashboard.vue + Ops 4 sub-pages NOT implemented;
      static status page handles the demoable surface area instead.
    - All backend endpoints from §P4 (sign-off, abandon, feedback) are
      complete and tested.
    
    Specs: docs/prd/newfunction/_spec/plan-migration.md · P4 L3 + UI
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • 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 Code »
  • 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 Code »
  • 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 Code »
  • 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 Code »
  • Adds the DevLoop Agent tool layer (CommonJS) under server/src/tools/devloop:
    - _errors.js / _sandbox.js — shared infra (3 error classes + path allow-list w/ {unitId})
    - tool-registry.js — loadAllTools / dispatch / listToolNames / getDevLoopTools
    - persistence-tools.js (5) — write_todolist · update_todo_item · update_runtime_state · timeline_append · record_memory
    - doc-tools.js (12) — bootstrap_prd_site · bootstrap_sdd_site · write_chapter · write_mvcp_page · archive_doc · diff_html · diff_units · echo_diff · update_search_index · validate_prd_site · validate_sdd_consistency · hash_contract
    - coder-tools.js (3) — contract_bridge · sandbox_check · append_coder_log (retry fields required)
    - tester-tools.js (5) — parse_vitest · hint_builder · bug_open · bug_transition · bug_list
    - integrator-tools.js (6) — port_picker · spawn_units · health_wait · run_case · parse_placeholder · collect_stderr
    - triager-tools.js (4) — extract_evidence · category_classifier · diff_contract_vs_impl · find_similar_bug
    - bash-json-guard.js — preExecute hook blocking inline JSON in Bash (CLAUDE.md L91-99)
    
    Total: 35 callable devloop tools.
    
    Tests: 88 cases across 9 files, all passing; combined with P0.0 services
    suite the project now has 159 green tests.
    
    Specs:
    - docs/prd/newfunction/_spec/arch-tool-registry.md
    - docs/prd/newfunction/_spec/agents-{pm,architect,coder,tester,integrator,triager}.md
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • First concrete code commit for DevLoop. Implements all 7 services that
    P0.A tools will depend on, per plan-migration P0.0.
    
    Services (server/services/devloop/, ~900 lines):
    - path-resolver.js   foundation — resolveProjectRoot + 12 derived paths;
                         sandbox + linked-new mode support; sensitive path
                         blacklist (with /tmp + os.tmpdir() exemptions);
                         ~/.devloop/linked-projects.json registry
    - doc-store.js       PRD/SDD multi-file site IO + cheerio validateHTML +
                         validateUnitsSchema + canonical-JSON hashContract
                         + automatic history/ archival
    - unit-registry.js   FSM (M-2: pending→coding→testing→passed/failed/blocked);
                         l2GateOpen; diffUnits (added/changed/removed);
                         reset semantics for L2 + L3
    - bug-tracker.js     bugs.ndjson append-only + dedupKey + P-9 transition
                         state machine + list/stats/history aggregation
    - timeline-logger.js M-13 ProcessTimeline — append/read/tail;
                         summary truncate to 280; payload oversize → ref form
    - changelog-writer.js M-15 — append/read/latest for prd/sdd/units revs
    - sse-broker.js      per-pid pub/sub + 25s heartbeat + stream.log replay
                         via Last-Event-ID; emit returns monotonic id
    - git-vault.js       spawn-git wrapper — init/commit/tag/log/diff/status/
                         resetWorkingTree/revert/archive; per-pid mutex;
                         nothing-to-commit returns {skipped:true} not throw
    
    Tests (server/tests/devloop/, 71 passing):
    - path-resolver.test.js  (17 cases) — sensitive path · sandbox alloc · linked-new
    - doc-store.test.js      (12 cases) — validateHTML · validateUnitsSchema · hashContract
    - unit-registry.test.js  (15 cases) — FSM transitions · l2GateOpen · diffUnits
    - bug-tracker.test.js    (10 cases) — open dedup · transition · list filter · history
    - timeline-logger.test.js (9 cases) — append/read/tail · summary truncate · oversize
    - git-vault.test.js      (8 cases)  — init idempotent · commit · tag · status · archive
    
    vitest config (`globals: true`) means tests use describe/it/expect globally,
    no `require('vitest')` needed (and would fail under vitest 4).
    
    Dep added: cheerio@^1.0.0 (used by docStore.validateHTML; HTML parsing).
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Before P0 coding begins, the doc set was missing three things that would
    have stalled implementation on day 3:
    
    1. Day-1 Quick-Start (plan-migration top section)
       - 8-step "what command do I type first" walkthrough
       - pnpm install → cp .env.example → extract-manifest verification → P0.0
         services → MOCK_CLAUDE=1 phase0-verify → real phase0-verify → P1
       - Anyone cloning can reach step 4 (doc verification) immediately
    
    2. P0.0 服务层 7 件套 (plan-migration P0 子任务表)
       - Previously P0.A "工具实现" depended on docStore/unitRegistry/sseBroker/
         bugTracker/timelineLogger/pathResolver/GitVault but none were listed
         as a task — engineer would hit "docStore.writePRD doesn't exist"
       - Now P0.0 lists them as a sequenced 4.5-day task: pathResolver first
         (everyone depends on it), then 5 other services, finally GitVault
       - GitVault tasks consolidated into P0.0 (removed duplicate P0.I)
       - Total P0: 13.5 → 17 days (3 → 3.5 weeks)
    
    3. Mock Claude CLI Mode (arch-acp-bridge §⑦, NEW)
       - MOCK_CLAUDE=1 env toggles ClaudeCliProtocol to read stubs from
         system/mock-responses/{agent}/{mode}.json instead of real Claude
       - Mock JSON: array of steps (text emit / tool_use), $pid placeholder
       - When mock vs real: mock for dev + CI, real for prompt quality + P1+
       - Enables zero-token tool dev + phase0-verify
       - Sections renumbered (⑧ → ⑨ etc) to accommodate insertion
    
    Total project: 10 → 10.5 weeks (still honest, still includes everything).
    No new MVCP defs (54). Search index 195.7KB. _spec/ regenerated by hook.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • The 50-page PRD HTML totals ~520KB; loading it all costs Claude ~222K
    tokens just for context. This adds a token-efficient sibling layer:
    
    - scripts/extract-spec.js → npm run spec:extract / spec:check
      Walks docs/prd/newfunction/*.html and produces stripped MD into _spec/.
      Strategy varies per page (full-extract for SDD/process/data,
      shell-strip for agents to keep long system prompts intact).
      Result: 327.9KB MD (~84K tokens) — 38% of full load, saves ~138K tokens
      for every Agent invocation that reads the spec.
    
    - scripts/git-hooks/pre-commit + scripts/install-hooks.sh
      Pre-commit guard: when any docs/prd/newfunction/*.html changes, the
      hook checks the corresponding _spec/*.md is up to date; fails commit
      if stale, telling user to `npm run spec:extract`. Auto-installed via
      package.json `prepare` script on `npm install`.
    
    - docs/prd/newfunction/_spec/ (51 .md files + CONVENTIONS.md)
      Machine-readable mirror of HTML. Used by:
      - Coder/Architect/Tester agents when reading spec at runtime
      - External Claude Code sessions doing reproducibility
      - CI checks (npm run spec:check)
      NOT hand-edited; regenerated from HTML by extract-spec.js.
    
    - CLAUDE.md: 1-line note directing future agents to read _spec/*.md
      preferentially, fall back to *.html only for wireframes/SVG/full
      human-readable context.
    
    This is the user's pre-existing scaffolding that the previous commits
    hadn't pulled in yet. Now tracked + enforced by hook.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Fills the gap: where does a DevLoop project actually live, and how does a user
    create one? Previous docs assumed everything goes under
    data/companies/{cid}/projects/{pid}/ with no user control.
    
    Design:
    - A DevLoop "project" = one directory + project.json + git history;
      the directory is the project root, the anchor for everything
    - 3 modes:
      - sandbox (default, v1): root auto-generated under data/.../projects/{pid}/
      - linked-new (v1): user picks any empty path, e.g. ~/code/auto-todo
      - linked-existing (v2): bind to existing git repo subdirectory
    - 3 creation entry points:
      - REST: POST /api/devloop/projects with optional {mode, target_path}
      - CLI: scripts/devloop-new.js with --path / --name / --requirement / --list
      - UI: Dashboard "+ NEW PROJECT" modal with mode radio + path picker
    - New pathResolver service (path-resolver.js): single source of truth for
      resolveProjectRoot(pid). All paths derive from it; nothing hardcodes
      data/companies/... anymore
    - linked projects registered in ~/.devloop/linked-projects.json
    - memory stays at company level (~/data/companies/{cid}/memory/) even for
      linked projects — privacy + cross-project knowledge isolation
    - Strict sandbox: blacklist /, /etc, /System, ~/.ssh, ~/.aws etc. for
      target_path; writeAllowList relative to root_path
    
    Pages changed:
    - arch-project-root.html (NEW, 15-section comprehensive design)
    - sdd-model.html       (M-1 ProjectMeta + mode + root_path fields)
    - sdd-control.html     (C-1 POST /projects accepts mode + target_path)
    - assets/shell.js      (sidebar adds arch-project-root)
    - assets/search-index.json + build-manifest.json (rebuilt)
    
    Adds ~2 days to P0 (pathResolver + schema migration), ~1.5 days to P1
    (CLI + mode params), ~1 day to P4 (UI modal). Total 10 → 10.5 weeks.
    
    Key insight: linked-new mode means a user can DevLoop code straight into
    ~/code/auto-todo, then `git push origin main` to ship — without manually
    exporting from the sandbox. The sandbox-vs-linked choice is path-transparent
    to LoopController and all Agents.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Fills a gap pointed out post-v0.3: docs had file-mtime + history/ archival
    only, no real version control. Now every Agent that completes work triggers
    LoopController to git commit; project ship/sign-off/abandon tag the repo.
    
    Design:
    - One git repo per project at data/companies/{cid}/projects/{pid}/.git
    - LoopController-centralized commits (Agents stay sandboxed, no git access)
    - Commit cadence: each Agent success → commit; Tester red → no commit;
      shipped/sign-off/abandon → tag
    - New GitVault service (C-18): spawn-git wrapper, ~150 lines,
      init/commit/tag/log/diff/status/archive/revert/resetWorkingTree
    - New process P-10 (Process.GitCommit): commitAfterAgent hook in
      callAgentWithPersistence; recoverOnBoot extended to detect dirty trees
    - .gitignore excludes agent-state/ (high-write) + history/ (git is history)
      + stream.log + runs stdout (too large)
    - New SSE events: git.committed · git.tagged · recovery_dirty_tree
    - Defer git push-to-remote to v2 (no network deps in v1)
    
    Pages changed:
    - arch-git-versioning.html (NEW, comprehensive design, 16 sections)
    - sdd-control.html       (+C-18 GitVault spec)
    - sdd-process.html       (+P-10 commitAfterAgent + recoverOnBoot dirty-check)
    - data-layout.html       (.git/ + .gitignore in project tree)
    - plan-migration.html    (P0 +3 days for GitVault, total 10 weeks)
    - assets/shell.js        (sidebar adds arch-git-versioning)
    - assets/search-index.json (rebuilt, 189.5KB, 50 pages)
    - build-manifest.json    (52 → 54 defs, 100% extraction)
    
    Key benefit: Coder 3-retry chain can be `git diff`-ed; L2 fail allows clean
    revert; project export becomes `git archive HEAD` (tracked files only,
    not the ~30MB project dir).
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Output of scripts/extract-manifest.js against docs/prd/newfunction/.
    Captures the current state:
    - 52 MVCP definitions (model=15, view=11, control=17, process=9)
    - 100% path + shape extraction coverage
    - Sized ~52KB
    
    This file is regenerable (just run the script), but committing the
    snapshot lets reviewers and external Claude Code sessions diff the
    schema surface without rebuilding.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • Earlier PRD attempt scoped to LemonBoss-only (excludes ArenaSK Skill
    marketplace / Arena / Master / Innovator / Open API / Evolution).
    Generated 2026-05-12, exists side-by-side with the later 50-page
    DevLoop PRD under docs/prd/newfunction/.
    
    Structure:
    - index.html (single-page shell with collapsible sidebar + lunr search)
    - assets/ (app.css/js, chapter.css, menu.js, search-index.json)
    - chapters/01-overview ~ 10-reproducibility (10 chapters)
    - _scan-manifest.json (scope manifest pinning what's in/out)
    - scripts/build-search-index.js (chapter HTML → lunr index)
    
    This commit just brings the existing files under version control;
    no edits to content.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • DevLoop: a 3-layer Loop (L1 Unit / L2 Integration / L3 Human) auto-development
    system that takes a one-line human requirement and produces multi-page HTML
    PRD + SDD + units.json + full backend/frontend code via 6 specialized agents.
    
    This commit adds the complete documentation set:
    
    50 HTML pages organized in 8 sections (3-level menu + global search):
    - 01 Overview · 02 PRD · 03 Design (loops + 6 agents)
    - 04 SDD (MVCP × 4) · 05 Prototype · 06 Architecture
    - 07 API · 08 Ops · 09 Plan
    
    Key specs:
    - 6 agent skills (PM/Architect/Coder/Tester/Integrator/BugTriager), each with
      full system prompt, 13-17 tool signatures, 3 E2E samples, helper source code
    - 52 MVCP definitions, 100% machine-extractable via data-* anchors
    - 79 tool signatures with implementation guidance (arch-tool-registry)
    - ACP bridge spec (arch-acp-bridge): how LoopController calls into LemonBoss
      agent-manager without breaking existing Master/Innovator flows
    - 5-phase plan P0→P4 (~9.5 weeks): P0 bootstrap (tool impl + ACP bridge),
      P1 docs MVP, P2 single unit L1, P3 L1+L2 loop, P4 L3 feedback + UI
    - Persistence layer: AgentState (M-10), Memory (M-11), Todolist (M-12),
      Timeline (M-13), Bugs (M-14), Changelog (M-15) + crash recovery (P-8)
    - Cost & concurrency budgets (plan-cost-concurrency)
    - Code lifecycle: stay-in-sandbox v1 + export API + future GitHub PR (v2)
    
    Plus supporting scripts (zero deps, regex-based):
    - scripts/extract-manifest.js: extracts MVCP defs to build-manifest.json,
      used to verify all definitions have path + shape (currently 100%)
    - scripts/build-search-index.js: builds assets/search-index.json (183KB),
      enables Ctrl+K global search across all 50 pages
    
    The PRD itself is meta-executable: a future Claude Code session reading
    plan-reproducibility.html can rebuild the entire DevLoop runtime from the
    docs alone.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »
  • - Fix port to 3010 (was 3000); both server/index.js and server/agent-server.js
      default to 3010 per config.js
    - Document the two server entrypoints: index.js (full ArenaSK, run via npm run dev)
      vs agent-server.js (Agent Chat only, run via start.sh)
    - Correct counts: 15 routes (not 11), 26 services (not 16), 10 views (not 21)
    - Remove false 'skills/' top-level dir reference; document actual data/skills/
    - Add full test/example/log npm scripts; auto-dev CLI bin; packages list
    - Add note on body-sanitizer middleware (the source of the JSON warning)
    - Add brand history note (ArenaSK → LemonBoss)
    - Keep existing Agentic Self-Correction Loop Prevention warning verbatim
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Code »


  • 1. Added global time range selector (1h/24h/7d/30d/all) that uniformly restricts the dataset for the whole dashboard.
    2. Added 'Search' inputs and 'Sort' dropdowns for Agent Ranking, Task Breakdown, and Recent Logs tabs.
    3. Decoupled global filteredData state from original rawData to allow smooth, consistent indicator rendering.
    yibo authored
     
    Browse Code »
  • Converted the Quota Monitor's vertical scroll layout into a clean 4-tab interface:
    1. Trend Statistics (使用趋势统计)
    2. Agent Ranking (各 Agent 计算力消耗排行榜)
    3. Task Breakdown (任务级成本分析)
    4. Recent Logs (最近的大模型调用日志)
    
    This significantly improves usability and avoids excessive scrolling while keeping the top overview indicators universally visible.
    yibo authored
     
    Browse Code »
  • Parses convId strings (e.g. task-T-xxx, callback-T-xxx) to group billing records by task ID.
    Provides a consolidated view showing total cost, token consumption, duration, and the agent
    pipeline sequence for each task, along with an expandable detailed breakdown per agent call.
    This allows easier identification of wasteful agent patterns.
    yibo authored
     
    Browse Code »
  • 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 Code »
  • 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 Code »
  • Root cause: heartbeat.md instructed Master to append inspection logs to
    plan.md on every heartbeat, causing plan.md to grow to 209KB (2922 lines
    of repeated 'status stable' logs).
    
    Changes:
    1. Truncated master/plan.md from 209KB to 7KB (kept pipeline records,
       removed 2800+ lines of repeated heartbeat logs)
    2. Updated heartbeat.md rules:
       - Banned appending inspection logs to plan.md
       - Added token budget awareness (10KB file read limit, prefer grep/find)
       - Normal heartbeats should reply '[心跳正常]' without using tools
    yibo authored
     
    Browse Code »
  • 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 Code »
  • Templates with new train data (hunt/digest/evolve):
    - agent-creator, auto-publisher, clickbait-copywriter
    - community-manager, competitor-spy, data-harvester
    - digester, weibo-scraper, interactive-video-selector
    - lemonv_drama, reddit-scraper, story-architect
    
    Updated configs & plans for all active templates.
    Updated agent states (master, innovator, hunter, evolver, digester).
    Added CLAUDE_EFFORT=low to .env (global disable thinking).
    Updated bin/lemon.js CLI tool.
    
    .gitignore: exclude evolve intermediate artifacts (FRAUDULENT, batch/eval
    scripts, iteration logs/scores, scorer versions, SKILL versions, .env)
    yibo authored
     
    Browse Code »