pgserve 2.1.3 → 2.2.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 (228) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +105 -1
  3. package/bin/autopg-wrapper.cjs +16 -0
  4. package/bin/pgserve-wrapper.cjs +31 -6
  5. package/bin/postgres-server.js +56 -0
  6. package/console/README.md +131 -0
  7. package/console/api.js +173 -0
  8. package/console/app.jsx +483 -0
  9. package/console/colors_and_type.css +227 -0
  10. package/console/components.jsx +167 -0
  11. package/console/console.css +1666 -0
  12. package/console/data.jsx +350 -0
  13. package/console/index.html +31 -0
  14. package/console/screens/databases.jsx +5 -0
  15. package/console/screens/health.jsx +5 -0
  16. package/console/screens/ingress.jsx +5 -0
  17. package/console/screens/optimizer.jsx +5 -0
  18. package/console/screens/rlm-sim.jsx +5 -0
  19. package/console/screens/rlm-trace.jsx +5 -0
  20. package/console/screens/security.jsx +5 -0
  21. package/console/screens/settings.jsx +611 -0
  22. package/console/screens/sql.jsx +5 -0
  23. package/console/screens/sync.jsx +5 -0
  24. package/console/screens/tables.jsx +5 -0
  25. package/console/tweaks-panel.jsx +425 -0
  26. package/package.json +11 -1
  27. package/src/cli-config.cjs +310 -0
  28. package/src/cli-install.cjs +98 -11
  29. package/src/cli-restart.cjs +228 -0
  30. package/src/cli-ui.cjs +580 -0
  31. package/src/cluster.js +43 -38
  32. package/src/postgres.js +141 -19
  33. package/src/settings-loader.cjs +235 -0
  34. package/src/settings-migrate.cjs +212 -0
  35. package/src/settings-pg-args.cjs +146 -0
  36. package/src/settings-schema.cjs +422 -0
  37. package/src/settings-validator.cjs +416 -0
  38. package/src/settings-writer.cjs +288 -0
  39. package/.claude/context/windows-debug.md +0 -119
  40. package/.genie/AGENTS.md +0 -15
  41. package/.genie/agents/README.md +0 -110
  42. package/.genie/agents/analyze.md +0 -176
  43. package/.genie/agents/forge.md +0 -290
  44. package/.genie/agents/garbage-cleaner.md +0 -324
  45. package/.genie/agents/garbage-collector.md +0 -596
  46. package/.genie/agents/github-issue-gc.md +0 -618
  47. package/.genie/agents/review.md +0 -380
  48. package/.genie/agents/semantic-analyzer/find-duplicates.md +0 -90
  49. package/.genie/agents/semantic-analyzer/find-orphans.md +0 -99
  50. package/.genie/agents/semantic-analyzer.md +0 -101
  51. package/.genie/agents/update.md +0 -182
  52. package/.genie/agents/wish.md +0 -357
  53. package/.genie/brainstorms/pgserve-v2/DESIGN.md +0 -174
  54. package/.genie/code/AGENTS.md +0 -694
  55. package/.genie/code/agents/audit/risk.md +0 -173
  56. package/.genie/code/agents/audit/security.md +0 -189
  57. package/.genie/code/agents/audit.md +0 -145
  58. package/.genie/code/agents/challenge.md +0 -230
  59. package/.genie/code/agents/change-reviewer.md +0 -295
  60. package/.genie/code/agents/code-garbage-collector.md +0 -425
  61. package/.genie/code/agents/code-quality.md +0 -410
  62. package/.genie/code/agents/commit-suggester.md +0 -255
  63. package/.genie/code/agents/commit.md +0 -124
  64. package/.genie/code/agents/consensus.md +0 -204
  65. package/.genie/code/agents/daily-standup.md +0 -722
  66. package/.genie/code/agents/docgen.md +0 -48
  67. package/.genie/code/agents/explore.md +0 -79
  68. package/.genie/code/agents/fix.md +0 -100
  69. package/.genie/code/agents/git/commit-advisory.md +0 -219
  70. package/.genie/code/agents/git/workflows/issue.md +0 -244
  71. package/.genie/code/agents/git/workflows/pr.md +0 -179
  72. package/.genie/code/agents/git/workflows/release.md +0 -460
  73. package/.genie/code/agents/git/workflows/report.md +0 -342
  74. package/.genie/code/agents/git.md +0 -432
  75. package/.genie/code/agents/implementor.md +0 -161
  76. package/.genie/code/agents/install.md +0 -515
  77. package/.genie/code/agents/issue-creator.md +0 -344
  78. package/.genie/code/agents/polish.md +0 -116
  79. package/.genie/code/agents/qa.md +0 -653
  80. package/.genie/code/agents/refactor.md +0 -294
  81. package/.genie/code/agents/release.md +0 -1129
  82. package/.genie/code/agents/roadmap.md +0 -885
  83. package/.genie/code/agents/tests.md +0 -557
  84. package/.genie/code/agents/tracer.md +0 -50
  85. package/.genie/code/agents/update/upstream-update.md +0 -85
  86. package/.genie/code/agents/update/versions/generic-update.md +0 -305
  87. package/.genie/code/agents/vibe.md +0 -1317
  88. package/.genie/code/spells/agent-configuration.md +0 -58
  89. package/.genie/code/spells/automated-rc-publishing.md +0 -106
  90. package/.genie/code/spells/branch-tracker-guidance.md +0 -28
  91. package/.genie/code/spells/debug.md +0 -320
  92. package/.genie/code/spells/emoji-naming-convention.md +0 -303
  93. package/.genie/code/spells/evidence-storage.md +0 -26
  94. package/.genie/code/spells/file-naming-rules.md +0 -35
  95. package/.genie/code/spells/forge-code-blueprints.md +0 -195
  96. package/.genie/code/spells/genie-integration.md +0 -153
  97. package/.genie/code/spells/publishing-protocol.md +0 -61
  98. package/.genie/code/spells/team-consultation-protocol.md +0 -284
  99. package/.genie/code/spells/tool-requirements.md +0 -20
  100. package/.genie/code/spells/triad-maintenance-protocol.md +0 -154
  101. package/.genie/code/teams/tech-council/council.md +0 -328
  102. package/.genie/code/teams/tech-council/jt.md +0 -352
  103. package/.genie/code/teams/tech-council/nayr.md +0 -305
  104. package/.genie/code/teams/tech-council/oettam.md +0 -375
  105. package/.genie/neurons/README.md +0 -193
  106. package/.genie/neurons/forge.md +0 -106
  107. package/.genie/neurons/genie.md +0 -63
  108. package/.genie/neurons/review.md +0 -106
  109. package/.genie/neurons/wish.md +0 -104
  110. package/.genie/product/README.md +0 -20
  111. package/.genie/product/cli-automation.md +0 -359
  112. package/.genie/product/environment.md +0 -60
  113. package/.genie/product/mission.md +0 -60
  114. package/.genie/product/roadmap.md +0 -44
  115. package/.genie/product/tech-stack.md +0 -34
  116. package/.genie/product/templates/context-template.md +0 -218
  117. package/.genie/product/templates/qa-done-report-template.md +0 -68
  118. package/.genie/product/templates/review-report-template.md +0 -89
  119. package/.genie/product/templates/wish-template.md +0 -120
  120. package/.genie/scripts/helpers/analyze-commit.js +0 -195
  121. package/.genie/scripts/helpers/bullet-counter.js +0 -194
  122. package/.genie/scripts/helpers/bullet-find.js +0 -289
  123. package/.genie/scripts/helpers/bullet-id.js +0 -244
  124. package/.genie/scripts/helpers/check-secrets.js +0 -237
  125. package/.genie/scripts/helpers/count-tokens.js +0 -200
  126. package/.genie/scripts/helpers/create-frontmatter.js +0 -456
  127. package/.genie/scripts/helpers/detect-markers.js +0 -293
  128. package/.genie/scripts/helpers/detect-todos.js +0 -267
  129. package/.genie/scripts/helpers/detect-unlabeled-blocks.js +0 -135
  130. package/.genie/scripts/helpers/embeddings.js +0 -344
  131. package/.genie/scripts/helpers/find-empty-sections.js +0 -158
  132. package/.genie/scripts/helpers/index.js +0 -319
  133. package/.genie/scripts/helpers/validate-frontmatter.js +0 -578
  134. package/.genie/scripts/helpers/validate-links.js +0 -207
  135. package/.genie/scripts/helpers/validate-paths.js +0 -373
  136. package/.genie/spells/README.md +0 -9
  137. package/.genie/spells/ace-protocol.md +0 -118
  138. package/.genie/spells/ask-one-at-a-time.md +0 -175
  139. package/.genie/spells/backup-analyzer.md +0 -542
  140. package/.genie/spells/blocker.md +0 -12
  141. package/.genie/spells/break-things-move-fast.md +0 -56
  142. package/.genie/spells/context-candidates.md +0 -72
  143. package/.genie/spells/context-critic.md +0 -51
  144. package/.genie/spells/defer-to-expertise.md +0 -278
  145. package/.genie/spells/delegate-dont-do.md +0 -292
  146. package/.genie/spells/error-investigation-protocol.md +0 -328
  147. package/.genie/spells/evidence-based-completion.md +0 -273
  148. package/.genie/spells/experiment.md +0 -65
  149. package/.genie/spells/file-creation-protocol.md +0 -229
  150. package/.genie/spells/forge-integration.md +0 -281
  151. package/.genie/spells/forge-orchestration.md +0 -514
  152. package/.genie/spells/gather-context.md +0 -18
  153. package/.genie/spells/global-health-check.md +0 -34
  154. package/.genie/spells/global-noop-roundtrip.md +0 -25
  155. package/.genie/spells/install-genie.md +0 -1232
  156. package/.genie/spells/install.md +0 -82
  157. package/.genie/spells/investigate-before-commit.md +0 -112
  158. package/.genie/spells/know-yourself.md +0 -288
  159. package/.genie/spells/learn.md +0 -828
  160. package/.genie/spells/mcp-diagnostic-protocol.md +0 -246
  161. package/.genie/spells/mcp-first.md +0 -124
  162. package/.genie/spells/multi-step-execution.md +0 -67
  163. package/.genie/spells/orchestration-boundary-protocol.md +0 -256
  164. package/.genie/spells/orchestrator-not-implementor.md +0 -189
  165. package/.genie/spells/prompt.md +0 -746
  166. package/.genie/spells/reflect.md +0 -404
  167. package/.genie/spells/routing-decision-matrix.md +0 -368
  168. package/.genie/spells/run-in-parallel.md +0 -12
  169. package/.genie/spells/session-state-updater-example.md +0 -196
  170. package/.genie/spells/session-state-updater.md +0 -220
  171. package/.genie/spells/track-long-running-tasks.md +0 -133
  172. package/.genie/spells/troubleshoot-infrastructure.md +0 -176
  173. package/.genie/spells/upgrade-genie.md +0 -415
  174. package/.genie/spells/url-presentation-protocol.md +0 -301
  175. package/.genie/spells/wish-initiation.md +0 -158
  176. package/.genie/spells/wish-issue-linkage.md +0 -410
  177. package/.genie/spells/wish-lifecycle.md +0 -100
  178. package/.genie/state/provider-status.json +0 -3
  179. package/.genie/state/version.json +0 -16
  180. package/.genie/wishes/canonical-pgserve-pm2-supervision/WISH.md +0 -290
  181. package/.genie/wishes/pgserve-v2/BRIEF-from-genie-pgserve.md +0 -99
  182. package/.genie/wishes/pgserve-v2/WISH.md +0 -442
  183. package/.genie/wishes/release-system-genie-pattern/WISH.md +0 -268
  184. package/.genie/wishes/release-system-genie-pattern/validation.md +0 -205
  185. package/.gitguardian.yaml +0 -29
  186. package/.gitguardianignore +0 -16
  187. package/.github/workflows/ci.yml +0 -122
  188. package/.github/workflows/release.yml +0 -289
  189. package/.github/workflows/version.yml +0 -228
  190. package/.husky/pre-commit +0 -2
  191. package/AGENTS.md +0 -433
  192. package/CLAUDE.md +0 -1
  193. package/Makefile +0 -285
  194. package/assets/icon.ico +0 -0
  195. package/bun.lock +0 -435
  196. package/bunfig.toml +0 -28
  197. package/ecosystem.config.cjs +0 -23
  198. package/eslint.config.js +0 -63
  199. package/examples/multi-tenant-demo.js +0 -104
  200. package/install.sh +0 -123
  201. package/knip.json +0 -9
  202. package/scripts/test-bun-self-heal.sh +0 -163
  203. package/scripts/test-npx.sh +0 -60
  204. package/tests/audit.test.js +0 -189
  205. package/tests/backpressure.test.js +0 -167
  206. package/tests/benchmarks/runner.js +0 -1197
  207. package/tests/benchmarks/vector-generator.js +0 -368
  208. package/tests/cli-install.test.js +0 -322
  209. package/tests/control-db.test.js +0 -285
  210. package/tests/daemon-args.test.js +0 -86
  211. package/tests/daemon-control.test.js +0 -171
  212. package/tests/daemon-fingerprint-integration.test.js +0 -111
  213. package/tests/daemon-pr24-regression.test.js +0 -198
  214. package/tests/fingerprint.test.js +0 -263
  215. package/tests/fixtures/240-orphan-seed.sql +0 -30
  216. package/tests/multi-tenant.test.js +0 -374
  217. package/tests/orphan-cleanup.test.js +0 -390
  218. package/tests/pg-version-regex.test.js +0 -129
  219. package/tests/quick-bench.js +0 -135
  220. package/tests/router-handshake-retry.test.js +0 -119
  221. package/tests/router-handshake-watchdog.test.js +0 -110
  222. package/tests/sdk.test.js +0 -71
  223. package/tests/stale-postmaster-pid.test.js +0 -85
  224. package/tests/stress-test.js +0 -439
  225. package/tests/sync-perf-test.js +0 -150
  226. package/tests/tcp-listen.test.js +0 -368
  227. package/tests/tenancy.test.js +0 -403
  228. package/tests/wrapper-supervision.test.js +0 -107
