DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Cortex — DeepSeek Harness 插件(DSH Plugin)
← Plugins

dsh-cortex

Cortex

Cortex — 低成本高质量多模型递归任务编排、模型评测与智能路由平台(DSH 插件):任务画像/策略匹配/递归拆解/动态路由/四级质量门控/批量监督/恢复引擎/预算控制/策略沉淀/KPI

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add dsh-cortex@0.3.0
README兼容性版本

兼容性与来源证明

Cortex 以 dsh-cortex 发布,当前版本为 0.3.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
web
发布来源
npm
Registry 更新时间
2026/9/11

版本

0.3.0stable
2026/9/11
0.2.2stable
2026/8/28
0.2.1stable
2026/8/26
查看其余 1 个版本
收起版本
0.2.0stable
2026/8/23

相关插件

正在加载相关插件…

最新版
0.3.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
1.7 MB
文件数
44
Surface
web
许可证
MIT
发布源
npm
GitHub
★ 1
周下载
0
最近提交
2026/9/11
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录

README

Cortex — Multi-Model Orchestration & Evaluation for DeepSeek-Harness

English | 中文 | npm package | GitHub

Cortex is a DeepSeek-Harness plugin that turns the host's primary (strong) model into a high-leverage supervisor. The supervisor plans, decomposes, verifies and accepts; routed executor models (small/cheap models such as Qwen3.8-9B) and tools do the heavy lifting. With a recursive task tree, dynamic routing, four-stage quality gates, budget control, failure recovery, policy reuse and per-dimension model evaluation, Cortex keeps quality stable while driving the unit cost of successful tasks down.

The supervisor is the host primary model that drives the cortex_* tools (e.g. deepseek-v4-pro in the bundled registry), and executors are the models the dynamic router picks per subtask (L1/L2 tiers, e.g. Qwen3.8-9B).

Suggested repository topics (GitHub): dsh-plugin · dsh · cordis · llm-orchestration · multi-model · model-routing · quality-gate


Highlights

