DESIGN.md@adapters/zcode/official_bridgeA

DESIGN.md@adapters/zcode/official_bridge from freehul/sgme is a DESIGN.md file: the design rules coding agents follow in that repo.

Install it, pinned
mdr add freehul/sgme/adapters/zcode/official_bridge/DESIGN.md@git:20261103.dcaf14a

Pins git:20261103.dcaf14a in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 14 of 14 checks passed
Kind
DESIGN.md file
Repository
freehul/sgme
Path
adapters/zcode/official_bridge/DESIGN.md
Versions recorded
1
Latest version
git:20261103.dcaf14a, committed Nov 3, 2026
Size
3,407 bytes
Repository stars
15
License
MIT

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

# 设计说明:ZCode 官方通道桥(official_bridge)

## 1. 为什么需要它

- ZCode PC 端的赠送额度(Start Plan / ZCODE GLOBAL BUILD)**不是普通 API Key**:端点 `https://zcode.z.ai/api/v1/zcode-plan/anthropic` 要求账户 JWT + **V4 客户端请求签名**,并且会校验请求体是否被代理改写;第三方网关(magpie 等)改 body 后会被风控 405/3012。
- 官方 CLI(`zcode.cjs`)在进程内完成 OAuth/JWT、签名与请求构造,是唯一合规且可自动化的通道。
- SGME 的提炼/重建只支持 OpenAI 兼容供应商,因此需要一层“官方 CLI ↔ OpenAI”桥。

## 2. 架构

```
SGME  ──HTTP──▶  bridge.py (127.0.0.1:8899/v1/chat/completions)
                     │  每个请求:prompt 写入临时文件
                     ▼
         node zcode.cjs -p <短指令> --attach prompt.txt
              --cwd <隔离目录> --mode plan --surface terminal
                     │  官方 CLI 内部完成签名/风控合规
                     ▼
           ZCode 官方端点(Start Plan / Coding Plan)
```

- 桥不保存凭据、不读取 CLI 的 `config.json`;身份完全由官方 CLI 的登录态决定。
- 并发用信号量(默认 2);单次调用超时、429/3012/MCP 错误分别归类并映射为 HTTP 429/502。

## 3. 身份模型(关键)

| 套餐 | 凭据形态 | 能否直连 | 桥怎么用 |
|---|---|---|---|
| ZCode Coding Plan | API Key(`id.secret`) | 可以(标准 Anthropic 端点) | 可直接用 SGME 的 openai_compat,不需要本桥 |
| ZCode Start Plan(赠送额度) | 账户 JWT + V4 签名 | 不可以 | 必须让 CLI 以**同一账号**登录(`zcode login bigmodel` / `zai`),由 CLI 签名 |

实践要点:
- 登录用错账号(例如登成另一个只有 coding-plan 的账号)会得到 `429/1113 无资源包`;
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add freehul/sgme/adapters/zcode/official_bridge/DESIGN.md@sha256:4bf3727b46546fa9

