@exaudeus/workrail 3.27.0 → 3.29.0

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 (160) hide show
  1. package/dist/console/assets/{index-FtTaDku8.js → index-BZ6HkxGf.js} +1 -1
  2. package/dist/console/index.html +1 -1
  3. package/dist/manifest.json +3 -3
  4. package/docs/README.md +57 -0
  5. package/docs/adrs/001-hybrid-storage-backend.md +38 -0
  6. package/docs/adrs/002-four-layer-context-classification.md +38 -0
  7. package/docs/adrs/003-checkpoint-trigger-strategy.md +35 -0
  8. package/docs/adrs/004-opt-in-encryption-strategy.md +36 -0
  9. package/docs/adrs/005-agent-first-workflow-execution-tokens.md +105 -0
  10. package/docs/adrs/006-append-only-session-run-event-log.md +76 -0
  11. package/docs/adrs/007-resume-and-checkpoint-only-sessions.md +51 -0
  12. package/docs/adrs/008-blocked-nodes-architectural-upgrade.md +178 -0
  13. package/docs/adrs/009-bridge-mode-single-instance-mcp.md +195 -0
  14. package/docs/adrs/010-release-pipeline.md +89 -0
  15. package/docs/architecture/README.md +7 -0
  16. package/docs/architecture/refactor-audit.md +364 -0
  17. package/docs/authoring-v2.md +527 -0
  18. package/docs/authoring.md +873 -0
  19. package/docs/changelog-recent.md +201 -0
  20. package/docs/configuration.md +505 -0
  21. package/docs/ctc-mcp-proposal.md +518 -0
  22. package/docs/design/README.md +22 -0
  23. package/docs/design/agent-cascade-protocol.md +96 -0
  24. package/docs/design/autonomous-console-design-candidates.md +253 -0
  25. package/docs/design/autonomous-console-design-review.md +111 -0
  26. package/docs/design/autonomous-platform-mvp-discovery.md +525 -0
  27. package/docs/design/claude-code-source-deep-dive.md +713 -0
  28. package/docs/design/console-cyberpunk-ui-discovery.md +504 -0
  29. package/docs/design/console-execution-trace-candidates-final.md +160 -0
  30. package/docs/design/console-execution-trace-candidates.md +211 -0
  31. package/docs/design/console-execution-trace-design-candidates-v2.md +113 -0
  32. package/docs/design/console-execution-trace-design-review.md +74 -0
  33. package/docs/design/console-execution-trace-discovery.md +394 -0
  34. package/docs/design/console-execution-trace-final-review.md +77 -0
  35. package/docs/design/console-execution-trace-review.md +92 -0
  36. package/docs/design/console-performance-discovery.md +415 -0
  37. package/docs/design/console-ui-backlog.md +280 -0
  38. package/docs/design/daemon-architecture-discovery.md +853 -0
  39. package/docs/design/daemon-design-candidates.md +318 -0
  40. package/docs/design/daemon-design-review-findings.md +119 -0
  41. package/docs/design/daemon-engine-design-candidates.md +210 -0
  42. package/docs/design/daemon-engine-design-review.md +131 -0
  43. package/docs/design/daemon-execution-engine-discovery.md +280 -0
  44. package/docs/design/daemon-gap-analysis.md +554 -0
  45. package/docs/design/daemon-owns-console-plan.md +168 -0
  46. package/docs/design/daemon-owns-console-review.md +91 -0
  47. package/docs/design/daemon-owns-console.md +195 -0
  48. package/docs/design/data-model-erd.md +11 -0
  49. package/docs/design/design-candidates-consolidate-dev-staleness.md +98 -0
  50. package/docs/design/design-candidates-walk-cache-depth-limit.md +80 -0
  51. package/docs/design/design-review-consolidate-dev-staleness.md +54 -0
  52. package/docs/design/design-review-walk-cache-depth-limit.md +48 -0
  53. package/docs/design/implementation-plan-consolidate-dev-staleness.md +142 -0
  54. package/docs/design/implementation-plan-walk-cache-depth-limit.md +141 -0
  55. package/docs/design/layer3b-ghost-nodes-design-candidates.md +229 -0
  56. package/docs/design/layer3b-ghost-nodes-design-review.md +93 -0
  57. package/docs/design/layer3b-ghost-nodes-implementation-plan.md +219 -0
  58. package/docs/design/list-workflows-latency-fix-plan.md +128 -0
  59. package/docs/design/list-workflows-latency-fix-review.md +55 -0
  60. package/docs/design/list-workflows-latency-fix.md +109 -0
  61. package/docs/design/native-context-management-api.md +11 -0
  62. package/docs/design/performance-sweep-2026-04.md +96 -0
  63. package/docs/design/routines-guide.md +219 -0
  64. package/docs/design/sequence-diagrams.md +11 -0
  65. package/docs/design/subagent-design-principles.md +220 -0
  66. package/docs/design/temporal-patterns-design-candidates.md +312 -0
  67. package/docs/design/temporal-patterns-design-review-findings.md +163 -0
  68. package/docs/design/test-isolation-from-config-file.md +335 -0
  69. package/docs/design/v2-core-design-locks.md +2746 -0
  70. package/docs/design/v2-lock-registry.json +734 -0
  71. package/docs/design/workflow-authoring-v2.md +1044 -0
  72. package/docs/design/workflow-docs-spec.md +218 -0
  73. package/docs/design/workflow-extension-points.md +687 -0
  74. package/docs/design/workrail-auto-trigger-system.md +359 -0
  75. package/docs/design/workrail-config-file-discovery.md +513 -0
  76. package/docs/docker.md +110 -0
  77. package/docs/generated/v2-lock-closure-plan.md +26 -0
  78. package/docs/generated/v2-lock-coverage.json +797 -0
  79. package/docs/generated/v2-lock-coverage.md +177 -0
  80. package/docs/ideas/backlog.md +3927 -0
  81. package/docs/ideas/design-candidates-mcp-resilience.md +208 -0
  82. package/docs/ideas/design-review-findings-mcp-resilience.md +119 -0
  83. package/docs/ideas/implementation_plan.md +249 -0
  84. package/docs/ideas/third-party-workflow-setup-design-thinking.md +1948 -0
  85. package/docs/implementation/02-architecture.md +316 -0
  86. package/docs/implementation/04-testing-strategy.md +124 -0
  87. package/docs/implementation/09-simple-workflow-guide.md +835 -0
  88. package/docs/implementation/13-advanced-validation-guide.md +874 -0
  89. package/docs/implementation/README.md +21 -0
  90. package/docs/integrations/claude-code.md +300 -0
  91. package/docs/integrations/firebender.md +315 -0
  92. package/docs/migration/v0.1.0.md +147 -0
  93. package/docs/naming-conventions.md +45 -0
  94. package/docs/planning/README.md +104 -0
  95. package/docs/planning/github-ticketing-playbook.md +195 -0
  96. package/docs/plans/README.md +24 -0
  97. package/docs/plans/agent-managed-ticketing-design.md +605 -0
  98. package/docs/plans/agentic-orchestration-roadmap.md +112 -0
  99. package/docs/plans/assessment-gates-engine-handoff.md +536 -0
  100. package/docs/plans/content-coherence-and-references.md +151 -0
  101. package/docs/plans/library-extraction-plan.md +340 -0
  102. package/docs/plans/mr-review-workflow-redesign.md +1451 -0
  103. package/docs/plans/native-context-management-epic.md +11 -0
  104. package/docs/plans/perf-fixes-design-candidates.md +225 -0
  105. package/docs/plans/perf-fixes-design-review-findings.md +61 -0
  106. package/docs/plans/perf-fixes-new-issues-candidates.md +264 -0
  107. package/docs/plans/perf-fixes-new-issues-review.md +110 -0
  108. package/docs/plans/prompt-fragments.md +53 -0
  109. package/docs/plans/ui-ux-workflow-design-candidates.md +120 -0
  110. package/docs/plans/ui-ux-workflow-discovery.md +100 -0
  111. package/docs/plans/ui-ux-workflow-review.md +48 -0
  112. package/docs/plans/v2-followup-enhancements.md +587 -0
  113. package/docs/plans/workflow-categories-candidates.md +105 -0
  114. package/docs/plans/workflow-categories-discovery.md +110 -0
  115. package/docs/plans/workflow-categories-review.md +51 -0
  116. package/docs/plans/workflow-discovery-model-candidates.md +94 -0
  117. package/docs/plans/workflow-discovery-model-discovery.md +74 -0
  118. package/docs/plans/workflow-discovery-model-review.md +48 -0
  119. package/docs/plans/workflow-source-setup-phase-1.md +245 -0
  120. package/docs/plans/workflow-source-setup-phase-2.md +361 -0
  121. package/docs/plans/workflow-staleness-detection-candidates.md +104 -0
  122. package/docs/plans/workflow-staleness-detection-review.md +58 -0
  123. package/docs/plans/workflow-staleness-detection.md +80 -0
  124. package/docs/plans/workflow-v2-design.md +69 -0
  125. package/docs/plans/workflow-v2-roadmap.md +74 -0
  126. package/docs/plans/workflow-validation-design.md +98 -0
  127. package/docs/plans/workflow-validation-roadmap.md +108 -0
  128. package/docs/plans/workrail-platform-vision.md +420 -0
  129. package/docs/reference/agent-context-cleaner-snippet.md +94 -0
  130. package/docs/reference/agent-context-guidance.md +140 -0
  131. package/docs/reference/context-optimization.md +284 -0
  132. package/docs/reference/example-workflow-repository-template/.github/workflows/validate.yml +125 -0
  133. package/docs/reference/example-workflow-repository-template/README.md +268 -0
  134. package/docs/reference/example-workflow-repository-template/workflows/example-workflow.json +80 -0
  135. package/docs/reference/external-workflow-repositories.md +916 -0
  136. package/docs/reference/feature-flags-architecture.md +472 -0
  137. package/docs/reference/feature-flags.md +349 -0
  138. package/docs/reference/god-tier-workflow-validation.md +272 -0
  139. package/docs/reference/loop-optimization.md +209 -0
  140. package/docs/reference/loop-validation.md +176 -0
  141. package/docs/reference/loops.md +465 -0
  142. package/docs/reference/mcp-platform-constraints.md +59 -0
  143. package/docs/reference/recovery.md +88 -0
  144. package/docs/reference/releases.md +177 -0
  145. package/docs/reference/troubleshooting.md +105 -0
  146. package/docs/reference/workflow-execution-contract.md +998 -0
  147. package/docs/roadmap/README.md +22 -0
  148. package/docs/roadmap/legacy-planning-status.md +103 -0
  149. package/docs/roadmap/now-next-later.md +70 -0
  150. package/docs/roadmap/open-work-inventory.md +389 -0
  151. package/docs/tickets/README.md +39 -0
  152. package/docs/tickets/next-up.md +76 -0
  153. package/docs/workflow-management.md +317 -0
  154. package/docs/workflow-templates.md +423 -0
  155. package/docs/workflow-validation.md +184 -0
  156. package/docs/workflows.md +254 -0
  157. package/package.json +3 -1
  158. package/spec/authoring-spec.json +61 -16
  159. package/workflows/workflow-for-workflows.json +252 -93
  160. package/workflows/workflow-for-workflows.v2.json +188 -77
