Skip to main content
M

dsh-berrycode (dsh-host)

miuiadmin/dsh-berrycode/packages/dsh-host

Engineering autonomy control plane for DeepSeek Harness with /berry and /ultracode commands, T0-T3 tiers, a 5-state SQLite FSM, pre-write R1-R4 guardrails, diff-guard and native analyzers, 3 on-demand tools (berry_plan, berry_step, berry_recall), 4 bundled skills, and a single-line Web input dock.

Install

dsh plugin --profile web add github:miuiadmin/dsh-berrycode

This plugin lives in the packages/dsh-host subdirectory of the repository.

README

dsh-berrycode

面向 DeepSeek Harness(DSH) 的原生进程内工程自治控制面微内核——专供精准编程、超长全自动稳定执行、大型项目深度开发、规范开发与反屎山架构治理。

English Summary: dsh-berrycode (package v0.1.4, architecture spec v1.2.0, MIT License) is an in-process engineering autonomy control plane for DeepSeek Harness (DSH 0.2.x). Everyday Q&A and small edits stay zero-overhead (T0/T1: 0 B prompt injection, 0 tools, no DB). /berry <objective> (T2 Deep-Track) and /ultracode <objective> (T3 UltraCode) activate a 5-state out-of-repo SQLite FSM, R1–R4 guardrails, Diff-Guard, and native analyzers. They latch up to 3 on-demand tools (berry_plan, berry_step, berry_recall), 4 bundled skills, and a single-line Web conversation.input.dock capsule. Runs 100% locally with zero telemetry and no extra API key required.

dsh-berrycode overview

核心指标与设计预算

  • 5 态 14 边 FSM:IDLE / SCOPING / EXECUTING / VERIFYING / PAUSED。
  • 6 + 1 张仓外 SQLite 表:$DSH_HOME/berrycode/repos/<hash>/state.db(WAL + 短同步事务 + RAM 哨兵防篡改 + user_version 在线迁移)。
  • ≤ 3 个按需锁存工具:berry_plan、berry_step、berry_recall(T0 / T1 为 0 工具,避免击穿 KV-Cache)。
  • ≤ 7,500 LOC 核心生产源码硬预算(100% TypeScript):四层单向解耦微内核,Layer 0 零外部与零 Node I/O 依赖。
  • T0 / T1 严格 0 B 隐身:日常问答与局部小改零注入、零 Dock、热路径 P99 < 1.0 ms。
  • 五大工程不变量:
    1. 100% 不遗漏(Zero Omission)——Requirement-to-Proof 覆盖图与人类独占令牌 reconcileAmendment 原子修订。
    2. 100% 不走偏(Zero Drift)——仓外控制面、写前 R1–R4 零误报红线、全非只读工具 O(dirty) 对账与加固 Git。
    3. 100% 不屎山(Zero Slop)——5-Rung 逐级证伪、< 100 ms Diff-Guard、传递测试闭包验证、0 用例必红、V8 覆盖率与 3 桶 Flaky 鉴伪。
    4. 架构优秀(Architectural Excellence)——Opt-in 架构适应度、Wave 0 契约前置、零 LLM 预热复用目录与宿主直调 workflowEngine 四重证明。
    5. 可持续发展(Sustainable Compounding)——FTS5 活体台账、崩溃无损恢复(MTTR < 10 s)、仓外战报导出、12 腿 selftest 与消融门禁。

四档渐进开发体验

档位命令 / 触发典型场景常驻 Prompt锁存工具
T0: Ghost Chat无活跃 Run + 问答 / 阅读代码解释、架构讨论0 B0
T1: Silent Fast-Path无活跃 Run + 1–3 文件小改快速修小 Bug、局部微调0 B0
T2: Deep-Track/berry <需求>跨多文件功能、中大型重构(15 m–2 h)≤ 260 / 420 B2
T3: UltraCode Mode/berry ultracode <目标>(别名 /ultracode、/berry marathon)旗舰 100% 全自动研发:前置 workflow 预研与一次性澄清、无人值守闭环与 workflow 强制评估≤ 260 / 420 B3

文档与工作区规范

本项目文档采用 Curia 2.7 两根管理(规则入口见 AGENTS.md,规范全文见 .agents/README.md):docs/ 存放现行标准与外部事实,.agents/ 存放计划、调研、决策笔记、技能与归档。

目录结构

  • packages/core(Layer 0):@berrycode/core 纯领域内核(零 Node I/O 与外部依赖,5 态 FSM、覆盖图、SHA-256 事件链、微胶囊、R1–R4 与 Flaky 归约)。
  • packages/engines(Layer 1):@berrycode/engines 确定性引擎(仓外 SQLite 与 RAM 哨兵、O(dirty) 对账、加固 Git、Diff-Guard、Rung 2 分析器、架构适应度、崩溃恢复与 12 腿自检)。
  • packages/dsh-host(Layer 2):dsh-berrycode 唯一可安装自包含 DSH 插件包(含 cordis.patch.yml、screenshots.json、4 个按需 Skill、lib/index.js 与浏览器客户端 lib/client.js)。
  • packages/client(Layer 3a):纯浏览器单行 conversation.input.dock 胶囊源码(T0 / T1 零渲染)。
  • packages/cli(Layer 3b):@berrycode/cli 独立命令行,提供 check / status / debt / rollback / selftest / export 六个子命令(锚定 Git toplevel、延迟加载 node:sqlite,永不修改 .git/hooks/)。
  • extensions/:三大独立可选编程扩展(dsh-berrycode-mutator、dsh-berrycode-cockpit、dsh-berrycode-parallel),通过 inject = ['berrycode'] 代码挂载。
  • evals/:四层 AST 依赖方向门禁(arch-boundaries.test.ts)、全量回归套件与 16 项跨仓 A/B 消融套件(ablation-suite/)。
  • scripts/pack-release.mjs 与 .github/workflows/:CI 门禁(ci.yml)与 v*.*.* Tag 自动发版流水线(release.yml,本地打包入口 pnpm run release:pack)。
  • LICENSE:MIT 开源许可证。