The line at the top of this page pins the label git:20261103.dcaf14a, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_vwlnztqxyonh3z3t.svg)](https://markdownregistry.com/a/art_vwlnztqxyonh3z3t)

1 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 1 version of this file, committed on Nov 3, 2026.

versioncommittedcommitsizeaudit
git:20261103.dcaf14a latest2026-11-03 dcaf14a 3,407 BA view

Audit of the latest version

A  14 of 14 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Size between 200 bytes and 200 KB (3407 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

freehul/sgme · 15 stars · license MIT · pushed 2026-11-06 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_vwlnztqxyonh3z3t
GET https://markdownregistry.com/api/v1/resolve?ref=freehul/sgme/adapters/zcode/official_bridge/DESIGN.md
GET https://markdownregistry.com/api/v1/blob/4bf3727b46546fa9d8c7ea2a3f47c799becf143c57e4afa950228a508bb880fa

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: what DESIGN.md is and how agents use it · which agent file does what.

More from freehul/sgme

AGENTS.md AGENTS.md file
freehul/sgme · AGENTS.md
git:20261105.664942f · audit A · 15 stars
sgme-claude-code SKILL.md skill
freehul/sgme · adapters/claude-code/SKILL.md · Claude Code 的 SGME 官方适配器(MCP stdio 动态透传 + 原生 hooks:SessionStart 注入 / Stop 落盘 / SessionEnd…
git:20261029.e6a8704 · audit A · 15 stars
sgme-codex SKILL.md skill
freehul/sgme · adapters/codex/SKILL.md · Codex 的 SGME 官方适配器(动态 MCP 代理 + 会话生命周期 CLI)。当对话涉及历史事实、用户偏好、记忆读写、技能检索、Wiki 查询或提炼触发时使用。接入标记:SGME-ONBOARDING-v2。
git:20261029.e6a8704 · audit A · 15 stars
sgme-bridge SKILL.md skill
freehul/sgme · adapters/doubao/SKILL.md · 豆包工作 ↔ SGME(拾光记忆引擎)官方适配器。SGME 是主人的长期记忆中枢(HTTP API <NAS_IP>:9910,MCP <NAS_IP>:9913),负责跨会话/多 Agent 的记忆提炼、按场景注入、wiki…
git:20261102.cbe83bb · audit B · 15 stars
dsh SKILL.md skill
freehul/sgme · adapters/dsh/SKILL.md · DeepSeek Harness(dsh)的 SGME(拾光记忆)官方适配器(Cordis TS 原生插件)。当对话涉及「以前/上次/还记得/历史事实」、要求记住某事、需要关怀信号/角色扮演、读写 SGME…
git:20261102.cf476fc · audit B · 15 stars
wiki-skill-discovery SKILL.md skill
freehul/sgme · adapters/dsh/skills/wiki-skill-discovery/SKILL.md · 发现并加载 SGME 知识库中的技能手册。当任务需要操作手册(如 SGME 运维、GitHub 操作、弱电流程)或不确定知识库有哪些手册时使用——按分类列目录、按描述判断、拉全文执行。
git:20260816.10a3ed6 · audit A · 15 stars
hermes SKILL.md skill
freehul/sgme · adapters/hermes/SKILL.md · Hermes 的 SGME(拾光记忆)官方适配器(memory.provider 插件)。当对话涉及「以前/上次/还记得/历史事实」、要求记住某事、需要关怀信号/角色扮演、读写 SGME…
git:20261102.cf476fc · audit B · 15 stars
mimo SKILL.md skill
freehul/sgme · adapters/mimo/SKILL.md · 小米 MiMo Desktop 的 SGME(拾光记忆)官方适配器。当对话涉及「以前/上次/还记得/历史事实」、要求记住某事、需要关怀信号/角色扮演、读写 SGME…
git:20261102.cbe83bb · audit B · 15 stars
sgme SKILL.md skill
freehul/sgme · adapters/workbuddy/SKILL.md · WorkBuddy 的 SGME(拾光记忆)官方适配器。当对话涉及「以前/上次/还记得/历史事实」、要求记住某事、需要关怀信号/角色扮演、读写 SGME…
git:20261102.cbe83bb · audit B · 15 stars
sgme-zcode SKILL.md skill
freehul/sgme · adapters/zcode/SKILL.md · ZCode 的 SGME(拾光记忆)官方适配器。当对话涉及「以前/上次/还记得/历史事实」、要求记住某事、需要关怀信号/角色扮演、读写 SGME 记忆/知识/技能、触发提炼或画像注入、补导入历史会话时使用。接入标记:SGME-ONBOARD…
git:20261102.cbe83bb · audit B · 15 stars
skill-registry-protocol SKILL.md skill
freehul/sgme · sgme/skills/protocol/SKILL.md · SGME 三大核心模块路由与技能按需注入协议——先判断 memory/wiki/skills 归属,再检索专业技能,不批量安装、不凭空编造。
v2.0.0 · audit A · 15 stars
adapter-claude-code SKILL.md skill
freehul/sgme · skills/adapter-claude-code/SKILL.md · Claude Code 的 SGME 官方适配器(MCP stdio 动态透传 + 原生 hooks:SessionStart 注入 / Stop 落盘 / SessionEnd…
git:20261029.e6a8704 · audit A · 15 stars

Every file in freehul/sgme

Browse by kind, by grade A, or by owner.