CapabilityEntryNotes
Task intelligencecortex_startProfile → fingerprint → strategy match (≥0.90 reuse / 0.70~0.90 light-check / <0.70 replan) → budget pool → granularity check
Recursive task treecortex_decomposeSafety limits: maxDepth 6 / maxTotalNodes 50 / maxChildrenPerNode 10 / maxReplan 3; DAG depends_on; aggregate nodes merge children by node schema + Gate0, active-model only
Recursive executioncortex_execute recursiveReady leaves auto-scheduled, aggregate nodes merged; evaluate:gate2 / multi_vote pass through — same standard as manual batch
Cachingengine built-inL1 exact + L2 semantic (near-duplicate text similarity, conservative 0.88 threshold, skip-able) + L3 cross-task component reuse
Drift & valueengine built-inModel drift monitoring vs static baseline (auto routing penalty, surfaced in registry/matrix) + value score & Pareto frontier per evaluation run
Dynamic routingcortex_executeCandidate filter → utility scoring (quality/success/risk − cost/latency/failure) → MQC upgrade gate; costFirst / balanced / qualityFirst; multi-model vote
Quality gatesGate0 deterministic · Gate1 self-check · Gate2 evaluator · Gate3 cortex_review · Gate3.5 red-teamHard fails: format_validity / safety / groundedness < 0.5; review decisions carry node quality/Gate1 context snapshots; red-team adversarially challenges high-impact acceptances (S/M, risk≥0.5 or quality≥0.9) — material defect → downgrade to retry
Recovery enginecortex_recoverFailure taxonomy → retry / switch / prompt-fix / decompose / upgrade / human + failure-pattern learning
Soft-defect correctioncortex_execute / cortex_recoverSoft cap max_delegations (default 3): a capable-but-insufficient result is corrected in place (same model → better model → escalate to supervisor); optional continuable sub-session (config.continuableCorrection) keeps context across rounds; hard failures still use type-based recovery
Price overridecortex_models / UI / CLISet/clear a model's effective price (price/clear_price, or `/cortex models set-price
Budget controlengine built-in4 pools (10/70/10/10), STOP-1..4 (STOP-2 from observed MQC — real ΔQ/ΔC, not hard-coded), 90% high-cost lock, degraded mode
Model evaluationcortex_evaluate7-dim scoring per case; per-model × task-type × capability × 7-dim profile (dims_profile, EMA, persisted across restarts; also fed by production Gate2/cortex_review dims); dynamic capabilities (profile-thresholded caps auto-register into the catalog and union with static capabilities at routing); Rule-First deterministic correctness for structured expected; UI one-click run; value score (Q×SR/Cost) + Pareto frontier; drift monitoring (vs static baseline → automatic routing penalty)
Model registrycortex_models (config/models.yaml)Static YAML + DSH ctx.llm dynamic discovery + enable/disable management; routing scores (ranking preview)
Policy centercortex_policy / cortex_strategy_matchFingerprint similarity, versioned policies, template families with metric-driven grayscale, skip-level tree suggestions
Organization mode (probes & governance)cortex_start.organization_mode / cortex_probeThe organization mode is a task property (standard / department / auto — auto decides by difficulty = max(complexity, scale, risk) against organizationAutoThreshold 0.75; an explicit declaration always wins). Department mode layers 8 built-in probes (requirements/engineering/testing/security/compliance/release/operations/knowledge, append-only custom ones) with scope, tool ceiling, quality floor, budget share and authority tiers P0–P4 (observe/advise/execute/decide/veto), Rule-First fail-closed governance (pass/review/veto → blocked_by_veto freezes the node and its downstream), a hash-chained ledger (governance.jsonl, verifiable), event bus × probe subscriptions → deterministic to-dos (intents.jsonl), adversarial governance review, critical-op approval chain, probe budget hard quota, priority dispatch and ROI ranking — all ledgered, all opt-in per task
Human-in-the-loopengine + cortex_probe interactionsWhen a rule says a human must answer (critical-op approval / veto confirmation / arbitration / human review / supervisor escalation / probe budget), the engine records the question + options + suggested action and, on unattended paths, wakes the conversation so the supervisor asks the user (deduped, batched, delivery recorded: interactions.jsonl); nothing is decided silently
KPIcortex_reportSupervisor calls/task, A-cost breakdown by call kind (start/decompose/review/…) (aByKind), supervisor leverage, saving vs direct primary-model run (negative → orchestration warning), quality, policy reuse rate, node autonomy rate / S-tier cost share / voting & engine-compute stats / admission queue
Phase-3 control planecortex_execute.control / UI / CLIAdmission queue (global + per-task limits, round-robin so big tasks cannot starve small ones), workflow control (pause / resume / terminate / isolate a node's call chain — in-flight calls cancelled, no false failure statuses), review protocols & prompt templates (versioned, append-only, with a contract-gap self-check)
Self-tuningUI “Learn chain” / /cortexBounded parameter proposals derived from recorded evidence (KPI / queue / execution profiles / learning-chain samples), applied only on explicit click with a confidence threshold and a per-run cap, every change ledgered; routing-weight learning (suggest/apply/rollback), budget rebalancing ledger, evaluator-calibration samples, audit snapshots
Web console/cortex ui / 8788Trends / timeline / model registry / capability matrix (4 metrics + 7-dim rows) / evaluation center / L0 tools / learning chain / departments, i18n zh+en follows the DSH General-settings language (the console reads and writes the same locale setting, the header button writes it back through the official settings service, every open console follows over SSE; a console without the settings service reads the document read-only and says so), light/dark theme, CNY/USD display, SSE live updates; no global organization-mode indicator (mode is a task property), department tasks badged per row
Watchdog/cortex watchdog / /watchdogCross-workspace timed task injection + goal-reached auto-iteration: schedule (--at/--after/--every, every ≥300s) injected via the official inbox channel (agent.followup — never writes session events), goal-loop (set goals; after an injected/executed task, the strong model objectively evaluates the conversation against the goals and re-injects improvement guidance until met (met+score double gate) or maxRounds reached), task-list (ordered task chain, each auto-advanced after the previous completes); work windows (global ws window <HH:MM-HH:MM>, cross-midnight/days supported), startAt/endAt, cross-workspace (ws:/session:/workspaceId/workspacePath targets); web console /watchdog + /api/watchdog/*; consecutive eval failures terminalize to failed (observable)

Recent Changes

A condensed log of the capabilities added after the initial release (full per-round evidence lives in docs/开发任务清单.md):

  • Organization mode — department probes & governance (cortex_probe, cortex_start.organization_mode): the mode is a task property (standard / department / auto = engine decides by difficulty = max(complexity, scale, risk), threshold organizationAutoThreshold 0.75; an explicit declaration always wins; domain/capability tags deliberately do not count as difficulty signals). Department mode adds 8 built-in probes (append-only custom), authority tiers P0–P4, Rule-First fail-closed governance (pass/review/veto, veto freezes the node and its downstream, cleared only by an explicit lift), a hash-chained ledger (governance.jsonl, verify-able), event bus × subscriptions → deterministic to-dos, adversarial governance review, a critical-op approval chain (veto-lift / P4 grant / enabling governance suspend until approved), a probe budget hard quota, priority dispatch and ROI ranking. Department mode is a layer on top of standard mode — it never introduces its own model pool, filter or routing criterion.
  • Human-in-the-loop: questions the rules say a human must answer (critical-op approval / veto confirmation / arbitration / human review / supervisor escalation / probe budget) are recorded with options + a suggested action, and on unattended paths the engine wakes the conversation so the supervisor asks the user — deduped, batched, delivery recorded; the console deliberately keeps no second to-do inbox (questions are asked in the conversation; data plane /api/interactions and cortex_probe interactions remain for scripts).
  • Phase-3 control plane: admission queue (global + per-task, round-robin), workflow control (pause/resume/terminate/per-node isolate), review protocols & prompt templates (versioned, append-only, contract-gap self-check), self-tuning proposals with guardrails + ledger, routing-weight learning, budget rebalancing and audit snapshots — all observable in the console's “Learn chain” tab and reachable from /cortex control|tune|org|gate|protocols.
  • Console language follows DSH General settings: lib/locale.js reads the host locale preference (settings service first, settings.yaml read-only fallback) and writes it back through the official settings service; the header button switches it, every open console follows over SSE (with a storage-event/heartbeat fallback so a missing host event can never silently strand the page), and the first paint already carries the language. The session “Tasks” panel registers and renders every label/status/button through it.

Install & Auto-Enable

dsh plugin is the supported way: it installs the package into the profile, and because this package declares dsh.bundle.patch (= cordis.patch.yml), it is automatically appended to dsh.profile.bundles — enabled on next boot with no manual profile edits.

From npm (published):

# install the plugin package as a dependency
yarn add dsh-cortex            # or: npm install dsh-cortex

# register it into a DSH profile and boot
npx @deepseek-ai/dsh plugin --profile web add dsh-cortex
npx @deepseek-ai/dsh web        # boot — the 13 cortex_* tools are live

From a local checkout (development):

cd <repo-path>                                   # the repo root
npx @deepseek-ai/dsh plugin --profile web add .  # anchors to this dir (or pass the absolute path)
npx @deepseek-ai/dsh web

Remove: npx @deepseek-ai/dsh plugin --profile web remove dsh-cortex.

The shipped bundle patch inserts the cortex row with uiEnabled: true, uiPort: 8788 (console listens on loopback only). stateDir and modelsFile use built-in defaults ($DSH_HOME/storages/cortex and the bundled config/models.yaml) — anything can be overridden by an - id: cortex config row in your profile's own cordis.patch.yml (it applies after bundle layers).

Typical Flow (agent view)

cortex_start → (cortex_strategy_match) → cortex_decompose T0 → cortex_execute [node_ids | recursive]
→ cortex_review (batch accept) → cortex_recover (on failures) → cortex_report (KPI) → cortex_policy (settle)

Operations & Commands

1. Agent tools (14 — the supervisor calls them autonomously)

ToolPurposeKey parameters
cortex_startCreate a task (profile → fingerprint → strategy match → budget pool)goal, profile{task_type, domain, complexity, risk, quality_requirement, budget_limit, input_tokens?, expected_output_tokens?, latency_requirement_ms?, language?, capability?}, input, organization_mode? (standard|department|auto — per-task; explicit wins over auto; the reply carries organizationMode{mode,source,reason,difficulty?})
cortex_strategy_matchPolicy-center lookup (3-tier reuse verdict)profile
cortex_decomposeSplit a parent node (safety limits / DAG / replace; large-text split: children[].split {count?, by?} auto-splits into N parallel shard executors + 1 aggregator)task_id, parent_id?, replace?, children[{goal, task_type, capability, output_schema, quality_target?, tool_allow?, depends_on?, type?, split?}]
cortex_executeRoute & execute (Gate0/1[/2], cache, accounting)task_id, node_id?/node_ids?, recursive?, mode? (costFirst
cortex_reviewGate3 batch acceptance (decisions carry quality/self-check snapshots; Gate3.5 red-team)task_id, decisions[{node_id, status, reason_code?, missing_items?, next_action, recommended_depth?, confidence?}], auto?, red_team?
cortex_probeDepartments & governance (probes / per-task mode / authority tiers / ledger / dispatch / ROI / to-dos & approvals / interactions / veto-lift / budget)action (list|show|add|enable|disable|policy|assign|mode|authority|authority-reset|ledger|verify|dispatch|roi|intents|intent-ack|intent-resolve|interactions|interaction-ack|interaction-resolve|subscriptions|approve|veto|lift), task_id?, node_id?, probe_id?, mode?, policy?, reason?
cortex_recoverRecovery decision tree (retry/switch/upgrade re-run in-engine)

2. Slash commands (/cortex <subcommand>)

CommandWhat it does
/cortex statusEngine state: tasks (running), nodes, attempts, policies, models, discipline status
/cortex task <id>Task tree (profile/strategy/budget/nodes)
/cortex trace <id>Execution trail (attempts + decisions)
/cortex kpi [id]KPI report (global or per task)
/cortex models [enable|disable <id>|refresh|reset|set-price <id> <in> <out> [cached]|clear-price <id>]Registry listing; reset clears evaluation feedback; enable/disable toggles; refresh re-discovers dynamic models; set-price/clear-price set/clear a model's effective price (persisted, 3-tier priority)
`/cortex policies [disableenable ]`
/cortex model-pref [set <id> [reason]|clear|show]Set/clear the preferred executor model with preference content (reason = which tasks it suits): routing adopts it when the task scene is covered by the content (>=50%) + active + quality <0.9 (user preference is authoritative — capability tags are advisory only, prefCapabilityMismatch audited; failed executions auto-upgrade via the recovery engine); persisted; same as page ★
/cortex l0L0 deterministic tool library (list/show/remove/generate/run)
/cortex rate [refresh]USD→CNY rate (refresh forces fetch)
/cortex resetDelete state files + clear in-memory store + reload static registry + immediately re-discover models from DSH (no host restart needed); newly discovered third-party models are dedup-merged into config/models.yaml (append-only, comments preserved) so they join the static registry permanently
`/cortex ui startstop
/cortex watchdog <add task|add goal|list|rm|pause|resume|run|goal|ws|ui>Watchdog: cross-workspace scheduled task injection (at/after/every, ≥300s) + goal-loop auto evaluation & remediation until reached (startAt/endAt optional; global work window 09:00–18:00; ws window to set/clear; consecutive eval failures terminalize to "failed" for visibility)

3. Console REST (127.0.0.1:8788)

GET  /api/overview · /api/timeline?hours=all|24|168 · /api/rate · /api/models
     /api/matrix · /api/evaluations · /api/eval-cases · /api/capabilities
     /api/evaluate/status · /api/task/<id> · /api/tasks?limit&session · /api/events (SSE live)
     /api/organization[?dispatch=<taskId>] · /api/interactions · /api/control
     /api/protocols[?task=<id>] · /api/tune · /api/budget · /api/routing
     /api/kpi-snapshots · /api/lang · /api/watchdog/calibration
POST /api/models/<id>            {enabled?: boolean, preferred?: boolean, reason?: string}   // reason = preference content (required on the page)
     /api/matrix/reset           (clear evaluation feedback)
     /api/eval-cases             {action: add|remove|save, ...}
     /api/capabilities           {name, description?}
     /api/evaluate               {models?, cases?, use_saved?} (real background run)
     /api/tasks/<id>             (DELETE — remove a history task with its nodes/attempts)
     /api/tasks/<id>/control     {action: pause|resume|terminate|isolate|unisolate}
     /api/control/purge          {kinds?, reason?}        (audit-purge, itself ledgered)
     /api/organization           {action: mode|assign|approve|intent-ack|intent-resolve|interaction-ack|interaction-resolve, ...} (whitelisted)
     /api/interactions           {action: ack|resolve, id, note?}
     /api/protocols              {protocol?|template?}   (versioned append-only writes)

     /api/lang                   GET  → {value, writable, pushed, settingsFile}   (console language follows DSH General settings)
                                 POST {lang} → writes the host `locale` setting through the official settings service
     /api/watchdog               {action: add-task|add-goal|pause|resume|remove|run|window-set|window-clear|ws-add, ...} (whitelisted)
GET  /watchdog · /api/watchdog/rules|runs?limit=50|targets|windows   (watchdog page, uses /api/events SSE)

4. Runtime lifecycle

  • Mount: apply → registry load (static YAML + persisted overrides + model states) → heartbeat stateDir/mounted.json → optional console → usage-settle timer (60s, zombie sweep every 5 ticks) → dynamic model discovery.
  • Per turn: orchestration-discipline context is injected per conversation session (suppressed only when that session has a flow active within 15 min); other sessions' leftover flows never suppress.
  • Unmount / restart: effect dispose stops the console (active SSE connections destroyed — no hang) and clears timers; everything durable lives in the state dir (tasks/nodes/policies/profiles/model states/rate) and rebuilds on restart (last-write-wins).
  • Self-healing: zombie tasks (running, 4h silent) are finalized automatically; evaluation feedback and drift baselines survive restarts; /cortex reset wipes state files for a fresh start (instant: store cleared, static registry reloaded, then DSH re-discovered); dynamic model discovery also refreshes automatically once a day (modelRefreshHours, default 24, 0=off).

Model Allocation (sub-agent pipeline)

  • Sensitivity tiers (driven by qualitySensitiveOf): S (complex planning / arbitration / final review / correction — needs strong reasoning), M (planning / numeric-statistics / key evaluation / visual detail — weak models may repeat & vote), L (regular execution). Decision records carry sensitivity.
  • Strongest fallback chain (strongestOf): configured strongestModel (must be active) → else derived from live profiles (tier → defaultQuality → measured quality → exec success rate). If no strongest model is configured, the current best available model IS the strongest — S-tier roles never stall; the mapping shifts dynamically as profiles update.
  • Sub-agents per node: planAgent (cortex_decompose auto:true — strongest model generates children), reviewAgent (cortex_review auto:true — threshold auto-accept for regular nodes + review sub-agent for anomalies/high-sensitivity), fixAgent (config.fixAgentAuto — on escalation/upgrade the strongest model may deliver a fix or the corrected answer directly).
  • Weak-model voting (repeat_vote, M/S tiers): the same model executes N rounds (2-5) and results are merged by agreement (pass/evaluate/arbitrate) — reliability of a strong model at ~1/100 cost.
  • Deterministic statistics (V8.0 §5.1 L0 tier): statistics/counting nodes become "extract (model, vote/early-stop) → majority-merged records → engine computation" — the model only extracts records (EXTRACT_CONTRACT); counts/aggregations are computed by lib/engine/compute.js (zero cost, replayable), eliminating model-count drift; type:"compute" = L0 engine node (decompose accepts compute:{ops:[...]}, inferred from goal by default) — results carry quality_source:"engine" (E tier, auto-accepted without supervisor review).
  • Pure-text statistics direct compute: word frequency / char / word / line counts — text is the data: the engine tokenizes and counts the source text directly (zero model calls, exact to each token, reproducible); entity-level stats still go extract+engine.
  • V8.0 metrics: cortex_report adds node autonomy rate (autonomyRate), S-tier cost share (cost.sShare) and voting/engine stats (voting: repeat attempts/cost, engine computes, estimated saving); UI report cards updated.
  • L0 capability library: AI-generated deterministic tools accumulate at runtime (, versioned) — execution checks first (id/name/keyword match → zero-cost engine run; explicit missing + allowed → strongest model generates code → (vm zero-trust / forbidden tokens / timeout / double-run determinism / sample+Gate0) → stored → executed; unverified code never runs); auto-disable after 3 consecutive failures; , , "L0 tools" UI tab.

Model Profiles (how they update)

  • Evaluation write-back (cortex_evaluate / one-click UI run): per task-type quality EMA + success rate + cost/latency + 7-dim capability profiles (dims_profile), persisted in profile_overrides.json (drift baselines anchored at first measurement).
  • Execution feedback: every real node execution (non-cache) updates deterministic counters — attempts/complete/failed + failure-type & task-type distributions, persisted in the same file; when samples >= 3 (EXEC_PROFILE_MIN_SAMPLES), routing uses the measured success rate instead of the static one (the more it is used, the truer the profile, the better the routing). Quality scores still come from evaluations only (Gate1 self-checks never pollute profiles).
  • POST /api/matrix/reset or /cortex models reset restores static baselines (evaluation + execution feedback).
  • Measured-only scores: the capability matrix shows a value only for verified capabilities (evaluation/execution write-back keys, tracked in measured); static declarations and defaultQuality never masquerade as verified scores — unverified cells display "no measured data".

Sub-Model Capabilities & Media Support

Executors (routed sub-models) are self-contained worker agents. What they can and cannot do:

Capability dimensions include media tags: image_analysis (declared by vision-capable models — image tasks filter by it) and audio_video_analysis (catalog dimension; no model declares it yet — matrix stays empty until a media-capable model/MCP is configured). Decompose image subtasks with capability: ['image_analysis'] (not document_analysis). Route-time closure: for nodes with image input, routing merges image_analysis into the need and applies an AND-hard-filter for media-exclusive capabilities — text-only models (even strong tiers) are excluded at routing (executor pre-check stays as the second line; force_models/preferred paths remain authoritative and call the user-chosen model).

DimensionSupported
Inputtext, files (read/glob/grep), images (read_image / MCP browser), URLs (web_search/web_fetch, read-only) — also base64 images (data:image/...;base64 or {image_base64, mime}) auto-decoded to a real file for the executor
Tools (agent mode)read glob grep read_image + web_search/web_fetch (read-only, default; override via executorExtraTools) + mcp__* (any configured MCP server — e.g. Playwright screenshots) + skill + business-plugin prefixes (default tssdp_)
PolicymediaPolicy: auto (default — media input forces agent mode + contract), reject (explicit fast-fail with diagnosis), pass_through (hand to MCP)
Outputstructured JSON + optional top-level artifacts [{path, mime}] — engine validates existence & magic bytes (png/jpeg/webp/gif/mp4/mp3/wav/pdf); invalid → node failed with audit trail
By default deniedwrite/edit/shell (pwsh/bash/run_code) and re-orchestration (subagent/workflow/cortex_*/…) — an explicit per-node tool_allow swaps in a custom allow list for artifact-producing tasks
Honest limitsDSH provider modalities are text + image only — audio/video understanding requires a media-capable MCP/multimodal route; otherwise the executor returns the {"unsupported": true, "reason": ...} contract (never invents content), or mediaPolicy: reject fails fast with a clear diagnosis