安装插件(DSH)

请从 GitHub Release 直接安装预构建 .tgz(本仓为 Monorepo 且不追踪 packages/*/lib/,请勿直装源码分支)。兼容 DSH >=0.2.0-rc.2 <0.2.1 || >=0.2.1-0 <0.2.2 || >=0.2.2-0 <0.3.0-0 与 Node >=22.19.0:

# Web Profile(包含单行 conversation.input.dock 胶囊)
dsh plugin --profile web add https://github.com/miuiadmin/dsh-berrycode/releases/download/v0.1.4/dsh-berrycode-0.1.4.tgz

# Headless 或 TUI Profile
dsh plugin --profile headless add https://github.com/miuiadmin/dsh-berrycode/releases/download/v0.1.4/dsh-berrycode-0.1.4.tgz

安装完成后重启对应 DSH 实例(如 dsh web),即可在对话中使用以下斜杠命令:

  • 启动任务:/berry <目标>、/berry ultracode <目标>(别名 /ultracode)。
  • 状态与治理:/berry status、/berry review、/berry assess、/berry pause、/berry resume、/berry amend、/berry export、/berry selftest。

卸载与清理(Uninstall):

dsh plugin --profile web remove dsh-berrycode
dsh plugin --profile headless remove dsh-berrycode
# 可选:清理仓外状态数据库与导出报告($DSH_HOME/berrycode/)

隐私与本地运行声明:本插件 100% 在本机 DSH 进程内运行,零遥测、零主动外联请求、无需额外 API Key(完全复用 DSH 当前模型);控制面状态仅保存在仓外 $DSH_HOME/berrycode/repos/<hash>/state.db(目录 0700、文件 0600),T0 / T1 不写入目标仓库也不建库。

快速开始与验证

pnpm install
pnpm run build
pnpm run verify
node packages/cli/lib/bin.js selftest

本机 DSH 隔离 Profile 联调安装与校验(详见 .agents/skills/dsh-local-dev/RUNBOOK.md):

dsh --profile berry-dev --from-default-profile headless --dump-default-config > /dev/null
dsh plugin --profile berry-dev add link:"$(pwd)/packages/dsh-host"
dsh --profile berry-dev --dump-config | rg -n "dsh-berrycode"

可运行示例

以下 27 个示例均在隔离临时 Git 仓库与仓外 $DSH_HOME 中运行并在退出时自动清理,不污染当前仓库;各示例详细说明与验收要点见 examples/README.md:

node examples/run-demo.mjs
node examples/run-extensions-demo.mjs
node examples/run-crash-recovery-demo.mjs
node examples/run-monorepo-demo.mjs
node examples/run-security-gauntlet-demo.mjs
node examples/run-amend-flaky-demo.mjs
node examples/run-storage-resilience-demo.mjs
node examples/run-subagent-steering-demo.mjs
node examples/run-fuzz-and-dock-demo.mjs
node examples/run-full-lifecycle-t0-to-t3-demo.mjs
node examples/run-polyglot-monorepo-demo.mjs
node examples/run-ci-pipeline-and-budget-demo.mjs
node examples/run-enterprise-saas-monorepo-demo.mjs
node examples/run-distributed-microservices-demo.mjs
node examples/run-legacy-migration-and-scale-demo.mjs
node examples/run-nextjs-fullstack-platform-demo.mjs
node examples/run-ai-ml-data-pipeline-demo.mjs
node examples/run-financial-core-scale-demo.mjs
node examples/run-compiler-sdk-monorepo-demo.mjs
node examples/run-cloud-native-k8s-operator-demo.mjs
node examples/run-realtime-ecommerce-high-churn-demo.mjs
node examples/run-game-engine-monorepo-demo.mjs
node examples/run-banking-compliance-multi-worktree-demo.mjs
node examples/run-open-source-mega-workspace-demo.mjs
node examples/run-iot-embedded-edge-fleet-demo.mjs
node examples/run-media-streaming-cdn-demo.mjs
node examples/run-global-erp-10k-scale-demo.mjs

# 或一键顺序运行全部 27/27 个示例
pnpm run demo:all

当前阶段

  • 发版状态:插件与全部可发布包当前版本为 v0.1.2(架构标准 v1.2.0),由 .github/workflows/release.yml 与 pnpm run release:pack 原子产出 Tarball 及 SHA256SUMS.txt。
  • 架构与质量状态:核心微内核、三大可选扩展与跨平台构建发布链均已收敛;全仓遵守 Curia 2.7 文档治理与四层 AST 依赖方向门禁。
  • 实测证据与现场核验:阶段实测快照与动态计数见上节证据档案(不在此重复手抄);实时状态以 pnpm run verify、pnpm run demo:all 与 node packages/cli/lib/bin.js selftest 为准。

Related plugins