jiushu-governance
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@jiushu-governance submit a long task and show me its progress"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
九枢 · 智能体进化治理运行时(Nine Pivots Governance Runtime)
一套纯 Python 标准库实现的智能体自治进化治理运行时:让智能体在"进化演习"中跑得起来,也停得下来——每一步都有闸口把关、有台账留痕、有检查点可续跑。
无第三方依赖,Python >= 3.7 即可运行。
这套东西解决什么问题
让智能体自主进化(自动出题、自动执行、自动晋升)最怕两件事:跑飞了没人拦,和跑挂了没法接。九枢把这两件事都变成流程的一部分:
跑之前:准入闸先审任务(羲和 L1),没有稳定基线不许晋升(后土 L3 终审);
跑之中:过程监控盯着输出(真武 L2),违禁即冻结,冻结后先自愈再上阵(女娲);
跑之后:产物锁档进哈希链(玄圭),判据核验、回放指纹比对、五本台账验链(太阴),全过才算数;
中断了:长任务模式逐步落检查点,从断点接着跑,已完成步骤不重跑。
Related MCP server: LinkedRun
组件一览
文件 | 角色 |
| 宪章:九枢定义、阵型与载史台账 |
| 立阵:把九个枢逐一绑上真实闸口 |
| L1 准入:任务进门先审 |
| L2 监控:输出批违禁即冻结 |
| L3 终审:对照稳定基线决定晋升 |
| 统一裁决内核(含女娲自愈) |
| 锁档:产物写入 Merkle 链正本库 |
| 记忆机:事件流正本 + 快照对账 + 回放 |
| 证据链验收引擎(薄编排器) |
| 派活与执行器隔离(fork 子进程) |
| 长任务模式:异步派发 / 断点续跑 / 进度可查 |
快速开始
# 长任务自测(7 项检查全过即部署就绪)
python3 九枢长任务.py selftest
# 派一个内建慢工件(生产实跑)
python3 九枢长任务.py submit prod
# 查进度
python3 九枢长任务.py status
# 中断后续跑
python3 九枢长任务.py resume <task_id> [--force]其他组件各自带自测:
python3 九枢载道.py selftest
python3 九枢执闸.py smoke
python3 玄圭试点.py selftest
python3 九枢一期试点.py selftest
python3 九枢二期编排.py selftest长任务模式
九枢长任务.py 补齐长活三件事:
异步派发:
submit()立台账即返回任务号,工位子进程(fork + setsid)脱离调用方独立跑完,跑完把验收报告锁档回填台账;断点续跑:七步流程(准入 → 执行 → 锁档 → 裁决 → 终审 → 判据 → 验真)每步落检查点,
resume()从上一步续跑,已完成步骤不重跑(留痕追加不覆盖);进度可查:
status()随时报进度(n/7)、当前步、耗时与产物号;工位失联心跳逾刻如实标注中断,不静默。
自定义任务写一个 Python 文件、暴露 TASK 字典即可(见 tasks/task_example.py):
python3 九枢长任务.py submit tasks/task_example.py诚实边界
断点粒度=步:执行步不可半途续跑,只可整步重跑(重试不静默,全部留痕);
同一时刻建议单工位串行(台账层未做多工位调度);v0.1.1 起共享正本(玄圭锁档链)与检查点均已加跨进程文件锁,锁档按内容哈希幂等(断点重跑不产生双锁);v0.1.2 起所有续跑路径(含非强制)均校验旧工位存活(僵尸态视为已退出),活工位一律拒续跑;
任务定义中的
test_fail_after_step仅为自测钩子(模拟中途被杀),生产件禁用;玄圭 Merkle 链为共享正本,自测产生的记录同样入链——这是设计口径,不是缺陷。
版本记录
v0.1.2(2026-11-26):发布后红蓝自攻(正反合)坐实四项缺陷并修复——①P0 长任务台账锁原打在被
os.replace反复替换的台账文件上,并发时锁随 inode 分裂、临界区重叠,叠加共享.tmp路径会坏档(并发提交实证两段 JSON 拼接);改为专用永不替换锁文件+锁内取号+唯一临时文件名;②P1 工位存活校验原只挂--force路径,误判中断后普通续跑会派双工位(实证执行留痕翻倍);扩到所有续跑路径,另补父进程登记间隙的工位自补 pid;③P1 提交取号原在锁外(读条数+1),并发提交撞号;取号入锁;④P2 玄圭回滚窗口原只覆盖审计段,确权链追加后、回执写完前的失败留「有叶无锁」孤儿叶且校验对其盲(实证 1 叶 0 锁仍报全绿);回滚窗口扩至副本→确权→回执→审计全程,verify()增加叶↔锁一一对应检查(orphan_leaves字段)。附带修正:准入拒收原因改读reasons_denied(原读reason恒空,溯源断链)。玄圭自测 14/14、长任务自测 9/9(含并发登记、活工位拒续跑、孤儿叶现形等新回归)。v0.1.1(2026-11-26):评审驱动修复——①玄圭共享正本加跨进程文件锁+资产号盘上重算,双进程并发写不再撞号覆盖;②
verify()增加逐资产哈希核验,覆盖写/丢件/篡改一律现形(v1.0 对覆盖写盲);③锁档按内容哈希幂等,断点重跑不产生双锁;④锁档半途失败全量回滚(弹 Merkle 叶+删副本),不留孤儿叶;⑤检查点加跨进程写锁,强制续跑前校验旧工位存活。玄圭自测 11/11、长任务自测 7/7。
设计纪律
重试不静默:失败与重试全部留痕,追加不覆盖;
契约冲突响亮失败:证据引用不符契约即拒,不降级兼容;
无证据不结案:缺证据的判据报错而非跳过;
回放验证:报告出库前,留痕指纹与事件流回放指纹必须一致。
防篡改前提(统一声明):本链可发现局部或单点篡改;持有全量记录的攻击者可整体重写并重算通过——链头哈希需带外留存(或对链头签名)方可对抗整体重写。
MCP 服务壳
mcp_server.py 把九枢的长任务能力与记忆机以 MCP 工具形式对外暴露,
供任意 MCP 客户端(Claude、Cursor 等)通过 stdio 调用。
运行时本体零依赖纯标准库;服务壳仅额外依赖 mcp 包(pip install mcp)。
Tool | What it does |
| Run the full self-test (9 checks) and return per-item results |
| Async-dispatch a long task ('prod' built-in or a task file path); returns the task id immediately |
| Query progress (n/7), current step, elapsed time, asset refs and errors |
| Resume from the last checkpoint; completed steps are never re-run |
| Read the event stream (read-only) — the source of truth |
| Replay events up to a timestamp into a state snapshot (read-only) |
| Latest state fingerprint + retention report (read-only) |
Client configuration (stdio):
{
"mcpServers": {
"jiushu-governance": {
"command": "python3",
"args": ["-m", "mcp_server"],
"env": {
"JIUSHU_HOME": "/full/path/to/jiushu-governance"
}
}
}
}Safety boundary: only task dispatch/query/resume and read-only memory operations are exposed. No ledger deletion, overwrite, or gate bypass is available through MCP.
道统映射表(命名即种子)
九枢——九根枢纽柱,撑起治理殿的顶。命名即架构:治理不是一道墙,而是多根柱子各承其力、缺一即倾:
道统 | 仓内落位 |
命名即种子:九枢=九柱承顶,闸口分层各司其职 | L1 准入闸/L2 过程监控闸/L3 终审闸三柱立殿 |
裁决有链:每条裁决落哈希台账,不丢、可校验、篡改即现形 |
|
判决标准不归调用方:自带阈值即协议违规,内核只认冻结配置 |
|
无证据不结案:终审每条结论必须携带证据引用 |
|
断点可续:长任务逐步落检查点,失联如实标注不静默 |
|
令牌防冒用:HMAC 签发,过期与篡改皆验出 |
|
回归铁律:改动后历史用例必须全绿 |
|
License
Apache License 2.0,见 LICENSE。
Available Tools
7 toolsmemory_eventsA
读取记忆机事件流(只读):since_ts/until_ts 为 Unix 秒(0 表示不设限), 返回时间窗内的事件列表。事件是体系状态的唯一正本。
Inputs: since_ts, until_ts. Returns: result
memory_replayA
按时刻回放事件流得到状态快照(只读):at_ts 为 Unix 秒(0 表示现在), 返回重放后的状态与事件计数,可验证「留痕可复算」。
Inputs: at_ts. Returns: result
memory_snapshotA
取最新状态快照并返回留存报告(只读):含当前状态指纹、 快照留存统计与保留策略情况,用于对账与巡检。
Inputs: no named parameters. Returns: result
selftestA
跑九枢长任务全量自测(9 项检查:派发/进度/验收/断点/并发等), 返回逐项结果。沙箱等受限环境中 fork 并发检查可能 FAIL(环境限制,非代码缺陷)。
Inputs: no named parameters. Returns: result
task_resumeA
断点续跑:从检查点续跑指定任务,已完成步骤不重跑(留痕不重复)。 force 仅在工位已确认失联时使用;活工位强制续跑会被拒绝。
Inputs: task_id (required), force. Returns: result
task_statusA
查询长任务进度:全部任务或指定任务号的进度(n/7)、当前步、耗时、 产物号与错误信息。工位失联会被如实标注为 INTERRUPTED,可续跑。
Inputs: task_id. Returns: result
task_submitA
异步派发一件长任务,立取任务号,工位子进程后台跑全链(七步闸口)。 source 取值:'prod'=内建生产件;或任务文件路径——仅允许白名单目录 <JIUSHU_HOME>/tasks/(或 JIUSHU_TASKS_DIR)下的文件(v0.1.3 H-1 修复), 白名单外路径在模块执行前即拒收。
Inputs: source. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The set splits cleanly into two clusters (task_* for long-task orchestration, memory_* for read-only audit) and submit/status/resume are clearly distinguishable by action. The only soft overlap is memory_snapshot versus memory_replay at at_ts=0 (now), since snapshot is effectively a replay-at-present plus a retention report; the descriptions mostly disambiguate but an agent could still pick the wrong one for a point-in-time state query.
Six of seven tools follow a clean prefix_noun convention (task_submit, task_status, task_resume, memory_events, memory_replay, memory_snapshot) with the prefix mapping to the cluster. The lone outlier is 'selftest', which has no prefix and no verb_noun structure.
Seven tools is well within the ideal 3-15 range and each one maps to a distinct operation (self-check, dispatch, poll, resume, two reads, one snapshot/report). Nothing appears padded or redundant for a governance/audit server.
The task lifecycle covers submit, poll, and resume, but there is no cancel/abort tool and no way to retrieve the artifacts or per-step output referenced by 产物号 in task_status, which is a real dead end for an agent handling a failed or unwanted task. The memory side is fully read-only by design, so its surface (events, replay, snapshot) is adequate, making the gaps moderate rather than severe.
Maintenance
Related MCP Connectors
Evidence-graded agent-work lanes, bid advice, live agent jobs and a hash-chained evidence ledger.
Independent witness for agent work: verified handoffs, bound approvals, and receipts.
Execution control plane for agents: capabilities, durable jobs, budgets, receipts, and BYOK.
Read-only gateway for durable agent identity, consent, recognized work, and signed receipts.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceOrchestrates persistent task graphs and enforces approval policies for MCP-driven agent workflows, coordinating with Agents Gateway for execution.MIT
- AlicenseAqualityCmaintenanceEnables agents to submit and manage persistent, dependency-aware task graphs with immutable artifacts, resource reservations, durable event streaming, and retryable process execution over MCP.12MIT

genpark-long-horizonofficial
AlicenseNot gradedqualityBmaintenanceEnables long-horizon autonomous task checkpointing and resumption through cryptographic event-sourced state persistence, idempotency key deduplication, timeout heartbeats, human-in-the-loop pause/resume tokens, and fail-safe recovery.7MIT- AlicenseNot gradedqualityNot gradedmaintenanceEnables agents to persist and resume long-horizon tasks using cryptographic event-sourced checkpoints, idempotency deduplication, scheduled heartbeats, pause/resume tokens, and fail-safe recovery.MIT