@@ -0,0 +1,518 @@
1
+ # CTC MCP Server: Technical Proposal
2
+
3
+ **Document Version:** 0.1
4
+ **Date:** January 2025
5
+ **Status:** Draft
6
+
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ ### Problem Statement
12
+
13
+ Developers writing tests in mobile repositories (zillow-android, zillow-ios) need access to test
14
+ case specifications that live in a separate CTC (Centralized Test Cases) repository. Currently,
15
+ there is no standard way for AI assistants to discover and retrieve these specifications, resulting
16
+ in:
17
+
18
+ - Context switching between repos to find relevant test cases
19
+ - AI assistants lacking knowledge of what tests should be implemented
20
+ - No automated way to verify test coverage against specifications
21
+ - Manual, error-prone process for linking implementations to specs
22
+
23
+ ### Solution Overview
24
+
25
+ The CTC MCP Server provides a lightweight local server that bridges the CTC repository and AI
26
+ development assistants. Running entirely on the developer's machine, it exposes test case
27
+ specifications through standardized MCP interfaces, enabling AI agents to:
28
+
29
+ - Discover test cases relevant to features being implemented
30
+ - Retrieve full specifications including given/when/then scenarios
31
+ - Help developers implement tests with correct annotations
32
+ - Support coverage analysis (post-MVP)
33
+
34
+ ### Why MCP?
35
+
36
+ Several alternatives were evaluated:
37
+
38
+ | Approach | Pros | Cons | Verdict |
39
+ |----------|------|------|---------|
40
+ | **Git submodule** | No new infrastructure | Painful UX, sync issues, "submodule hell" | Rejected |
41
+ | **Copy specs to mobile repos** | Simple | Violates single source of truth, drift | Rejected |
42
+ | **Extend WorkRail** | No new MCP | WorkRail is general-purpose, shouldn't be CTC-specific | Rejected |
43
+ | **Multi-root workspace** | Simple | Requires manual setup, two repos to manage | Fallback option |
44
+ | **Dedicated CTC MCP** | Clean architecture, agent-native, follows Constellation pattern | Another MCP to configure | **Selected** |
45
+
46
+ The MCP approach was selected because:
47
+
48
+ 1. Follows the established Constellation MCP pattern
49
+ 2. Provides agent-native access to specs
50
+ 3. Maintains CTC repo as single source of truth
51
+ 4. One-time setup cost per developer
52
+
53
+ ---
54
+
55
+ ## Architecture Overview
56
+
57
+ ### System Context
58
+
59
+ ```
60
+ CTC GitLab Repo CTC MCP Server Developer's IDE
61
+ ┌──────────────────┐ ┌──────────────┐ ┌──────────────┐
62
+ │ specs/ │ │ │ │ │
63
+ │ ├── MM/ │ fetch │ Registry │ MCP │ AI Agent │
64
+ │ │ └── *.yaml │ ──────► │ + Cache │ ◄───────► │ (Cursor) │
65
+ │ ├── GTM/ │ │ │ │ │
66
+ │ └── TBEX/ │ └──────────────┘ └──────────────┘
67
+ └──────────────────┘ │ │
68
+ (source of ~/.cache/ zillow-android/
69
+ truth) ctc-mcp/ zillow-ios/
70
+ ```
71
+
72
+ ### Key Design Decisions
73
+
74
+ | Decision | Rationale |
75
+ |----------|-----------|
76
+ | **Separate MCP** | WorkRail is general-purpose; CTC is domain-specific data access |
77
+ | **GitLab as data source** | CTC repo is the single source of truth; no duplication |
78
+ | **Local caching** | Fast responses, offline capability, reduced API calls |
79
+ | **Comment-based annotations** | Works on Android (Kotlin) and iOS (Swift) without build changes |
80
+ | **No version detection** | Unlike Constellation, YAML specs are stable; always use main branch |
81
+
82
+ ### Data Model
83
+
84
+ ```typescript
85
+ interface TestCase {
86
+ id: string; // "TC-MSG-FUNC-001-TC01"
87
+ collectionId: string; // "TC-MSG-FUNC-001"
88
+ description: string; // "User sends text message successfully"
89
+ priority: "P1" | "P2" | "P3";
90
+ testType: "Bare Integration" | "UI" | "Snapshot";
91
+ team: string; // "MM", "GTM", "TBEX"
92
+ feature: string; // "messaging", "touring", "rentals"
93
+ given: string[]; // Preconditions
94
+ when: string[]; // Actions
95
+ then: string[]; // Expected outcomes
96
+ requirementsUrl?: string; // Link to BRD/PRD
97
+ designUrl?: string; // Link to Figma
98
+ lastUpdated: string; // ISO date
99
+ }
100
+ ```
101
+
102
+ ---
103
+
104
+ ## MCP Tools
105
+
106
+ ### MVP Scope (2 Tools)
107
+
108
+ The MVP includes only the essential tools for Pillar 2 (test implementation assistance):
109
+
110
+ #### 1. search_test_cases
111
+
112
+ **Purpose:** Find test cases by various criteria. The primary discovery tool.
113
+
114
+ **Input Schema:**
115
+ | Parameter | Type | Required | Description |
116
+ |-----------|------|----------|-------------|
117
+ | query | string | No | Free text search across descriptions, given/when/then |
118
+ | team | string | No | Filter by team (MM, GTM, TBEX) |
119
+ | feature | string | No | Filter by feature (messaging, touring, rentals) |
120
+ | priority | enum | No | Filter by priority (P1, P2, P3) |
121
+ | testType | enum | No | Filter by test type (Bare Integration, UI, Snapshot) |
122
+ | limit | number | No | Max results (default: 20) |
123
+
124
+ **Response:** Array of matching test cases with summary information.
125
+
126
+ **Example Usage:**
127
+
128
+ ```
129
+ Developer: "What tests do I need for the login feature?"
130
+ Agent calls: search_test_cases({ feature: "login", priority: "P1" })
131
+ Agent: "I found 3 P1 test cases for login:
132
+ - TC-AUTH-001-TC01: Valid credentials returns JWT
133
+ - TC-AUTH-001-TC02: Invalid password returns 401
134
+ - TC-AUTH-001-TC03: Missing email returns 400"
135
+ ```
136
+
137
+ #### 2. get_test_case
138
+
139
+ **Purpose:** Get full details of a specific test case by ID. Includes fuzzy matching suggestions if
140
+ ID not found.
141
+
142
+ **Input Schema:**
143
+ | Parameter | Type | Required | Description |
144
+ |-----------|------|----------|-------------|
145
+ | testCaseId | string | Yes | Test case ID (e.g., TC-MSG-FUNC-001-TC01) |
146
+
147
+ **Response:** Full test case specification, or error with suggested similar IDs.
148
+
149
+ **Example Usage:**
150
+
151
+ ```
152
+ Developer: "Show me the details for TC-AUTH-001-TC01"
153
+ Agent calls: get_test_case({ testCaseId: "TC-AUTH-001-TC01" })
154
+ Agent: "Here's the full spec:
155
+
156
+ TC-AUTH-001-TC01: Valid credentials returns JWT
157
+ Priority: P1
158
+ Type: Bare Integration
159
+
160
+ Given:
161
+ - User has valid credentials in the system
162
+ - Authentication service is available
163
+
164
+ When:
165
+ - User submits login with correct email and password
166
+
167
+ Then:
168
+ - User receives 200 OK response
169
+ - Response contains valid JWT token
170
+ - Token expiry is set to 24 hours"
171
+ ```
172
+
173
+ **Not Found Handling:**
174
+
175
+ ```
176
+ Agent calls: get_test_case({ testCaseId: "TC-AUTH-001-TC99" })
177
+ Response: {
178
+ "found": false,
179
+ "requestedId": "TC-AUTH-001-TC99",
180
+ "suggestions": [
181
+ "TC-AUTH-001-TC01",
182
+ "TC-AUTH-001-TC02",
183
+ "TC-AUTH-001-TC03"
184
+ ]
185
+ }
186
+ ```
187
+
188
+ ### Post-MVP Tools
189
+
190
+ These tools will be added after MVP validation:
191
+
192
+ #### 3. get_implementation_template (Post-MVP)
193
+
194
+ **Purpose:** Generate platform-specific test skeleton with correct annotation format.
195
+
196
+ **Input Schema:**
197
+ | Parameter | Type | Required | Description |
198
+ |-----------|------|----------|-------------|
199
+ | testCaseId | string | Yes | Test case ID to implement |
200
+ | platform | enum | Yes | Target platform (android, ios) |
201
+
202
+ **Response:** Code template with `@TestCaseId` annotation and spec as comments.
203
+
204
+ **Why Post-MVP:** The agent can generate code without this tool. Having it ensures consistent
205
+ annotation format, but it's not essential for initial validation.
206
+
207
+ #### 4. find_unimplemented_test_cases (Post-MVP)
208
+
209
+ **Purpose:** Coverage gap analysis for Pillar 3.
210
+
211
+ **Input Schema:**
212
+ | Parameter | Type | Required | Description |
213
+ |-----------|------|----------|-------------|
214
+ | team | string | No | Filter by team |
215
+ | feature | string | No | Filter by feature |
216
+ | implementedIds | string[] | Yes | List of test case IDs already implemented |
217
+
218
+ **Response:** Coverage statistics and list of unimplemented test cases.
219
+
220
+ **Why Post-MVP:** This is Pillar 3 functionality. Pillar 2 (implementation assistance) should be
221
+ validated first.
222
+
223
+ ### Tool Summary
224
+
225
+ | Tool | MVP? | Pillar | Purpose |
226
+ |------|------|--------|---------|
227
+ | search_test_cases | Yes | 2 | Discovery |
228
+ | get_test_case | Yes | 2 | Retrieval |
229
+ | get_implementation_template | No | 2 | Code generation |
230
+ | find_unimplemented_test_cases | No | 3 | Coverage analysis |
231
+
232
+ ---
233
+
234
+ ## Integration with Three Pillars
235
+
236
+ ### Pillar 1: Test Case Generation
237
+
238
+ **Relationship:** CTC MCP is a consumer of Pillar 1 output.
239
+
240
+ - Pillar 1 generates YAML test case specs in the CTC repo
241
+ - CTC MCP reads these specs and exposes them to agents
242
+ - No changes needed to Pillar 1 for MCP to work
243
+
244
+ ### Pillar 2: Test Implementation Assistance
245
+
246
+ **Relationship:** CTC MCP is the primary enabler of Pillar 2.
247
+
248
+ **Developer Flow:**
249
+
250
+ 1. Developer starts implementing a feature in zillow-android
251
+ 2. Asks agent: "What tests do I need for this feature?"
252
+ 3. Agent calls `search_test_cases` via CTC MCP
253
+ 4. Agent presents relevant test cases
254
+ 5. Developer selects one to implement
255
+ 6. Agent calls `get_test_case` for full spec
256
+ 7. Agent helps write test code with `@TestCaseId` annotation
257
+ 8. Developer commits test
258
+
259
+ **Annotation Format:**
260
+
261
+ ```kotlin
262
+ // Android (Kotlin)
263
+ // @TestCaseId("TC-MSG-FUNC-001-TC01")
264
+ @Test
265
+ fun `user sends text message successfully`() {
266
+ // Test implementation
267
+ }
268
+ ```
269
+
270
+ ```swift
271
+ // iOS (Swift)
272
+ // @TestCaseId("TC-MSG-FUNC-001-TC01")
273
+ func testUserSendsTextMessageSuccessfully() {
274
+ // Test implementation
275
+ }
276
+ ```
277
+
278
+ ### Pillar 3: Verification
279
+
280
+ **Relationship:** CTC MCP provides data for coverage analysis (post-MVP).
281
+
282
+ **Coverage Flow:**
283
+
284
+ 1. Script extracts all `@TestCaseId` annotations from codebase
285
+ 2. Agent calls `find_unimplemented_test_cases` with extracted IDs
286
+ 3. MCP compares against full spec inventory
287
+ 4. Returns coverage percentage and missing test cases
288
+
289
+ ---
290
+
291
+ ## Implementation Roadmap
292
+
293
+ ### Phase 1: Foundation (Week 1-2)
294
+
295
+ - [ ] Project scaffolding (Node.js, TypeScript)
296
+ - [ ] GitLab API client with rate limiting
297
+ - [ ] Local cache manager (~/.cache/ctc-mcp/)
298
+ - [ ] Configuration management (~/.config/ctc-mcp/config.json)
299
+ - [ ] YAML parser for test case specs
300
+
301
+ ### Phase 2: MVP Tools (Week 2-3)
302
+
303
+ - [ ] `search_test_cases` implementation
304
+ - [ ] `get_test_case` implementation with fuzzy matching
305
+ - [ ] MCP server setup (stdio transport)
306
+ - [ ] Error handling and logging
307
+
308
+ ### Phase 3: Distribution (Week 3-4)
309
+
310
+ - [ ] npm package preparation
311
+ - [ ] Installation documentation
312
+ - [ ] IDE configuration examples (Cursor, Firebender)
313
+ - [ ] Troubleshooting guide
314
+
315
+ ### Phase 4: Post-MVP (Future)
316
+
317
+ - [ ] `get_implementation_template` tool
318
+ - [ ] `find_unimplemented_test_cases` tool
319
+ - [ ] WorkRail workflow integration
320
+ - [ ] Coverage dashboard integration
321
+
322
+ ---
323
+
324
+ ## Developer Setup
325
+
326
+ ### Installation
327
+
328
+ Add to IDE's MCP configuration (e.g., `mcp.json`):
329
+
330
+ ```json
331
+ {
332
+ "mcpServers": {
333
+ "ctc-mcp": {
334
+ "command": "npx",
335
+ "args": [
336
+ "-y",
337
+ "--registry",
338
+ "https://artifactory.zgtools.net/artifactory/api/npm/znpm",
339
+ "@zillow/ctc-mcp@latest"
340
+ ]
341
+ }
342
+ }
343
+ }
344
+ ```
345
+
346
+ ### Configuration
347
+
348
+ Create `~/.config/ctc-mcp/config.json`:
349
+
350
+ ```json
351
+ {
352
+ "gitlab": {
353
+ "token": "glpat-xxxxxxxxxxxxxxxxxxxx"
354
+ },
355
+ "logLevel": "info"
356
+ }
357
+ ```
358
+
359
+ ### Verification
360
+
361
+ Ask your AI assistant:
362
+ > "What test cases exist for the messaging feature?"
363
+
364
+ The agent should return test cases from the CTC repository.
365
+
366
+ ---
367
+
368
+ ## Caching Strategy
369
+
370
+ ### Cache Structure
371
+
372
+ ```
373
+ ~/.cache/ctc-mcp/
374
+ ├── test_cases.json # All test cases
375
+ ├── teams.json # Team metadata
376
+ └── manifest.json # Cache metadata
377
+ ```
378
+
379
+ ### Cache Behavior
380
+
381
+ | Scenario | Behavior |
382
+ |----------|----------|
383
+ | First run | Fetch from GitLab, populate cache |
384
+ | Subsequent runs | Use cache |
385
+ | Cache miss | Fetch from GitLab |
386
+ | Manual refresh | Delete cache directory, restart |
387
+
388
+ ### Why No TTL/Expiry?
389
+
390
+ Unlike Constellation (where component APIs change frequently), CTC specs are:
391
+
392
+ - Updated less frequently
393
+ - Not version-sensitive (no API signatures)
394
+ - Easy to manually refresh when needed
395
+
396
+ Developers can clear cache when they know specs have changed:
397
+
398
+ ```bash
399
+ rm -rf ~/.cache/ctc-mcp
400
+ ```
401
+
402
+ ---
403
+
404
+ ## Comparison to Constellation MCP
405
+
406
+ | Aspect | Constellation MCP | CTC MCP |
407
+ |--------|-------------------|---------|
408
+ | **Domain** | UI components + design tokens | Test case specifications |
409
+ | **Tools count** | Many (search, tokens, migration, etc.) | Minimal (2 for MVP) |
410
+ | **Version detection** | Yes (API signatures change) | No (YAML is stable) |
411
+ | **Cache strategy** | Version-based | Simple (main branch) |
412
+ | **Platform support** | Android, iOS, Web | Android, iOS |
413
+ | **Code generation** | No | Yes (post-MVP) |
414
+ | **Coverage tracking** | No | Yes (post-MVP) |
415
+
416
+ ---
417
+
418
+ ## Success Criteria
419
+
420
+ ### MVP Success
421
+
422
+ The MVP will be considered successful if:
423
+
424
+ 1. **Functional:** Agents can search and retrieve test cases
425
+ 2. **Performant:** Response time < 500ms for cached queries
426
+ 3. **Adopted:** At least 5 developers actively using it
427
+ 4. **Useful:** Developers report finding relevant test cases faster
428
+
429
+ ### Metrics to Track
430
+
431
+ | Metric | Target | Measurement |
432
+ |--------|--------|-------------|
433
+ | Setup success rate | > 90% | First-run telemetry |
434
+ | Query response time | < 500ms | Local timing |
435
+ | Cache hit rate | > 80% | Cache statistics |
436
+ | Developer satisfaction | > 7/10 | Survey |
437
+
438
+ ---
439
+
440
+ ## Risk Assessment
441
+
442
+ | Risk | Probability | Impact | Mitigation |
443
+ |------|-------------|--------|------------|
444
+ | GitLab API rate limits | Low | Medium | Aggressive caching |
445
+ | MCP protocol changes | Low | High | Pin to stable version |
446
+ | Low adoption | Medium | High | Good docs, simple setup |
447
+ | Cache corruption | Low | Low | Easy cache clear |
448
+
449
+ ---
450
+
451
+ ## Open Questions
452
+
453
+ 1. **Should MCP support both main branch and tagged releases?**
454
+ - Current proposal: main branch only
455
+ - Alternative: Support version override for specific tags
456
+
457
+ 2. **How should coverage data be aggregated across Android and iOS?**
458
+ - Pillar 3 concern, deferred to post-MVP
459
+
460
+ 3. **Should there be a WorkRail workflow that uses CTC MCP?**
461
+ - Deferred to post-MVP
462
+ - WorkRail can call MCP tools; integration is natural
463
+
464
+ ---
465
+
466
+ ## Appendix: Rejected Alternatives
467
+
468
+ ### A. Extend WorkRail with CTC Tools
469
+
470
+ **Proposal:** Add `ctc_lookup` tool directly to WorkRail MCP.
471
+
472
+ **Rejected because:**
473
+
474
+ - WorkRail is a general-purpose workflow engine
475
+ - Adding domain-specific tools violates single responsibility
476
+ - Authentication and data source management would complicate WorkRail
477
+ - CTC team should own CTC tooling
478
+
479
+ ### B. Extend Constellation MCP
480
+
481
+ **Proposal:** Add test case queries to Constellation MCP.
482
+
483
+ **Rejected because:**
484
+
485
+ - Constellation is for design system (components, tokens)
486
+ - Test cases are unrelated domain
487
+ - Would create confusing scope for Constellation MCP
488
+ - Different teams own different concerns
489
+
490
+ ### C. Git Submodule
491
+
492
+ **Proposal:** Add CTC repo as submodule in mobile repos.
493
+
494
+ **Rejected because:**
495
+
496
+ - Git submodules have poor developer experience
497
+ - Sync issues, stale refs, merge conflicts
498
+ - Requires manual `git submodule update`
499
+ - MCP provides better UX for same outcome
500
+
501
+ ### D. Combined "Orchestration MCP"
502
+
503
+ **Proposal:** Single MCP combining WorkRail + CTC + other tools.
504
+
505
+ **Rejected because:**
506
+
507
+ - Creates coupling between unrelated systems
508
+ - Release coordination overhead
509
+ - Unclear ownership
510
+ - Scope creep risk ("everything goes in the MCP")
511
+
512
+ ---
513
+
514
+ ## Document History
515
+
516
+ | Version | Date | Author | Changes |
517
+ |---------|------|--------|---------|
518
+ | 0.1 | January 2025 | - | Initial draft |
@@ -0,0 +1,22 @@
1
+ # Design Docs
2
+
3
+ Use this directory for **durable design and architecture**.
4
+
5
+ Good fits:
6
+
7
+ - system design
8
+ - architectural explanations
9
+ - extension-point design
10
+ - protocol or model design
11
+ - long-lived design constraints
12
+
13
+ Do **not** use this directory for:
14
+
15
+ - roadmap prioritization
16
+ - execution-ready tickets
17
+ - raw ideas
18
+ - temporary implementation moment docs
19
+
20
+ ## Notes
21
+
22
+ - If a doc is about **what to build next**, it probably belongs in `docs/roadmap/`, `docs/tickets/`, or `docs/plans/` instead.
@@ -0,0 +1,96 @@
1
+ # The Agent Cascade Protocol
2
+
3
+ ## Executive Summary
4
+
5
+ The **Agent Cascade Protocol** is the architectural foundation that allows WorkRail to function universally across different agentic environments—from simple "chat" interfaces to complex, multi-agent IDEs like Firebender and Cursor.
6
+
7
+ Instead of requiring a specific setup, WorkRail adopts a **Progressive Capability** model. It detects the available agent capabilities and "cascades" down to the best execution strategy available.
8
+
9
+ This ensures three critical outcomes:
10
+ 1. **Universal Compatibility:** WorkRail works for users with zero configuration.
11
+ 2. **Power User Scalability:** WorkRail enables advanced orchestration for users with configured subagents.
12
+ 3. **Zero Hallucination:** The protocol verifies capabilities before attempting to use them.
13
+
14
+ ---
15
+
16
+ ## The Three Execution Tiers
17
+
18
+ WorkRail defines three distinct tiers of execution. The system automatically selects the highest available tier for each task.
19
+
20
+ ### Tier 3: Delegation Mode (Gold)
21
+ * **Requirement:** User has specialized Subagents (e.g., "Researcher") configured with access to WorkRail MCP tools.
22
+ * **Behavior:** The Main Agent acts as a **Dispatcher**. It identifies a task (e.g., "Gather Context"), selects the appropriate Subagent, and hands off the entire corresponding WorkRail Routine (e.g., `routine-gather`). The Subagent executes the routine independently and reports back the final result.
23
+ * **Pros:** Parallel execution, true specialization, cleanest context window for Main Agent.
24
+ * **Cons:** Requires the most advanced configuration (Tool Whitelisting).
25
+
26
+ ### Tier 2: Proxy Mode (Silver)
27
+ * **Requirement:** User has specialized Subagents, but they *cannot* access WorkRail tools (default state in many IDEs).
28
+ * **Behavior:** The Main Agent acts as a **Driver**. It reads the WorkRail steps itself, but delegates the *work* to the Subagent via natural language prompts.
29
+ * *Main Agent:* "Researcher, please find all files related to Auth."
30
+ * *Subagent:* (Uses native grep) "Here they are..."
31
+ * *Main Agent:* (Reads output, marks WorkRail step as complete).
32
+ * **Pros:** Uses Subagent specialization and context isolation without complex tool config.
33
+ * **Cons:** Main Agent's context window gets polluted with the management overhead; serial execution only.
34
+
35
+ ### Tier 1: Solo Mode (Bronze)
36
+ * **Requirement:** User has no subagents (or is using a standard chat interface).
37
+ * **Behavior:** The Main Agent acts as the **Worker**. WorkRail dynamically injects "Persona Instructions" into the step prompt to simulate specialization.
38
+ * *WorkRail Prompt:* "ACT AS A RESEARCHER. Do not write code. Only gather context."
39
+ * **Pros:** Works everywhere, zero configuration.
40
+ * **Cons:** Single context window, risk of persona drift (e.g., trying to code during research).
41
+
42
+ ---
43
+
44
+ ## The Decision Logic (The Probe)
45
+
46
+ How does WorkRail know which tier to use? It uses a **"Verify then Delegate"** pattern (The Probe Protocol).
47
+
48
+ ### 1. The Boot Check (Diagnostic Phase)
49
+ When a session starts (or via the `workflow-diagnose-environment` workflow), WorkRail guides the Main Agent to probe the environment:
50
+
51
+ 1. **Check for Subagents:** "Do you have a 'Researcher' subagent?"
52
+ * *No:* **Fallback to Tier 1 (Solo).**
53
+ * *Yes:* Proceed to step 2.
54
+
55
+ 2. **Check for Tool Access:** "Ask your Researcher to call `workflow_list`."
56
+ * *Success:* **Upgrade to Tier 3 (Delegation).**
57
+ * *Failure/Unknown:* **Fallback to Tier 2 (Proxy).**
58
+
59
+ ### 2. The Runtime Handoff (Execution Phase)
60
+ When executing a workflow step that calls for a specialized routine:
61
+
62
+ * **If Tier 3:** WorkRail provides the **Delegation Instruction**:
63
+ > "Delegate the `routine-gather` workflow to your Researcher Subagent. Instruct them to run it using `workflow_next`."
64
+
65
+ * **If Tier 2:** WorkRail provides the **Proxy Instruction**:
66
+ > "Act as a Proxy. Read the steps of `routine-gather`. For each step, instruct your Researcher Subagent to perform the work via natural language. Validate their results yourself."
67
+
68
+ * **If Tier 1:** WorkRail provides the **Persona Instruction**:
69
+ > "ACT AS A RESEARCHER. Execute the `routine-gather` steps yourself. Focus purely on gathering context."
70
+
71
+ ---
72
+
73
+ ## Configuration & Assets
74
+
75
+ To support this protocol, WorkRail provides:
76
+
77
+ 1. **The Diagnostic Workflow:** A guided utility (`workflow-diagnose-environment.json`) to help users verify and configure their agents.
78
+ 2. **The Asset Pack:** Standardized definitions for common roles (Researcher, Architect, Builder, Reviewer) that users can copy-paste into their IDE configs.
79
+ * Includes System Prompts (for Tiers 1-3).
80
+ * Includes Tool Whitelists (for enabling Tier 3).
81
+ 3. **The Config Cache:** A local file (`.workrail/config.json`) where the Diagnostic Workflow saves the environment state, so the Main Agent remembers the correct Tier across sessions.
82
+
83
+ ---
84
+
85
+ ## Summary of Flows
86
+
87
+ | Feature | Tier 3 (Delegate) | Tier 2 (Proxy) | Tier 1 (Solo) |
88
+ | :--- | :--- | :--- | :--- |
89
+ | **Orchestrator** | Main Agent | Main Agent | Main Agent |
90
+ | **Worker** | Subagent | Subagent | Main Agent |
91
+ | **Tools Used** | Subagent (Native + MCP) | Subagent (Native) | Main Agent (Native + MCP) |
92
+ | **Context** | Isolated | Shared/Polluted | Shared |
93
+ | **Config Req** | High (Tools + Prompts) | Low (Prompts) | None |
94
+ | **Scalability** | High | Medium | Low |
95
+
96
+ This protocol ensures WorkRail is never "broken" by a lack of configuration—it simply adapts its strategy to match the available tools.