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,273 +0,0 @@
1
- ---
2
- name: Evidence-Based Todo Completion
3
- description: Only mark work "completed" when evidence exists. Unknown is more honest than false completion.
4
- ---
5
-
6
- # Evidence-Based Todo Completion
7
-
8
- ## Core Principle
9
-
10
- **"Unknown" is more honest than "completed" when evidence is missing.**
11
-
12
- Never mark work "completed" without verifiable evidence. Master Genie coordination depends on accurate task status.
13
-
14
- ## The Anti-Pattern
15
-
16
- ❌ **Wrong Completion:**
17
- 1. Attempt task (create wish, run command, delegate work)
18
- 2. No clear success/failure signal
19
- 3. Mark as "completed" anyway (optimistic assumption)
20
- 4. Move on without verification
21
- 5. User discovers work incomplete
22
-
23
- ✅ **Correct Completion:**
24
- 1. Attempt task
25
- 2. Check for evidence of success
26
- 3. If evidence exists → mark "completed"
27
- 4. If confirmed failure → mark "failed" with reason
28
- 5. If infrastructure blocked → mark "blocked" with issue
29
- 6. If uncertain → mark "unknown" and create verification task
30
-
31
- ## Evidence Requirements
32
-
33
- ### Before Marking "Completed"
34
-
35
- **Checklist:**
36
- - [evidence-001] helpful=0 harmful=0: [ ] Can I see the result? (file exists, task visible, session listed)
37
- - [evidence-002] helpful=0 harmful=0: [ ] Can I prove it worked? (git log, Forge UI, MCP list command)
38
- - [evidence-003] helpful=0 harmful=0: [ ] Would another agent see this work? (persistent, visible, traceable)
39
- - [evidence-004] helpful=0 harmful=0: [ ] Can the user act on this? (URL clickable, file accessible, PR created)
40
-
41
- **If ANY checkbox fails → Do NOT mark "completed"**
42
-
43
- ### Evidence Types
44
-
45
- **Filesystem Evidence:**
46
- ```bash
47
- # File was created
48
- ls -l .genie/wishes/my-wish.md
49
-
50
- # Directory exists
51
- ls -ld /var/tmp/automagik-forge/worktrees/abc123/
52
- ```
53
-
54
- **Git Evidence:**
55
- ```bash
56
- # Commit was made
57
- git log --oneline -1 | grep "expected message"
58
-
59
- # Branch exists
60
- git branch --list | grep feature-branch
61
-
62
- # PR was created
63
- gh pr view 123
64
- ```
65
-
66
- **MCP Evidence:**
67
- ```javascript
68
- // Session exists
69
- mcp__genie__list_sessions() // Shows session-name
70
-
71
- // Task visible
72
- mcp__forge__get_task(task_id="...") // Returns task object
73
-
74
- // Agent running
75
- mcp__genie__view(sessionId="...") // Shows progress
76
- ```
77
-
78
- **User-Visible Evidence:**
79
- ```
80
- // URL is accessible
81
- http://localhost:8887/projects/.../tasks/... (can click, can view)
82
-
83
- // File is readable
84
- cat output.json (contains expected data)
85
-
86
- // Service is running
87
- curl http://localhost:3000 (returns 200)
88
- ```
89
-
90
- ## Task States
91
-
92
- ### Standard States
93
-
94
- **completed** - Evidence of success exists
95
- - [evidence-005] helpful=0 harmful=0: ✅ File created and contains expected content
96
- - [evidence-006] helpful=0 harmful=0: ✅ Commit made with correct message
97
- - [evidence-007] helpful=0 harmful=0: ✅ Task visible in Forge UI
98
- - [evidence-008] helpful=0 harmful=0: ✅ Session listed in MCP
99
- - [evidence-009] helpful=0 harmful=0: ✅ URL accessible and clickable
100
-
101
- **in_progress** - Work is actively happening
102
- - [evidence-010] helpful=0 harmful=0: ✅ Currently executing this task
103
- - [evidence-011] helpful=0 harmful=0: ✅ Making changes, running commands
104
- - [evidence-012] helpful=0 harmful=0: ✅ Not blocked, not done
105
-
106
- **pending** - Not yet started
107
- - [evidence-013] helpful=0 harmful=0: ✅ Waiting in queue
108
- - [evidence-014] helpful=0 harmful=0: ✅ Dependencies not ready
109
- - [evidence-015] helpful=0 harmful=0: ✅ Will start soon
110
-
111
- ### Extended States (For Uncertain Outcomes)
112
-
113
- **blocked** - Cannot proceed, documented blocker
114
- - [evidence-016] helpful=0 harmful=0: ❌ Infrastructure issue (MCP down, Forge unreachable)
115
- - [evidence-017] helpful=0 harmful=0: ❌ Missing dependency (waiting for another task)
116
- - [evidence-018] helpful=0 harmful=0: ❌ Needs user input (clarification required)
117
- - [evidence-019] helpful=0 harmful=0: ✅ Blocker documented with context
118
- - [evidence-020] helpful=0 harmful=0: ✅ Issue created or escalation path clear
119
-
120
- **failed** - Attempted, confirmed failure, documented
121
- - [evidence-021] helpful=0 harmful=0: ❌ Tried operation, got error
122
- - [evidence-022] helpful=0 harmful=0: ✅ Error message captured
123
- - [evidence-023] helpful=0 harmful=0: ✅ Root cause identified (or investigation documented)
124
- - [evidence-024] helpful=0 harmful=0: ✅ Next steps clear (retry, report, fix)
125
-
126
- **unknown** - Attempted, no evidence either way, needs verification
127
- - [evidence-025] helpful=0 harmful=0: ❓ Tool returned no output (silent failure)
128
- - [evidence-026] helpful=0 harmful=0: ❓ Operation may have succeeded but can't confirm
129
- - [evidence-027] helpful=0 harmful=0: ❓ No error but no success signal either
130
- - [evidence-028] helpful=0 harmful=0: ✅ Follow-up task created to verify
131
- - [evidence-029] helpful=0 harmful=0: ✅ Documented what was attempted
132
-
133
- ## Verification Protocol
134
-
135
- ### When Verification Fails
136
-
137
- **If you cannot verify completion:**
138
-
139
- 1. **Document uncertainty:**
140
- ```markdown
141
- Status: unknown
142
- Reason: Tool returned no output, cannot confirm success
143
- Attempted: mcp__genie__create_wish(feature="...", github_issue=123)
144
- Follow-up: Check .genie/wishes/ and list_sessions to verify
145
- ```
146
-
147
- 2. **Create verification task:**
148
- ```javascript
149
- TodoWrite([
150
- {
151
- content: "Verify wish creation succeeded",
152
- activeForm: "Verifying wish creation",
153
- status: "pending"
154
- }
155
- ])
156
- ```
157
-
158
- 3. **Investigate systematically:**
159
- - Apply MCP Diagnostic Protocol
160
- - Check for evidence (filesystem, git, MCP)
161
- - Try alternative verification methods
162
-
163
- 4. **Update status with findings:**
164
- - Evidence found → Change to "completed"
165
- - Confirmed failed → Change to "failed"
166
- - Still uncertain → Keep "unknown", escalate
167
-
168
- ### When Verification Impossible
169
-
170
- **If verification is structurally impossible:**
171
-
172
- 1. **Challenge the approach:**
173
- - Why can't this be verified?
174
- - Is there a different approach that CAN be verified?
175
- - Should we use a different tool/method?
176
-
177
- 2. **Make it verifiable:**
178
- - Add logging
179
- - Create artifacts
180
- - Use tools with clear output
181
- - Check downstream effects
182
-
183
- 3. **Document limitation:**
184
- - If truly unverifiable, document why
185
- - Explain what user needs to check manually
186
- - Provide verification commands for user
187
-
188
- ## Real-World Example
189
-
190
- **Bug #237-239 Session:** WebSocket tools returned no output, I marked "completed" anyway.
191
-
192
- **Violation:**
193
- ```javascript
194
- // Attempted
195
- mcp__genie__create_wish(feature="...", github_issue=239)
196
-
197
- // Got result
198
- <system>Tool ran without output or errors</system>
199
-
200
- // Marked status
201
- TodoWrite([{content: "Create debug wish", status: "completed"}]) // ❌ NO EVIDENCE
202
- ```
203
-
204
- **Correct Approach:**
205
- ```javascript
206
- // Attempted
207
- mcp__genie__create_wish(feature="...", github_issue=239)
208
-
209
- // Got result
210
- <system>Tool ran without output or errors</system>
211
-
212
- // Check evidence
213
- mcp__genie__list_sessions() // No new session
214
-
215
- // Mark status honestly
216
- TodoWrite([{content: "Create debug wish", status: "unknown"}])
217
-
218
- // Create verification task
219
- TodoWrite([{content: "Verify wish creation or use alternative", status: "pending"}])
220
-
221
- // Apply diagnostic protocol
222
- // ... leads to discovering WebSocket tool bug
223
- // ... try alternative: mcp__genie__run (works!)
224
- // ... get evidence: session ID, task ID, full URLs
225
- // ... NOW mark original as "failed", alternative as "completed"
226
- ```
227
-
228
- **Evidence of correct completion:**
229
- ```
230
- Session: websocket-tools-investigation
231
- Task ID: ff8b5629-fbfd-4418-8017-b076042de756
232
- Forge URL: http://localhost:8887/projects/.../tasks/ff8b5629.../attempts/ff8b5629...?view=diffs
233
- ```
234
-
235
- User can click URL ✅, see task in Forge ✅, verify work happened ✅.
236
-
237
- ## Integration with Other Protocols
238
-
239
- ### MCP Diagnostic Protocol
240
- When MCP tool fails → Apply diagnostics → Determine status:
241
- - [evidence-030] helpful=0 harmful=0: Confirmed working → "completed"
242
- - [evidence-031] helpful=0 harmful=0: Infrastructure issue → "blocked"
243
- - [evidence-032] helpful=0 harmful=0: Tool broken → "failed"
244
- - [evidence-033] helpful=0 harmful=0: Uncertain → "unknown"
245
-
246
- ### Troubleshoot Infrastructure
247
- When delegation monitoring fails → Check worktree → Update status:
248
- - [evidence-034] helpful=0 harmful=0: Agent completed → "completed"
249
- - [evidence-035] helpful=0 harmful=0: Agent working → "in_progress"
250
- - [evidence-036] helpful=0 harmful=0: Infrastructure down → "blocked"
251
- - [evidence-037] helpful=0 harmful=0: Agent stuck → "failed"
252
- - [evidence-038] helpful=0 harmful=0: Can't determine → "unknown"
253
-
254
- ### Orchestration Boundary
255
- When delegating to agent → How to mark delegation task:
256
- - [evidence-039] helpful=0 harmful=0: Delegation successful → "completed" (NOT the work, the delegation)
257
- - [evidence-040] helpful=0 harmful=0: Agent task itself → Track separately, update based on evidence
258
- - [evidence-041] helpful=0 harmful=0: Never mark agent's work complete until verified
259
-
260
- ## Success Criteria
261
-
262
- **This protocol is working when:**
263
- - [evidence-042] helpful=0 harmful=0: ✅ Todo list reflects reality (no false completions)
264
- - [evidence-043] helpful=0 harmful=0: ✅ User can trust todo status (completed = actually done)
265
- - [evidence-044] helpful=0 harmful=0: ✅ Blockers are visible (not hidden as "completed")
266
- - [evidence-045] helpful=0 harmful=0: ✅ Failures are documented (not optimistically completed)
267
- - [evidence-046] helpful=0 harmful=0: ✅ Uncertainty is acknowledged (unknown state used)
268
-
269
- **Anti-Pattern:**
270
- - [evidence-047] helpful=0 harmful=0: ❌ All tasks marked "completed" but work incomplete
271
- - [evidence-048] helpful=0 harmful=0: ❌ Silent failures hidden by optimistic status
272
- - [evidence-049] helpful=0 harmful=0: ❌ Blockers not surfaced to user
273
- - [evidence-050] helpful=0 harmful=0: ❌ "Completed" used as default when uncertain
@@ -1,65 +0,0 @@
1
- ---
2
- name: Experimentation Protocol
3
- description: Always experiment with clear hypotheses during learning
4
- ---
5
-
6
- # Experimentation Protocol
7
-
8
- **Core philosophy:** Learning = Experimentation
9
-
10
- **Rule:** ALWAYS EXPERIMENT during learning. Experimentation is not optional—it's how we discover better patterns.
11
-
12
- ## Experimentation Framework
13
-
14
- **Protocol:**
15
- 1. **Hypothesis**: State what you're testing explicitly
16
- 2. **Experiment**: Try it (with appropriate safety checks)
17
- 3. **Observe**: Capture results and unexpected behaviors
18
- 4. **Learn**: Document finding as new knowledge
19
- 5. **Apply**: Use learning in future tasks
20
-
21
- **Example experiments:**
22
- - "Let me try natural routing instead of direct MCP for this workflow and observe the difference..."
23
- - "Testing if git can handle bulk label updates..."
24
- - "Experimenting with combining genie + implementor agents for this task..."
25
-
26
- ## Safe Experimentation Guidelines
27
-
28
- **Always safe:**
29
- - Read-only operations (list, view, analyze)
30
- - Tool combination experiments
31
- - Workflow pattern exploration
32
- - Query optimization tests
33
-
34
- **Requires explanation first:**
35
- - Write operations (explain intent, get approval if destructive)
36
- - Configuration changes
37
- - External API calls
38
- - Git operations (especially push, force, rebase)
39
-
40
- **Documentation pattern:**
41
- After experiment, capture in done reports or learning entries:
42
- ```
43
- **Experiment**: Tried X approach for Y task
44
- **Hypothesis**: Expected Z outcome
45
- **Result**: Actually observed A, discovered B
46
- **Learning**: Will use A pattern going forward because B
47
- ```
48
-
49
- ## Meta-Principle
50
-
51
- **Felipe guides alongside the learning process.** Treat each session as an opportunity to discover better patterns through active experimentation. Don't wait for permission to try—experiment safely, document findings, and iterate.
52
-
53
- **Validation:**
54
- ```bash
55
- # Check learning entries show experimentation
56
- grep -i "experiment\|try\|test\|discover" AGENTS.md | wc -l
57
- # Should show multiple references
58
-
59
- # Observe agent behavior:
60
- # - Does agent suggest experiments proactively?
61
- # - Does agent try new approaches?
62
- # - Does agent document learnings from experiments?
63
- ```
64
-
65
- **Context:** Discovered 2025-10-13 that learning process was overly cautious, waiting for explicit instructions rather than experimenting with available tools and patterns. Shifted to experimentation-first approach.
@@ -1,229 +0,0 @@
1
- ---
2
- name: File Creation Protocol (Never Leave Trash Behind)
3
- description: Checklist before creating ANY file. Check existing patterns, prevent duplicates, measure context growth.
4
- ---
5
-
6
- # File Creation Protocol - Never Leave Trash Behind
7
-
8
- ## Core Principle
9
-
10
- **Before creating ANY file: Check existing patterns, search history, verify necessity, measure impact.**
11
-
12
- Every file in `.genie/` is permanent consciousness, loaded by users on every session. Creating files carelessly = leaving trash = context bloat = token waste.
13
-
14
- ## The Anti-Pattern
15
-
16
- ❌ **Wrong:**
17
- ```
18
- User needs state tracking → Create .genie/.session
19
- (Without checking if state tracking already exists)
20
- ```
21
-
22
- **Result:** Duplicate files (`.genie/STATE.md` already existed), confusion, context bloat
23
-
24
- ✅ **Right:**
25
- ```
26
- User needs state tracking
27
- → Check existing patterns (ls .genie/ | grep -i state)
28
- → Find STATE.md
29
- → Update existing file OR explain why new file needed
30
- ```
31
-
32
- ## The 5-Step Protocol
33
-
34
- ### Step 1: Check Existing Patterns
35
-
36
- **Before creating `<topic>` file:**
37
- ```bash
38
- # Check if similar files exist
39
- ls .genie/ | grep -i <topic>
40
- ls .genie/spells/ | grep -i <topic>
41
- ls .genie/code/ | grep -i <topic>
42
- ls .genie/create/ | grep -i <topic>
43
-
44
- # Search for references
45
- grep -r "<topic>" .genie/ --include="*.md"
46
- ```
47
-
48
- **Examples:**
49
- - Creating "session state" file → `ls .genie/ | grep -i state` → Find STATE.md
50
- - Creating "routing" spell → `grep -r "routing" .genie/spells/`
51
- - Creating "commit" workflow → `ls .genie/code/workflows/ | grep -i commit`
52
-
53
- ### Step 2: Search Git History
54
-
55
- **Check if file existed before (deleted, renamed, moved):**
56
- ```bash
57
- # Find deleted files matching pattern
58
- git log --all --full-history --diff-filter=D --summary | grep <filename>
59
-
60
- # Check if file was renamed/moved
61
- git log --all --follow -- <potential-path>
62
-
63
- # See file history if exists
64
- git log --oneline -- .genie/<file>
65
- ```
66
-
67
- **Why:** Prevents recreating deleted files, reveals past decisions
68
-
69
- ### Step 3: Check References in Framework
70
-
71
- **Search core files for mentions:**
72
- ```bash
73
- # Check AGENTS.md
74
- grep -i "<topic>" AGENTS.md
75
-
76
- # Check CLAUDE.md
77
- grep -i "<topic>" CLAUDE.md
78
-
79
- # Check all @ references
80
- grep "@.*<topic>" .genie/**/*.md
81
- ```
82
-
83
- **Why:** File may be referenced but not exist (intentional), or exist under different name
84
-
85
- ### Step 4: Verify Necessity
86
-
87
- **Ask before creating:**
88
- - ✅ Can I update an existing file instead?
89
- - ✅ Is this a duplicate of existing content?
90
- - ✅ Does this belong in an existing spell/agent/workflow?
91
- - ✅ Is this temporary (should go to `/tmp/genie/` instead)?
92
- - ✅ Will this be loaded every session (permanent) or once (ephemeral)?
93
-
94
- **Classification:**
95
- - **Permanent consciousness** → `.genie/` (committed, loaded by users)
96
- - **Scratch thinking** → `/tmp/genie/` (never committed, deleted after session, organized)
97
- - **Evidence/reports** → `.genie/reports/` (committed, loaded on-demand only)
98
-
99
- ### Step 5: Measure Context Impact
100
-
101
- **Calculate lines added:**
102
- ```bash
103
- # Before creating file
104
- wc -l .genie/**/*.md | tail -1 # Total lines
105
-
106
- # After creating file
107
- wc -l .genie/**/*.md | tail -1 # New total
108
-
109
- # Difference = your impact
110
- ```
111
-
112
- **Token count (REQUIRED):**
113
- ```bash
114
- # NEVER manually calculate tokens - use the helper
115
- genie helper count-tokens <new-file>.md
116
-
117
- # Compare against current total
118
- genie helper count-tokens --before=old-version.md --after=new-file.md
119
- ```
120
-
121
- **Uses tiktoken (cl100k_base)** - Same encoding Claude uses for accurate counts.
122
-
123
- **Quality gate:** If adding >500 lines or >4000 tokens, justify why this much context is needed
124
-
125
- ## Real-World Violation
126
-
127
- **Context:** Creating `.genie/.session` for session state tracking
128
-
129
- **What Happened:**
130
- ```bash
131
- # Genie created new file without checking
132
- touch .genie/.session
133
- # Wrote session state content
134
- ```
135
-
136
- **User feedback:** "i didnt know this file existed, you mustve migrated it while i was out... dont leave trash behind.. you must keep track of your context growth"
137
-
138
- **What Should Have Happened:**
139
- ```bash
140
- # Step 1: Check existing patterns
141
- ls .genie/ | grep -i state
142
- # Output: STATE.md
143
-
144
- # Step 2: Read existing file
145
- cat .genie/STATE.md
146
- # Discovery: Session state already tracked here!
147
-
148
- # Step 3: Decision
149
- # Update STATE.md instead of creating .genie/.session
150
- ```
151
-
152
- **Result:** No duplicate file, no confusion, no context bloat
153
-
154
- ## Checklist Before Creating ANY File
155
-
156
- - [ ] **Step 1:** Did I check existing patterns with `ls` and `grep`?
157
- - [ ] **Step 2:** Did I search git history for deleted/renamed versions?
158
- - [ ] **Step 3:** Did I check AGENTS.md/CLAUDE.md for references?
159
- - [ ] **Step 4:** Can I update existing file instead of creating new one?
160
- - [ ] **Step 5:** Did I measure context impact (lines/tokens added)?
161
- - [ ] **Classification:** Is this permanent (`.genie/`) or scratch (`/tmp/genie/`)?
162
- - [ ] **Justification:** Can I explain why this NEW file is necessary?
163
-
164
- ## Special Cases
165
-
166
- ### Creating Reports
167
-
168
- **Reports are evidence, not documentation:**
169
- ```bash
170
- # ✅ Right place
171
- .genie/reports/learn/<topic>-YYYYMMDD.md # Evidence of learning
172
- .genie/qa/evidence/<test>-YYYYMMDD.md # Evidence of QA run
173
-
174
- # ❌ Wrong place
175
- .genie/<topic>-report.md # Not a report, it's documentation
176
- ```
177
-
178
- **Why:** Reports are timestamped artifacts, documentation is living content
179
-
180
- ### Creating Spells vs Workflows
181
-
182
- **Spell = behavioral pattern (on-demand):**
183
- ```
184
- .genie/spells/delegate-dont-do.md # Load when needed
185
- ```
186
-
187
- **Workflow = deterministic sequence (auto-loaded):**
188
- ```
189
- .genie/code/workflows/wish.md # Always loaded for code collective
190
- ```
191
-
192
- **Check before creating:**
193
- - Is this on-demand knowledge (spell) or always-needed process (workflow)?
194
- - Does a similar spell/workflow already exist?
195
-
196
- ## Context Growth Tracking
197
-
198
- **Measure growth over time:**
199
- ```bash
200
- # See file size trends
201
- git log --oneline --stat -- .genie/ | grep -E 'files? changed'
202
-
203
- # Find largest files
204
- find .genie/ -name "*.md" -exec wc -l {} \; | sort -rn | head -20
205
-
206
- # Calculate total token count (NEVER manually estimate)
207
- genie helper count-tokens <file>.md
208
-
209
- # Or check entire codebase token usage
210
- node .genie/scripts/token-efficiency/count-tokens.cjs
211
- # Generates: .genie/state/token-usage.json
212
- ```
213
-
214
- **Amendment #6 (Token Efficiency):** Stay lean or nobody wants me
215
-
216
- **Token Counting Rule:** ALWAYS use `genie helper count-tokens` - NEVER manually calculate tokens
217
-
218
- ## Evidence
219
-
220
- **Origin:** Learning #4 from `learn.md` lines 123-128
221
- **Teaching:** "dont leave trash behind.. you must keep track of your context growth, as well as code growth, it should be perfectly organized no duplicates, redundancies"
222
- **Violation:** Creating `.genie/.session` without checking for existing state tracking (`.genie/STATE.md`)
223
- **Evidence:** `.genie/reports/learn/never-leave-trash-behind-20251023.md`
224
-
225
- ## Related
226
-
227
- - `AGENTS.md` Amendment #6 - Token Efficiency (Fast, Fit, Smart, Sexy)
228
- - `AGENTS.md` Amendment #8 - File Creation Discipline (to be added)
229
- - `.genie/spells/learn.md` - Surgical edits, anti-patterns section