Example flows: image analysis → cortex_execute on a node with image references (agent mode + read_image/MCP); screenshot/poster generation → Playwright MCP + artifacts declaration (magic-byte validated); audio/video processing → only with a media MCP configured (else explicit diagnosis, classified INPUT_FAILURE).

Preferred-model fallback: when a preferred executor (e.g. a text-only L1 model) is handed an image task, it runs first (attempt is recorded). The executor now pre-checks modality deterministically (modelAcceptsImage via host llm.resolveModelInfo): a model that does not declare image input fails fast with model lacks image modality (no generation — a text model must never be allowed to fabricate read-image evidence; observed in production: invented 800x600 / white-pixel result for a 1x1 red PNG). The recovery engine detects the gap and switches directly to a vision-capable candidate — no unnecessary decompose/upgrade round-trip.

Host prerequisite for vision: the vision model must declare inputModalities: [text, image] in the host's llm-deepseek.models entry (e.g. ~/.dsh/settings.yaml) — otherwise read_image refuses with "model does not declare image input" (the catalog default for undeclared entries is [text]).

Cost Model

  • Executor models (sub-models): exact TokenUsage from subagent/chat sessions (billed = input + cache read/write), priced from the registry — true token accounting.
  • Supervisor (primary model): real session-model usage via DSH sessionProjections/tokenMeter (the tokenUsage projection returns {totals:{uncachedInputTokens, outputTokens, cacheReadTokens, cacheWriteTokens}}; Cortex normalizes both nested and legacy flat shapes, so outputTokens is captured for accurate A-cost — fallback estimate only when no projection exists), plus a "vs direct primary-model run" baseline saving in cortex_report (85% cache-hit discounted).
  • Single ledger (usage.jsonl): task cost / global KPI / timeline all derive from usage rows (multi-vote, sub-agent, Gate2 and supervisor calls included); session-level conversation ledger dedupes detail rows across buckets — including across restarts via the cumulative anchor (no double-count).
  • Budget pools cover every cost: supervisor calls map to pools by kind (start/replan→plan, review/fix/evaluate→quality, recover/escalate→emergency), aggregate nodes→exec; the documented 90% high-cost lock is live (usage ≥90% → new L2/L3 excluded in routing, plus an exec-spend guard).
  • Peak pricing unified: models.yaml peak windows (×2) apply to A and sub-models alike (peakPricing config, default on; Sundays/weekends off-peak).
  • UI-triggered evaluations run without a supervisor (chat path) and are not counted as supervisor calls.
  • Effective price override (cortex_models.price/clear_price, UI, or /cortex models set-price|clear-price): a user-set unit price overrides the default, while a model/provider authoritative price wins over both; persisted (survives restarts) and used for routing cost scoring.

