
Slang Workflows
io.github.shofer-dev由 GitHub 账号 shofer-dev 发布v0.1.2更新于 Oct 24, 2026
Provable, declarative multi-agent workflows for Claude Code (typed .slang, non-LLM executor).
概览
一个本地 MCP 服务器,通过确定性的非 LLM 执行器在 Claude Code 中运行带类型的 .slang 多智能体工作流。
- 可以做什么
- 发现并列出项目与用户工作流目录中的 .slang 文件,显示名称、参数和智能体数量,并提供语法速查表以便内联生成工作流。在运行前解析并静态分析工作流,检测死锁、未知引用和孤立输出。以同步或后台方式运行工作流,带类型化输出契约、重试、邮箱路由和轮次预算。通过序列化状态、Mermaid 拓扑流程图和带事件日志的 Mermaid 时序图追踪查看运行情况。同步运行中可升级给人工确认。
- 适用场景
- 当你希望在 Claude Code 中获得可重复、可审计的多智能体流水线,并强制限制每个智能体的工具范围、校验交接契约、保证终止时使用。适合带审批关卡的功能实现、并行只读调试以及仅审查不改动的智能体。
- 运行要求
- 以 npm 包 slang-workflows 通过 stdio 在本地运行。需要 Node.js 22+ 和 pnpm,并需安装并已认证 Claude Code,claude CLI 在 PATH 中,因为智能体以 Agent SDK 会话运行。运行智能体需要可选的 @anthropic-ai/claude-agent-sdk 包;解析和校验无需该包。未声明任何环境变量或请求头。
安装
在 SourceWeft 中
- 打开 控制台中的 Slang Workflows,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
slang-workflows
Run provable, .slang-driven multi-agent workflows inside Claude Code.
A non-LLM state machine (the slang executor) runs inside an MCP server and coordinates agents;
each agent is a Claude Agent SDK session. You declare the collaboration in a typed .slang
file and the executor enforces it — typed output contracts, static analysis, tool-scoping, and
provable termination — instead of leaving coordination to the model. The top-level Claude Code
session only triggers and observes; it never makes a coordination decision.
Claude Code's native dynamic workflows also codify orchestration (Claude writes a JS script); slang's difference is that the structure is enforced and statically analyzable, and runs render as Mermaid topology + trace diagrams. See the benchmark for the A/B/C head-to-head.
Origin. The
.slangWorkflow engine was born in Shofer — the AI-agent VS Code extension — where the deterministic, non-LLM executor was first built. This plugin brings it to Claude Code.
Design and rationale:
DESIGN.md. Language reference:slang_specs.md. Privacy:PRIVACY.md.
How it works
The top-level Claude Code session only triggers and observes — it never makes a coordination
decision. The non-LLM executor reads your .slang file, dispatches each stake to an Agent
SDK session (one long-lived session per agent, resumed across rounds), checks every result against
its output contract (retrying on failure), routes it through the mailbox, and repeats each
round until the workflow's converge condition or round budget is met. Runs render as Mermaid
topology and trace diagrams; escalate @Human surfaces back to you in the normal chat.
Use cases
Concrete workflows (each is a .slang file you run with run_workflow):
- Implement a feature with a human design-approval gate (
implement-feature.slang) — an Architect decomposes your request and writes the design doc, but is scoped so it physically cannot write code (write_paths: ["**/*.md"],deny: [Bash]) and must delegate. You approve the design (escalate @Human), then a Developer implements it slice-by-slice while a Reviewer signs off each round, with a final review gate before it commits. - Ship a feature as separate, verified deliverables (
implement-feature-complex.slang) — a linear Design → Implement → Test → Review → Document pipeline where five specialists each produce one artifact (the implementation, a passing vitest spec, usage docs) and can't do another's job — so code, tests, and docs actually match the design. Converges only when every stage has committed. - Troubleshoot a bug with two independent investigators (
debug.slang) — paste the symptom/repro; two developers root-cause it in parallel, strictly read-only (no accidental edits), an Orchestrator consolidates their independent findings into one fix plan, one developer implements it, and the other peer-reviews the fix in a loop until satisfied. - A reviewer that can inspect but never edit — give the review agent
read/executeand no write scope, so a "check my work" run can run tests and read code but cannot alter it — enforced, not just prompted.
Features
- Reproducible multi-agent pipelines — the collaboration is codified in a
.slangfile and driven by a deterministic (non-LLM) executor, so a run unfolds the same way every time — no improvised, unrepeatable subagent coordination. - Enforced per-agent tool-scoping —
write_pathsrestricts each agent's Write/Edit to path globs anddenyremoves tools (e.g.Bash), enforced via the SDK'scanUseTool— not merely requested in a prompt. - Static analysis before running —
validate_workflowdetects deadlocks, unknown references, and orphaned outputs at parse time, before any tokens are spent. - Typed output contracts — each stake must return a structurally and semantically valid result
(
output: {…} where <expr>); invalid results retry instead of silently propagating downstream. - Provable termination — round budgets (
budget: rounds(N)) + per-stake timeouts guarantee every run finishes. - Auto-generated diagrams — every run renders a Mermaid topology (
get_topology) and a sequence-diagram trace (get_trace), for live or post-mortem inspection. - Convergence-driven collaboration — agents route via mailboxes and iterate until a declared convergence condition or budget is reached, with session resume so an agent keeps its context across rounds.
How this differs from Claude Code's native dynamic workflows
Claude Code already has a built-in dynamic workflows feature: when a task needs orchestration, Claude
writes a JavaScript script (via the Agent SDK / Workflow tool) that spawns and coordinates subagents.
That's a real step up from improvised, one-off subagent calls — the script codifies the orchestration and,
once written, runs deterministically and coordinates for ~0 extra LLM cost. slang shares those goals; our
benchmark shows both approaches reach real, working implementations with near-zero
coordination-LLM cost. The difference is what the orchestration is, and what's guaranteed about it:
In short: native dynamic workflows put the orchestration in LLM-written code you have to trust; slang puts it in a typed declaration the runtime validates and enforces — analyzable before it runs, scoped and contract-checked while it runs, and rendered as diagrams after. Reach for slang when you want guarantees and auditability (safety-scoped agents, provable termination, contract-valid hand-offs, a reusable versioned workflow), not just "the model coordinated some subagents this time." Both are far better than unstructured subagents — slang trades a bit of up-front declaration for enforcement and repeatability.
What works today
- Discover / validate / run
.slangworkflows — authored or LLM-generated inline (MCP tools below). - Deterministic executor: stake → output-contract validation + retry → mailbox routing →
convergence; multi-agent flows; session resume (one agent = one session across stakes);
escalate @Human. - Output contracts: structural (
output: {...}, via SDKoutputFormat) + semantic (where <expr>). - Enforced tool scoping:
write_paths(Write/Edit restricted to path globs, via a PreToolUse command hook) anddeny(remove native or MCP tools). - Static analysis (
validate_workflow): deadlock / unknown-ref / orphan-output detection before running. - Provable termination:
budget: rounds(N)+ per-stake timeouts — the run always finishes. - Diagrams:
get_topology(Mermaid flowchart) +get_trace(Mermaid sequence + event log). - Synchronous or background runs (
background:true) with live polling of state/topology/trace.
See DESIGN.md § Implementation Status for the full matrix.
Requirements
- Node.js 22+ and pnpm.
- Claude Code installed and authenticated (the
claudeCLI on yourPATH) — the Agent SDK spawns it to run agents.
Install
Agent SDK note.
@anthropic-ai/claude-agent-sdkis declared as an optional dependency because some internal registries don't mirror it. Ifpnpm installskips it, add it from the public registry:The server parses/validates workflows without it; running agents requires it.
Verify the install:
Use it
At runtime the server discovers .slang files in your project's .claude/workflows/ (and
~/.claude/workflows/) — that's the user's space for their own workflows. The plugin ships
showcase workflows in server/test/fixtures/; copy them in to try them:
Quickest: register the MCP server with Claude Code
From the project whose .claude/workflows/ you want to run:
Then in Claude Code, ask it to use the tools — e.g. "list the slang workflows", "run the where-clause workflow".
As a Claude Code plugin
This directory is a self-contained plugin: .claude-plugin/plugin.json
.mcp.json(a stdio server launched asnpx tsx ${CLAUDE_PLUGIN_ROOT}/server/src/main.ts). Install it through Claude Code's plugin mechanism to expose the tools automatically.
Slash commands
Once the plugin is loaded, these commands drive it directly (Claude Code namespaces them by the
plugin, so your / menu shows slang-workflows:…):
They're thin wrappers over the MCP tools below — you can always just ask Claude in natural language instead (e.g. "run the where-clause workflow").
MCP tools
Generate-and-run loop: get_slang_grammar → author slang → validate_workflow{source} → run_workflow{source, background:true} → poll get_topology / get_trace while it runs. The workflow is authored by an LLM but executed deterministically (contracts enforced, always terminates). @Human escalation works in synchronous runs only (interactive elicitation needs the tool call to stay open).
Develop
The executor depends only on a Dispatcher interface; FakeDispatcher makes the whole VM
testable without the Agent SDK or any model calls (see server/test/).
Layout
License
Apache-2.0. See LICENSE.
来源:README.md,提交 71b4c60
工具
0版本历史
1- v0.1.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分