ns-langgraph-agents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLangGraph Agents
LangGraph 智能体
Production-grade LangGraph.js (Node 24+, TypeScript strict, ).
@langchain/langgraphOwns runtime doctrine — placement, prompt/capability injection, graph-spec sync. Diffs via or . Framework choice: .
ns-coderns-autonomousns-multi-agent-architect生产级LangGraph.js(Node 24+、严格模式TypeScript、依赖)。
@langchain/langgraph负责运行时准则——文件布局、提示词/能力注入、图规格同步。通过或实现差异更新。框架选型由负责。
ns-coderns-autonomousns-multi-agent-architectApplicability
适用场景
| Context | Doctrine strength |
|---|---|
| Greenfield agent-api (new LangGraph runtime) | MUST follow build workflow gates — dev-chat, budgets, normalize-before-truncate, separate skill cap. Topology: suggest |
| Brownfield existing agent | RECOMMENDED migration toward same controls; orphan recovery does not Critical-fail missing topology |
| Intentional MCP redesign | Sync |
Brownfield open ReAct valid until deliberate topology change. Greenfield MUST = new agent-api + intentional MCP redesign only.
| 场景 | 准则严格程度 |
|---|---|
| 全新项目agent-api(新LangGraph运行时) | 必须遵循构建工作流规范——开发对话、预算控制、截断前标准化、技能权限分离。拓扑建议:对于大多数MCP/工具密集型场景,推荐使用 |
| 遗留项目已有智能体 | 建议迁移至相同管控体系;遗留架构恢复时,若缺少拓扑不会导致严重失败 |
| 针对性MCP重构 | 同步交付 |
遗留项目的开放式ReAct模式可继续使用,直至主动变更拓扑。全新项目强制准则仅适用于新agent-api及针对性MCP重构场景。
Routing (read first)
路由规则(必读)
| Signal | Action |
|---|---|
| No framework lock / CrewAI requested | Stop → |
| Orphan / lost structure / layout unclear | Run orphan checklist before features ( |
GitLab | Defer to harness |
| Approved placement/inject plan ready for diff | Hand off to |
| 信号 | 操作 |
|---|---|
| 无框架锁定 / 要求使用CrewAI | 停止 → 调用 |
| 架构混乱 / 结构丢失 / 布局不清晰 | 在开发功能前先执行遗留架构恢复清单( |
涉及GitLab | 移交至 |
| 已批准的布局/注入方案待实现 | 移交至 |
Boot (mandatory)
启动流程(强制)
See — complete Session boot (blocking) there, then:
../../ns-harness/references/session-boot.md- Confirm and
{agent_api_root}when touching runtimegraph-spec.md - Load placement/inject refs before path decisions (,
references/placement-and-domains.md)references/prompt-and-capability-injection.md - Continue this skill
Success: placement + inject doctrine + project rules. Failure: invented folders or external frameworks.
参考——**完成会话启动(阻塞式)**后,执行以下步骤:
../../ns-harness/references/session-boot.md- 处理运行时相关内容时,确认和
{agent_api_root}的位置graph-spec.md - 进行路径决策前,加载布局/注入相关参考文档(、
references/placement-and-domains.md)references/prompt-and-capability-injection.md - 继续使用本技能
成功标准:符合布局+注入准则+项目规则。失败情况:随意创建文件夹或使用外部框架。
When to use
使用场景对应操作
| Situation | Action |
|---|---|
Greenfield agent-api (no | Build workflow Phase 0 then Phase 1 bootstrap — |
| Brownfield / orphaned runtime | Run Orphan recovery ( |
| New file / unclear folder | Placement Decision Block + |
| System prompt / skill inject / bind | Prompt/Capability plan + |
| Topology / state / capabilities change | Spec Sync Gate — update |
| MCP with many servers/tools | Read |
| Token blow-up / slow turns | Read |
| Provider message/reasoning quirks | Read |
| HITL / streaming UX | Read |
| JSON planner / analyst chooses tools | Operator-progress channel — |
| Evals before merge | Read |
| 场景 | 操作 |
|---|---|
全新项目agent-api(无 | 执行构建工作流第0阶段,再执行第1阶段脚手架搭建——参考 |
| 遗留/混乱的运行时 | 在开发功能前先执行遗留架构恢复( |
| 新建文件/文件夹位置不明确 | 执行布局决策检查 + 参考 |
| 系统提示词/技能注入/绑定 | 制定提示词/能力方案 + 参考 |
| 拓扑/状态/能力变更 | 执行规格同步检查——在同一交付中更新 |
| 多服务器/工具的MCP场景 | 阅读 |
| Token超限/响应缓慢 | 阅读 |
| 服务商消息/推理特性差异 | 阅读 |
| HITL/流式交互体验 | 阅读 |
| JSON规划器/分析师选工具 | 遵循操作员进度规范—— |
| 合并前评估 | 阅读 |
Core doctrine
核心准则
LangGraph = control flow. MCP/local tools = capabilities under graph. Small graph state (refs, summaries). Checkpointer = full state; context window = LLM view — separate.
System prompt: compose (motor) + (product persona) per LLM invoke. Never persist composed system/persona text in graph state, checkpointer, or durable . Summary at index 0 ≠ full system — , .
base_invariantinjectedmessagesSystemMessagereferences/prompt-and-capability-injection.mdreferences/message-content-blocks.mdLocale: conversation-observed (detection-first from human messages ± intent slots); weak hint only; Intl formatters in code — not fixed bootstrap locale. , .
turnLocaleconfigurable.localereferences/evidence-and-fidelity.mdtemplates/snippets/conversation-locale.ts.snippetOperator progress (JSON planner hops): greenfield with a planner/analyst that emits structured (no on that hop) MUST persist (or ) + on . language MUST match the current user message (last ) — not English unless that message is English; not product default locale. Machine stays English for audit. Emit SSE from that field at node entry of the next hop — not , not in durable . Hop 0 uses generic copy from (or locale) in the same operator language. Open ReAct + uses / only. Details: , .
streaming_sseexecutionPlanbindToolsuserFacingIntentanalysis.userFacingIntentexecutionPlanAgentStateuserFacingIntentHumanMessageintentthinkingresponse_streamingmessagesconversation/presentation/ToolNodetool_startedtool_finishedtemplates/contracts/planner-contract.mdreferences/streaming-and-hitl.mdThree capability kinds bind to the model:
| Kind | LLM wire name | Internal id |
|---|---|---|
| Local tool | | |
| MCP tool | | |
| Skill procedure | | |
Wire names must match (use separators; colons only in internal ids). Colon in a new wire name is Critical on review.
^[a-zA-Z0-9_-]{1,128}$__LangGraph = 控制流。MCP/本地工具 = 图管控下的能力。图状态应精简(引用、摘要)。检查点工具 = 完整状态;上下文窗口 = LLM可见范围——两者需分离。
系统提示词:每次调用LLM时,组合(核心规则) + (产品角色)。切勿将组合后的系统/角色文本持久化到图状态、检查点或持久化中。索引0处的摘要不等于完整系统提示词——参考、。
base_invariantinjectedmessagesSystemMessagereferences/prompt-and-capability-injection.mdreferences/message-content-blocks.md区域设置:基于对话检测的(优先从人类消息±意图槽位检测);仅作为弱提示;代码中使用Intl格式化工具——而非固定的脚手架区域设置。参考、。
turnLocaleconfigurable.localereferences/evidence-and-fidelity.mdtemplates/snippets/conversation-locale.ts.snippet操作员进度(JSON规划器步骤):全新项目的模式中,若使用输出结构化的规划器/分析师(该步骤不绑定),必须在中持久化(或) + 。的语言必须与当前用户消息(最后一条)一致——除非用户消息是英文,否则不能使用英文;不能使用产品默认区域设置。机器始终使用英文以便审计。在下一阶段的节点入口处,从该字段发送SSE 事件——而非,也不能写入持久化。第0阶段使用(或对应区域设置)中的通用文本,且需与操作员语言一致。开放式ReAct + 仅使用 / 事件。详情参考、。
streaming_sseexecutionPlanbindToolsAgentStateuserFacingIntentanalysis.userFacingIntentexecutionPlanuserFacingIntentHumanMessageintentthinkingresponse_streamingmessagesconversation/presentation/ToolNodetool_startedtool_finishedtemplates/contracts/planner-contract.mdreferences/streaming-and-hitl.md三种能力类型可绑定到模型:
| 类型 | LLM绑定名称 | 内部ID |
|---|---|---|
| 本地工具 | | |
| MCP工具 | | |
| 技能流程 | | |
绑定名称必须符合正则(使用分隔;仅内部ID可使用冒号)。新绑定名称中出现冒号会导致评审不通过。
^[a-zA-Z0-9_-]{1,128}$__Pre-change gates
变更前检查
Before new file or inject/bind change: complete all three. No code until posted.
新建文件或修改注入/绑定前:完成以下三项检查。未提交检查结果前请勿编写代码。
1. Placement Decision Block
1. 布局决策检查
markdown
undefinedmarkdown
undefinedPlacement Decision Block
布局决策检查
- Artifact: …
- Type: …
- Target path: …
- Layer: …
- Refs: placement-and-domains.md
- do_not_create_under: […]
Full matrix: `references/placement-and-domains.md`.- 产物: …
- 类型: …
- 目标路径: …
- 层级: …
- 参考文档: placement-and-domains.md
- 禁止创建路径: […]
完整矩阵参考`references/placement-and-domains.md`。2. Prompt / Capability plan
2. 提示词/能力方案
markdown
undefinedmarkdown
undefinedPrompt / Capability plan
提示词/能力方案
- Compose: base_invariant + injected (rebuild per invoke; not in state/checkpointer/durable messages)
- Motor (): [gather-no-Markdown / sole-writer / tool discipline / JSON planner userFacingIntent is SSE not Markdown / …]
base_invariant - Product (): canonical path + persona/tone notes; mode-resolved: yes/no; modes: [...]; resolver: ...
injected - System layers touched: […]
- Canonical prompt path: …
- Session overlay: yes/no
- Bind list: […]
- Auto-inject skills: […] (exclusive of bind for same id)
- Truncate caps: tool vs skill body
- Bind parity: …
- Spec paths to sync: […]
Full doctrine: `references/prompt-and-capability-injection.md`.- 组合方式: base_invariant + injected(每次调用时重构;不存入状态/检查点/持久化messages)
- 核心规则(): [禁止Markdown收集 / 单一输出者 / 工具使用规范 / JSON规划器userFacingIntent仅用于SSE而非Markdown / …]
base_invariant - 产品配置(): 标准路径 + 角色/语气说明;模式解析: 是/否;模式列表: [...]; 解析器: ...
injected - 涉及系统层级: […]
- 标准提示词路径: …
- 会话覆盖: 是/否
- 绑定列表: […]
- 自动注入技能: […](与同ID的绑定互斥)
- 截断规则: 工具 vs 技能主体
- 绑定一致性: …
- 需同步的规格路径: […]
完整准则参考`references/prompt-and-capability-injection.md`。3. Spec Sync Gate
3. 规格同步检查
Nodes, edges, state, capabilities, recursion_limit, or wire names change: update same delivery. Stale archive ≠ SoT — sync spec to intended runtime; do not force-fit live code to stale archive.
graph-spec.md节点、边、状态、能力、递归限制或绑定名称变更时:在同一交付中更新。过时归档文件不视为可信来源——需将规格同步至预期运行时;请勿强行让现有代码适配过时归档。
graph-spec.mdReference map
参考文档映射
Load on demand — do not memorize whole files.
| Reference | Read when |
|---|---|
| Greenfield copy of |
| Project structure unclear or agent "lost" |
| Scaffolding, refactors, layer violations |
| Where to put files; domain vs graph vs config |
| System prompt layers, bind vs inject, bind parity |
| AIMessage/HumanMessage/ToolMessage across providers |
| trim, summarize, tool vs skill body caps, |
| Multi-server MCP, discovery, transport, lifecycle |
| Allowlist, classification, rate limits, tool budgets |
| State-backed evidence, fidelity gate, conversation-observed locale |
| |
| Per-turn tool/MCP caps, arg fingerprint duplicate-skip |
| |
| Tool errors, circuit breaker, retries |
| Postgres audit, LangSmith, OTel, run context |
| ReAct, plan_execute (suggested start for most MCP), other topologies; node id ≠ state channel |
| SSE envelopes, operator |
| JSON planner hops: |
| Architecture, tool-selection, memory evals |
| Review gate before marking done |
Templates: (greenfield tree), , , (brownfield patches).
templates/agent-runtime/templates/graph-spec.mdtemplates/contracts/templates/snippets/按需加载——无需记忆完整文档内容。
| 参考文档 | 使用场景 |
|---|---|
| 从 |
| 项目结构不清晰或智能体「失控」时 |
| 脚手架搭建、重构、层级违规检查 |
| 文件存放位置;领域/图/配置的划分 |
| 系统提示词层级、绑定vs注入、绑定一致性 |
| 不同服务商的AIMessage/HumanMessage/ToolMessage处理 |
| 裁剪、摘要、工具vs技能主体限制、 |
| 多服务器MCP、服务发现、传输、生命周期管理 |
| 白名单、分类、速率限制、工具预算 |
| 状态验证、保真度检查、对话检测区域设置 |
| |
| 单轮工具/MCP调用限制、参数指纹去重 |
| |
| 工具错误、熔断机制、重试逻辑 |
| Postgres审计、LangSmith、OTel、运行上下文 |
| ReAct、plan_execute(大多数MCP场景推荐起始拓扑)、其他拓扑;节点ID ≠ 状态通道 |
| SSE信封格式、操作员 |
| JSON规划器步骤: |
| 架构、工具选择、内存评估 |
| 标记完成前的评审检查 |
模板路径:(全新项目目录)、、、(遗留项目补丁)。
templates/agent-runtime/templates/graph-spec.mdtemplates/contracts/templates/snippets/Session inputs
会话输入
| Variable | Required |
|---|---|
| Default |
| What to build, fix, or review |
| 变量 | 必填 |
|---|---|
| 默认值 |
| 需构建、修复或评审的内容 |
Orphan recovery (brownfield first)
遗留架构恢复(优先处理)
Runtime disorganized or team blocked:
- Read ; score project.
references/orphan-recovery-checklist.md - Gap report: structure, placement, context window, inject/bind parity, MCP governance, HTTP, spec sync.
- Ordered fix plan (one phase per message if large).
- Implement via .
ns-coder
No new graph nodes or MCP servers until layout + governance baselines pass.
运行时混乱或团队受阻时:
- 阅读;为项目评分。
references/orphan-recovery-checklist.md - 生成差距报告:结构、布局、上下文窗口、注入/绑定一致性、MCP管控、HTTP、规格同步。
- 制定有序修复计划(大型项目可分阶段提交)。
- 通过执行修复。
ns-coder
布局+管控基线达标前,请勿新增图节点或MCP服务器。
Build workflow (greenfield or post-recovery)
构建工作流(全新项目或恢复后)
Phase 0 — Spec gate
第0阶段 — 规格检查
If is missing, create it from . Minimum sections: locked header (, , ), domain ownership, prompt composition, state schema, nodes table, edges, interrupts, memory, capability bind/inject table, recursion_limit, HTTP routes.
graph-spec.mdtemplates/graph-spec.mdframeworkarchitectureinteraction_modeIf the user has no architecture decision yet, stop and invoke first.
ns-multi-agent-architect若缺少,从创建。必填章节:锁定头部(、、)、领域归属、提示词组合、状态 schema、节点表、边、中断、内存、能力绑定/注入表、递归限制、HTTP路由。
graph-spec.mdtemplates/graph-spec.mdframeworkarchitectureinteraction_mode若用户尚未确定架构决策,停止当前操作并先调用。
ns-multi-agent-architectPhase 1 — Skeleton
第1阶段 — 骨架搭建
If is missing, run (). Then in .
{agent_api_root}/package.jsonscripts/bootstrap-agent-runtime.mjsreferences/bootstrap-agent-runtime.mdnpm install && npm test{agent_api_root}Do not assemble the tree from . Do not copy another product. After copy: align with ; put domain in + via later phases / .
templates/snippets/src/graph/graph-spec.mdconversation/config/ns-coderBrownfield existing tree: align per — snippets for patches only.
references/runtime-layout.md若缺少,运行(参考)。然后在目录下执行。
{agent_api_root}/package.jsonscripts/bootstrap-agent-runtime.mjsreferences/bootstrap-agent-runtime.md{agent_api_root}npm install && npm test请勿从组装目录树。请勿复制其他项目的结构。复制完成后:将与对齐;后续阶段通过将领域逻辑放入 + 。
templates/snippets/src/graph/graph-spec.mdns-coderconversation/config/遗留项目现有目录:参考对齐——仅使用补丁片段。
references/runtime-layout.mdPhase 2 — State and persistence
第2阶段 — 状态与持久化
After bootstrap, verify these exist; do not re-scaffold. Fill only gaps vs .
graph-spec.md- with
AgentStatereducer (messagesor Zod +Annotation.Root).MessagesZodMeta - in dev/prod;
PostgresSaveronly inMemorySaver.tests/setup.ts - Every invoke/stream: via
configurable.thread_id.buildRunConfig - JSON planner/analyst (no on that hop): declare
bindTools+executionPlan(or nested onuserFacingIntent) inanalysisstate schema —graph-spec.md.templates/snippets/state.ts.snippet
脚手架搭建完成后,验证以下内容是否存在;请勿重新搭建。仅补充与的差距部分。
graph-spec.md- 带reducer的
messages(AgentState或Zod +Annotation.Root)。MessagesZodMeta - 开发/生产环境使用;仅在
PostgresSaver中使用tests/setup.ts。MemorySaver - 每次调用/流式传输:通过传入
buildRunConfig。configurable.thread_id - JSON规划器/分析师(该步骤不绑定):在
bindTools的状态 schema 中声明graph-spec.md+executionPlan(或嵌套在userFacingIntent中)——参考analysis。templates/snippets/state.ts.snippet
Phase 3 — LLM and messages
第3阶段 — LLM与消息
- Provider config in (infra only — no domain prompts).
src/llm/ - Prefer JSON mode + Zod parse for structured turns; avoid on OpenAI-compatible local servers.
withStructuredOutput - Normalize provider output via /
contentBlocks— seecontent_blocks.references/message-content-blocks.md
- 服务商配置放在(仅基础设施配置——无领域提示词)。
src/llm/ - 结构化交互优先使用JSON模式+Zod解析;OpenAI兼容的本地服务器避免使用。
withStructuredOutput - 通过/
contentBlocks标准化服务商输出——参考content_blocks。references/message-content-blocks.md
Phase 4 — Context window (mandatory)
第4阶段 — 上下文窗口(强制)
Implement per :
references/context-window-and-tokens.md- before every LLM call.
trimMessagesForLlm - then
normalizeMcpToolResultbeforetruncateToolOutputenters state.ToolMessage - Separate for skill bodies (snippet
CONTEXT_SKILL_BODY_MAX_CHARS).skillBodyMaxChars - Optional with persisted compaction (
summarizeOlderMessages+ rewrite) in the same agent-node return.RemoveMessage
Never pass raw to the model.
state.messages参考实现:
references/context-window-and-tokens.md- 每次调用LLM前执行。
trimMessagesForLlm - 进入状态前,先执行
ToolMessage再执行normalizeMcpToolResult。truncateToolOutput - 技能主体使用独立的限制(参考片段
CONTEXT_SKILL_BODY_MAX_CHARS)。skillBodyMaxChars - 可选:使用并在同一智能体节点返回中执行持久化压缩(
summarizeOlderMessages+ 重写)。RemoveMessage
切勿将原始直接传入模型。
state.messagesPhase 5 — Capabilities
第5阶段 — 能力集成
- Local s in
StructuredTool.src/tools/ - MCP: governed client — discovery → local allowlist → wire names → singleton client lifecycle ().
references/mcp-complex-access.md - Skills: auto-discovered →
skills/*.mdor auto-inject (exclusive per id).use_skill__{id}
Apply and before . Enforce bind parity. Wire per-turn tool/MCP budgets from when MCP or external tools are bound.
references/capability-governance.mdreferences/prompt-and-capability-injection.mdbindToolstemplates/snippets/tool-budget.ts.snippet- 本地放在
StructuredTool。src/tools/ - MCP:管控型客户端——服务发现 → 本地白名单 → 绑定名称 → 单例客户端生命周期(参考)。
references/mcp-complex-access.md - 技能:自动发现 →
skills/*.md或自动注入(同ID互斥)。use_skill__{id}
调用前,需遵循和。强制保证绑定一致性。绑定MCP或外部工具时,参考实现单轮工具/MCP调用预算限制。
bindToolsreferences/capability-governance.mdreferences/prompt-and-capability-injection.mdtemplates/snippets/tool-budget.ts.snippetPhase 6 — HTTP and interaction mode
第6阶段 — HTTP与交互模式
| Mode | Requirements |
|---|---|
| |
| SSE envelope per |
| HITL | |
Brownfield missing dev-chat: recommend add — not Critical. Postman synced with live routes.
| 模式 | 要求 |
|---|---|
| 实现 |
| 遵循 |
| HITL | 实现 |
遗留项目缺少dev-chat接口:建议添加——非强制要求。Postman需与当前路由同步。
Phase 7 — Observability
第7阶段 — 可观测性
Wire : , , , , persist . LangSmith and OTel are opt-in.
references/observability.mdinitDbrunStoragelogLlmCalllogToolExecutionturn_decisions对接:、、、、持久化。LangSmith和OTel为可选配置。
references/observability.mdinitDbrunStoragelogLlmCalllogToolExecutionturn_decisionsPhase 8 — Evals and review
第8阶段 — 评估与评审
- Add suites per .
references/evals-and-gates.md - Run in
npm run build && npm test.{agent_api_root} - Invoke on the diff; ask it to verify placement, inject, wire-name, and bind-parity anti-patterns when the diff touches
ns-reviewer.agent-api
- 参考添加测试套件。
references/evals-and-gates.md - 在目录下执行
{agent_api_root}。npm run build && npm test - 调用评审差异;当差异涉及
ns-reviewer时,要求其验证布局、注入、绑定名称、绑定一致性等反模式问题。agent-api
Maintenance workflow
维护工作流
Ongoing work (not greenfield):
- Three Pre-change gates
- matches intended graph after change
graph-spec.md - Layer: graph node, conversation, MCP, memory, HTTP
- Read matching reference before edit
- Minimal diff via with placement/inject handoff
ns-coder - Postman on HTTP route change
- Re-run orphan checklist items touched
日常维护(非全新项目):
- 完成三项变更前检查
- 变更后需与预期图一致
graph-spec.md - 层级分类:图节点、对话、MCP、内存、HTTP
- 编辑前阅读对应参考文档
- 通过实现最小化差异,并移交布局/注入相关内容
ns-coder - HTTP路由变更时同步Postman
- 重新运行涉及的遗留架构恢复清单项
MCP complex access (quick rules)
MCP复杂访问(快速规则)
Multiple MCP servers, overlapping or large catalogs:
- Discovery filter — allowlisted before bind
tools/list - Local classify — ; never trust server read-only flags
read | write | destructive | admin - Singleton client — one per process; no per-request stdio in prod
MultiServerMCPClient - Transport — Streamable HTTP deployed; stdio local single-user dev only
- Errors — MCP = recoverable
isError: trueToolMessage; protocol fail may abort with HTTP/SSEstatus: "error"failed - Secrets — env or / request payload only; never state or checkpointer
configurable
Full: .
references/mcp-complex-access.md多MCP服务器、工具目录重叠或规模较大时:
- 服务发现过滤 — 绑定前先通过白名单过滤
tools/list - 本地分类 — 标记;切勿信任服务器的只读标记
read | write | destructive | admin - 单例客户端 — 每个进程仅实例化一个;生产环境禁止为每个请求生成stdio子进程
MultiServerMCPClient - 传输方式 — 部署流式HTTP;stdio仅用于本地单用户开发
- 错误处理 — MCP返回= 可恢复的
isError: true,标记ToolMessage;协议失败可能导致HTTP/SSE返回status: "error"并终止failed - 密钥管理 — 仅通过环境变量或/请求载荷传递;切勿存入状态或检查点
configurable
完整规则参考。
references/mcp-complex-access.mdHandoff to ns-coder
移交至ns-coder
When implementation is approved, delegate with:
markdown
undefined方案获批后,按以下格式移交任务:
markdown
undefinedLangGraph implementation task
LangGraph实现任务
- Root: {agent_api_root}
- Spec: path/to/graph-spec.md
- Phase: [number and name from this skill]
- target_paths: […]
- layer: […]
- do_not_create_under: […]
- injection_notes: [layers / bind vs auto-inject / caps]
- spec_paths_to_sync: […]
- References to apply: [list]
- Acceptance: build + test pass; orphan checklist items [n] resolved; placement + inject + bind parity verified
- Review: ns-reviewer after tests — must check placement, inject, wire names (), bind parity (load ns-langgraph-agents anti-patterns when diff touches agent-api)
:
Stay here for diagnosis, spec, placement, governance design, and **greenfield bootstrap copy**. `ns-coder` for feature diffs. Version-scoped features: `ns-spec-driven`.- 根目录: {agent_api_root}
- 规格文档: path/to/graph-spec.md
- 阶段: [本技能中的阶段编号及名称]
- 目标路径: […]
- 层级: […]
- 禁止创建路径: […]
- 注入说明: [层级 / 绑定vs自动注入 / 限制]
- 需同步的规格路径: […]
- 需应用的参考文档: [列表]
- 验收标准: 构建+测试通过;遗留架构恢复清单第[n]项已解决;布局+注入+绑定一致性已验证
- 评审: 测试通过后调用ns-reviewer——当差异涉及agent-api时,需检查本技能中提到的布局、注入、绑定名称()、绑定一致性等反模式
:
本技能负责诊断、规格制定、布局设计、管控方案设计,以及**全新项目脚手架复制**。`ns-coder`负责功能差异实现。版本化功能由`ns-spec-driven`负责。Stop conditions
停止条件
| Condition | Action |
|---|---|
No | Create spec or invoke architect |
| Greenfield assembled from snippets / another product tree | Stop; run |
| Path outside placement matrix / inventing folders | Stop; propose legal path |
Domain / locale / copy landing in | Stop; reroute to conversation/config |
| Bind without parity (dispatchable but unbound) | Stop; fix bind or document unbound + test |
| Stop; use |
| Skill auto-inject + bind same id without explicit decision | Stop; choose one mode |
| CrewAI requested | Redirect to appropriate skill |
| Change spans >3 layers without plan | One-line phased plan, wait for approval |
| Critical security gap (secrets in state, ungoverned MCP) | Block feature work; fix governance first |
| 条件 | 操作 |
|---|---|
缺少 | 创建规格文档或调用架构选型工具 |
| 全新项目从片段/其他项目组装目录树 | 停止;运行 |
| 路径超出布局矩阵范围/随意创建文件夹 | 停止;提出合规路径方案 |
领域/区域设置/文本放入 | 停止;重新路由至conversation/config目录 |
| 绑定不一致(可调度但未绑定) | 停止;修复绑定或记录未绑定情况并测试 |
新绑定名称中包含 | 停止;使用 |
| 同一ID同时启用技能自动注入+绑定且未明确决策 | 停止;选择其中一种模式 |
| 要求使用CrewAI | 重定向至对应技能 |
| 变更涉及超过3个层级且无方案 | 制定分阶段计划,等待批准 |
| 严重安全漏洞(状态中存储密钥、MCP无管控) | 暂停功能开发;优先修复管控问题 |
Related skills (ownership)
关联技能(职责划分)
| Skill | Owns |
|---|---|
| Doctrine, placement, inject plan, graph-spec, greenfield scaffold |
| Feature diffs + review loop (not initial scaffold copy) |
| Verdict; when diff touches |
| Framework choice before Phase 0 when unlocked |
| Version features after scaffold exists (or first task = bootstrap) |
| Runtime debug |
| 技能 | 职责 |
|---|---|
| 准则制定、布局设计、注入方案、图规格、全新项目脚手架 |
| 功能差异实现+评审循环(不包含初始脚手架复制) |
| 评审结论;当差异涉及 |
| 未锁定框架时,第0阶段前的框架选型 |
| 脚手架搭建完成后的版本化功能管理(或首个任务为脚手架搭建) |
| 运行时调试 |
Forbidden
禁止操作
- Emitting planner as
userFacingIntentor as Markdown inresponse_streaming(SSEmessagesonly; composer remains sole Markdown writer)thinking - Writing in a language other than the current user message (e.g. English progress when the operator wrote Portuguese)
userFacingIntent - Persisting composed system/persona prompt () — or secrets/API keys — in graph state, checkpointer, or durable
base_invariant + injected(rebuild system text per invoke)messages - Treating bootstrap / /
.envas primary locale SoT, or persisting sticky thread locale (use conversation-observedconfigurable.locale+ Intl)turnLocale - Passing unbounded tool/MCP output into
state.messages - Applying tool/MCP truncate caps to skill bodies (use )
CONTEXT_SKILL_BODY_MAX_CHARS - Trusting MCP tool metadata for security classification
- Spawning stdio MCP subprocesses per HTTP request in production
- compiling
memory/StateGraph - Domain qualify/conversation prompts in
src/llm/ - Locale/presentation under
graph/ - Nudge as fake
HumanMessage - Tests under
src/ - Greenfield tree from snippets or another product — use only
templates/agent-runtime/
- 将规划器作为
userFacingIntent发送,或写入response_streaming作为Markdown(仅允许作为SSEmessages事件;输出文本仅由专属模块编写Markdown)thinking - 使用与当前用户消息不同的语言(例如操作员发送葡萄牙语,却输出英文进度)
userFacingIntent - 持久化组合后的系统/角色提示词()——或密钥/API密钥——到图状态、检查点或持久化
base_invariant + injected(每次调用时重新构建系统文本)messages - 将脚手架//
.env作为区域设置的主要可信来源,或持久化会话固定区域设置(使用对话检测的configurable.locale+ Intl)turnLocale - 将无限制的工具/MCP输出写入
state.messages - 对技能主体应用工具/MCP截断规则(使用)
CONTEXT_SKILL_BODY_MAX_CHARS - 信任MCP工具元数据进行安全分类
- 生产环境中为每个HTTP请求生成stdio MCP子进程
- 在目录中编译
memory/StateGraph - 在中存放领域/对话提示词
src/llm/ - 在目录下存放区域设置/展示相关内容
graph/ - 将引导消息伪装成
HumanMessage - 在目录下存放测试用例
src/ - 从片段或其他项目构建全新项目目录树——仅允许使用
templates/agent-runtime/