Development

npm test                 # node --test (engine/service/ui/watchdog unit + smoke + mocked full flow) — 512 tests
node scripts/mock-flow-scenario.mjs  # **mocked end-to-end scenario matrix** (success/failure/repair/recovery/governance/interaction/dept-vs-standard parity, 9/9, zero model calls)
node scripts/org-scenario.mjs        # department probes & governance scenario matrix (incl. per-task organization mode, 17/17, zero model calls)
node scripts/phase3-scenario.mjs     # phase-3 scenario matrix (queue/control/protocols/self-tune, 6/6, zero model calls)
node scripts/verify-http-org.mjs     # governance REST end-to-end (incl. the interaction data plane and per-task mode, 40/40)
node tools/verify-post-restart.mjs   # post-restart self-check (8 checks, incl. JSONL integrity + policy refs + the interaction channel)
node tools/verify-live.mjs [baseUrl]  # **live-instance self-check** (35 checks, read-only, zero model calls): page markers (removed UI absent, new UI present) + org/interaction/task/control/protocol/self-tune/overview + routing-weights data plane & rendering + **console-language follow (/api/lang + first-paint marker)** + per-task mode fields
node scripts/verify-server.mjs       # isolated console (defaults to a **temporary state dir**, removed on exit; pass CORTEX_VERIFY_STATE_DIR to inspect real data)
node tools/smoke-ui.mjs              # UI script syntax + SSE + model toggle

