@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,74 @@
1
+ # Workflow v2 Roadmap
2
+
3
+ This is the **canonical planning/status doc** for WorkRail v2.
4
+
5
+ Use it for:
6
+
7
+ - the v2 mission and invariants
8
+ - what is already shipped
9
+ - what remains partial or open
10
+ - realistic next work
11
+
12
+ Do **not** use this doc for long-form design history or chat-resumption guidance. Those belong in the companion design doc and the code.
13
+
14
+ ## Mission
15
+
16
+ Make WorkRail workflows **resumable, rewind-safe, deterministic, and durable** without depending on chat transcript state.
17
+
18
+ ## Core invariants
19
+
20
+ ### 1. Execution happens through opaque workflow tokens
21
+
22
+ Agents should round-trip tokens, not construct engine internals.
23
+
24
+ ### 2. Durable truth is append-only
25
+
26
+ Sessions and runs should be projections over append-only execution truth, not mutable JSON truth stores.
27
+
28
+ ### 3. Runs are pinned to compiled workflow content
29
+
30
+ Execution should stay tied to a deterministic workflow snapshot rather than drift with later edits.
31
+
32
+ ### 4. Rewinds must stay safe
33
+
34
+ If a user or client rewinds chat state, WorkRail should preserve execution integrity through branching/recovery rather than silent corruption.
35
+
36
+ ## Shipped or largely shipped
37
+
38
+ - v2 MCP tool surface (`list_workflows`, `inspect_workflow`, `start_workflow`, `continue_workflow`, `checkpoint_workflow`, `resume_session`)
39
+ - append-only execution substrate and projections
40
+ - token-based execution boundary
41
+ - checkpointing and session resumption
42
+ - typed output validation and blocked retry UX
43
+ - substantial hardening/modularization work
44
+
45
+ ## Still partial
46
+
47
+ - lifecycle validation coverage breadth (see `docs/plans/workflow-validation-roadmap.md`)
48
+
49
+ ## Still open
50
+
51
+ - progress notifications
52
+ - stronger verification/evidence contract model
53
+ - parallel `forEach` execution
54
+ - subagent composition chains
55
+
56
+ See `docs/plans/v2-followup-enhancements.md` for the detailed open follow-up initiative list.
57
+
58
+ ## Recommended next work
59
+
60
+ ### Near-term
61
+
62
+ 1. **Progress notifications**
63
+ 2. **Verification/evidence contract improvements**
64
+
65
+ ### After that
66
+
67
+ 1. **Parallel loop execution and richer delegated composition**
68
+
69
+ ## Canonical companions
70
+
71
+ - `docs/plans/workflow-v2-design.md`
72
+ - `docs/plans/v2-followup-enhancements.md`
73
+ - `docs/roadmap/open-work-inventory.md`
74
+ - `docs/tickets/next-up.md`
@@ -0,0 +1,98 @@
1
+ # Workflow Validation Design
2
+
3
+ This is the **canonical durable design doc** for the workflow validation initiative.
4
+
5
+ Use it for:
6
+
7
+ - architectural rules that should remain true over time
8
+ - the validation model and shared boundaries
9
+ - important design constraints that explain *why* the system is shaped this way
10
+
11
+ Do **not** use this doc as a code-shadow full of exact signatures or large copy-paste implementation recipes. Those drift too easily.
12
+
13
+ ## Core design rule
14
+
15
+ Validation must track what runtime actually does, not a simplified approximation of it.
16
+
17
+ If validation and runtime diverge, the validator becomes a false assurance layer.
18
+
19
+ ## Architectural principles
20
+
21
+ ### Shared resolution, not duplicate resolution
22
+
23
+ Validation and runtime should rely on the same source/variant resolution logic rather than maintaining parallel implementations.
24
+
25
+ This includes:
26
+
27
+ - workflow discovery
28
+ - candidate resolution
29
+ - first-step/start construction
30
+ - feature-flag-sensitive variant choice
31
+
32
+ ### One validation pipeline, many consumers
33
+
34
+ CLI, MCP tools, registry validation, and any future runtime assertions should all rely on the same validation pipeline rather than each adding their own interpretation of “valid.”
35
+
36
+ ### Fail loudly instead of hiding invalid workflows
37
+
38
+ If invalid workflows are filtered out or silently degraded, the system cannot make trustworthy claims about validity.
39
+
40
+ ### Validate the lifecycle, not just the file
41
+
42
+ Static validation is necessary but insufficient. A stronger validation story includes execution-oriented checks and lifecycle coverage for important bundled workflows.
43
+
44
+ ## Validation tiers
45
+
46
+ ### Tier 1: File validation
47
+
48
+ Purpose:
49
+
50
+ - schema conformance
51
+ - structural correctness
52
+
53
+ This is the cheapest and most local layer, but it is not enough on its own.
54
+
55
+ ### Tier 2: Registry validation
56
+
57
+ Purpose:
58
+
59
+ - validate discoverable workflows as runtime resolves them
60
+ - catch duplicate IDs, source conflicts, and variant-resolution mismatches
61
+
62
+ This is the tier that closes the gap between individual file validity and actual runtime selection behavior.
63
+
64
+ ### Tier 3: Execution validation
65
+
66
+ Purpose:
67
+
68
+ - verify lifecycle integrity
69
+ - catch failures that only appear when stepping through execution paths
70
+
71
+ This tier is what turns validation from “static confidence” into stronger runtime equivalence.
72
+
73
+ ## Important design consequences
74
+
75
+ ### Validation is partly a runtime-design problem
76
+
77
+ Some validation gaps cannot be solved only by adding new checks. They require runtime behavior to stop hiding invalid states or silently degrading.
78
+
79
+ ### Tests are part of the contract
80
+
81
+ Lifecycle harnesses and regression coverage are not optional polish. They are part of the proof that the validation story matches execution reality.
82
+
83
+ ### Code is the implementation truth
84
+
85
+ This doc should explain the durable model, but exact signatures, file counts, and phased code recipes belong in code/tests or short-lived implementation work, not in the permanent design doc.
86
+
87
+ ## Current design priorities
88
+
89
+ 1. preserve runtime/validation parity
90
+ 2. make failures visible rather than hidden
91
+ 3. expand lifecycle confidence pragmatically
92
+ 4. avoid sprawling operator/process docs that duplicate the plan
93
+
94
+ ## Companion docs
95
+
96
+ - `docs/plans/workflow-validation-roadmap.md`
97
+ - `docs/roadmap/open-work-inventory.md`
98
+ - `docs/tickets/next-up.md`
@@ -0,0 +1,108 @@
1
+ # Workflow Validation Roadmap
2
+
3
+ This is the **canonical planning/status doc** for the workflow validation initiative.
4
+
5
+ Use it for:
6
+
7
+ - mission and invariants
8
+ - what is shipped
9
+ - what is still open
10
+ - realistic next work
11
+
12
+ Do **not** use this doc for line-by-line implementation scaffolding. That belongs either in the code, tests, or the companion design doc.
13
+
14
+ ## Mission
15
+
16
+ Make workflow validation the authoritative, runtime-equivalent gate for all workflows.
17
+
18
+ In practice, that means:
19
+
20
+ - invalid workflows should be caught before user-visible execution
21
+ - invalid workflows should not be silently hidden
22
+ - validation and runtime should agree on what workflow is actually being executed
23
+
24
+ ## Durable invariants
25
+
26
+ ### 1. Runtime workflow-definition failures are validator failures
27
+
28
+ If a workflow passes validation and later fails during execution because the workflow definition itself is invalid, the validator is incomplete.
29
+
30
+ ### 2. Validation and runtime must speak the same error language
31
+
32
+ If runtime can discover workflow-definition errors that validation cannot represent, the validation model is incomplete.
33
+
34
+ ### 3. Validation and runtime must resolve the same workflow
35
+
36
+ Registry validation and runtime must use the same resolution path for sources, variants, and start construction.
37
+
38
+ ### 4. There is one authoritative validation pipeline
39
+
40
+ No consumer should decide “is this workflow valid?” by reimplementing validation outside the shared pipeline.
41
+
42
+ ## Validation model
43
+
44
+ ### Tier 1: File validation
45
+
46
+ Checks whether an individual workflow file is structurally valid.
47
+
48
+ ### Tier 2: Registry validation
49
+
50
+ Checks workflows as runtime actually discovers and resolves them across sources and variants.
51
+
52
+ ### Tier 3: Execution validation
53
+
54
+ Checks that workflows can actually run through lifecycle paths without workflow-definition failures.
55
+
56
+ ## Current status
57
+
58
+ ### Shipped or largely shipped
59
+
60
+ - unified validation pipeline groundwork
61
+ - registry-centric validation groundwork
62
+ - validation/runtime resolution-parity direction
63
+ - fail-louder runtime direction for some previously hidden errors
64
+
65
+ ### Still partial
66
+
67
+ - lifecycle-harness breadth and real coverage targets
68
+ - normalization of stale validation status/operator docs
69
+ - fully explicit closure on remaining runtime-vs-validation gaps
70
+
71
+ ### Still open
72
+
73
+ - broader lifecycle coverage for bundled workflows
74
+ - final cleanup of stale operator-oriented validation docs
75
+ - any remaining closure work needed for a trustworthy “done” claim
76
+
77
+ ## Remaining work
78
+
79
+ ### Near-term
80
+
81
+ 1. **Expand lifecycle validation coverage**
82
+ - define a realistic target
83
+ - cover more bundled workflows
84
+ - stop implying closure that the current test surface does not support
85
+
86
+ 2. **Finish validation status cleanup**
87
+ - reduce stale operator docs and duplicated entrypoints
88
+ - make this roadmap the clear planning source of truth
89
+
90
+ 3. **Confirm remaining gaps explicitly**
91
+ - document whether any runtime-definition failure classes remain outside the validator
92
+
93
+ ### Later, if needed
94
+
95
+ 1. tighten any remaining runtime/validator parity gaps
96
+ 2. revisit whether additional execution-integrity tooling is needed
97
+
98
+ ## What success looks like
99
+
100
+ - validation is the trusted gate for bundled workflows
101
+ - the remaining open work is small, explicit, and measurable
102
+ - the planning/docs surface is simple enough that contributors know where truth lives
103
+
104
+ ## Live companions
105
+
106
+ - `docs/plans/workflow-validation-design.md`
107
+ - `docs/roadmap/open-work-inventory.md`
108
+ - `docs/tickets/next-up.md`
@@ -0,0 +1,420 @@
1
+ # WorkRail Platform Vision: From Engine to Ecosystem
2
+
3
+ ## Problem statement
4
+
5
+ WorkRail is a powerful workflow execution engine. But getting workflows into users' hands -- discovering, installing, sharing, configuring -- is harder than it should be. The engine works well once running; everything around it creates friction.
6
+
7
+ This matters because WorkRail's value scales with adoption. A workflow that only runs on the author's machine is a personal tool. A workflow that any agent on any team can discover and run is infrastructure. The gap between those two is the problem this document addresses.
8
+
9
+ ## Personas
10
+
11
+ ### Solo developer
12
+
13
+ Works alone or on a small project. Wants structured agent execution for recurring tasks (code review, feature implementation, bug triage). Doesn't want to learn a new system -- just wants the agent to be better.
14
+
15
+ - **Entry point**: installs workrail, uses bundled workflows
16
+ - **Progression**: tweaks a workflow prompt, eventually authors their own
17
+ - **Pain today**: setup is manual, no guidance, has to understand the internals
18
+
19
+ ### Team member
20
+
21
+ Part of a team sharing a repo. The team has conventions and patterns they want agents to follow consistently. Wants to use team workflows without thinking about it.
22
+
23
+ - **Entry point**: clones a repo, team workflows should just be there
24
+ - **Progression**: contributes improvements to team workflows
25
+ - **Pain today**: has to manually install workflows, references break across machines, no project-level discovery
26
+
27
+ ### Platform/infrastructure team
28
+
29
+ Maintains shared patterns that other teams should follow (contribution models, API design, deployment). Wants to distribute workflows that encode "how to do X correctly" so that consuming teams get it right without tribal knowledge.
30
+
31
+ - **Entry point**: authors workflows with embedded references (schemas, guides, patterns)
32
+ - **Progression**: maintains and versions workflows that other teams consume
33
+ - **Pain today**: workspace references break outside the source repo, no distribution mechanism, no way to update consumers
34
+
35
+ ### Open source author
36
+
37
+ Ships a library or framework. Wants to include a workflow that helps users integrate it correctly. The workflow should work for anyone who installs the package, regardless of their setup.
38
+
39
+ - **Entry point**: includes a workflow in their package
40
+ - **Progression**: maintains the workflow alongside the code
41
+ - **Pain today**: no portable packaging, no reference portability, no install mechanism
42
+
43
+ ### Non-developer
44
+
45
+ Works in content, ops, data, product. Heard that agents can follow structured workflows. Wants to encode a process (incident response, content review, data pipeline check) without writing JSON.
46
+
47
+ - **Entry point**: describes what they want, agent creates the workflow
48
+ - **Progression**: tweaks the workflow through conversation, not code
49
+ - **Pain today**: would bounce immediately. JSON authoring is a hard wall.
50
+
51
+ ## Progressive complexity model
52
+
53
+ Users should be able to use WorkRail at any level without understanding the levels above.
54
+
55
+ ### Level 0: Use bundled workflows
56
+
57
+ - Install workrail. Bundled workflows are available immediately.
58
+ - Pick one, run it. No authoring, no configuration.
59
+ - **Requirement**: zero-config start. Works out of the box.
60
+
61
+ ### Level 1: Install a shared workflow
62
+
63
+ - Someone gives you a workflow (file, URL, package name).
64
+ - One action to install. Setup prompt handles it.
65
+ - **Requirement**: single-step install. Agent-assisted. No manual file management.
66
+
67
+ ### Level 2: Customize an existing workflow
68
+
69
+ - Fork a workflow and modify it for your needs.
70
+ - Edit prompts, add steps, change confirmation gates.
71
+ - Could be JSON editing, markdown editing, or conversational ("make Phase 3 more thorough").
72
+ - **Requirement**: multiple authoring surfaces. JSON is not the only option.
73
+
74
+ ### Level 3: Author a new workflow
75
+
76
+ - Create a workflow from scratch for a recurring task.
77
+ - Full access to all features (loops, fragments, references, delegation).
78
+ - Use the workflow-for-workflows or author manually.
79
+ - **Requirement**: strong authoring spec, good examples, validation tooling.
80
+
81
+ ### Level 4: Distribute workflows
82
+
83
+ - Package a workflow with its references and companion files.
84
+ - Share within a team (repo-local), across teams (multi-repo), or publicly (published package).
85
+ - **Requirement**: portable reference resolution, directory-based packaging, optional registry.
86
+
87
+ ## Discovery architecture
88
+
89
+ Workflow discovery must be layered, automatic, and work without per-project configuration.
90
+
91
+ ### Discovery layers (in resolution order)
92
+
93
+ | Layer | Source | When it applies | Setup required |
94
+ |-------|--------|----------------|----------------|
95
+ | Bundled | Shipped with the workrail package | Always | None |
96
+ | User-installed | `~/.workrail/workflows/` | Always | Place files or use setup prompt |
97
+ | Project-local | `.workrail/workflows/` in any ancestor directory of configured roots | When roots are configured | One-time: add root to config |
98
+ | Module-local | `.workrail/workflows/` in subdirectories of configured roots | When roots are configured | None (auto-discovered within roots) |
99
+
100
+ ### Multi-root configuration
101
+
102
+ A single MCP server instance serves workflows from multiple workspace roots. Roots are configured in `~/.workrail/config.json`:
103
+
104
+ ```json
105
+ {
106
+ "workspaceRoots": [
107
+ "~/git/work/monorepo",
108
+ "~/git/personal/workrail",
109
+ "~/git/oss/my-library"
110
+ ]
111
+ }
112
+ ```
113
+
114
+ The server scans all roots at startup. Within each root, it recursively discovers `.workrail/workflows/` directories at any depth.
115
+
116
+ Adding a root is a one-time operation, handled by the setup prompt. Removing a root removes its workflows from discovery.
117
+
118
+ ### Grouped listing
119
+
120
+ `list_workflows` returns workflows grouped by source, not as a flat list:
121
+
122
+ ```
123
+ Available Workflows:
124
+
125
+ ## WorkRail Built-in
126
+ - coding-task-agentic: Lean Coding Task
127
+ - workflow-for-workflows: Workflow Authoring
128
+
129
+ ## monorepo (repo-level)
130
+ - ci-release: CI Release Flow
131
+
132
+ ## Payments (monorepo/features/payments)
133
+ - payment-integration: Payment Integration
134
+ - payment-api-review: Payment API Review
135
+
136
+ ## Platform (monorepo/platform)
137
+ - platform-contribution: Platform Contribution Guide
138
+ ```
139
+
140
+ Groups are named from a `.workrail/config.json` in the module directory if present, falling back to the directory name.
141
+
142
+ ### ID disambiguation
143
+
144
+ If two workflows share the same ID across groups, `start_workflow` accepts either:
145
+ - The bare ID (if unique across all groups)
146
+ - A qualified ID: `group/workflow-id` (if ambiguous)
147
+
148
+ The agent handles disambiguation conversationally when needed.
149
+
150
+ ## Sharing model
151
+
152
+ ### Same repo (team sharing)
153
+
154
+ Convention-based. Place workflows in `.workrail/workflows/` in the repo or module. Teammates clone the repo, add the root to their config (once), and all workflows are discovered.
155
+
156
+ ```
157
+ my-repo/
158
+ .workrail/
159
+ workflows/
160
+ team-code-review.json
161
+ team-feature-impl.json
162
+ ```
163
+
164
+ No install step. No sync. Git handles versioning, review, and distribution.
165
+
166
+ ### Cross-repo (org sharing)
167
+
168
+ Multi-root config. Each repo is a root. Workflows from all repos are available in a single `list_workflows` call.
169
+
170
+ For workflows that reference files (schemas, guides), use `resolveFrom: workflow` so references resolve relative to the workflow file's location. The workflow and its references are a self-contained directory.
171
+
172
+ ```
173
+ shared-workflows-repo/
174
+ contribution/
175
+ .workrail/
176
+ workflows/
177
+ platform-contribution.json
178
+ refs/
179
+ contribution-schema.json
180
+ patterns-guide.md
181
+ ```
182
+
183
+ Clone the repo, add it as a root, done.
184
+
185
+ ### Public sharing
186
+
187
+ A workflow directory is the unit of distribution:
188
+
189
+ ```
190
+ my-workflow/
191
+ workflow.json
192
+ refs/
193
+ schema.json
194
+ guide.md
195
+ README.md
196
+ ```
197
+
198
+ Distribution mechanisms (any of these work):
199
+ - Git repository (clone or submodule)
200
+ - npm package
201
+ - Tarball / zip
202
+ - Direct file sharing (for single-file workflows with no references)
203
+
204
+ The setup prompt handles installation: "Install this workflow from [URL/path]" -- the agent downloads, places it in `~/.workrail/workflows/`, and verifies references resolve.
205
+
206
+ ## Reference evolution
207
+
208
+ ### Current state
209
+
210
+ References are pointers to files. The engine resolves paths and tells the agent where to look. The agent reads the files with its own tools. Two resolution bases: `workspace` (user's project) and `package` (workrail's own files).
211
+
212
+ ### Problems
213
+
214
+ 1. `workspace` references break outside the source repo (not portable)
215
+ 2. `package` references use brittle path arithmetic (`__dirname` + `../../../`)
216
+ 3. No way to deliver reference content at the right time (all-at-once on start)
217
+ 4. No way to co-locate references with a workflow for sharing
218
+
219
+ ### Evolution
220
+
221
+ #### Add `resolveFrom: "workflow"`
222
+
223
+ Resolves paths relative to the workflow file's location on disk. This is the portability primitive: a workflow directory with co-located references works anywhere.
224
+
225
+ ```json
226
+ {
227
+ "id": "api-schema",
228
+ "source": "refs/api-schema.json",
229
+ "resolveFrom": "workflow"
230
+ }
231
+ ```
232
+
233
+ As long as the `refs/` directory travels with the workflow file, the reference resolves.
234
+
235
+ #### Add step-level attachments
236
+
237
+ A step declares which references it needs. The engine reads the file and includes the content in the tool response. The agent doesn't make a separate `read_file` call.
238
+
239
+ ```json
240
+ {
241
+ "id": "implement-api",
242
+ "title": "Implement the API endpoint",
243
+ "attachments": ["api-schema"],
244
+ "prompt": "Implement the endpoint according to the attached schema."
245
+ }
246
+ ```
247
+
248
+ Content is delivered just-in-time. Phase 0 gets the overview doc. Phase 3 gets the schema. Context is fresh at the point of use.
249
+
250
+ #### Safety limits
251
+
252
+ - Size cap per attachment (default 32KB, configurable per reference)
253
+ - Total attachment budget per step (default 64KB)
254
+ - Oversized references fall back to pointer-only with a note: "Reference 'X' is too large to attach. Read it with your file tools at: [path]"
255
+
256
+ #### MCP resources for bundled content
257
+
258
+ Package-bundled references (schema, authoring spec, setup guide) are also exposed as MCP resources. Agents and clients that support resources can discover and read them without a workflow context.
259
+
260
+ ## Authoring surface evolution
261
+
262
+ ### Now: JSON + agent-assisted
263
+
264
+ JSON remains the engine format. The workflow-for-workflows helps authors create workflows through structured agent guidance. The authoring spec and schema define correctness.
265
+
266
+ ### Next: Markdown authoring
267
+
268
+ A simpler format for Level 2 users who want to tweak workflows without deep JSON knowledge:
269
+
270
+ ```markdown
271
+ # Code Review Workflow
272
+
273
+ ## Step 1: Understand the changes
274
+ Read the PR description and the changed files. Summarize what was changed and why.
275
+
276
+ ## Step 2: Review for correctness
277
+ Check each file for bugs, edge cases, and missing error handling.
278
+
279
+ > [!confirm]
280
+ > Confirm findings with the user before proceeding.
281
+
282
+ ## Step 3: Write review comments
283
+ Post your findings as PR review comments.
284
+ ```
285
+
286
+ A compiler converts this to JSON. The markdown format supports a subset of features (steps, prompts, confirmation gates). Advanced features (loops, fragments, conditions) require JSON.
287
+
288
+ ### Later: Visual editing
289
+
290
+ A web UI for workflow authoring. Drag-and-drop steps, visual loop configuration, prompt editing with preview. Outputs JSON. This is the Level 2 experience for non-developers.
291
+
292
+ The console surface (`console/`) is the natural home for this.
293
+
294
+ ## MCP primitive usage
295
+
296
+ WorkRail currently uses only MCP tools. The full MCP spec offers three primitives, each suited to different interactions.
297
+
298
+ ### Tools (agent-controlled actions)
299
+
300
+ Keep for execution:
301
+ - `start_workflow` -- create session, begin execution
302
+ - `continue_workflow` -- advance or rehydrate
303
+ - `checkpoint_workflow` -- record progress
304
+
305
+ Keep for queries that benefit from agent timing:
306
+ - `list_workflows` -- discovery (also useful as a resource, see below)
307
+ - `inspect_workflow` -- detailed workflow view
308
+
309
+ ### Resources (discoverable content)
310
+
311
+ Add for content that should be discoverable without a tool call:
312
+ - `workrail://spec/workflow-schema` -- JSON schema
313
+ - `workrail://spec/authoring-spec` -- authoring guidance
314
+ - `workrail://docs/setup-guide` -- setup and configuration guide
315
+ - `workrail://workflows/{id}` -- workflow metadata (mirrors inspect_workflow)
316
+
317
+ Resources complement tools. Clients that support resources get richer discoverability. Clients that only support tools use the existing tool surface. No degradation.
318
+
319
+ ### Prompts (user-triggered interactions)
320
+
321
+ Add for user-initiated actions that don't need full workflow execution:
322
+ - `/setup-workrail` -- first-time setup, add repos, configure preferences
323
+ - `/start {workflow}` -- user-friendly workflow start (wraps start_workflow)
324
+ - `/help-authoring` -- guidance for writing workflows
325
+
326
+ Prompts surface in client UIs as slash commands or menu items. They lower the barrier for users who don't know the tool names.
327
+
328
+ ### Backward compatibility
329
+
330
+ All three primitives are additive. The existing tool surface continues to work unchanged. Resources and prompts are available to clients that support them and invisible to clients that don't.
331
+
332
+ ## Agent-driven setup
333
+
334
+ Setup and configuration are handled by an MCP prompt backed by a setup guide resource.
335
+
336
+ ### The setup guide
337
+
338
+ A concise reference document (`docs/setup-guide.md`) shipped with the package and exposed as an MCP resource. Covers:
339
+
340
+ - WorkRail directory structure and conventions
341
+ - How to add a workspace root
342
+ - How to install a shared workflow
343
+ - How to configure preferences
344
+ - How to verify the setup
345
+ - Troubleshooting common issues
346
+
347
+ ### The setup prompt
348
+
349
+ ```
350
+ /setup-workrail
351
+ ```
352
+
353
+ When triggered:
354
+ 1. Server returns the setup guide content as context
355
+ 2. Agent reads the user's intent conversationally
356
+ 3. Agent performs the setup (file operations, config updates, validation)
357
+ 4. Agent verifies with `list_workflows` and reports what's available
358
+
359
+ Handles all setup scenarios:
360
+ - "Set up workrail for my monorepo"
361
+ - "I got this workflow from a teammate" (pastes JSON)
362
+ - "Add my other repo to workrail"
363
+ - "Change my default preferences"
364
+ - "Show me what's available"
365
+
366
+ ### Why not a workflow for setup?
367
+
368
+ A workflow adds session overhead (tokens, checkpoints, event log) for a task that takes 2 minutes. The setup interaction is stateless and conversational. An MCP prompt with a reference doc is the right weight.
369
+
370
+ ## Phased delivery
371
+
372
+ ### Now (no engine changes)
373
+
374
+ 1. **Write the setup guide** (`docs/setup-guide.md`)
375
+ 2. **Add multi-root config** support to `~/.workrail/config.json`
376
+ 3. **Recursive module discovery** within configured roots
377
+ 4. **Grouped `list_workflows` output** with source tagging
378
+
379
+ ### Next (small engine changes)
380
+
381
+ 5. **`resolveFrom: workflow`** for portable co-located references
382
+ 6. **MCP resources** for bundled docs (schema, authoring spec, setup guide)
383
+ 7. **MCP prompt** for `/setup-workrail`
384
+ 8. **Module-level `.workrail/config.json`** for group naming
385
+
386
+ ### Later (medium engine changes)
387
+
388
+ 9. **Step-level attachments** for timed content delivery
389
+ 10. **Markdown authoring format** with compiler to JSON
390
+ 11. **MCP prompt** for `/start {workflow}`
391
+ 12. **`workrail install` CLI** for one-command workflow installation
392
+
393
+ ### Future (larger scope)
394
+
395
+ 13. **Workflow overlay/extension** system (customize without forking)
396
+ 14. **Visual authoring** in the console UI
397
+ 15. **Published workflow packages** (npm or dedicated registry)
398
+ 16. **Content pinning** at compile time for fully self-contained workflows
399
+
400
+ ## Design constraints
401
+
402
+ - **Backward compatible**: every change is additive. Existing workflows, tools, and configs continue to work.
403
+ - **Client-agnostic**: works with any MCP client. Features that depend on resources/prompts degrade gracefully to tools-only.
404
+ - **Convention over configuration**: sensible defaults, auto-discovery, minimal required config.
405
+ - **Agent-first setup**: the agent handles infrastructure work. The user makes decisions, not file operations.
406
+ - **Progressive disclosure**: Level 0 users never see Level 4 complexity. Each level is self-contained.
407
+
408
+ ## Open questions
409
+
410
+ 1. **Workflow ID namespacing**: should IDs be globally unique, or scoped to their group? Global uniqueness is simpler but constraining. Group-scoped requires qualified IDs for disambiguation.
411
+
412
+ 2. **Config file location**: `~/.workrail/config.json` is user-global. Should there also be a project-level config (`.workrail/config.json` at repo root) for team-shared settings like group names?
413
+
414
+ 3. **Markdown authoring scope**: how much of the JSON feature set should markdown support? Enough for Level 2 (steps, prompts, confirmations) or more (loops, conditions, fragments)?
415
+
416
+ 4. **Reference content delivery format**: when step-level attachments deliver content, how should it be framed? Inline in the prompt? Separate content section? Depends on content type (markdown vs JSON vs code)?
417
+
418
+ 5. **Overlay/extension design**: what's the minimum safe override surface for derived workflows? References only? References + metaGuidance? Step-level patches?
419
+
420
+ 6. **Update semantics**: when a shared workflow is updated upstream, how does the consumer know? Pull-based (check on start)? Notification? Manual?