@zigrivers/scaffold 3.32.1 → 3.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +41 -18
  2. package/content/guides/knowledge-freshness/.diagrams/diagram-0.svg +1 -1
  3. package/content/guides/knowledge-freshness/.diagrams/manifest.json +1 -1
  4. package/content/guides/knowledge-freshness/index.html +9 -5
  5. package/content/guides/knowledge-freshness/index.md +5 -4
  6. package/content/guides/pipeline/index.html +2 -2
  7. package/content/guides/pipeline/index.md +2 -2
  8. package/content/knowledge/VERSION +1 -1
  9. package/content/knowledge/backend/backend-api-design.md +21 -3
  10. package/content/knowledge/backend/backend-architecture.md +21 -3
  11. package/content/knowledge/backend/backend-async-patterns.md +16 -2
  12. package/content/knowledge/backend/backend-auth-patterns.md +19 -2
  13. package/content/knowledge/backend/backend-conventions.md +15 -3
  14. package/content/knowledge/backend/backend-data-modeling.md +19 -3
  15. package/content/knowledge/backend/backend-deployment.md +21 -3
  16. package/content/knowledge/backend/backend-dev-environment.md +13 -3
  17. package/content/knowledge/backend/backend-fintech-broker-integration.md +14 -2
  18. package/content/knowledge/backend/backend-fintech-compliance.md +23 -4
  19. package/content/knowledge/mcp-server/mcp-authentication.md +100 -0
  20. package/content/knowledge/mcp-server/mcp-deployment-patterns.md +119 -0
  21. package/content/knowledge/mcp-server/mcp-error-handling.md +131 -0
  22. package/content/knowledge/mcp-server/mcp-observability.md +125 -0
  23. package/content/knowledge/mcp-server/mcp-prompt-primitives.md +119 -0
  24. package/content/knowledge/mcp-server/mcp-protocol-fundamentals.md +130 -0
  25. package/content/knowledge/mcp-server/mcp-resource-design.md +111 -0
  26. package/content/knowledge/mcp-server/mcp-sdk-selection.md +136 -0
  27. package/content/knowledge/mcp-server/mcp-testing-strategies.md +127 -0
  28. package/content/knowledge/mcp-server/mcp-tool-design.md +125 -0
  29. package/content/knowledge/mcp-server/mcp-transport-patterns.md +122 -0
  30. package/content/knowledge/mcp-server/mcp-versioning.md +115 -0
  31. package/content/methodology/custom-defaults.yml +2 -0
  32. package/content/methodology/deep.yml +2 -0
  33. package/content/methodology/mcp-server-overlay.yml +88 -0
  34. package/content/methodology/mvp.yml +2 -0
  35. package/content/pipeline/build/multi-agent-resume.md +107 -11
  36. package/content/pipeline/build/multi-agent-start.md +104 -11
  37. package/content/pipeline/build/single-agent-resume.md +74 -8
  38. package/content/pipeline/build/single-agent-start.md +69 -12
  39. package/content/pipeline/finalization/materialize-plan-to-beads.md +473 -0
  40. package/content/pipeline/foundation/beads.md +6 -0
  41. package/content/pipeline/planning/implementation-plan-review.md +25 -0
  42. package/content/pipeline/planning/implementation-plan.md +75 -1
  43. package/content/pipeline/specification/mcp-tool-resource-contract.md +77 -0
  44. package/dist/cli/commands/adopt.d.ts.map +1 -1
  45. package/dist/cli/commands/adopt.js +33 -1
  46. package/dist/cli/commands/adopt.js.map +1 -1
  47. package/dist/cli/commands/init.d.ts +6 -0
  48. package/dist/cli/commands/init.d.ts.map +1 -1
  49. package/dist/cli/commands/init.js +46 -3
  50. package/dist/cli/commands/init.js.map +1 -1
  51. package/dist/cli/init-flag-families.d.ts +6 -1
  52. package/dist/cli/init-flag-families.d.ts.map +1 -1
  53. package/dist/cli/init-flag-families.js +59 -2
  54. package/dist/cli/init-flag-families.js.map +1 -1
  55. package/dist/cli/init-flag-families.test.js +86 -1
  56. package/dist/cli/init-flag-families.test.js.map +1 -1
  57. package/dist/config/schema.d.ts +2310 -126
  58. package/dist/config/schema.d.ts.map +1 -1
  59. package/dist/config/schema.js +26 -1
  60. package/dist/config/schema.js.map +1 -1
  61. package/dist/config/schema.test.js +75 -2
  62. package/dist/config/schema.test.js.map +1 -1
  63. package/dist/config/validators/index.d.ts.map +1 -1
  64. package/dist/config/validators/index.js +2 -0
  65. package/dist/config/validators/index.js.map +1 -1
  66. package/dist/config/validators/mcp-server.d.ts +4 -0
  67. package/dist/config/validators/mcp-server.d.ts.map +1 -0
  68. package/dist/config/validators/mcp-server.js +37 -0
  69. package/dist/config/validators/mcp-server.js.map +1 -0
  70. package/dist/config/validators/mcp-server.test.d.ts +2 -0
  71. package/dist/config/validators/mcp-server.test.d.ts.map +1 -0
  72. package/dist/config/validators/mcp-server.test.js +47 -0
  73. package/dist/config/validators/mcp-server.test.js.map +1 -0
  74. package/dist/core/assembly/materialize-plan-to-beads-assembly.test.d.ts +2 -0
  75. package/dist/core/assembly/materialize-plan-to-beads-assembly.test.d.ts.map +1 -0
  76. package/dist/core/assembly/materialize-plan-to-beads-assembly.test.js +75 -0
  77. package/dist/core/assembly/materialize-plan-to-beads-assembly.test.js.map +1 -0
  78. package/dist/e2e/project-type-overlays.test.js +83 -0
  79. package/dist/e2e/project-type-overlays.test.js.map +1 -1
  80. package/dist/project/adopt.d.ts.map +1 -1
  81. package/dist/project/adopt.js +3 -1
  82. package/dist/project/adopt.js.map +1 -1
  83. package/dist/project/detectors/coverage.test.js +1 -0
  84. package/dist/project/detectors/coverage.test.js.map +1 -1
  85. package/dist/project/detectors/disambiguate.d.ts.map +1 -1
  86. package/dist/project/detectors/disambiguate.js +6 -1
  87. package/dist/project/detectors/disambiguate.js.map +1 -1
  88. package/dist/project/detectors/disambiguate.test.js +18 -0
  89. package/dist/project/detectors/disambiguate.test.js.map +1 -1
  90. package/dist/project/detectors/index.d.ts.map +1 -1
  91. package/dist/project/detectors/index.js +2 -1
  92. package/dist/project/detectors/index.js.map +1 -1
  93. package/dist/project/detectors/mcp-server.d.ts +4 -0
  94. package/dist/project/detectors/mcp-server.d.ts.map +1 -0
  95. package/dist/project/detectors/mcp-server.js +91 -0
  96. package/dist/project/detectors/mcp-server.js.map +1 -0
  97. package/dist/project/detectors/mcp-server.test.d.ts +2 -0
  98. package/dist/project/detectors/mcp-server.test.d.ts.map +1 -0
  99. package/dist/project/detectors/mcp-server.test.js +115 -0
  100. package/dist/project/detectors/mcp-server.test.js.map +1 -0
  101. package/dist/project/detectors/types.d.ts +6 -2
  102. package/dist/project/detectors/types.d.ts.map +1 -1
  103. package/dist/project/detectors/types.js.map +1 -1
  104. package/dist/types/config.d.ts +8 -1
  105. package/dist/types/config.d.ts.map +1 -1
  106. package/dist/wizard/copy/core.d.ts.map +1 -1
  107. package/dist/wizard/copy/core.js +4 -0
  108. package/dist/wizard/copy/core.js.map +1 -1
  109. package/dist/wizard/copy/index.d.ts.map +1 -1
  110. package/dist/wizard/copy/index.js +2 -0
  111. package/dist/wizard/copy/index.js.map +1 -1
  112. package/dist/wizard/copy/mcp-server.d.ts +3 -0
  113. package/dist/wizard/copy/mcp-server.d.ts.map +1 -0
  114. package/dist/wizard/copy/mcp-server.js +40 -0
  115. package/dist/wizard/copy/mcp-server.js.map +1 -0
  116. package/dist/wizard/copy/types.d.ts +5 -1
  117. package/dist/wizard/copy/types.d.ts.map +1 -1
  118. package/dist/wizard/flags.d.ts +9 -1
  119. package/dist/wizard/flags.d.ts.map +1 -1
  120. package/dist/wizard/questions.d.ts +4 -2
  121. package/dist/wizard/questions.d.ts.map +1 -1
  122. package/dist/wizard/questions.js +37 -0
  123. package/dist/wizard/questions.js.map +1 -1
  124. package/dist/wizard/questions.test.js +107 -0
  125. package/dist/wizard/questions.test.js.map +1 -1
  126. package/dist/wizard/wizard.d.ts +3 -2
  127. package/dist/wizard/wizard.d.ts.map +1 -1
  128. package/dist/wizard/wizard.js +3 -1
  129. package/dist/wizard/wizard.js.map +1 -1
  130. package/package.json +1 -1
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: mcp-tool-design
3
+ description: MCP tool naming conventions, JSON Schema inputSchema design, idempotency, output content blocks, isError for tool-level errors, outputSchema, and annotations
4
+ topics: [mcp, tools, json-schema, tool-design, error-handling]
5
+ volatility: evolving
6
+ last-reviewed: null
7
+ version-pin: 'MCP spec 2025-11-25'
8
+ sources:
9
+ - url: https://modelcontextprotocol.io/specification/2025-11-25/server/tools
10
+ - url: https://json-schema.org/draft/2020-12/schema
11
+ ---
12
+
13
+ Tools are the primary mechanism by which MCP servers expose executable capabilities to LLM clients. A well-designed tool is discoverable, predictable, safe to retry, and explicit about its failure modes.
14
+
15
+ ## Summary
16
+
17
+ Each MCP tool has a `name`, optional `description`, a JSON Schema `inputSchema`, and an optional `outputSchema`. Tool calls use `tools/call`; results carry a `content` array of typed content blocks and an optional `isError` boolean. Use `isError: true` to report expected tool-level failures (API errors, invalid business inputs) as structured results rather than JSON-RPC protocol errors. Tools should be idempotent where possible, and side-effect-bearing tools should be explicitly documented as such via annotations.
18
+
19
+ ## Deep Guidance
20
+
21
+ ### Tool naming conventions
22
+
23
+ Tool names must be unique within a server. Use `snake_case` for tool names — the 2025-11-25 spec revision (SEP-986) formally reinforces this convention. Names should be short verb-noun phrases that describe what the tool does: `get_weather`, `create_issue`, `search_documents`. Avoid generic names like `execute` or `run` that give the LLM no signal about the tool's purpose.
24
+
25
+ The `description` field is critical — it is the primary signal the LLM uses to decide when to invoke a tool. Be specific about what the tool does, what inputs it expects, and when it should be used. A poor description leads to misuse. A good description includes the domain, the action, any preconditions, and the output shape in plain English.
26
+
27
+ ### JSON Schema inputSchema
28
+
29
+ Every tool MUST declare an `inputSchema` as a valid JSON Schema object. MCP uses **JSON Schema 2020-12** as its default schema dialect (established in the 2025-11-25 revision). The schema serves two purposes: runtime validation and LLM guidance. Best practices:
30
+
31
+ - Use `type: "object"` at the root with named `properties`.
32
+ - List required parameters in the `required` array. Do not list optional parameters there.
33
+ - Add a `description` to every property — the LLM reads these to understand each argument.
34
+ - Use the most specific type possible: prefer `"type": "integer"` over `"type": "number"` when only integers make sense.
35
+ - Use `enum` for fixed sets of valid values.
36
+ - Use `format` hints (`"format": "uri"`, `"format": "date"`) where applicable.
37
+
38
+ Example of a well-specified inputSchema:
39
+ ```json
40
+ {
41
+ "type": "object",
42
+ "properties": {
43
+ "repo": {
44
+ "type": "string",
45
+ "description": "GitHub repository in owner/name format, e.g. 'acme/backend'"
46
+ },
47
+ "state": {
48
+ "type": "string",
49
+ "enum": ["open", "closed", "all"],
50
+ "description": "Filter issues by state. Defaults to 'open'."
51
+ },
52
+ "limit": {
53
+ "type": "integer",
54
+ "minimum": 1,
55
+ "maximum": 100,
56
+ "description": "Maximum number of issues to return. Defaults to 20."
57
+ }
58
+ },
59
+ "required": ["repo"]
60
+ }
61
+ ```
62
+
63
+ Always validate inputs against the inputSchema in the server implementation before executing any side effects. The spec requires it, and doing so prevents malformed or injected arguments from reaching downstream systems.
64
+
65
+ ### Idempotency and side effects
66
+
67
+ MCP tools should be designed with idempotency in mind wherever the underlying operation supports it. Read-only tools (queries, lookups) are naturally idempotent and carry the lowest risk. Mutating tools (writes, deletes, API calls with side effects) should document their non-idempotency explicitly.
68
+
69
+ The `annotations` field on a tool definition carries hints for clients:
70
+
71
+ ```json
72
+ {
73
+ "annotations": {
74
+ "readOnlyHint": true,
75
+ "idempotentHint": true,
76
+ "openWorldHint": false
77
+ }
78
+ }
79
+ ```
80
+
81
+ `readOnlyHint: true` means the tool does not modify any state. `idempotentHint: true` means calling it multiple times with the same arguments produces the same result. `openWorldHint: true` means the tool interacts with external systems beyond the local environment. Clients treat these as untrusted hints — they assist the LLM in deciding whether user confirmation is needed, but do not replace host-side confirmation flows for destructive operations.
82
+
83
+ ### Output content blocks
84
+
85
+ Tool results return a `content` array containing one or more typed content blocks:
86
+
87
+ - **TextContent**: `{ "type": "text", "text": "..." }` — the most common type; use for plain text, JSON strings, or structured prose.
88
+ - **ImageContent**: `{ "type": "image", "data": "<base64>", "mimeType": "image/png" }` — for screenshots, charts, or generated images.
89
+ - **AudioContent**: `{ "type": "audio", "data": "<base64>", "mimeType": "audio/wav" }` — for audio responses.
90
+ - **ResourceLink**: `{ "type": "resource_link", "uri": "...", "name": "...", "mimeType": "..." }` — reference a resource the client can fetch separately.
91
+ - **EmbeddedResource**: `{ "type": "resource", "resource": { "uri": "...", "mimeType": "...", "text": "..." } }` — inline resource content.
92
+
93
+ Tools can return multiple content blocks in one result (e.g., a text summary plus an image). The `content` array is always present, even for empty results — return an empty array rather than null.
94
+
95
+ If the tool declares an `outputSchema`, it MUST also provide structured content in a `structuredContent` field matching that schema, and SHOULD also include the serialized JSON as a TextContent block for backwards compatibility.
96
+
97
+ ### isError: tool errors vs protocol errors
98
+
99
+ MCP distinguishes two error reporting paths:
100
+
101
+ **Protocol errors** (JSON-RPC errors) are for structural/wire-level failures where the call could not be dispatched at all: unknown tool name in `tools/call`, malformed JSON-RPC structure, server crashes. These return a JSON-RPC error response with a negative integer `code`. The LLM cannot generally recover from protocol errors.
102
+
103
+ **Tool execution errors** use `isError: true` in the result. Use this for any failure that occurs after the tool dispatches — including tool `inputSchema` validation failures, business validation rejections, API rate limits, resource not found, and network timeouts. Per the 2025-11-25 spec (SEP-1303), tool input validation failures MUST use `isError: true` (not `-32602`) so the model can read the error and self-correct. Return `isError: true` with a descriptive TextContent explaining what went wrong and, when possible, what the caller should do differently.
104
+
105
+ ```json
106
+ {
107
+ "content": [
108
+ {
109
+ "type": "text",
110
+ "text": "GitHub API rate limit exceeded. Resets at 2025-06-18T14:00:00Z. Retry after that time."
111
+ }
112
+ ],
113
+ "isError": true
114
+ }
115
+ ```
116
+
117
+ Never raise a JSON-RPC protocol error for domain-level failures that a well-behaved caller might encounter. Reserve protocol errors for structural dispatch failures (wrong method name, unknown tool). When in doubt, use `isError: true` — it keeps the LLM in the loop about what went wrong.
118
+
119
+ ### Partial failures
120
+
121
+ When a tool processes multiple items and some fail, report partial results in the `content` array with a summary, and set `isError: true` only if the overall operation should be treated as failed. For best-effort multi-item tools, return results for successful items and error descriptions for failed ones, without setting `isError: true`, so the LLM can use the partial output.
122
+
123
+ ### List change notifications
124
+
125
+ If the server's tool set can change at runtime (e.g., tools are dynamically registered), declare `tools: { listChanged: true }` in capabilities and send `notifications/tools/list_changed` when the set changes. The client will re-issue `tools/list` to refresh its cache. This is important for servers where available tools depend on user configuration or authentication state.
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: mcp-transport-patterns
3
+ description: MCP stdio and Streamable HTTP transports, deprecated HTTP+SSE migration, session management, MCP-Protocol-Version header, and transport selection guidance
4
+ topics: [mcp, transport, stdio, http, sse, session-management]
5
+ volatility: fast-moving
6
+ last-reviewed: null
7
+ version-pin: 'MCP spec 2025-11-25'
8
+ sources:
9
+ - url: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports
10
+ ---
11
+
12
+ MCP defines two standard transports: **stdio** (local subprocess) and **Streamable HTTP** (network-accessible). The old HTTP+SSE transport from spec version 2024-11-05 is deprecated. Transport choice is a deployment decision that shapes your server's authentication model, scalability, and operational complexity.
13
+
14
+ ## Summary
15
+
16
+ **stdio**: client launches server as subprocess, communicates over stdin/stdout, logs go to stderr. Best for local tools installed alongside the client. **Streamable HTTP**: server runs independently at an HTTP endpoint, clients POST JSON-RPC messages, server optionally streams responses via SSE. Best for shared/remote servers. The deprecated HTTP+SSE transport used separate GET (SSE stream) and POST (messages) endpoints — migrate to Streamable HTTP. The `MCP-Protocol-Version` header MUST be sent on all HTTP requests after initialization.
17
+
18
+ ## Deep Guidance
19
+
20
+ ### stdio transport
21
+
22
+ In the stdio transport, the MCP client launches the server as a child process. All JSON-RPC messages flow over the process's standard streams:
23
+
24
+ - Client writes JSON-RPC messages to server's **stdin**, one message per line, no embedded newlines.
25
+ - Server writes JSON-RPC messages to its **stdout**, one message per line, no embedded newlines.
26
+ - Server writes diagnostic/logging output to **stderr** only — stdout is reserved strictly for JSON-RPC protocol messages.
27
+
28
+ ```
29
+ Client Process
30
+ ├── spawns → Server Process
31
+ │ ├── stdin ← JSON-RPC messages from client
32
+ │ ├── stdout → JSON-RPC messages to client
33
+ │ └── stderr → logs (captured by client, not protocol)
34
+ ```
35
+
36
+ **Key rules for stdio servers:**
37
+ - NEVER write anything to stdout except valid JSON-RPC messages. Any stray output (debug prints, startup banners, library log messages) will corrupt the protocol stream and cause parse errors. This is the most common stdio bug.
38
+ - Redirect all application logging to stderr (or a file). In Python: `print("msg", file=sys.stderr)`. In Node.js: `process.stderr.write(...)`. In Go: `fmt.Fprintln(os.Stderr, ...)`.
39
+ - The server process's working directory may be undefined (could be `/` on macOS) when launched by a client. Use absolute paths for any file access or configuration loading.
40
+
41
+ Shutdown: the client closes the server's stdin stream, waits for the process to exit, then sends SIGTERM after a timeout, then SIGKILL.
42
+
43
+ ### Streamable HTTP transport
44
+
45
+ The Streamable HTTP transport runs the server as an independent HTTP service. A single MCP endpoint (e.g., `https://example.com/mcp`) handles both GET and POST:
46
+
47
+ **Client → Server (POST)**: Every JSON-RPC message from client to server is a new HTTP POST. The client MUST include `Accept: application/json, text/event-stream` headers. The server responds either with `Content-Type: application/json` (single response) or `Content-Type: text/event-stream` (SSE stream for streaming/multiple messages).
48
+
49
+ **Server → Client (GET)**: The client MAY open a GET SSE stream to receive server-initiated messages (notifications, server-to-client requests) without first sending a POST. The server returns `Content-Type: text/event-stream` or `405 Method Not Allowed` if not supported.
50
+
51
+ **Session management**: The server MAY assign a session ID in the `Mcp-Session-Id` response header during initialization. If issued, the client MUST include `Mcp-Session-Id: <id>` on all subsequent requests. Sessions are terminated via HTTP DELETE to the MCP endpoint with the session ID header.
52
+
53
+ **Security requirements**:
54
+ - Validate the `Origin` header on all incoming connections to prevent DNS rebinding attacks.
55
+ - Bind to localhost only (127.0.0.1) when running locally; never 0.0.0.0 for local-only servers.
56
+ - Implement authentication for all connections (see `mcp-authentication.md`).
57
+
58
+ ### MCP-Protocol-Version header
59
+
60
+ After initialization, HTTP clients MUST include `MCP-Protocol-Version: <negotiated-version>` on all requests. Example: `MCP-Protocol-Version: 2025-11-25`. If a server receives no version header, it SHOULD assume `2025-03-26` for backwards compatibility. Servers MUST reject requests with unsupported versions with `400 Bad Request`. As of 2025-11-25, servers MUST also respond with HTTP 403 Forbidden when an incoming connection carries an invalid `Origin` header (previously the response code was not specified).
61
+
62
+ ### Deprecated HTTP+SSE transport
63
+
64
+ The HTTP+SSE transport (from spec version 2024-11-05) used two separate endpoints:
65
+ - A GET endpoint that opened a persistent SSE stream, returning an `endpoint` event with a POST URL.
66
+ - A POST endpoint for client messages.
67
+
68
+ This is **deprecated** as of spec 2025-03-26 and replaced by Streamable HTTP. For backwards compatibility:
69
+
70
+ **Servers** wanting to support both old and new clients: keep the old SSE GET endpoint and old POST endpoint running alongside the new Streamable HTTP endpoint.
71
+
72
+ **Clients** detecting transport version: POST an `initialize` request. If the server responds with success, it supports Streamable HTTP. If the server returns 4xx (405 or 404), issue a GET instead — if it returns an SSE stream with an `endpoint` event, it's an old HTTP+SSE server. Support both paths during a migration window.
73
+
74
+ ### Transport selection guidance
75
+
76
+ | Scenario | Recommended transport |
77
+ |----------|----------------------|
78
+ | Local tool (installed alongside client) | stdio |
79
+ | Developer machine tool (file access, CLI wrappers) | stdio |
80
+ | Shared team server (hosted, multi-user) | Streamable HTTP |
81
+ | Cloud-hosted integration (SaaS backend) | Streamable HTTP |
82
+ | Containerized/serverless deployment | Streamable HTTP |
83
+ | Mobile or browser-based host | Streamable HTTP |
84
+
85
+ **Choose stdio when**: the server must run on the user's machine, the tool accesses local files or processes, you want zero-config deployment (install package, configure path), or you want the simplest possible security model (OS process isolation, no network auth needed).
86
+
87
+ **Choose Streamable HTTP when**: the server is shared across multiple clients or users, you need centralized deployment and updates, the server integrates with remote APIs or databases, or you need to run the server independently of any specific client lifecycle.
88
+
89
+ Custom transports are allowed by the spec — any bidirectional communication channel that preserves JSON-RPC message format and lifecycle requirements can be used. Document custom transports thoroughly.
90
+
91
+ ### Connection lifecycle and error handling
92
+
93
+ Both transports follow the same JSON-RPC 2.0 lifecycle:
94
+
95
+ 1. **Initialize**: client sends `initialize` request with protocol version and capabilities; server responds with its own capabilities.
96
+ 2. **Initialized notification**: client sends `notifications/initialized` to signal readiness.
97
+ 3. **Normal operation**: bidirectional request/response and notifications.
98
+ 4. **Shutdown**: client sends `notifications/cancelled` for in-flight requests, then closes the transport.
99
+
100
+ **Common transport errors and remediation**:
101
+
102
+ | Error | Cause | Fix |
103
+ |-------|-------|-----|
104
+ | Parse errors on stdio | Non-JSON written to stdout (e.g., debug prints) | Redirect all non-protocol output to stderr |
105
+ | `400 Bad Request` on HTTP | Missing or invalid `MCP-Protocol-Version` header | Ensure client sends the header after initialization |
106
+ | `404` on HTTP | Client using old HTTP+SSE transport path | Detect and support both paths during migration |
107
+ | Session `410 Gone` | Session expired or server restarted | Client should re-initialize and re-establish session |
108
+
109
+ ### Testing transport behavior
110
+
111
+ ```typescript
112
+ // Test stdio transport with in-process transport for unit tests
113
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
114
+ import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
115
+
116
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
117
+ const client = new Client({ name: "test-client", version: "1.0.0" });
118
+ await client.connect(clientTransport);
119
+ // server connects to serverTransport in parallel
120
+ ```
121
+
122
+ For HTTP transport integration tests, use a real HTTP server bound to a random port (`listen(0)`) and tear it down after each test. Never share server state between tests.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: mcp-versioning
3
+ description: MCP protocol version negotiation, MCP-Protocol-Version HTTP header, capability-based feature detection, server versioning strategy, and backwards compatibility
4
+ topics: [mcp, versioning, protocol-version, backwards-compatibility, capability-negotiation]
5
+ volatility: stable
6
+ last-reviewed: null
7
+ version-pin: 'MCP spec 2025-11-25'
8
+ sources:
9
+ - url: https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle
10
+ - url: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports
11
+ ---
12
+
13
+ MCP uses calendar-versioned protocol strings and capability-based feature detection. Understand both mechanisms to build servers that work with current clients and remain compatible as the spec evolves.
14
+
15
+ ## Summary
16
+
17
+ Protocol versions are date strings (e.g., `2025-11-25`). The client proposes a version in `initialize`; the server echoes it or responds with its preferred version. If versions are incompatible, the client disconnects. HTTP clients MUST include `MCP-Protocol-Version: <negotiated-version>` on all subsequent requests. Feature availability is determined by capability negotiation, not version numbers alone. For your server's own versioning, use semantic versioning; keep the `serverInfo.version` field current and stable across protocol version changes.
18
+
19
+ ## Deep Guidance
20
+
21
+ ### Protocol version strings
22
+
23
+ MCP protocol versions are ISO 8601 calendar dates: `2025-11-25`, `2025-06-18`, `2025-03-26`, `2024-11-05`. Current production version is `2025-11-25`. Always send the latest version you support in the `initialize` request — the server will downgrade if needed.
24
+
25
+ Version negotiation in the `initialize` handshake:
26
+ 1. Client sends `"protocolVersion": "2025-11-25"` (its latest supported version).
27
+ 2. If the server supports `2025-11-25`, it responds with `"protocolVersion": "2025-11-25"`.
28
+ 3. If the server only supports `2025-03-26`, it responds with `"protocolVersion": "2025-03-26"`.
29
+ 4. The client checks if it supports the server's response version. If not, it disconnects.
30
+
31
+ This ensures both sides agree on a common protocol dialect before any other messages are exchanged.
32
+
33
+ ### MCP-Protocol-Version HTTP header
34
+
35
+ After initialization, HTTP clients MUST send `MCP-Protocol-Version: <negotiated-version>` on every subsequent request:
36
+
37
+ ```
38
+ POST /mcp HTTP/1.1
39
+ Host: mcp.example.com
40
+ Content-Type: application/json
41
+ Accept: application/json, text/event-stream
42
+ MCP-Protocol-Version: 2025-11-25
43
+ Mcp-Session-Id: abc123
44
+ ```
45
+
46
+ Servers use this header to handle requests differently based on protocol version when supporting multiple versions simultaneously. If a server receives no `MCP-Protocol-Version` header, the spec says to assume `2025-03-26` for backwards compatibility. Servers MUST return `400 Bad Request` for unsupported or invalid version header values.
47
+
48
+ ### Capability-based feature detection
49
+
50
+ Do not version-gate features solely on protocol version numbers. Use capability negotiation instead. A server supporting `2025-11-25` may not declare the `prompts` capability — that means prompts are not available regardless of protocol version.
51
+
52
+ The correct pattern for clients: check whether the server declared the capability before calling the corresponding methods. A client that calls `tools/list` without checking whether the server declared `tools` capability will receive a protocol error. The `initialize` response is the authoritative source of truth for what a server supports.
53
+
54
+ For servers: declare only the capabilities you actually implement. Over-declaring capabilities (e.g., declaring `resources: { subscribe: true }` but not handling `resources/subscribe`) will cause client errors and poor UX.
55
+
56
+ ### Evolving your server's capabilities over versions
57
+
58
+ When you add a new capability to your server (e.g., adding resource support to a tools-only server):
59
+ - Add the capability to your `initialize` response immediately.
60
+ - The capability declaration is backwards compatible — old clients that don't use resources will simply not call `resources/list`.
61
+ - Do not bump your `serverInfo.version` for protocol-level changes; that field tracks your server's own software version.
62
+
63
+ When you remove a capability (uncommon but possible):
64
+ - Remove it from the `initialize` response.
65
+ - Any client that was relying on it will receive a protocol error when they call the now-unsupported method.
66
+ - Consider maintaining the capability with a deprecation notice in the server's `instructions` field before fully removing it.
67
+
68
+ ### Server software versioning
69
+
70
+ The `serverInfo.version` in `initialize` is your server's semantic version (e.g., `"1.3.0"`), independent of the MCP protocol version. Follow semantic versioning:
71
+ - **Patch** (1.0.x): bug fixes, no schema changes, no capability changes.
72
+ - **Minor** (1.x.0): new tools/resources/prompts added, existing ones unchanged.
73
+ - **Major** (x.0.0): removed or renamed tools/resources/prompts, breaking schema changes.
74
+
75
+ Breaking changes in tool `inputSchema` or resource URI patterns are breaking changes for MCP clients that have auto-discovered and cached your server's schema. Treat them as major version bumps and communicate them in advance.
76
+
77
+ ### Supporting multiple protocol versions simultaneously
78
+
79
+ If you need to serve both old (2024-11-05 HTTP+SSE) and new (2025-11-25 Streamable HTTP) clients:
80
+ - Keep the old SSE GET endpoint and POST endpoint running alongside the new MCP endpoint.
81
+ - Use the `MCP-Protocol-Version` header to route behavior within the Streamable HTTP path.
82
+ - Set a deprecation date for old transport support and communicate it in the `serverInfo` description or via documentation.
83
+
84
+ For servers that only need to support the latest spec, target `2025-11-25` and do not implement the deprecated HTTP+SSE transport. New clients target the current spec; support for the old transport is only needed if you have existing clients that have not yet migrated.
85
+
86
+ ### Spec evolution cadence
87
+
88
+ The MCP spec has evolved on roughly a quarterly cadence: `2024-11-05` (initial), `2025-03-26` (Streamable HTTP introduction), `2025-06-18`, `2025-11-25` (current). Major changes between versions: `2024-11-05 → 2025-03-26` introduced Streamable HTTP, deprecating HTTP+SSE. `2025-03-26 → 2025-06-18` added `outputSchema` for tools, `structuredContent`, audio content type, `title` fields, and the `elicitation` client capability. `2025-06-18 → 2025-11-25` added OIDC Discovery 1.0 support; aligned OAuth Protected Resource Metadata to RFC 9728 (`WWW-Authenticate` header now optional with `.well-known` fallback); incremental scope consent and Client ID Metadata Documents for client registration; `icons` metadata on tools/resources/prompts; JSON Schema 2020-12 as the default dialect; input validation errors explicitly directed as Tool Execution Errors (`isError`) for model self-correction; Streamable HTTP servers MUST respond HTTP 403 for invalid Origin headers; stdio servers MAY use stderr for all logging; elicitation gains URL-mode, titled/untitled enums, and primitive default values; sampling gains `tools`/`toolChoice` support; experimental `tasks` feature for durable requests with polling. Watch the spec changelog (https://modelcontextprotocol.io) for new capabilities that may benefit your server.
89
+
90
+ ### Backwards compatibility checklist
91
+
92
+ When releasing a new server version, verify these backwards compatibility invariants before shipping:
93
+
94
+ 1. **No renamed tools**: renaming a tool (e.g., `search_files` → `find_files`) is a breaking change. Existing clients with auto-approved tool calls will fail silently. Use the old name as an alias or bump major version with advance notice.
95
+ 2. **No removed required input fields**: removing a required field from `inputSchema` is non-breaking (callers can stop providing it); adding a new required field IS breaking (callers that don't provide it will receive validation errors).
96
+ 3. **No resource URI pattern changes**: changing `file://{path}` to `file://workspace/{path}` breaks all existing resource subscriptions and saved URIs. Treat as a major version change.
97
+ 4. **No prompt argument removals**: removing a declared prompt argument breaks clients that pass that argument.
98
+ 5. **No capability downgrades without communication**: removing `resources: { subscribe: true }` when clients have active subscriptions causes silent failures.
99
+
100
+ For patch and minor releases, adding new optional tool parameters, new tools, new resources, or new prompts is always backwards compatible — existing callers ignore what they don't use.
101
+
102
+ ### Version signaling in serverInfo
103
+
104
+ Use the `serverInfo.version` field as a machine-readable signal for clients that cache schemas:
105
+
106
+ ```json
107
+ {
108
+ "serverInfo": {
109
+ "name": "my-mcp-server",
110
+ "version": "2.1.0"
111
+ }
112
+ }
113
+ ```
114
+
115
+ Clients can cache tool/resource schemas keyed by `(serverInfo.name, serverInfo.version)`. When the server bumps its version, clients re-fetch schemas rather than serving stale cached definitions. This pattern is especially important for IDE integrations and agent frameworks that pre-load tool definitions at startup.
@@ -43,6 +43,7 @@ steps:
43
43
  database-schema: { enabled: true, conditional: "if-needed" }
44
44
  review-database: { enabled: true, conditional: "if-needed" }
45
45
  api-contracts: { enabled: true, conditional: "if-needed" }
46
+ mcp-tool-resource-contract: { enabled: false }
46
47
  review-api: { enabled: true, conditional: "if-needed" }
47
48
  ux-spec: { enabled: true, conditional: "if-needed" }
48
49
  review-ux: { enabled: true, conditional: "if-needed" }
@@ -74,6 +75,7 @@ steps:
74
75
  apply-fixes-and-freeze: { enabled: true }
75
76
  developer-onboarding-guide: { enabled: true }
76
77
  implementation-playbook: { enabled: true }
78
+ materialize-plan-to-beads: { enabled: true, conditional: "if-needed" }
77
79
  # Phase 15 — Build (build) — stateless, on-demand execution steps
78
80
  single-agent-start: { enabled: true }
79
81
  single-agent-resume: { enabled: true }
@@ -42,6 +42,7 @@ steps:
42
42
  database-schema: { enabled: true, conditional: "if-needed" }
43
43
  review-database: { enabled: true, conditional: "if-needed" }
44
44
  api-contracts: { enabled: true, conditional: "if-needed" }
45
+ mcp-tool-resource-contract: { enabled: false }
45
46
  review-api: { enabled: true, conditional: "if-needed" }
46
47
  ux-spec: { enabled: true, conditional: "if-needed" }
47
48
  review-ux: { enabled: true, conditional: "if-needed" }
@@ -73,6 +74,7 @@ steps:
73
74
  apply-fixes-and-freeze: { enabled: true }
74
75
  developer-onboarding-guide: { enabled: true }
75
76
  implementation-playbook: { enabled: true }
77
+ materialize-plan-to-beads: { enabled: true, conditional: "if-needed" }
76
78
  # Phase 15 — Build (build) — stateless, on-demand execution steps
77
79
  single-agent-start: { enabled: true }
78
80
  single-agent-resume: { enabled: true }
@@ -0,0 +1,88 @@
1
+ # methodology/mcp-server-overlay.yml
2
+ name: mcp-server
3
+ description: >
4
+ MCP Server overlay — an MCP server has no UI, so the design-system and UX
5
+ steps are disabled. database-schema/review-database stay available
6
+ (if-needed) for servers that persist resources/state. The
7
+ mcp-tool-resource-contract step is enabled (if-needed) for specifying MCP
8
+ tool/resource/prompt schemas. MCP domain knowledge (protocol, SDK, transport,
9
+ tool/resource design, auth, testing, deployment, observability, versioning)
10
+ is injected into the relevant pipeline steps.
11
+ project-type: mcp-server
12
+
13
+ step-overrides:
14
+ # No UI surface — disable design/UX steps entirely.
15
+ design-system: { enabled: false }
16
+ ux-spec: { enabled: false }
17
+ review-ux: { enabled: false }
18
+ # Stateful servers may persist resources; keep available but skippable.
19
+ database-schema: { enabled: true, conditional: "if-needed" }
20
+ review-database: { enabled: true, conditional: "if-needed" }
21
+ # MCP-specific spec step — enabled for mcp-server projects.
22
+ mcp-tool-resource-contract: { enabled: true, conditional: "if-needed" }
23
+
24
+ # ---------------------------------------------------------------------------
25
+ # knowledge-overrides
26
+ # ---------------------------------------------------------------------------
27
+ # Inject MCP domain expertise into existing pipeline steps so that MCP
28
+ # protocol, SDK, transport, tool/resource design, auth, testing, deployment,
29
+ # observability, and versioning knowledge is available during prompt assembly.
30
+ knowledge-overrides:
31
+ # Foundation
32
+ tech-stack:
33
+ append: [mcp-protocol-fundamentals, mcp-sdk-selection, mcp-transport-patterns]
34
+ tdd:
35
+ append: [mcp-testing-strategies]
36
+
37
+ # Architecture & Decisions
38
+ system-architecture:
39
+ append: [mcp-protocol-fundamentals, mcp-transport-patterns, mcp-tool-design, mcp-resource-design]
40
+ adrs:
41
+ append: [mcp-sdk-selection, mcp-transport-patterns]
42
+
43
+ # Specifications
44
+ api-contracts:
45
+ append: [mcp-tool-design, mcp-resource-design, mcp-error-handling]
46
+ # mcp-tool-resource-contract knowledge is already declared in the step's own
47
+ # frontmatter knowledge-base ([mcp-tool-design, mcp-resource-design,
48
+ # mcp-prompt-primitives, mcp-error-handling]); no overlay override needed.
49
+ database-schema:
50
+ append: [mcp-resource-design]
51
+
52
+ # Testing
53
+ add-e2e-testing:
54
+ append: [mcp-testing-strategies]
55
+
56
+ # Quality Gates
57
+ security:
58
+ append: [mcp-authentication]
59
+ review-security:
60
+ append: [mcp-authentication]
61
+ operations:
62
+ append: [mcp-deployment-patterns, mcp-observability, mcp-versioning]
63
+ review-operations:
64
+ append: [mcp-deployment-patterns, mcp-observability, mcp-versioning]
65
+
66
+ # Reviews
67
+ review-architecture:
68
+ append: [mcp-transport-patterns, mcp-tool-design, mcp-resource-design]
69
+
70
+ # ---------------------------------------------------------------------------
71
+ # reads-overrides
72
+ # ---------------------------------------------------------------------------
73
+ # Wire docs/mcp-contract.md (output of mcp-tool-resource-contract) into
74
+ # downstream steps that need MCP auth/validation/error contracts.
75
+ # Uses append-only so non-MCP steps are unaffected when the overlay is absent.
76
+ reads-overrides:
77
+ # Security review: MCP auth/error contracts are security-relevant
78
+ security:
79
+ append: [mcp-tool-resource-contract]
80
+ review-security:
81
+ append: [mcp-tool-resource-contract]
82
+ # Test generation: test the tools/resources against the contract
83
+ create-evals:
84
+ append: [mcp-tool-resource-contract]
85
+ story-tests:
86
+ append: [mcp-tool-resource-contract]
87
+ tdd:
88
+ append: [mcp-tool-resource-contract]
@@ -42,6 +42,7 @@ steps:
42
42
  database-schema: { enabled: false }
43
43
  review-database: { enabled: false }
44
44
  api-contracts: { enabled: false }
45
+ mcp-tool-resource-contract: { enabled: false }
45
46
  review-api: { enabled: false }
46
47
  ux-spec: { enabled: false }
47
48
  review-ux: { enabled: false }
@@ -73,6 +74,7 @@ steps:
73
74
  apply-fixes-and-freeze: { enabled: false }
74
75
  developer-onboarding-guide: { enabled: false }
75
76
  implementation-playbook: { enabled: true }
77
+ materialize-plan-to-beads: { enabled: false }
76
78
  # Phase 15 — Build (build) — stateless, on-demand execution steps
77
79
  single-agent-start: { enabled: true }
78
80
  single-agent-resume: { enabled: true }
@@ -119,17 +119,113 @@ Recover your context by checking the current state of work:
119
119
 
120
120
  ### Beads Recovery
121
121
 
122
- **If Beads is configured** (`.beads/` exists):
123
- - `bd list --assignee "$ARGUMENTS"` check for tasks with `in_progress` status owned by this agent
124
- - If a PR shows as merged, close the corresponding task: `bd close <id>`
125
- - If there is in-progress work, finish it (see "Resume In-Progress Work" below)
126
- - Otherwise, clean up and start fresh:
127
- - `git fetch origin --prune && git clean -fd`
128
- - Run the install command from CLAUDE.md Key Commands
129
- - Atomically claim the next ready task: `TASK=$(bd ready --claim --json | jq -r '.id')` (sets `assignee=$BEADS_ACTOR` + `status=in_progress`; no race window between agents).
130
- - Continue working until `bd ready --claim --json` returns no task.
131
-
132
- **Without Beads:**
122
+ The implementation plan is materialized into Beads issues by
123
+ `/scaffold:materialize-plan-to-beads` before the build phase. A resumed build
124
+ runs the **same defensive preflight** as the start prompt it never claims
125
+ against an empty or stale tracker. Under multi-agent concurrency,
126
+ materialization is **orchestrator-only** and runs **once per wave under a
127
+ merge-slot lock**; workers never materialize and must wait for a run-stamped
128
+ completion signal before their first claim.
129
+
130
+ **Step 1 compute `beads_usable`.** `beads_usable` is true only when **all**
131
+ hold: `.beads/` exists, `bd` is on `PATH`, `bd version` parses to **≥ 1.0.5**
132
+ (using a macOS/BSD-safe numeric compare — split major/minor/patch and compare
133
+ numerically, never rely on GNU `sort -V`), and `jq` is on `PATH`. Never write
134
+ `[ -d .beads ] && bd …` as a whole command — it returns exit 1 when `.beads/` is
135
+ absent and breaks callers under `set -e`; use an `if`.
136
+
137
+ **Step 2 — route on the decision table** (this is what prevents the "empty
138
+ tracker looks done" bug):
139
+
140
+ | Condition | Action |
141
+ |---|---|
142
+ | `.beads/` **absent** | Non-Beads project → drive the loop from the markdown playbook/plan (see "Markdown fallback" below). Do **not** call `bd`. |
143
+ | `.beads/` present but `beads_usable` is false (`bd`/`jq` missing or `bd` < 1.0.5) | **Fail closed.** Stop and tell the user to install/upgrade `bd` (≥ v1.0.5) and `jq`. Do **not** markdown-fall-back — Beads may already hold execution state. |
144
+ | `beads_usable`, plan has **no** stable IDs **and** Beads holds no plan-derived issues and no non-bootstrap claimed/closed work | Genuinely legacy plan → markdown loop, emit "re-run planning to assign stable task IDs". Do **not** claim. |
145
+ | `beads_usable`, plan has no stable IDs **but** Beads already holds plausible build work | **Fail closed** — markdown would bypass existing execution state. |
146
+ | `beads_usable`, contract **partially present or malformed** | **Fail closed.** Do **not** markdown-fall-back. Require planning to be re-run/fixed. |
147
+ | `beads_usable` **and a valid stable-ID contract** | **Resume your own task; orchestrator materializes once under the lock; workers wait; then claim** (see Step 3). |
148
+
149
+ **Step 3 — `beads_usable` + valid contract:**
150
+
151
+ **Two distinct identities.** The merge-slot needs a **per-process unique** holder
152
+ (e.g. `agent-$$` or a UUID) so two local agents sharing one `git user.name` don't
153
+ both think they hold the slot. The **claim/resume actor must stay stable** per
154
+ worktree/session — resolve `BEADS_ACTOR` → `git user.name` → `$USER` (never
155
+ empty). Use the unique value **only** for `bd merge-slot acquire/check/release`;
156
+ keep the stable `BEADS_ACTOR` for the resume lookup and `bd ready --claim`.
157
+
158
+ 1. **Resume the actor's own in-flight *plan* task first.** Before claiming
159
+ anything new — and using the **stable** claim actor, not the per-process lock
160
+ identity — check for a **plan-derived** task already `in_progress` assigned to
161
+ you, scoped exactly like claiming:
162
+ `bd list --status in_progress --assignee <actor> --has-metadata-key plan_task_id --json`.
163
+ If one exists, continue it (see "Resume In-Progress Work" below). Scoping to
164
+ `plan_task_id` prevents resuming onto an unrelated manual/bootstrap issue
165
+ assigned to the same actor; any such non-plan in-progress work is reported
166
+ separately, not resumed as build work.
167
+ 2. **Reconcile merged PRs.** If a PR shows as merged, close the corresponding
168
+ task: `bd close <id>`.
169
+ 3. **Orchestrator-only materialization under the merge-slot lock.** Only the wave
170
+ orchestrator (the first agent resuming the wave) runs the materializer;
171
+ workers skip to step 4. The orchestrator:
172
+ - **Clears/overwrites any stale completion signal before acquiring the lock**,
173
+ so a signal left from a previous pipeline run (or a pre-update plan) can't
174
+ let workers race ahead of a fresh re-materialization. The **completion
175
+ signal must be run-stamped** — carry a `run_id` or the current plan hash
176
+ (e.g. a metadata flag on the project merge-slot/bootstrap bead, or a
177
+ workspace marker recording `run_id` / `materialized_at`).
178
+ - **Acquires the lock with a real acquisition loop, not a status poll** — loop
179
+ on `bd merge-slot acquire` itself and re-verify ownership via
180
+ `bd merge-slot check --json` (a released slot is `holder: null` and never
181
+ auto-promotes a waiter). Guard the non-zero/queued return with `|| true` and
182
+ release via a `trap … EXIT INT TERM`.
183
+ - **Once ownership is confirmed, invokes `/scaffold:materialize-plan-to-beads`**
184
+ (the canonical procedure — do not duplicate the four-pass logic). It is
185
+ idempotent and a cheap no-op when in sync. If it returns non-zero, **fail
186
+ closed** (do not set the signal, do not claim, do not markdown-fall-back).
187
+ - On success, **sets the run-stamped completion signal**, then **releases**
188
+ the slot.
189
+ 4. **Workers block on the run-stamped completion signal before their first
190
+ claim.** A released slot (`holder: null`) does **not** prove the orchestrator
191
+ ran — blocking on slot release alone is insufficient (a worker could
192
+ acquire/release before the orchestrator started). Workers wait until a signal
193
+ matching **this run's** `run_id`/plan-hash is present, then proceed.
194
+ 5. **Clean up and run the scoped claim loop** (using the **stable** `BEADS_ACTOR`,
195
+ not the per-process lock identity):
196
+ - `git fetch origin --prune && git clean -fd`
197
+ - Run the install command from CLAUDE.md Key Commands
198
+ - Atomically claim the next ready **plan** task:
199
+ `TASK=$(bd ready --claim --has-metadata-key plan_task_id --json | jq -r '.id')`
200
+ - Scoping to `plan_task_id` keeps the loop from ever claiming the bootstrap
201
+ "initialize Beads" bead or a manually-created issue.
202
+ - This sets `assignee=$BEADS_ACTOR` + `status=in_progress` in a single
203
+ round-trip — no race window between agents.
204
+ 6. Continue until the scoped claim
205
+ (`bd ready --claim --has-metadata-key plan_task_id --json`) returns no ready
206
+ task, then run the **completion check**.
207
+
208
+ **Completion check (empty `bd ready` ≠ done).** An empty scoped-ready result does
209
+ **not** mean the build is finished. On an empty result, fetch all plan-derived
210
+ tasks (`bd list --all --limit 0 --has-metadata-key plan_task_id --json`) and
211
+ classify the remaining non-`closed` tasks:
212
+
213
+ - **All plan tasks `closed`** → genuinely **done**; exit gracefully.
214
+ - Otherwise classify **each** remaining non-`closed` task independently — do
215
+ **not** short-circuit on "any task is `in_progress`". Resolve blocker statuses
216
+ from an **unfiltered** `bd list --all --limit 0 --json` (manual blockers carry
217
+ no `plan_task_id`):
218
+ - **advancing** — the task is itself `in_progress`, **or** a **transitive**
219
+ blocker (walk the chain; bound the walk, reuse `bd dep cycles`) is
220
+ `in_progress`.
221
+ - **stalled** — not `in_progress` and no transitive blocker is `in_progress`.
222
+ - **All remaining advancing** → exit gracefully (normal multi-agent case). **Any
223
+ stalled** → **stop and report the stalled subset**, grouped by why (open
224
+ dependency, manual `blocked`, `deferred`). Unrelated global `in_progress` work
225
+ that blocks none of the stalled tasks does **not** suppress the report.
226
+
227
+ **Markdown fallback** (only when `.beads/` is **absent**, or for a genuinely
228
+ legacy plan per the table — never past existing Beads state):
133
229
  - Read `docs/implementation-playbook.md` as the primary task reference.
134
230
  Fall back to `docs/implementation-plan.md` when no playbook is present.
135
231
  - If a PR shows as merged, mark the corresponding task as complete in the plan/playbook