Versioning & releases: the version is read from package.json; bumping it (e.g. npm version patch) and pushing to main — after tests pass — auto-creates an annotated tag v<version>, generates a GitHub Release from the git log, and publishes to npm. Pushing the tag is not re-CI'd (no duplicate runs).

Repository Layout

app-pkg/index.js   entry forwarder (rollout cache-bypass, same pattern as dsh-tssdp)
app-pkg/client.js  browser client bundle (sidebar footer action + settings section + session 「Tasks」 tab)
lib/index.js       plugin entry (name/inject/apply + lifecycle, language-follow bridge)
lib/service.js     CortexService facade (high-level operations behind the tools)
lib/tools.js       14 agent tools
lib/cli.js         /cortex command group
lib/ui-server.js   local web console (127.0.0.1:8788) + watchdog page
lib/locale.js      console language bridge (DSH General-settings locale; read via settings service or settings.yaml, write via the official settings service)
lib/watchdog.js    cross-workspace scheduled task injection + goal-loop remediation
lib/watchdog-cli.js /cortex watchdog command handlers
lib/engine/*.js    pure engines (fingerprint/router/budget/quality/recovery/store/executor/kpi/granularity/compute/l0/weight-learn/calibration/peak/state-reset/probe/governance/protocols/interaction/queue/self-tune/task-view/bus/util)
config/models.yaml model registry (overridable)
test/              node --test suites (incl. mock-flow: full pipeline driven by a mock host)
scripts/           scenario matrices + the shared mock host (mock-host.mjs used by tests and scripts)
tools/             verification/dev scripts

Feedback & Issues

Found a bug, a misleading description, or a feature you'd like to see? Open an issue on GitHub:

  • Issue tracker: https://github.com/iguowz/dsh-cortex/issues
  • Please include: DSH version, Cortex version (from /cortex status), the operation you ran, and the full error/trace output.

Questions, suggestions and feature requests are welcome too.

License

MIT

one cortex dictionary (zh+en)
  • Console simplification: the global organization-mode switch and the “default mode” badge are gone (mode is per task; each task row still shows its own mode badge), the “needs your action” block is gone, and the remaining panels (probes / responsibility matrix / authority / ledger / dispatch / to-dos / ROI / learning chain / L0 / evaluation) are all business-worded with no raw JSON and no framework names.
  • Quality & routing depth: Gate3.5 red-team, per-dimension capability profiles (dims_profile, EMA) fed by evaluation and production Gate2/review, drift monitoring with automatic routing penalties, value score + Pareto frontier, static-baseline reset, effective price override (3-tier priority), L1/L2/L3 cache, deterministic statistics via type:"compute" engine nodes, and an L0 deterministic tool library that is generated and sandbox-verified at runtime.
  • Maintainability pass: shared numeric helpers (lib/engine/util.js) replace nine sets of duplicated implementations; the browser bundle's UI text lives in one dictionary (a regression test forbids hard-coded Chinese in the bundle); dead exports/CSS/scripts were removed with evidence.
  • task_id, node_id?
    cortex_policySettle a policy from a successful tasktask_id, note?
    cortex_reportKPI report (per task or global)task_id?
    cortex_modelsModel registry / profiles / routing scores / drift / price overridetask_type?, capability?, model?, enabled?, refresh?, reset?, price?, clear_price?
    cortex_evaluateModel evaluation (7-dim × capability profiles, value/Pareto)cases?, use_saved?, models?, task_type?, quality_target?
    cortex_eval_casesEval-case library (page + conversation shared)action? (list
    cortex_capabilitiesCapability catalog (append-only)action? (list
    cortex_l0L0 deterministic tool library (list/show/add/remove/generate/run)action?, keywords, allowed?
    /cortex routing [suggest|show|apply|rollback]Route-weight learning: sample-driven weights suggestion (suggest), show current, one-click apply, rollback — automation driven by per-node routing samples + drift
    /cortex budgetBudget rebalancing: shared-pool balance + ledger (dynamic reclaim/re-distribution)
    /cortex calibrationEvaluator-calibration chain (historical contradictory samples across review vs self-check vs terminal state)
    /cortex org [mode <standard|department|auto> [task]|dispatch [task]|roi [task]|intents|ledger [probe]]Departments & governance: per-task mode (or global default), priority dispatch, department ROI, to-dos/approvals, ledger view
    /cortex gate <interactions|approve|veto|lift|protocols>Governance gate: pending human questions, approve a suspended critical op, explicit veto / lift, review protocols & prompt templates
    /cortex control <status|pause|resume|terminate|isolate|unisolate|purge> [task] [node]Phase-3 workflow control (admission queue snapshot + per-task/per-node control), audit purge
    /cortex tune [apply|history]Self-tuning proposals (dry-run by default) / apply with guardrails / ledger
    /cortex helpCommand usage
    stateDir/l0_capabilities.json
    l0:"id"
    sandbox verification
    cortex_l0
    /cortex l0
  • Auto mode: autoMode(task) — quality_requirement≥0.9 ∥ complexity≥0.8 ∥ risk≥0.8 → qualityFirst automatically (no manual mode).
  • §7.1 KPIs: convergence rate / avg tree depth / cache hit rate (task-level + global, deterministic definitions); attempts now carry fromCache/cacheLevel (cache hits observable); no duplicate cache rows on hit (same-key idempotent).
  • §4.13 learning chain ⑤ + §7.1 global model usage: distillation dataset stateDir/distill.jsonl — L3 (strongest tier) high-quality outputs (execution / multi-vote consensus / S-delegated plan·review·fix·L0 generation) auto-collected when quality ≥ distillMinQuality (0.9), capped at 500 rows, observable via report distill{rows,models,lastAt}; globalKpi models gains tierUsage/upgradeRate/fallbackRate.
  • Domain-dimension profiles (§4.12 model×domain×task-type): domain_profiles[domain][taskType/cap] — EMA write-back from evaluation/Gate2 (same alpha, cross-restart deep-merge persistence); routing fallback chain domain → type-level → 7-dim mean → default (predictQuality(model, node, env.domain)); cortex_evaluate adds domain param (single-domain case set auto-inherits); cortex_models displays domain profiles.
  • 相关插件

    继续浏览 agents-orchestration 分类下经过校验的插件。

    Headless@deepseek-ai/dsh-headlessdsh one-shot bundle:基于 dsh-base 的直接核心 Agent/Session 运行器,不包含 Host、HTTP 或浏览器层Experimental Agent Team Web Profile@deepseek-ai/dsh-experimental-agent-team-web-profile用于 Agent Teams Remote 和 UI 插件的实验性 Web 配置层Subagent Codex@deepseek-ai/dsh-subagent-codex基于官方 app-server 协议的一次性 Codex 子代理提供程序Subagent Claude Code@deepseek-ai/dsh-subagent-claude-code基于官方 Agent SDK 的一次性 Claude Code 子代理提供方