@@ -1,246 +0,0 @@
1
- ---
2
- name: MCP Diagnostic Protocol
3
- description: Always verify MCP health before using specialized tools. Investigate systematically when tools fail silently.
4
- ---
5
-
6
- # MCP Diagnostic Protocol
7
-
8
- ## Core Principle
9
-
10
- **Check MCP health BEFORE using specialized tools. Silent failure requires investigation, not assumption.**
11
-
12
- When MCP tools fail (especially WebSocket-native tools), diagnose systematically before giving up or suggesting manual workarounds.
13
-
14
- ## The Anti-Pattern
15
-
16
- ❌ **Wrong Response:**
17
- 1. Use specialized MCP tool (`create_wish`, `run_forge`)
18
- 2. Tool returns no output
19
- 3. Assume success or failure without evidence
20
- 4. Mark work "complete" or suggest manual workaround
21
- 5. Move on without investigation
22
-
23
- ✅ **Correct Response:**
24
- 1. Use specialized MCP tool
25
- 2. Tool returns no output
26
- 3. **Check MCP health systematically**
27
- 4. Try alternatives (simpler tools, non-WebSocket)
28
- 5. Look for evidence of success/failure
29
- 6. Report infrastructure issue if found
30
- 7. ONLY THEN suggest manual approach (with full context)
31
-
32
- ## Diagnostic Protocol
33
-
34
- ### Step 1: Verify MCP Server Responsive
35
-
36
- **Before using any specialized tool, confirm MCP is working:**
37
- ```javascript
38
- // Simple read operation - should always work
39
- mcp__genie__list_agents()
40
- ```
41
-
42
- **If this fails:**
43
- - MCP server may be down
44
- - Connection issue
45
- - Configuration problem
46
-
47
- **Action:** Fix MCP connection before attempting specialized operations
48
-
49
- ### Step 2: Check If Work Already Exists
50
-
51
- **Prevent duplicate work - check if operation already succeeded:**
52
- ```javascript
53
- // See active sessions
54
- mcp__genie__list_sessions()
55
-
56
- // Check Forge tasks
57
- mcp__forge__list_tasks(project_id="...")
58
- ```
59
-
60
- **If work exists:**
61
- - Silent tool call may have actually succeeded
62
- - Previous attempt may have completed
63
- - Duplicate operation unnecessary
64
-
65
- **Action:** Resume existing work, don't create new
66
-
67
- ### Step 3: Start with Simple Operations
68
-
69
- **Test MCP progressively:**
70
- ```
71
- Read operations → Write operations
72
- Non-WebSocket → WebSocket
73
- Diagnostic → Action
74
- ```
75
-
76
- **Example progression:**
77
- ```javascript
78
- // 1. Simple read (no WebSocket)
79
- mcp__genie__list_agents()
80
-
81
- // 2. Session operation (may use WebSocket)
82
- mcp__genie__list_sessions()
83
-
84
- // 3. Complex operation (WebSocket-native)
85
- mcp__genie__create_wish(...)
86
- ```
87
-
88
- **If simple operations work but complex fail:**
89
- - Isolates issue to specific tool
90
- - Provides diagnostic context
91
- - Enables targeted bug report
92
-
93
- ### Step 4: Try Alternative Tools
94
-
95
- **When specialized tool fails, try equivalent non-WebSocket version:**
96
-
97
- **WebSocket Tools:**
98
- - `mcp__genie__create_wish` → `mcp__genie__run` with agent="wish"
99
- - `mcp__genie__run_forge` → `mcp__genie__run` with agent="forge"
100
-
101
- **Direct Tools:**
102
- - Genie MCP → Forge MCP directly
103
- - MCP → Native Bash/Read as last resort
104
-
105
- **Example:**
106
- ```javascript
107
- // This failed (WebSocket):
108
- mcp__genie__create_wish(feature="...", github_issue=123)
109
-
110
- // Try non-WebSocket alternative:
111
- mcp__genie__run(
112
- agent="wish",
113
- prompt="Create wish for feature X linked to issue #123"
114
- )
115
- ```
116
-
117
- ### Step 5: Check for Evidence of Success
118
-
119
- **Silent failure might be silent success - verify:**
120
-
121
- **Filesystem:**
122
- ```bash
123
- # Check if files created
124
- ls .genie/wishes/
125
- ls /var/tmp/automagik-forge/worktrees/
126
- ```
127
-
128
- **Git:**
129
- ```bash
130
- # Check for commits
131
- git log --oneline -5
132
- ```
133
-
134
- **MCP:**
135
- ```javascript
136
- // Check if sessions exist
137
- mcp__genie__list_sessions()
138
- ```
139
-
140
- **If evidence exists:**
141
- - Operation succeeded despite no output
142
- - Report output issue, but don't duplicate work
143
-
144
- ### Step 6: Report or Escalate
145
-
146
- **If systematic investigation shows infrastructure issue:**
147
-
148
- 1. **Document findings:**
149
- - What tool was used
150
- - What output was expected vs received
151
- - What diagnostics were performed
152
- - What evidence exists (or doesn't)
153
-
154
- 2. **Create issue:**
155
- ```bash
156
- gh issue create \
157
- --title "MCP tool silent failure: create_wish returns no output" \
158
- --body "$(cat investigation-notes.md)" \
159
- --label "bug,infrastructure"
160
- ```
161
-
162
- 3. **Use workaround:**
163
- - Document why workaround needed
164
- - Use alternative tool with full context
165
- - Track issue for proper fix
166
-
167
- **Only after exhausting all diagnostic steps should manual workaround be suggested.**
168
-
169
- ## Common Violations
170
-
171
- ### Violation 1: Silent Failure → Immediate Exit
172
-
173
- **Wrong:**
174
- ```
175
- Tool fails → "This isn't working, try manually" → Exit
176
- ```
177
-
178
- **Right:**
179
- ```
180
- Tool fails → Check MCP health → Try alternatives → Look for evidence → Report issue → Then suggest workaround with context
181
- ```
182
-
183
- ### Violation 2: No Output → Assume Success
184
-
185
- **Wrong:**
186
- ```
187
- create_wish returns nothing → Mark task "completed" → Move on
188
- ```
189
-
190
- **Right:**
191
- ```
192
- create_wish returns nothing → Check list_sessions → Check filesystem → Check git → Verify evidence → Then mark status
193
- ```
194
-
195
- ### Violation 3: First Failure → Give Up
196
-
197
- **Wrong:**
198
- ```
199
- create_wish fails → "Let's do this manually instead"
200
- ```
201
-
202
- **Right:**
203
- ```
204
- create_wish fails → Try list_agents → Try mcp__genie__run → Check worktrees → Report infrastructure bug → Create wish with working tool
205
- ```
206
-
207
- ## Integration with Evidence Protocol
208
-
209
- This protocol works with Evidence-Based Todo Completion:
210
-
211
- ```
212
- MCP tool used → No output received → Diagnostic protocol executed → Evidence checked → Status determined:
213
- - completed (evidence of success found)
214
- - failed (confirmed failure, documented)
215
- - blocked (infrastructure issue, reported)
216
- - unknown (no evidence either way, needs verification)
217
- ```
218
-
219
- **Never mark "completed" without evidence. Unknown is more honest than falsely complete.**
220
-
221
- ## Real-World Example
222
-
223
- **Bug #239:** WebSocket MCP tools (`create_wish`, `run_forge`) returned no output during task creation attempt.
224
-
225
- **Violation:** Marked task "completed" without evidence, suggested manual workaround.
226
-
227
- **Correct Response:**
228
- 1. ✅ Check MCP health: `list_agents` (worked)
229
- 2. ✅ Check sessions: `list_sessions` (no new sessions)
230
- 3. ✅ Try alternative: `mcp__genie__run` (worked!)
231
- 4. ✅ Get evidence: Session ID, task ID, full URLs returned
232
- 5. ✅ Report issue: Created #239 for WebSocket tool investigation
233
- 6. ✅ Use working tool: Successfully created both wishes with verification
234
-
235
- **Evidence:** Session `websocket-tools-investigation` created, task ff8b5629... visible in Forge UI.
236
-
237
- ## Success Criteria
238
-
239
- **This protocol is working when:**
240
- - ✅ No more premature exits after first tool failure
241
- - ✅ Infrastructure issues reported, not worked around silently
242
- - ✅ Alternative tools tried before suggesting manual approach
243
- - ✅ Evidence checked before declaring success/failure
244
- - ✅ Todo status reflects reality (blocked/failed/unknown vs false "completed")
245
-
246
- **Integration:** Works with MCP-first hierarchy, Evidence-based completion, Troubleshoot Infrastructure protocols.
@@ -1,124 +0,0 @@
1
- ---
2
- name: MCP First (Tool Usage Hierarchy)
3
- description: MCP tools are primary interface, not optional. Use native tools only as fallback.
4
- ---
5
-
6
- # MCP First - Tool Usage Hierarchy
7
-
8
- ## Core Principle
9
-
10
- **MCP Genie tools are PRIMARY interface for all Genie/Agent/Spell/Forge operations, not supplementary.**
11
-
12
- When MCP tools exist for an operation, use them first. Native tools (Read, Bash, etc.) are fallback only.
13
-
14
- ## Why MCP First
15
-
16
- 1. **Optimized:** MCP tools may have caching, better integration
17
- 2. **Superpower:** MCP is designed specifically for Genie workflows
18
- 3. **Consistency:** Using MCP ensures all agents use same interface
19
- 4. **Future-proof:** MCP layer can evolve without changing agent behavior
20
-
21
- ## Tool Hierarchy
22
-
23
- ### Spell Operations
24
-
25
- ❌ **Wrong:** `Read(.genie/spells/learn.md)`
26
- ✅ **Right:** `mcp__genie__read_spell("learn")`
27
-
28
- **Why:** MCP spell reading may parse frontmatter, handle aliases, track usage
29
-
30
- ### Agent/Session Operations
31
-
32
- ❌ **Wrong:** Reading files in Forge worktree with `Read`
33
- ✅ **Right:** `mcp__genie__view(sessionId, full=true)`
34
-
35
- **Why:** MCP provides structured session data, handles worktree paths automatically
36
-
37
- ### Forge Operations
38
-
39
- ❌ **Wrong:** Bash worktree commands to check status
40
- ✅ **Right:** `mcp__forge__get_task(task_id)`
41
-
42
- **Why:** Forge API provides structured data, handles multiple worktrees
43
-
44
- ### Workspace Info
45
-
46
- ❌ **Wrong:** Reading individual files from `.genie/product/`
47
- ✅ **Right:** `mcp__genie__get_workspace_info()`
48
-
49
- **Why:** MCP aggregates all workspace context in one call
50
-
51
- ## When to Use Native Tools
52
-
53
- Use native tools (Read, Glob, Grep, Bash) when:
54
- - ✅ No MCP equivalent exists
55
- - ✅ Working with non-Genie files (implementation code, config files)
56
- - ✅ MCP tool fails or is unavailable
57
- - ✅ Performance-critical path exploration (Glob is very fast)
58
-
59
- ## Common Violations
60
-
61
- ### Violation 1: Reading Spells Directly
62
- **Wrong:**
63
- ```javascript
64
- Read(.genie/spells/delegate-dont-do.md)
65
- ```
66
-
67
- **Right:**
68
- ```javascript
69
- mcp__genie__read_spell("delegate-dont-do")
70
- ```
71
-
72
- ### Violation 2: Checking Forge Status with Bash
73
- **Wrong:**
74
- ```bash
75
- cd /var/tmp/automagik-forge/worktrees/abc123
76
- git log --oneline -3
77
- ```
78
-
79
- **Right:**
80
- ```javascript
81
- mcp__forge__get_task_attempt(attempt_id="abc123")
82
- mcp__genie__view(sessionId="abc123", full=true)
83
- ```
84
-
85
- ### Violation 3: Reading Workspace Files Individually
86
- **Wrong:**
87
- ```javascript
88
- Read(.genie/product/mission.md)
89
- Read(.genie/product/tech-stack.md)
90
- Read(.genie/product/roadmap.md)
91
- ```
92
-
93
- **Right:**
94
- ```javascript
95
- mcp__genie__get_workspace_info()
96
- ```
97
-
98
- ## Checklist Before Using Native Tools
99
-
100
- Before using Read/Bash/Grep for Genie-related operations:
101
-
102
- - [ ] Did I check if MCP tool exists for this?
103
- - [ ] Is this a non-Genie file (implementation code)?
104
- - [ ] Have I tried the MCP equivalent and it failed?
105
- - [ ] Am I certain no MCP tool covers this use case?
106
-
107
- ## Evidence
108
-
109
- **Origin:** Learning #6 from `learn.md` (lines 140-150)
110
- **Teaching:** "The Genie MCP is your superpower. You need to rely on it as much as you can."
111
- **Session:** `/tmp/session-ultrathink-analysis.md` lines 263-292
112
-
113
- ## Quick Reference
114
-
115
- | Operation | ❌ Native | ✅ MCP |
116
- |-----------|----------|--------|
117
- | Read spell | `Read(.genie/spells/X.md)` | `read_spell("X")` |
118
- | Check session | `Read(worktree/file)` | `view(sessionId, full=true)` |
119
- | Get task status | `cd worktree && git log` | `get_task(task_id)` |
120
- | Workspace info | `Read(.genie/product/*.md)` | `get_workspace_info()` |
121
- | List agents | `ls .genie/code/agents` | `list_agents()` |
122
- | List spells | `ls .genie/spells` | `list_spells()` |
123
-
124
- **Remember:** MCP is my superpower. Use it.
@@ -1,67 +0,0 @@
1
- ---
2
- name: Execution Integrity Protocol *(CRITICAL - SAY-DO GAP)*
3
- description: Match verbal commitments with immediate actions
4
- ---
5
-
6
- # Execution Integrity Protocol *(CRITICAL - SAY-DO GAP)*
7
-
8
- **NEVER** state an intention without immediately executing it. **ALWAYS** match verbal commitments with actions.
9
-
10
- ## Violation: Say-Do Gap (Sleep Command Pattern)
11
-
12
- **Context:** Session 2025-10-17 23:00-23:05 UTC - Learn agent progress check
13
-
14
- **Pattern:** Saying "Waiting X seconds..." without executing `sleep X` command
15
-
16
- ## Forbidden Actions
17
-
18
- - ❌ "Waiting ~120s before checking results..." → No sleep command executed
19
- - ❌ Verbal commitment ("I will X") without tool invocation
20
- - ❌ Continuing with other actions after wait statement
21
- - ❌ Repeating pattern after correction
22
-
23
- ## Required Workflow
24
-
25
- **When committing to wait/delay/sleep:**
26
- ```
27
- ✅ CORRECT PATTERN:
28
- "Waiting 120s before checking results..."
29
- <invoke Bash with command="sleep 120">
30
- [THEN continue after sleep completes]
31
-
32
- ❌ WRONG PATTERN:
33
- "Waiting ~120s before checking results..."
34
- [continues with other text/actions without executing sleep]
35
- ```
36
-
37
- ## Implementation Rules
38
-
39
- 1. Commit statement ("Waiting X seconds...") MUST be followed IMMEDIATELY by sleep command
40
- 2. NO text/actions between commit and execution
41
- 3. Sleep duration MUST match stated duration exactly
42
- 4. Use Bash tool with sleep command, not just text
43
- 5. Self-validate before responding: "Did I execute what I said I would?"
44
-
45
- ## Why This Matters
46
-
47
- - **Trust violation:** Say one thing, do another erodes credibility
48
- - **False expectations:** User thinks work is paused, it's not
49
- - **Polling protocol violations:** Checking too soon without actual wait
50
- - **Self-awareness failure:** Repeated pattern after correction demonstrates lack of learning
51
-
52
- ## Recent Violation
53
-
54
- **2025-10-17 23:00-23:05 UTC:**
55
- - Said "Waiting ~120s..." TWICE without executing sleep
56
- - Required TWO corrections from Felipe before finally executing
57
- - First instance: "Waiting ~120s..." → No sleep → Felipe: "you didnt sleep 120, you just said you would"
58
- - Second instance: "You're right, waiting now..." → STILL no sleep → Felipe: "this is curious, you didnt use sleep again, either.... you need to self improve"
59
- - Finally executed after second correction: `sleep 120`
60
- - **Pattern:** Verbal commitment → no action → correction → verbal commitment → no action → correction → action
61
- - **Root cause:** Fundamental say-do gap, statements not backed by actions
62
- - **Result:** Trust erosion, repeated behavioral failure after explicit teaching
63
- - **Evidence:** User teaching 2025-10-17 23:00-23:05 UTC
64
-
65
- ## Validation
66
-
67
- Every "waiting/sleeping/pausing" statement must show corresponding sleep command in tool invocations.
@@ -1,256 +0,0 @@
1
- # 📘 Orchestration Boundary Protocol Playbook
2
-
3
- **Priority:** 🔴 CRITICAL
4
- **Category:** Core Discipline
5
- **Created:** 2025-10-21
6
-
7
- ---
8
-
9
- ## 🎯 Strategies and Hard Rules
10
-
11
- ### The Core Principle
12
-
13
- **Once Forge task attempt starts → Base Genie STOPS touching implementation**
14
-
15
- This is the fundamental boundary between orchestration (planning, coordinating) and execution (implementing, fixing).
16
-
17
- ### When Genie CAN Touch Files
18
-
19
- **✅ Permitted:**
20
- - [orchestration-001] helpful=0 harmful=0: ✅ No Forge task exists for this work (permitted to edit)
21
- - [orchestration-002] helpful=0 harmful=0: ✅ Pure orchestration files like SESSION-STATE.md, MASTER-PLAN.md (permitted)
22
- - [orchestration-003] helpful=0 harmful=0: ✅ Emergency hotfix when Forge unavailable (permitted with caution)
23
- - [orchestration-004] helpful=0 harmful=0: ✅ Meta-learning: creating/updating .genie/spells/ (permitted direct execution)
24
-
25
- **❌ Forbidden:**
26
- - [orchestration-005] helpful=0 harmful=0: ❌ Forge task attempt is active for this work (forbidden to edit)
27
- - [orchestration-006] helpful=0 harmful=0: ❌ Implementation work: bug fixes, features, refactoring (forbidden, delegate to Forge)
28
- - [orchestration-007] helpful=0 harmful=0: ❌ Files owned by specialized agents like Git agent (forbidden, delegate properly)
29
-
30
- ### Post-Delegation Responsibilities
31
-
32
- **After delegating to Forge, Genie:**
33
- - [orchestration-008] helpful=0 harmful=0: ✅ Monitors progress (check Forge status via MCP)
34
- - [orchestration-009] helpful=0 harmful=0: ✅ Answers questions if Forge executor asks
35
- - [orchestration-010] helpful=0 harmful=0: ✅ Coordinates with other agents (multi-agent orchestration)
36
- - [orchestration-011] helpful=0 harmful=0: ✅ Plans next steps (strategic planning post-execution)
37
- - [orchestration-012] helpful=0 harmful=0: ✅ Reviews when complete (quality assurance role)
38
- - [orchestration-013] helpful=0 harmful=0: ❌ Edits code files (forbidden after delegation)
39
- - [orchestration-014] helpful=0 harmful=0: ❌ Implements fixes (forbidden, that's Forge's job)
40
- - [orchestration-015] helpful=0 harmful=0: ❌ Duplicates Forge's work (critical boundary violation)
41
-
42
- ---
43
-
44
- ## 🔄 Common Patterns
45
-
46
- ### Pattern 1: Correct Delegation Flow
47
-
48
- **User Request:** "Fix bug #168 (graceful shutdown)"
49
-
50
- **Genie's Workflow:**
51
- 1. ✅ Create Forge task (if none exists)
52
- 2. ✅ Start task attempt (isolated worktree created)
53
- 3. ✅ **STOP** - Forge executor takes over
54
- 4. ✅ Monitor progress (check Forge status)
55
- 5. ✅ Review when complete
56
- 6. ✅ Coordinate PR/merge if needed
57
-
58
- **What Genie Does NOT Do:**
59
- - [orchestration-016] helpful=0 harmful=0: ❌ Start implementing after creating task (boundary violation)
60
- - [orchestration-017] helpful=0 harmful=0: ❌ Edit files in main workspace while Forge works (creates conflicts)
61
- - [orchestration-018] helpful=0 harmful=0: ❌ Duplicate Forge's work (critical anti-pattern)
62
- - [orchestration-019] helpful=0 harmful=0: ❌ Assume agent failed when can't view progress (check worktree first!)
63
-
64
- ### Pattern 2: Meta-Learning vs Forge Decision
65
-
66
- **Meta-Learning (Direct):**
67
- - Document patterns
68
- - Create spells
69
- - Update framework
70
- - Learning documentation
71
-
72
- **Forge (Delegation):**
73
- - Implement features
74
- - Fix bugs
75
- - Build systems
76
- - Code refactoring
77
-
78
- ---
79
-
80
- ## 💻 Code Snippets and Templates
81
-
82
- ### Worktree Verification Commands
83
-
84
- ```bash
85
- # List all active worktrees
86
- ls /var/tmp/automagik-forge/worktrees/
87
-
88
- # Navigate to specific worktree (use task ID prefix)
89
- cd /var/tmp/automagik-forge/worktrees/<task-id-prefix>*
90
-
91
- # Check if agent has been committing
92
- git log --oneline -5
93
-
94
- # Check working directory status
95
- git status
96
-
97
- # Check recent file activity
98
- ls -lt | head -10
99
- ```
100
-
101
- ### Pre-Edit Safety Check Script
102
-
103
- ```bash
104
- # Before editing ANY implementation file, run:
105
-
106
- # 1. Check for active Forge sessions
107
- mcp__genie__list_sessions
108
-
109
- # 2. Check worktree status
110
- ls /var/tmp/automagik-forge/worktrees/
111
-
112
- # 3. If worktree exists for this work → STOP
113
- # Let Forge executor handle it
114
- ```
115
-
116
- ---
117
-
118
- ## 🔧 Troubleshooting and Pitfalls
119
-
120
- ### Pitfall 1: The Violation Pattern
121
-
122
- **What Happened (Bug #168):**
123
- 1. Base Genie created Forge task
124
- 2. Base Genie started task attempt b51db539 (isolated worktree)
125
- 3. Base Genie THEN started implementing in main workspace ❌
126
- 4. **Result:** Duplicate work, boundary violation, confusion
127
-
128
- **Why This Is Critical:**
129
- - Forge executor is ALREADY working in isolated worktree
130
- - Base Genie editing same files = conflict + duplication
131
- - Violates core principle: Genie = orchestrator, NOT implementor
132
-
133
- **How to Avoid:**
134
- Follow the enforcement checklist (see Verification section)
135
-
136
- ### Pitfall 2: Assuming Failure When Monitoring Fails
137
-
138
- **Problem:**
139
- Forge MCP monitoring fails (can't view session, backend unreachable) → Genie assumes agent failed → Genie starts implementing ❌
140
-
141
- **Solution:**
142
- CHECK THE WORKTREE FIRST before assuming failure
143
-
144
- **Commands:**
145
- ```bash
146
- # Navigate to worktree
147
- cd /var/tmp/automagik-forge/worktrees/b51d* # Example: task b51db539
148
-
149
- # Check if agent has been committing
150
- git log --oneline -3
151
-
152
- # Output example:
153
- # b8913b23 fix: Use workspace package version for update detection
154
- ```
155
-
156
- **Interpretation:**
157
- - [orchestration-020] helpful=0 harmful=0: ✅ Commits exist in worktree → Agent is working successfully!
158
- - [orchestration-021] helpful=0 harmful=0: ✅ Recent changes in worktree → Agent progressing normally
159
- - [orchestration-022] helpful=0 harmful=0: ❌ No commits AND task old → Might be stalled (investigate)
160
- - [orchestration-023] helpful=0 harmful=0: ❌ Worktree doesn't exist → Task not started (safe to work)
161
-
162
- **Real-World Example (Bug #168):**
163
- While Base Genie was implementing duplicate work, fix agent had ALREADY completed the fix in its worktree. Monitoring failed, but agent succeeded.
164
-
165
- **Lesson:** Infrastructure issues ≠ Agent failures. Always check worktree before assuming failure.
166
-
167
- **Related:** `@.genie/spells/troubleshoot-infrastructure.md` (5-step diagnostic protocol)
168
-
169
- ---
170
-
171
- ## 📚 Domain-Specific Knowledge
172
-
173
- ### Worktree Isolation Architecture
174
-
175
- **How Forge Works:**
176
- - Each task attempt = isolated git worktree
177
- - Location: `/var/tmp/automagik-forge/worktrees/<task-id-prefix>*/`
178
- - Independent workspace (doesn't affect main repo)
179
- - Agent commits to worktree branch
180
- - Success → merge to target branch
181
- - Failure → discard worktree
182
-
183
- **Why This Matters:**
184
- - [orchestration-024] helpful=0 harmful=0: Genie's main workspace ≠ Forge executor's worktree (different locations)
185
- - [orchestration-025] helpful=0 harmful=0: Editing main workspace while Forge works = boundary violation (creates conflicts)
186
- - [orchestration-026] helpful=0 harmful=0: Always check worktree to see actual progress (monitoring infrastructure may fail)
187
-
188
- ### Agent Responsibility Matrix
189
-
190
- - [orchestration-027] helpful=0 harmful=0: Implementation work → Forge executor (Base Genie: orchestrate, monitor only)
191
- - [orchestration-028] helpful=0 harmful=0: Git operations → Git agent (Base Genie: delegate, don't execute)
192
- - [orchestration-029] helpful=0 harmful=0: Meta-learning → Base Genie direct execution (update spells, patterns)
193
- - [orchestration-030] helpful=0 harmful=0: Orchestration files → Base Genie direct execution (SESSION-STATE.md, plans)
194
- - [orchestration-031] helpful=0 harmful=0: Emergency hotfix → Base Genie if no Forge available (execute with caution)
195
-
196
- ### Historical Context
197
-
198
- **First Documented Violation:**
199
- - **Date:** 2025-10-21 ~05:45 UTC
200
- - **Bug:** #168 (graceful shutdown)
201
- - **Task attempt:** b51db539
202
- - **Files affected:** src/cli/genie-cli.ts (historical - old path structure)
203
- - **Root cause:** Unclear boundaries between orchestration vs execution
204
- - **Pattern recognized by:** Felipe (user feedback)
205
- - **Learning applied:** This playbook created
206
-
207
- **Amendment Status:**
208
- This protocol became Amendment #4 in AGENTS.md: "Orchestration Boundary - Once Delegated, Never Duplicated"
209
-
210
- ---
211
-
212
- ## ✅ Verification Checklist
213
-
214
- Before editing ANY implementation file, Base Genie must verify:
215
-
216
- ### 1. Active Task Check
217
- - [orchestration-032] helpful=0 harmful=0: [ ] Check SESSION-STATE.md for active attempts before editing
218
- - [orchestration-033] helpful=0 harmful=0: [ ] Run `mcp__genie__list_sessions` to see running tasks
219
- - [orchestration-034] helpful=0 harmful=0: [ ] **If active task exists for this work → STOP** (let executor handle it)
220
-
221
- ### 2. Worktree Status Check
222
- - [orchestration-035] helpful=0 harmful=0: [ ] List worktrees: `ls /var/tmp/automagik-forge/worktrees/`
223
- - [orchestration-036] helpful=0 harmful=0: [ ] Navigate to relevant worktree (if exists)
224
- - [orchestration-037] helpful=0 harmful=0: [ ] Check commits: `git log --oneline -5` (verify agent activity)
225
- - [orchestration-038] helpful=0 harmful=0: [ ] Check status: `git status` (see working changes)
226
- - [orchestration-039] helpful=0 harmful=0: [ ] **If commits exist → Agent is working! DO NOT DUPLICATE**
227
-
228
- ### 3. Agent Responsibility Check
229
- - [orchestration-040] helpful=0 harmful=0: [ ] Is this implementation work? → Forge executor (delegate)
230
- - [orchestration-041] helpful=0 harmful=0: [ ] Is this orchestration? → Base Genie OK (proceed)
231
- - [orchestration-042] helpful=0 harmful=0: [ ] Is this learning? → Meta-learn protocol (use learn spell)
232
- - [orchestration-043] helpful=0 harmful=0: [ ] Is this git operations? → Git agent (delegate properly)
233
-
234
- ### 4. Work Type Classification
235
- - [orchestration-044] helpful=0 harmful=0: [ ] Is this exploration (reading, analyzing)? → OK for Genie (proceed)
236
- - [orchestration-045] helpful=0 harmful=0: [ ] Is this execution (editing, implementing)? → Delegate (boundary rule)
237
-
238
- ### 5. Quick Decision Tree
239
-
240
- ```
241
- Are you about to edit an implementation file?
242
-
243
- ├─ YES → Is there an active Forge task for this work?
244
- │ │
245
- │ ├─ YES → STOP ❌ (Let Forge handle it)
246
- │ │
247
- │ └─ NO → Are you the right agent for this?
248
- │ │
249
- │ ├─ Implementation → Delegate to Forge
250
- │ │
251
- │ └─ Orchestration/Learning → Proceed ✅
252
-
253
- └─ NO → Proceed ✅
254
- ```
255
-
256
- **Remember:** Once delegated, never duplicated.