@mizyoel/mercury-mesh 0.9.4

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 (128) hide show
  1. package/.copilot/mcp-config.json +14 -0
  2. package/.copilot/skills/agent-collaboration/SKILL.md +42 -0
  3. package/.copilot/skills/agent-conduct/SKILL.md +24 -0
  4. package/.copilot/skills/architectural-proposals/SKILL.md +151 -0
  5. package/.copilot/skills/ci-validation-gates/SKILL.md +84 -0
  6. package/.copilot/skills/cli-wiring/SKILL.md +47 -0
  7. package/.copilot/skills/client-compatibility/SKILL.md +89 -0
  8. package/.copilot/skills/cross-mesh/SKILL.md +114 -0
  9. package/.copilot/skills/distributed-mesh/SKILL.md +287 -0
  10. package/.copilot/skills/distributed-mesh/mesh.json.example +30 -0
  11. package/.copilot/skills/distributed-mesh/sync-mesh.ps1 +111 -0
  12. package/.copilot/skills/distributed-mesh/sync-mesh.sh +104 -0
  13. package/.copilot/skills/docs-standards/SKILL.md +71 -0
  14. package/.copilot/skills/economy-mode/SKILL.md +101 -0
  15. package/.copilot/skills/external-comms/SKILL.md +331 -0
  16. package/.copilot/skills/gh-auth-isolation/SKILL.md +183 -0
  17. package/.copilot/skills/git-workflow/SKILL.md +206 -0
  18. package/.copilot/skills/github-multi-account/SKILL.md +95 -0
  19. package/.copilot/skills/history-hygiene/SKILL.md +36 -0
  20. package/.copilot/skills/humanizer/SKILL.md +107 -0
  21. package/.copilot/skills/init-mode/SKILL.md +101 -0
  22. package/.copilot/skills/mesh-conventions/SKILL.md +69 -0
  23. package/.copilot/skills/model-selection/SKILL.md +139 -0
  24. package/.copilot/skills/nap/SKILL.md +24 -0
  25. package/.copilot/skills/personal-mesh/SKILL.md +57 -0
  26. package/.copilot/skills/project-conventions/SKILL.md +56 -0
  27. package/.copilot/skills/release-process/SKILL.md +435 -0
  28. package/.copilot/skills/reskill/SKILL.md +92 -0
  29. package/.copilot/skills/reviewer-protocol/SKILL.md +79 -0
  30. package/.copilot/skills/secret-handling/SKILL.md +200 -0
  31. package/.copilot/skills/session-recovery/SKILL.md +155 -0
  32. package/.copilot/skills/test-discipline/SKILL.md +37 -0
  33. package/.copilot/skills/windows-compatibility/SKILL.md +74 -0
  34. package/.github/agents/mercury-mesh.agent.md +1732 -0
  35. package/.mesh/manifesto.md +66 -0
  36. package/.mesh/templates/casting/Futurama.json +10 -0
  37. package/.mesh/templates/casting-history.json +4 -0
  38. package/.mesh/templates/casting-policy.json +37 -0
  39. package/.mesh/templates/casting-reference.md +104 -0
  40. package/.mesh/templates/casting-registry.json +3 -0
  41. package/.mesh/templates/ceremonies.md +41 -0
  42. package/.mesh/templates/charter.md +56 -0
  43. package/.mesh/templates/constraint-tracking.md +38 -0
  44. package/.mesh/templates/cooperative-rate-limiting.md +229 -0
  45. package/.mesh/templates/copilot-instructions.md +50 -0
  46. package/.mesh/templates/department-backlog.md +15 -0
  47. package/.mesh/templates/department-charter.md +27 -0
  48. package/.mesh/templates/department-state.json +19 -0
  49. package/.mesh/templates/history.md +10 -0
  50. package/.mesh/templates/identity/now.md +9 -0
  51. package/.mesh/templates/identity/wisdom.md +15 -0
  52. package/.mesh/templates/interface-contract.md +26 -0
  53. package/.mesh/templates/issue-lifecycle.md +421 -0
  54. package/.mesh/templates/keda-scaler.md +166 -0
  55. package/.mesh/templates/machine-capabilities.md +77 -0
  56. package/.mesh/templates/mcp-config.md +90 -0
  57. package/.mesh/templates/mercury-mesh.agent.md +1732 -0
  58. package/.mesh/templates/multi-agent-format.md +28 -0
  59. package/.mesh/templates/orchestration-log.md +27 -0
  60. package/.mesh/templates/org-autonomy-spec.md +152 -0
  61. package/.mesh/templates/org-backlog-from-triage.js +199 -0
  62. package/.mesh/templates/org-runtime-reconcile.js +364 -0
  63. package/.mesh/templates/org-seed-runtime.js +238 -0
  64. package/.mesh/templates/org-status.js +193 -0
  65. package/.mesh/templates/org-structure.json +38 -0
  66. package/.mesh/templates/package.json +3 -0
  67. package/.mesh/templates/plugin-marketplace.md +49 -0
  68. package/.mesh/templates/ralph-circuit-breaker.md +313 -0
  69. package/.mesh/templates/ralph-triage.js +844 -0
  70. package/.mesh/templates/raw-agent-output.md +37 -0
  71. package/.mesh/templates/roster.md +60 -0
  72. package/.mesh/templates/routing.md +78 -0
  73. package/.mesh/templates/run-output.md +50 -0
  74. package/.mesh/templates/schedule.json +64 -0
  75. package/.mesh/templates/scribe-charter.md +119 -0
  76. package/.mesh/templates/skill.md +24 -0
  77. package/.mesh/templates/skills/agent-collaboration/SKILL.md +42 -0
  78. package/.mesh/templates/skills/agent-conduct/SKILL.md +24 -0
  79. package/.mesh/templates/skills/architectural-proposals/SKILL.md +151 -0
  80. package/.mesh/templates/skills/ci-validation-gates/SKILL.md +84 -0
  81. package/.mesh/templates/skills/cli-wiring/SKILL.md +47 -0
  82. package/.mesh/templates/skills/client-compatibility/SKILL.md +89 -0
  83. package/.mesh/templates/skills/cross-mesh/SKILL.md +114 -0
  84. package/.mesh/templates/skills/distributed-mesh/SKILL.md +287 -0
  85. package/.mesh/templates/skills/distributed-mesh/mesh.json.example +30 -0
  86. package/.mesh/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -0
  87. package/.mesh/templates/skills/distributed-mesh/sync-mesh.sh +104 -0
  88. package/.mesh/templates/skills/docs-standards/SKILL.md +71 -0
  89. package/.mesh/templates/skills/economy-mode/SKILL.md +101 -0
  90. package/.mesh/templates/skills/external-comms/SKILL.md +331 -0
  91. package/.mesh/templates/skills/gh-auth-isolation/SKILL.md +183 -0
  92. package/.mesh/templates/skills/git-workflow/SKILL.md +204 -0
  93. package/.mesh/templates/skills/github-multi-account/SKILL.md +95 -0
  94. package/.mesh/templates/skills/history-hygiene/SKILL.md +36 -0
  95. package/.mesh/templates/skills/humanizer/SKILL.md +107 -0
  96. package/.mesh/templates/skills/init-mode/SKILL.md +101 -0
  97. package/.mesh/templates/skills/mesh-conventions/SKILL.md +69 -0
  98. package/.mesh/templates/skills/model-selection/SKILL.md +139 -0
  99. package/.mesh/templates/skills/nap/SKILL.md +24 -0
  100. package/.mesh/templates/skills/personal-mesh/SKILL.md +57 -0
  101. package/.mesh/templates/skills/project-conventions/SKILL.md +56 -0
  102. package/.mesh/templates/skills/release-process/SKILL.md +435 -0
  103. package/.mesh/templates/skills/reskill/SKILL.md +92 -0
  104. package/.mesh/templates/skills/reviewer-protocol/SKILL.md +79 -0
  105. package/.mesh/templates/skills/secret-handling/SKILL.md +200 -0
  106. package/.mesh/templates/skills/session-recovery/SKILL.md +155 -0
  107. package/.mesh/templates/skills/test-discipline/SKILL.md +37 -0
  108. package/.mesh/templates/skills/windows-compatibility/SKILL.md +74 -0
  109. package/.mesh/templates/workflows/mesh-ci.yml +24 -0
  110. package/.mesh/templates/workflows/mesh-docs.yml +54 -0
  111. package/.mesh/templates/workflows/mesh-heartbeat.yml +237 -0
  112. package/.mesh/templates/workflows/mesh-insider-release.yml +61 -0
  113. package/.mesh/templates/workflows/mesh-issue-assign.yml +243 -0
  114. package/.mesh/templates/workflows/mesh-label-enforce.yml +181 -0
  115. package/.mesh/templates/workflows/mesh-preview.yml +55 -0
  116. package/.mesh/templates/workflows/mesh-promote.yml +120 -0
  117. package/.mesh/templates/workflows/mesh-release.yml +77 -0
  118. package/.mesh/templates/workflows/mesh-triage.yml +383 -0
  119. package/.mesh/templates/workflows/sync-mesh-labels.yml +204 -0
  120. package/README.md +640 -0
  121. package/bin/mercury-mesh.cjs +317 -0
  122. package/docs/brand-language.md +287 -0
  123. package/docs/commander-onboarding.md +462 -0
  124. package/docs/mercury-mesh-runtime-rename-impact.md +148 -0
  125. package/docs/persona-manifesto.md +114 -0
  126. package/docs/scenarios/client-compatibility.md +59 -0
  127. package/index.cjs +41 -0
  128. package/package.json +43 -0
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: "distributed-mesh"
3
+ description: "How to coordinate with meshes on different machines using git as transport"
4
+ domain: "distributed-coordination"
5
+ confidence: "high"
6
+ source: "multi-model-consensus (Opus 4.6, Sonnet 4.5, GPT-5.4)"
7
+ ---
8
+
9
+ ## SCOPE
10
+
11
+ **✅ THIS SKILL PRODUCES (exactly these, nothing more):**
12
+
13
+ 1. **`mesh.json`** — Generated from user answers about zones and meshes (which meshes participate, what zone each is in, paths/URLs for each), using `mesh.json.example` in this skill's directory as the schema template
14
+ 2. **`sync-mesh.sh` and `sync-mesh.ps1`** — Copied from this skill's directory into the project root (these are bundled resources, NOT generated code)
15
+ 3. **Zone 2 state repo initialization** (if applicable) — If the user specified a Zone 2 shared state repo, run `sync-mesh.sh --init` to scaffold the state repo structure
16
+ 4. **A decision entry** in `.mesh/decisions/inbox/` documenting the mesh configuration for team awareness
17
+
18
+ **❌ THIS SKILL DOES NOT PRODUCE:**
19
+
20
+ - **No application code** — No validators, libraries, or modules of any kind
21
+ - **No test files** — No test suites, test cases, or test scaffolding
22
+ - **No GENERATING sync scripts** — They are bundled with this skill as pre-built resources. COPY them, don't generate them.
23
+ - **No daemons or services** — No background processes, servers, or persistent runtimes
24
+ - **No modifications to existing Mercury Mesh files** beyond the decision entry (no changes to team.md, routing.md, agent charters, etc.)
25
+
26
+ **Your role:** Configure the mesh topology and install the bundled sync scripts. Nothing more.
27
+
28
+ ## Context
29
+
30
+ When meshes are on different machines (developer laptops, CI runners, cloud VMs, partner orgs), the local file-reading convention still works — but remote files need to arrive on your disk first. This skill teaches the pattern for distributed Mercury Mesh communication.
31
+
32
+ **When this applies:**
33
+ - meshes span multiple machines, VMs, or CI runners
34
+ - meshes span organizations or companies
35
+ - An agent needs context from a Mercury Mesh whose files aren't on the local filesystem
36
+
37
+ **When this does NOT apply:**
38
+ - All meshes are on the same machine (just read the files directly)
39
+
40
+ ## Patterns
41
+
42
+ ### The Core Principle
43
+
44
+ > "The filesystem is the mesh, and git is how the mesh crosses machine boundaries."
45
+
46
+ The agent interface never changes. Agents always read local files. The distributed layer's only job is to make remote files appear locally before the agent reads them.
47
+
48
+ ### Three Zones of Communication
49
+
50
+ **Zone 1 — Local:** Same filesystem. Read files directly. Zero transport.
51
+
52
+ **Zone 2 — Remote-Trusted:** Different host, same org, shared git auth. Transport: `git pull` from a shared repo. This collapses Zone 2 into Zone 1 — files materialize on disk, agent reads them normally.
53
+
54
+ **Zone 3 — Remote-Opaque:** Different org, no shared auth. Transport: `curl` to fetch published contracts (SUMMARY.md). One-way visibility — you see only what they publish.
55
+
56
+ ### Agent Lifecycle (Distributed)
57
+
58
+ ```
59
+ 1. SYNC: git pull (Zone 2) + curl (Zone 3) — materialize remote state
60
+ 2. READ: cat .mesh/**/state.md — all files are local now
61
+ 3. WORK: do their assigned work (the agent's normal task, NOT mesh-building)
62
+ 4. WRITE: update own billboard, log, drops
63
+ 5. PUBLISH: git add + commit + push — share state with remote peers
64
+ ```
65
+
66
+ Steps 2–4 are identical to local-only. Steps 1 and 5 are the entire distributed extension. **Note:** "WORK" means the agent performs its normal Mercury Mesh duties — it does NOT mean "build mesh infrastructure."
67
+
68
+ ### The mesh.json Config
69
+
70
+ ```json
71
+ {
72
+ "meshes": {
73
+ "auth-Mercury Mesh": { "zone": "local", "path": "../auth-Mercury Mesh/.mesh" },
74
+ "ci-Mercury Mesh": {
75
+ "zone": "remote-trusted",
76
+ "source": "git@github.com:our-org/ci-Mercury Mesh.git",
77
+ "ref": "main",
78
+ "sync_to": ".mesh/remotes/ci-Mercury Mesh"
79
+ },
80
+ "partner-fraud": {
81
+ "zone": "remote-opaque",
82
+ "source": "https://partner.dev/Mercury Mesh-contracts/fraud/SUMMARY.md",
83
+ "sync_to": ".mesh/remotes/partner-fraud",
84
+ "auth": "bearer"
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ Three zone types, one file. Local meshes need only a path. Remote-trusted need a git URL. Remote-opaque need an HTTP URL.
91
+
92
+ ### Write Partitioning
93
+
94
+ Each Mercury Mesh writes only to its own directory (`boards/{self}.md`, `meshes/{self}/*`, `drops/{date}-{self}-*.md`). No two meshes write to the same file. Git push/pull never conflicts. If push fails ("branch is behind"), the fix is always `git pull --rebase && git push`.
95
+
96
+ ### Trust Boundaries
97
+
98
+ Trust maps to git permissions:
99
+ - **Same repo access** = full mesh visibility
100
+ - **Read-only access** = can observe, can't write
101
+ - **No access** = invisible (correct behavior)
102
+
103
+ For selective visibility, use separate repos per audience (internal, partner, public). Git permissions ARE the trust negotiation.
104
+
105
+ ### Phased Rollout
106
+
107
+ - **Phase 0:** Convention only — document zones, agree on mesh.json fields, manually run `git pull`/`git push`. Zero new code.
108
+ - **Phase 1:** Sync script (~30 lines bash or PowerShell) when manual sync gets tedious.
109
+ - **Phase 2:** Published contracts + curl fetch when a Zone 3 partner appears.
110
+ - **Phase 3:** Never. No MCP federation, A2A, service discovery, message queues.
111
+
112
+ **Important:** Phases are NOT auto-advanced. These are project-level decisions — you start at Phase 0 (manual sync) and only move forward when the team decides complexity is justified.
113
+
114
+ ### Mesh State Repo
115
+
116
+ The shared mesh state repo is a plain git repository — NOT a Mercury Mesh project. It holds:
117
+ - One directory per participating Mercury Mesh
118
+ - Each directory contains at minimum a SUMMARY.md with the Mercury Mesh's current state
119
+ - A root README explaining what the repo is and who participates
120
+
121
+ No `.mesh/` folder, no agents, no automation. Write partitioning means each Mercury Mesh only pushes to its own directory. The repo is a rendezvous point, not an intelligent system.
122
+
123
+ If you want a Mercury Mesh that *observes* mesh health, that's a separate Mercury Mesh project that lists the state repo as a Zone 2 remote in its `mesh.json` — it does NOT live inside the state repo.
124
+
125
+ ## Examples
126
+
127
+ ### Developer Laptop + CI Mercury Mesh (Zone 2)
128
+
129
+ Auth-Mercury Mesh agent wakes up. `git pull` brings ci-Mercury Mesh's latest results. Agent reads: "3 test failures in auth module." Adjusts work. Pushes results when done. **Overhead: one `git pull`, one `git push`.**
130
+
131
+ ### Two Orgs Collaborating (Zone 3)
132
+
133
+ Payment-Mercury Mesh fetches partner's published SUMMARY.md via curl. Reads: "Risk scoring v3 API deprecated April 15. New field `device_fingerprint` required." The consuming agent (in payment-Mercury Mesh's team) reads this information and uses it to inform its work — for example, updating payment integration code to include the new field. Partner can't see payment-Mercury Mesh's internals.
134
+
135
+ ### Same Org, Shared Mesh Repo (Zone 2)
136
+
137
+ Three meshes on different machines. One shared git repo holds the mesh. Each Mercury Mesh: `git pull` before work, `git push` after. Write partitioning ensures zero merge conflicts.
138
+
139
+ ## AGENT WORKFLOW (Deterministic Setup)
140
+
141
+ When a user invokes this skill to set up a distributed mesh, follow these steps **exactly, in order:**
142
+
143
+ ### Step 1: ASK the user for mesh topology
144
+
145
+ Ask these questions (adapt phrasing naturally, but get these answers):
146
+
147
+ 1. **Which meshes are participating?** (List of Mercury Mesh names)
148
+ 2. **For each Mercury Mesh, which zone is it in?**
149
+ - `local` — same filesystem (just need a path)
150
+ - `remote-trusted` — different machine, same org, shared git access (need git URL + ref)
151
+ - `remote-opaque` — different org, no shared auth (need HTTPS URL to published contract)
152
+ 3. **For each Mercury Mesh, what's the connection info?**
153
+ - Local: relative or absolute path to their `.mesh/` directory
154
+ - Remote-trusted: git URL (SSH or HTTPS), ref (branch/tag), and where to sync it to locally
155
+ - Remote-opaque: HTTPS URL to their SUMMARY.md, where to sync it, and auth type (none/bearer)
156
+ 4. **Where should the shared state live?** (For Zone 2 meshes: git repo URL for the mesh state, or confirm each Mercury Mesh syncs independently)
157
+
158
+ ### Step 2: GENERATE `mesh.json`
159
+
160
+ Using the answers from Step 1, create a `mesh.json` file at the project root. Use `mesh.json.example` from THIS skill's directory (`.mesh/skills/distributed-mesh/mesh.json.example`) as the schema template.
161
+
162
+ Structure:
163
+
164
+ ```json
165
+ {
166
+ "meshes": {
167
+ "<Mercury Mesh-name>": { "zone": "local", "path": "<relative-or-absolute-path>" },
168
+ "<Mercury Mesh-name>": {
169
+ "zone": "remote-trusted",
170
+ "source": "<git-url>",
171
+ "ref": "<branch-or-tag>",
172
+ "sync_to": ".mesh/remotes/<Mercury Mesh-name>"
173
+ },
174
+ "<Mercury Mesh-name>": {
175
+ "zone": "remote-opaque",
176
+ "source": "<https-url-to-summary>",
177
+ "sync_to": ".mesh/remotes/<Mercury Mesh-name>",
178
+ "auth": "<none|bearer>"
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ Write this file to the project root. Do NOT write any other code.
185
+
186
+ ### Step 3: COPY sync scripts
187
+
188
+ Copy the bundled sync scripts from THIS skill's directory into the project root:
189
+
190
+ - **Source:** `.mesh/skills/distributed-mesh/sync-mesh.sh`
191
+ - **Destination:** `sync-mesh.sh` (project root)
192
+
193
+ - **Source:** `.mesh/skills/distributed-mesh/sync-mesh.ps1`
194
+ - **Destination:** `sync-mesh.ps1` (project root)
195
+
196
+ These are bundled resources. Do NOT generate them — COPY them directly.
197
+
198
+ ### Step 4: RUN `--init` (if Zone 2 state repo exists)
199
+
200
+ If the user specified a Zone 2 shared state repo in Step 1, run the initialization:
201
+
202
+ **On Unix/Linux/macOS:**
203
+ ```bash
204
+ bash sync-mesh.sh --init
205
+ ```
206
+
207
+ **On Windows:**
208
+ ```powershell
209
+ .\sync-mesh.ps1 -Init
210
+ ```
211
+
212
+ This scaffolds the state repo structure (Mercury Mesh directories, placeholder SUMMARY.md files, root README).
213
+
214
+ **Skip this step if:**
215
+ - No Zone 2 meshes are configured (local/opaque only)
216
+ - The state repo already exists and is initialized
217
+
218
+ ### Step 5: WRITE a decision entry
219
+
220
+ Create a decision file at `.mesh/decisions/inbox/<your-agent-name>-mesh-setup.md` with this content:
221
+
222
+ ```markdown
223
+ ### <YYYY-MM-DD>: Mesh configuration
224
+
225
+ **By:** <your-agent-name> (via distributed-mesh skill)
226
+
227
+ **What:** Configured distributed mesh with <N> meshes across zones <list-zones-used>
228
+
229
+ **meshes:**
230
+ - `<Mercury Mesh-name>` — Zone <X> — <brief-connection-info>
231
+ - `<Mercury Mesh-name>` — Zone <X> — <brief-connection-info>
232
+ - ...
233
+
234
+ **State repo:** <git-url-if-zone-2-used, or "N/A (local/opaque only)">
235
+
236
+ **Why:** <user's stated reason for setting up the mesh, or "Enable cross-machine Mercury Mesh coordination">
237
+ ```
238
+
239
+ Write this file. The Scribe will merge it into the main decisions file later.
240
+
241
+ ### Step 6: STOP
242
+
243
+ **You are done.** Do not:
244
+ - Generate sync scripts (they're bundled with this skill — COPY them)
245
+ - Write validator code
246
+ - Write test files
247
+ - Create any other modules, libraries, or application code
248
+ - Modify existing Mercury Mesh files (team.md, routing.md, charters)
249
+ - Auto-advance to Phase 2 or Phase 3
250
+
251
+ Output a simple completion message:
252
+
253
+ ```
254
+ ✅ Mesh configured. Created:
255
+ - mesh.json (<N> meshes)
256
+ - sync-mesh.sh and sync-mesh.ps1 (copied from skill bundle)
257
+ - Decision entry: .mesh/decisions/inbox/<filename>
258
+
259
+ Run `bash sync-mesh.sh` (or `.\sync-mesh.ps1` on Windows) before agents start to materialize remote state.
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Anti-Patterns
265
+
266
+ **❌ Code generation anti-patterns:**
267
+ - Writing `mesh-config-validator.js` or any validator module
268
+ - Writing test files for mesh configuration
269
+ - Generating sync scripts instead of copying the bundled ones from this skill's directory
270
+ - Creating library modules or utilities
271
+ - Building any code that "runs the mesh" — the mesh is read by agents, not executed
272
+
273
+ **❌ Architectural anti-patterns:**
274
+ - Building a federation protocol — Git push/pull IS federation
275
+ - Running a sync daemon or server — Agents are not persistent. Sync at startup, publish at shutdown
276
+ - Real-time notifications — Agents don't need real-time. They need "recent enough." `git pull` is recent enough
277
+ - Schema validation for markdown — The LLM reads markdown. If the format changes, it adapts
278
+ - Service discovery protocol — mesh.json is a file with 10 entries. Not a "discovery problem"
279
+ - Auth framework — Git SSH keys and HTTPS tokens. Not a framework. Already configured
280
+ - Message queues / event buses — Agents wake, read, work, write, sleep. Nobody's home to receive events
281
+ - Any component requiring a running process — That's the line. Don't cross it
282
+
283
+ **❌ Scope creep anti-patterns:**
284
+ - Auto-advancing phases without user decision
285
+ - Modifying agent charters or routing rules
286
+ - Setting up CI/CD pipelines for mesh sync
287
+ - Creating dashboards or monitoring tools
@@ -0,0 +1,30 @@
1
+ {
2
+ "meshes": {
3
+ "auth-mesh": {
4
+ "zone": "local",
5
+ "path": "../auth-mesh/.mesh"
6
+ },
7
+ "api-mesh": {
8
+ "zone": "local",
9
+ "path": "../api-mesh/.mesh"
10
+ },
11
+ "ci-mesh": {
12
+ "zone": "remote-trusted",
13
+ "source": "git@github.com:our-org/ci-mesh.git",
14
+ "ref": "main",
15
+ "sync_to": ".mesh/remotes/ci-mesh"
16
+ },
17
+ "data-mesh": {
18
+ "zone": "remote-trusted",
19
+ "source": "git@github.com:our-org/data-pipeline.git",
20
+ "ref": "main",
21
+ "sync_to": ".mesh/remotes/data-mesh"
22
+ },
23
+ "partner-fraud": {
24
+ "zone": "remote-opaque",
25
+ "source": "https://partner.example.com/mesh-contracts/fraud/SUMMARY.md",
26
+ "sync_to": ".mesh/remotes/partner-fraud",
27
+ "auth": "bearer"
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,111 @@
1
+ # sync-mesh.ps1 — Materialize remote mesh state locally
2
+ #
3
+ # Reads mesh.json, fetches remote meshes into local directories.
4
+ # Run before agent reads. No daemon. No service. ~40 lines.
5
+ #
6
+ # Usage: .\sync-mesh.ps1 [path-to-mesh.json]
7
+ # .\sync-mesh.ps1 -Init [path-to-mesh.json]
8
+ # Requires: git
9
+ param(
10
+ [switch]$Init,
11
+ [string]$MeshJson = "mesh.json"
12
+ )
13
+ $ErrorActionPreference = "Stop"
14
+
15
+ # Handle -Init mode
16
+ if ($Init) {
17
+ if (-not (Test-Path $MeshJson)) {
18
+ Write-Host "❌ $MeshJson not found"
19
+ exit 1
20
+ }
21
+
22
+ Write-Host "🚀 Initializing mesh state repository..."
23
+ $config = Get-Content $MeshJson -Raw | ConvertFrom-Json
24
+ $nodes = $config.meshes.PSObject.Properties.Name
25
+
26
+ # Create node directories with placeholder SUMMARY.md
27
+ foreach ($node in $nodes) {
28
+ if (-not (Test-Path $node)) {
29
+ New-Item -ItemType Directory -Path $node | Out-Null
30
+ Write-Host " ✓ Created $node/"
31
+ } else {
32
+ Write-Host " • $node/ exists (skipped)"
33
+ }
34
+
35
+ $summaryPath = "$node/SUMMARY.md"
36
+ if (-not (Test-Path $summaryPath)) {
37
+ "# $node`n`n_No state published yet._" | Set-Content $summaryPath
38
+ Write-Host " ✓ Created $summaryPath"
39
+ } else {
40
+ Write-Host " • $summaryPath exists (skipped)"
41
+ }
42
+ }
43
+
44
+ # Generate root README.md
45
+ if (-not (Test-Path "README.md")) {
46
+ $readme = @"
47
+ # Mercury Mesh State Repository
48
+
49
+ This repository tracks published state from participating meshes.
50
+
51
+ ## Participating Meshes
52
+
53
+ "@
54
+ foreach ($node in $nodes) {
55
+ $zone = $config.meshes.$node.zone
56
+ $readme += "- **$node** (Zone: $zone)`n"
57
+ }
58
+ $readme += @"
59
+
60
+ Each mesh directory contains a ``SUMMARY.md`` with their latest published state.
61
+ State is synchronized using ``sync-mesh.sh`` or ``sync-mesh.ps1``.
62
+ "@
63
+ $readme | Set-Content "README.md"
64
+ Write-Host " ✓ Created README.md"
65
+ } else {
66
+ Write-Host " • README.md exists (skipped)"
67
+ }
68
+
69
+ Write-Host ""
70
+ Write-Host "✅ Mesh state repository initialized"
71
+ exit 0
72
+ }
73
+
74
+ $config = Get-Content $MeshJson -Raw | ConvertFrom-Json
75
+
76
+ # Zone 2: Remote-trusted — git clone/pull
77
+ foreach ($entry in $config.meshes.PSObject.Properties | Where-Object { $_.Value.zone -eq "remote-trusted" }) {
78
+ $node = $entry.Name
79
+ $source = $entry.Value.source
80
+ $ref = if ($entry.Value.ref) { $entry.Value.ref } else { "main" }
81
+ $target = $entry.Value.sync_to
82
+
83
+ if (Test-Path "$target/.git") {
84
+ git -C $target pull --rebase --quiet 2>$null
85
+ if ($LASTEXITCODE -ne 0) { Write-Host "⚠ ${node}: pull failed (using stale)" }
86
+ } else {
87
+ New-Item -ItemType Directory -Force -Path (Split-Path $target -Parent) | Out-Null
88
+ git clone --quiet --depth 1 --branch $ref $source $target 2>$null
89
+ if ($LASTEXITCODE -ne 0) { Write-Host "⚠ ${node}: clone failed (unavailable)" }
90
+ }
91
+ }
92
+
93
+ # Zone 3: Remote-opaque — fetch published contracts
94
+ foreach ($entry in $config.meshes.PSObject.Properties | Where-Object { $_.Value.zone -eq "remote-opaque" }) {
95
+ $node = $entry.Name
96
+ $source = $entry.Value.source
97
+ $target = $entry.Value.sync_to
98
+ $auth = $entry.Value.auth
99
+
100
+ New-Item -ItemType Directory -Force -Path $target | Out-Null
101
+ $params = @{ Uri = $source; OutFile = "$target/SUMMARY.md"; UseBasicParsing = $true }
102
+ if ($auth -eq "bearer") {
103
+ $tokenVar = ($node.ToUpper() -replace '-', '_') + "_TOKEN"
104
+ $token = [Environment]::GetEnvironmentVariable($tokenVar)
105
+ if ($token) { $params.Headers = @{ Authorization = "Bearer $token" } }
106
+ }
107
+ try { Invoke-WebRequest @params -ErrorAction Stop }
108
+ catch { "# ${node} — unavailable ($(Get-Date))" | Set-Content "$target/SUMMARY.md" }
109
+ }
110
+
111
+ Write-Host "✓ Mesh sync complete"
@@ -0,0 +1,104 @@
1
+ #!/bin/bash
2
+ # sync-mesh.sh — Materialize remote mesh state locally
3
+ #
4
+ # Reads mesh.json, fetches remote meshes into local directories.
5
+ # Run before agent reads. No daemon. No service. ~40 lines.
6
+ #
7
+ # Usage: ./sync-mesh.sh [path-to-mesh.json]
8
+ # ./sync-mesh.sh --init [path-to-mesh.json]
9
+ # Requires: jq (https://github.com/jqlang/jq), git, curl
10
+
11
+ set -euo pipefail
12
+
13
+ # Handle --init mode
14
+ if [ "${1:-}" = "--init" ]; then
15
+ MESH_JSON="${2:-mesh.json}"
16
+
17
+ if [ ! -f "$MESH_JSON" ]; then
18
+ echo "❌ $MESH_JSON not found"
19
+ exit 1
20
+ fi
21
+
22
+ echo "🚀 Initializing mesh state repository..."
23
+ nodes=$(jq -r '.meshes | keys[]' "$MESH_JSON")
24
+
25
+ # Create node directories with placeholder SUMMARY.md
26
+ for node in $nodes; do
27
+ if [ ! -d "$node" ]; then
28
+ mkdir -p "$node"
29
+ echo " ✓ Created $node/"
30
+ else
31
+ echo " • $node/ exists (skipped)"
32
+ fi
33
+
34
+ if [ ! -f "$node/SUMMARY.md" ]; then
35
+ echo -e "# $node\n\n_No state published yet._" > "$node/SUMMARY.md"
36
+ echo " ✓ Created $node/SUMMARY.md"
37
+ else
38
+ echo " • $node/SUMMARY.md exists (skipped)"
39
+ fi
40
+ done
41
+
42
+ # Generate root README.md
43
+ if [ ! -f "README.md" ]; then
44
+ {
45
+ echo "# Mercury Mesh State Repository"
46
+ echo ""
47
+ echo "This repository tracks published state from participating meshes."
48
+ echo ""
49
+ echo "## Participating Meshes"
50
+ echo ""
51
+ for node in $nodes; do
52
+ zone=$(jq -r ".meshes.\"$node\".zone" "$MESH_JSON")
53
+ echo "- **$node** (Zone: $zone)"
54
+ done
55
+ echo ""
56
+ echo "Each mesh directory contains a \`SUMMARY.md\` with their latest published state."
57
+ echo "State is synchronized using \`sync-mesh.sh\` or \`sync-mesh.ps1\`."
58
+ } > README.md
59
+ echo " ✓ Created README.md"
60
+ else
61
+ echo " • README.md exists (skipped)"
62
+ fi
63
+
64
+ echo ""
65
+ echo "✅ Mesh state repository initialized"
66
+ exit 0
67
+ fi
68
+
69
+ MESH_JSON="${1:-mesh.json}"
70
+
71
+ # Zone 2: Remote-trusted — git clone/pull
72
+ for node in $(jq -r '.meshes | to_entries[] | select(.value.zone == "remote-trusted") | .key' "$MESH_JSON"); do
73
+ source=$(jq -r ".meshes.\"$node\".source" "$MESH_JSON")
74
+ ref=$(jq -r ".meshes.\"$node\".ref // \"main\"" "$MESH_JSON")
75
+ target=$(jq -r ".meshes.\"$node\".sync_to" "$MESH_JSON")
76
+
77
+ if [ -d "$target/.git" ]; then
78
+ git -C "$target" pull --rebase --quiet 2>/dev/null \
79
+ || echo "⚠ $node: pull failed (using stale)"
80
+ else
81
+ mkdir -p "$(dirname "$target")"
82
+ git clone --quiet --depth 1 --branch "$ref" "$source" "$target" 2>/dev/null \
83
+ || echo "⚠ $node: clone failed (unavailable)"
84
+ fi
85
+ done
86
+
87
+ # Zone 3: Remote-opaque — fetch published contracts
88
+ for node in $(jq -r '.meshes | to_entries[] | select(.value.zone == "remote-opaque") | .key' "$MESH_JSON"); do
89
+ source=$(jq -r ".meshes.\"$node\".source" "$MESH_JSON")
90
+ target=$(jq -r ".meshes.\"$node\".sync_to" "$MESH_JSON")
91
+ auth=$(jq -r ".meshes.\"$node\".auth // \"\"" "$MESH_JSON")
92
+
93
+ mkdir -p "$target"
94
+ auth_flag=""
95
+ if [ "$auth" = "bearer" ]; then
96
+ token_var="$(echo "${node}" | tr '[:lower:]-' '[:upper:]_')_TOKEN"
97
+ [ -n "${!token_var:-}" ] && auth_flag="--header \"Authorization: Bearer ${!token_var}\""
98
+ fi
99
+
100
+ eval curl --silent --fail $auth_flag "$source" -o "$target/SUMMARY.md" 2>/dev/null \
101
+ || echo "# ${node} — unavailable ($(date))" > "$target/SUMMARY.md"
102
+ done
103
+
104
+ echo "✓ Mesh sync complete"
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: "docs-standards"
3
+ description: "Microsoft Style Guide + Mercury Mesh-specific documentation patterns"
4
+ domain: "documentation"
5
+ confidence: "high"
6
+ source: "earned (PAO charter, multiple doc PR reviews)"
7
+ ---
8
+
9
+ ## Context
10
+
11
+ Mercury Mesh documentation follows the Microsoft Style Guide with Mercury Mesh-specific conventions. Consistency across docs builds trust and improves discoverability.
12
+
13
+ ## Patterns
14
+
15
+ ### Microsoft Style Guide Rules
16
+ - **Sentence-case headings:** "Getting started" not "Getting Started"
17
+ - **Active voice:** "Run the command" not "The command should be run"
18
+ - **Second person:** "You can configure..." not "Users can configure..."
19
+ - **Present tense:** "The system routes..." not "The system will route..."
20
+ - **No ampersands in prose:** "and" not "&" (except in code, brand names, or UI elements)
21
+
22
+ ### Mercury Mesh Formatting Patterns
23
+ - **Scannability first:** Paragraphs for narrative (3-4 sentences max), bullets for scannable lists, tables for structured data
24
+ - **"Try this" prompts at top:** Start feature/scenario pages with practical prompts users can copy
25
+ - **Experimental warnings:** Features in preview get callout at top
26
+ - **Cross-references at bottom:** Related pages linked after main content
27
+
28
+ ### Structure
29
+ - **Title (H1)** → **Warning/callout** → **Try this code** → **Overview** → **HR** → **Content (H2 sections)**
30
+
31
+ ### Test Sync Rule
32
+ - **Always update test assertions:** When adding docs pages to `features/`, `scenarios/`, `guides/`, update corresponding `EXPECTED_*` arrays in `test/docs-build.test.ts` in the same commit
33
+
34
+ ## Examples
35
+
36
+ ✓ **Correct:**
37
+ ```markdown
38
+ # Getting started with Mercury Mesh
39
+
40
+ > ⚠️ **Experimental:** This feature is in preview.
41
+
42
+ Try this:
43
+ \`\`\`bash
44
+ Mercury Mesh init
45
+ \`\`\`
46
+
47
+ Mercury Mesh helps you build AI teams...
48
+
49
+ ---
50
+
51
+ ## Install Mercury Mesh
52
+
53
+ Run the following command...
54
+ ```
55
+
56
+ ✗ **Incorrect:**
57
+ ```markdown
58
+ # Getting Started With Mercury Mesh // Title case
59
+
60
+ Mercury Mesh is a tool which will help users... // Third person, future tense
61
+
62
+ You can install Mercury Mesh with npm & configure it... // Ampersand in prose
63
+ ```
64
+
65
+ ## Anti-Patterns
66
+
67
+ - Title-casing headings because "it looks nicer"
68
+ - Writing in passive voice or third person
69
+ - Long paragraphs of dense text (breaks scannability)
70
+ - Adding doc pages without updating test assertions
71
+ - Using ampersands outside code blocks