pgserve 2.1.2 → 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 (227) 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 +80 -7
  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-control.test.js +0 -171
  211. package/tests/daemon-fingerprint-integration.test.js +0 -111
  212. package/tests/daemon-pr24-regression.test.js +0 -198
  213. package/tests/fingerprint.test.js +0 -263
  214. package/tests/fixtures/240-orphan-seed.sql +0 -30
  215. package/tests/multi-tenant.test.js +0 -374
  216. package/tests/orphan-cleanup.test.js +0 -390
  217. package/tests/pg-version-regex.test.js +0 -129
  218. package/tests/quick-bench.js +0 -135
  219. package/tests/router-handshake-retry.test.js +0 -119
  220. package/tests/router-handshake-watchdog.test.js +0 -110
  221. package/tests/sdk.test.js +0 -71
  222. package/tests/stale-postmaster-pid.test.js +0 -85
  223. package/tests/stress-test.js +0 -439
  224. package/tests/sync-perf-test.js +0 -150
  225. package/tests/tcp-listen.test.js +0 -368
  226. package/tests/tenancy.test.js +0 -403
  227. package/tests/wrapper-supervision.test.js +0 -107
@@ -1,158 +0,0 @@
1
- # Rule #2: Wish Initiation (Behavioral Spell)
2
-
3
-
4
- **CRITICAL RULE:** All significant work must start with a wish document. Work done without a wish = framework violation.
5
-
6
- ## What Qualifies as "Significant"
7
-
8
- Work is significant if ANY of these apply:
9
- - ✅ Multi-part tasks (≥2 distinct groups)
10
- - ✅ Multi-file changes (≥3 files touched)
11
- - ✅ Architectural decisions (routing, priorities, structure)
12
- - ✅ Time investment (≥1 hour estimated)
13
- - ✅ Framework changes (affects multiple agents/workflows)
14
- - ✅ User request explicitly scoped (clear goals/outputs)
15
-
16
- ## Why This Rule Exists
17
-
18
- **Problem it solves:**
19
- 1. **Evidence tracking:** Wish documents preserve execution groups, decisions, outcomes
20
- 2. **Context preservation:** Session restart doesn't lose work progress
21
- 3. **Audit trail:** Clear proof of what was done, why, and evidence
22
- 4. **Streamlined workflow:** Plan → Wish → Forge → Review becomes automatic
23
- 5. **Team visibility:** Other agents know what's in progress
24
-
25
- **What happens without it:**
26
- - ❌ Work scattered across session (no formal grouping)
27
- - ❌ Context lost on session restart
28
- - ❌ No evidence aggregation (efforts forgotten)
29
- - ❌ Framework workflow broken (skipped Wish phase)
30
- - ❌ No Done Report (completion not documented)
31
-
32
- ## How to Apply This Rule
33
-
34
- ### BEFORE Starting Work
35
-
36
- **Checklist:**
37
- - [ ] Is this significant? (check list above)
38
- - [ ] If YES → Create wish FIRST
39
- - [ ] If NO → Continue with simple task
40
-
41
- **Creating a wish:**
42
- ```bash
43
- mkdir -p .genie/wishes/<slug>/
44
- cat > .genie/wishes/<slug>/<slug>-wish.md << 'EOF'
45
- # Wish: [Title]
46
-
47
- ## Context Ledger
48
- - Problem: [what needs fixing]
49
- - Goal: [what we'll deliver]
50
- - Timeline: [estimate]
51
-
52
- ## Execution Groups
53
- ### Group A: [Phase 1]
54
- - Task 1
55
- - Task 2
56
-
57
- ### Group B: [Phase 2]
58
- - Task 1
59
-
60
- ## Evidence Checklist
61
- - [ ] Deliverable 1
62
- - [ ] Deliverable 2
63
- EOF
64
- ```
65
-
66
- ### AFTER Work Completes
67
-
68
- **Update wish with:**
69
- - [x] All groups marked completed
70
- - [x] Evidence checklist filled
71
- - [x] Done Report path documented
72
- - [x] Lessons learned section updated
73
-
74
- ## Examples
75
-
76
- ### ✅ CORRECT: Wish Created First
77
-
78
- ```
79
- User: "I want to analyze and prioritize our 30 spells"
80
- Me: "Great! Let me create a wish for this..."
81
- [Create: spells-prioritization-wish.md]
82
- "I've set up groups: Analysis, Automation, Docs, Testing"
83
- [Execute groups]
84
- [Close wish with evidence]
85
- ```
86
-
87
- ### ❌ WRONG: Work Done, Then Wish Created
88
-
89
- ```
90
- User: "I want to analyze and prioritize our 30 spells"
91
- Me: [Works for 2 hours]
92
- [Creates wish AFTER work is done]
93
- ← VIOLATION: Broke Plan → Wish → Forge → Review flow
94
- ```
95
-
96
- ### ✅ CORRECT: Simple Task (No Wish Needed)
97
-
98
- ```
99
- User: "What's the token count for AGENTS.md?"
100
- Me: "Let me check..."
101
- [runs: genie helper count-tokens AGENTS.md]
102
- Me: "5,686 tokens (23KB, 618 lines) using tiktoken cl100k_base encoding"
103
- ← No wish needed: simple informational task
104
- ```
105
-
106
- ## Validation Before Committing
107
-
108
- **Never commit work without verifying:**
109
- - [ ] Wish created (if significant)
110
- - [ ] All execution groups documented
111
- - [ ] Evidence checklist completed
112
- - [ ] Done Report path in wish
113
- - [ ] Lessons learned section filled
114
- - [ ] No framework violations
115
-
116
- **If wish missing on significant work:**
117
- 1. Create wish retroactively (acknowledge violation)
118
- 2. Document why (learning entry)
119
- 3. Invoke learn agent to propagate lesson
120
- 4. Commit with violation note
121
-
122
- ## Example Violation & Fix
123
-
124
- **Violation (2025-10-18):**
125
- - Spells prioritization work executed for 2+ hours
126
- - No wish created at start
127
- - Evidence scattered across session
128
-
129
- **Fix:**
130
- - Created wish: `.genie/wishes/spells-prioritization/spells-prioritization-wish.md`
131
- - Documented all groups and deliverables
132
- - Added lessons learned: Rule #2 violation
133
- - Invoked learn agent → created this spell
134
- - Committed: "feat: document Rule #2 + fix spells prioritization violation"
135
-
136
- ## Anti-Patterns to Avoid
137
-
138
- ❌ **"It's just a quick thing"** → If it touches >2 files, create wish
139
- ❌ **"I'll create the wish after"** → Defeats the purpose (context already lost)
140
- ❌ **"No one will notice"** → Framework depends on this discipline
141
- ❌ **"This is too simple for a wish"** → If ≥2 hours or ≥3 files, document it
142
- ❌ **"I'll remember what we did"** → Session ends, memory lost
143
-
144
- ## Integration with Framework
145
-
146
- **This spell is:**
147
- - **Tier 3 (System Coordination):** Auto-loaded every session
148
- - **Enforced by:** Meta-learn protocol (corrections documented)
149
- - **Verified by:** Review + qa agents
150
- - **Result:** All significant work has formal tracking
151
-
152
- ---
153
-
154
- **Status:** Active behavioral rule (all future work must follow)
155
- **Violation handling:** Retroactive wish + learn agent invocation
156
- **Framework impact:** CRITICAL - enables streamlined Plan → Wish → Forge → Review
157
-
158
- **Remember:** The Genie framework depends on this. Every user request must streamline through the wish system. No exceptions.
@@ -1,410 +0,0 @@
1
- # Rule #6: Wish-Issue Linkage (Behavioral Spell)
2
-
3
- **Created:** 2025-10-20
4
- **Priority:** CRITICAL
5
- **Learn Session:** c873572f-fd95-4ea0-a0c9-cdaed1dda898
6
-
7
- **CRITICAL RULE:** Every wish MUST link to a GitHub issue. No issue → no wish creation.
8
-
9
- ---
10
-
11
- ## The Core Principle
12
-
13
- **Before ANY wish document is created:**
14
- 1. GitHub issue MUST exist
15
- 2. Issue number MUST be validated
16
- 3. Issue link MUST be in wish front-matter
17
-
18
- **No exceptions.** This is mandatory for all wish workflows.
19
-
20
- ---
21
-
22
- ## Why This Rule Exists
23
-
24
- ### Problem it Solves
25
-
26
- **Without issue linkage:**
27
- - ❌ No team visibility (non-Genie users don't know what's planned)
28
- - ❌ No approval checkpoint (work may be rejected after implementation)
29
- - ❌ No audit trail (work history scattered across systems)
30
- - ❌ No search/discovery (GitHub search can't find wishes)
31
- - ❌ No permalink stability (wishes live in .genie/, may move)
32
-
33
- **With issue linkage:**
34
- - ✅ Team visibility (everyone sees what's being worked on)
35
- - ✅ Approval gates (issue discussion before implementation starts)
36
- - ✅ Complete audit trail (issue → wish → forge task → PR → merge)
37
- - ✅ Searchable history (GitHub search finds all work)
38
- - ✅ Stable permalinks (issue #XXX never changes)
39
-
40
- ### Architectural Hierarchy
41
-
42
- ```
43
- GitHub Issue (Public, Permanent)
44
-
45
- Wish Document (Internal Planning)
46
-
47
- Forge Task (Execution Tracking)
48
-
49
- Git Branch + Worktree (Implementation)
50
-
51
- Pull Request (Review + Merge)
52
- ```
53
-
54
- **Each level links to parent:**
55
- - Wish → Issue #XXX
56
- - Forge task → Issue #XXX + Wish path
57
- - Branch → forge/XXXX-kebab-case (derived from task)
58
- - PR → Closes #XXX
59
-
60
- ---
61
-
62
- ## How To Apply This Rule
63
-
64
- ### Step 1: Issue Validation (BEFORE Discovery)
65
-
66
- **When user requests wish creation:**
67
-
68
- ```typescript
69
- // Genie MUST check:
70
- const issueProvided = userInput.includes('#') || userInput.includes('issue');
71
-
72
- if (!issueProvided) {
73
- // Ask user for issue number
74
- await ask("Is there a GitHub issue for this? If yes, provide #XXX. If no, I'll create one.");
75
- }
76
-
77
- // Validate issue exists
78
- const issue = await gh.issue.get(issueNumber);
79
- if (!issue) {
80
- // Route to issue creation workflow
81
- await createIssueFirst();
82
- }
83
- ```
84
-
85
- **BLOCK wish creation until issue confirmed.**
86
-
87
- ### Step 2: Issue Creation (If Missing)
88
-
89
- If no issue exists, route to issue creation:
90
-
91
- ```markdown
92
- **Issue Creation Checklist:**
93
- 1. Ask user: "Should I create GitHub issue first?"
94
- 2. Gather context:
95
- - Title (clear, actionable)
96
- - Description (context ledger summary)
97
- - Labels (wish, enhancement, bug, etc.)
98
- - Acceptance criteria
99
- 3. Create issue via GitHub API:
100
- \`gh issue create --title "..." --body "..." --label wish\`
101
- 4. Extract issue number from response
102
- 5. THEN proceed to wish creation
103
- ```
104
-
105
- ### Step 3: Wish Document Linkage
106
-
107
- Every wish document MUST include issue reference:
108
-
109
- ```markdown
110
- # Wish: <Title>
111
-
112
- **GitHub Issue:** #152 <-- MANDATORY FIELD
113
- **Status:** Discovery
114
- **Created:** !`date -u +"%Y-%m-%d"`
115
- **Forge Task:** (filled after task creation)
116
-
117
- ## Context Ledger
118
-
119
- **Origin:** GitHub Issue #152
120
- **Problem:** [from issue description]
121
- ...
122
- ```
123
-
124
- ### Step 4: Forge Task Linkage
125
-
126
- When creating wish with task:
127
-
128
- ```typescript
129
- await mcp__genie__create_wish({
130
- feature: "MCP Server Authentication",
131
- github_issue: 152 // Issue number required!
132
- });
133
-
134
- // Or run forge task directly:
135
- await mcp__genie__run_forge({
136
- agent: "implementor",
137
- prompt: `
138
- **GitHub Issue:** #152
139
- **Wish Document:** @.genie/wishes/mcp-auth/mcp-auth-wish.md
140
-
141
- [Full wish context from issue]
142
- `
143
- });
144
- ```
145
-
146
- ---
147
-
148
- ## Integration With Existing Workflows
149
-
150
- ### Wish Workflow Enhancement
151
-
152
- **Add Step 0 (NEW) before Discovery:**
153
-
154
- ```markdown
155
- ### Step 0: Issue Validation
156
- **Goal:** Ensure GitHub issue exists before starting wish dance
157
-
158
- **Process:**
159
- 1. Check if user provided issue number
160
- 2. If YES:
161
- - Validate issue exists: \`gh issue view #XXX\`
162
- - Extract context from issue
163
- - Proceed to Step 1 (Discovery)
164
- 3. If NO:
165
- - Ask: "Should I create a GitHub issue first?"
166
- - If user says yes → delegate to issue-creation workflow
167
- - If user says no → BLOCK wish creation, explain rule
168
-
169
- **Delegation:**
170
- \`\`\`
171
- mcp__genie__run with agent="issue-check" prompt="Validate issue #XXX exists"
172
- \`\`\`
173
-
174
- **Output:** Issue number + issue context + "Ready for discovery?"
175
- ```
176
-
177
- ### Blueprint Workflow Enhancement
178
-
179
- **Update wish document template:**
180
-
181
- ```markdown
182
- **Required front-matter fields:**
183
- - GitHub Issue: #XXX <-- MUST be filled
184
- - Forge Task: <task_id> <-- Auto-filled after creation
185
- - Status: Discovery/In-Progress/Review/Done
186
- - Created: !`date`
187
- ```
188
-
189
- ---
190
-
191
- ## Enforcement Mechanism
192
-
193
- ### Pre-Creation Check
194
-
195
- **In wish.md orchestrator:**
196
- ```typescript
197
- // BEFORE starting wish dance
198
- async function validateIssueExists(userRequest: string): Promise<IssueValidation> {
199
- const issueMatch = userRequest.match(/#(\d+)/);
200
-
201
- if (!issueMatch) {
202
- return {
203
- valid: false,
204
- reason: "No issue number provided",
205
- action: "prompt_user_for_issue"
206
- };
207
- }
208
-
209
- const issueNumber = issueMatch[1];
210
- const issue = await gh.issue.get(issueNumber);
211
-
212
- if (!issue) {
213
- return {
214
- valid: false,
215
- reason: `Issue #${issueNumber} does not exist`,
216
- action: "create_issue_first"
217
- };
218
- }
219
-
220
- return {
221
- valid: true,
222
- issue: issue,
223
- issueNumber: issueNumber
224
- };
225
- }
226
- ```
227
-
228
- ### Post-Creation Validation
229
-
230
- **In review.md agent:**
231
- ```typescript
232
- // Validate wish document has issue link
233
- async function validateWishDocument(wishPath: string): Promise<boolean> {
234
- const content = await fs.readFile(wishPath, 'utf-8');
235
- const hasIssueLink = /\*\*GitHub Issue:\*\* #\d+/.test(content);
236
-
237
- if (!hasIssueLink) {
238
- throw new Error(`Wish ${wishPath} missing GitHub issue link! Rule #6 violation.`);
239
- }
240
-
241
- return true;
242
- }
243
- ```
244
-
245
- ---
246
-
247
- ## Examples
248
-
249
- ### ✅ CORRECT: Issue First, Then Wish
250
-
251
- ```
252
- User: "I want to add MCP authentication"
253
-
254
- Genie: "Great idea! Is there a GitHub issue for this?"
255
- User: "Yes, #152"
256
-
257
- Genie: [Validates #152 exists]
258
- Genie: "Perfect! Issue #152 confirmed. Let's start the wish dance..."
259
- [Creates wish with GitHub Issue: #152]
260
- [Links Forge task to #152]
261
- ```
262
-
263
- ### ✅ CORRECT: Create Issue First
264
-
265
- ```
266
- User: "I want to unify the naming taxonomy"
267
-
268
- Genie: "Excellent! I don't see a GitHub issue for this. Should I create one first?"
269
- User: "Yes please"
270
-
271
- Genie: [Creates issue #155 via gh CLI]
272
- Genie: "Issue #155 created! Now let's create the wish..."
273
- [Creates wish with GitHub Issue: #155]
274
- ```
275
-
276
- ### ❌ WRONG: Wish Without Issue
277
-
278
- ```
279
- User: "Create a wish for voice agent transformation"
280
-
281
- Genie: [Creates wish document immediately] <-- VIOLATION!
282
- Genie: [No issue link in wish] <-- VIOLATION!
283
-
284
- ← This breaks Rule #6. MUST validate/create issue FIRST.
285
- ```
286
-
287
- ---
288
-
289
- ## Spell Metadata
290
-
291
- **Spell Type:** Behavioral (Tier 6 - Workflow & State Management)
292
- **Auto-loaded:** YES (every session)
293
- **Enforced by:** wish.md orchestrator, review.md validator
294
- **Violation handling:** BLOCK wish creation, route to issue-creation
295
- **Related spells:**
296
- - Rule #2: Wish Initiation (`@.genie/spells/wish-initiation.md`)
297
- - Wish Document Management (`@.genie/spells/wish-lifecycle.md`)
298
- - Persistent Tracking Protocol (`@.genie/spells/track-long-running-tasks.md`)
299
-
300
- ---
301
-
302
- ## Anti-Patterns To Avoid
303
-
304
- ❌ **"The issue is implied"** → No. Explicit link required.
305
- ❌ **"I'll create issue after wish"** → No. Issue FIRST, always.
306
- ❌ **"This is internal work, no issue needed"** → No. All wishes need issues.
307
- ❌ **"Issue creation slows me down"** → Good. Approval gate is intentional.
308
- ❌ **"I forgot to link the issue"** → Fix immediately (retroactive linking).
309
-
310
- ---
311
-
312
- ## Retroactive Fixes
313
-
314
- **If wish exists without issue:**
315
- 1. Create GitHub issue immediately
316
- 2. Update wish document with issue #
317
- 3. Update Forge task title/description with issue #
318
- 4. Add violation note to learn session
319
- 5. Document in meta-learn protocol
320
-
321
- **Example:**
322
- ```bash
323
- # Create missing issue
324
- gh issue create --title "Wish: Voice Agent Transformation" \
325
- --body "$(cat .genie/wishes/voice-agent/voice-agent-wish.md)" \
326
- --label wish
327
-
328
- # Extract issue number
329
- ISSUE_NUM=$(gh issue list --limit 1 --json number --jq '.[0].number')
330
-
331
- # Update wish document
332
- sed -i "s/\*\*GitHub Issue:\*\* TBD/**GitHub Issue:** #$ISSUE_NUM/" \
333
- .genie/wishes/voice-agent/voice-agent-wish.md
334
-
335
- # Document violation
336
- echo "Rule #6 violation: Retroactively linked issue #$ISSUE_NUM" >> \
337
- .genie/reports/learn-wish-issue-amendment-20251020.md
338
- ```
339
-
340
- ---
341
-
342
- ## MCP Integration
343
-
344
- ### Genie Spell Execution Pattern
345
-
346
- **Goal:** Genie MCP executes spells dynamically (lighter base prompts)
347
-
348
- **How this works:**
349
- 1. Base Genie prompt = thin orchestrator
350
- 2. Spells loaded as @ references (not full content in base prompt)
351
- 3. When wish requested → Genie dynamically loads wish-issue-linkage-rule.md
352
- 4. Spell execution = read file, apply rules, validate
353
-
354
- **Benefits:**
355
- - Lighter base prompts (token efficiency)
356
- - Spells updated independently (no base prompt changes)
357
- - Clear separation of concerns (orchestration vs execution)
358
-
359
- **Implementation:**
360
- ```typescript
361
- // In wish.md orchestrator
362
- async function ensureIssueExists(userRequest: string) {
363
- // Load spell dynamically
364
- const spell = await loadSkill('@.genie/spells/wish-issue-linkage.md');
365
-
366
- // Execute spell logic
367
- const validation = await spell.validateIssue(userRequest);
368
-
369
- if (!validation.valid) {
370
- // Route to issue creation
371
- return await spell.createIssueFirst(userRequest);
372
- }
373
-
374
- return validation.issueNumber;
375
- }
376
- ```
377
-
378
- ---
379
-
380
- ## Summary
381
-
382
- **Rule #6 in one sentence:**
383
- > No GitHub issue = no wish creation. Issue first, always.
384
-
385
- **Why it matters:**
386
- - Team visibility (public tracking)
387
- - Approval gates (discussion before work)
388
- - Audit trail (complete history)
389
- - Search/discovery (GitHub search works)
390
- - Permalink stability (issue # never changes)
391
-
392
- **How to follow:**
393
- 1. Check if issue exists
394
- 2. If not → create issue first
395
- 3. Link issue # in wish front-matter
396
- 4. Link issue # in Forge task
397
- 5. Close issue when PR merges
398
-
399
- **Enforcement:**
400
- - wish.md blocks creation without issue
401
- - review.md validates issue link exists
402
- - Meta-learn tracks violations
403
-
404
- ---
405
-
406
- **Status:** Active behavioral rule (all future wishes must follow)
407
- **Violation handling:** BLOCK + route to issue creation
408
- **Framework impact:** CRITICAL - enables public visibility + audit trail
409
-
410
- **Remember:** GitHub is source of truth. Wishes are implementation plans. Forge tasks are execution. All three MUST link together.
@@ -1,100 +0,0 @@
1
- ---
2
- name: Wish Document Management
3
- description: Keep wishes as living blueprints with orchestration strategy and evidence
4
- ---
5
-
6
- # Wish Document Management
7
-
8
- **Purpose:** Wish documents are living blueprints; maintain clarity from inception to closure.
9
-
10
- ## Success Criteria
11
-
12
- ✅ Wish contains orchestration strategy, agent assignments, evidence log.
13
- ✅ Done Report references appended with final summary + remaining risks.
14
- ✅ No duplicate wish documents created.
15
-
16
- ## Multi-Stage Investigation Pattern (RECOMMENDED)
17
-
18
- **Pattern:** Investigation → Pre-Wish → Wish Creation
19
-
20
- **When to use:** Complex features requiring architectural decisions, risk assessment, or significant implementation effort.
21
-
22
- **Benefits:**
23
- - Surface all risks, benefits, and trade-offs BEFORE committing to implementation
24
- - Pre-wish summary provides TL;DR + decision matrix for stakeholder buy-in
25
- - Wish document becomes comprehensive single source of truth
26
- - Learn task tracks knowledge gained throughout investigation
27
-
28
- ### Phase 1: Investigation
29
- **Objective:** Deep analysis and proof-of-concept validation
30
-
31
- **Deliverables:**
32
- - Multiple investigation reports (API validation, comparisons, strategies, test plans)
33
- - Proof-of-concept implementation (if applicable)
34
- - Risk assessment and trade-off analysis
35
- - Technical feasibility validation
36
-
37
- **Example (Issue #120):**
38
- - 7 investigation reports (~5,000 lines total)
39
- - POC: forge-executor.ts (300 lines, working implementation)
40
- - Risk/benefit analysis across multiple dimensions
41
-
42
- ### Phase 2: Pre-Wish Summary
43
- **Objective:** Decision-making checkpoint with stakeholder visibility
44
-
45
- **Deliverables:**
46
- - TL;DR executive summary (2-3 paragraphs)
47
- - Decision matrix (pros/cons/risks/benefits)
48
- - Go/No-Go recommendation with confidence score
49
- - Resource requirements and timeline estimate
50
-
51
- **Decision Matrix Elements:**
52
- - Ease analysis: How difficult is the change?
53
- - Replacement mapping: What gets deleted, what gets added?
54
- - Risk assessment: What could go wrong?
55
- - Benefit quantification: What improves and by how much?
56
-
57
- ### Phase 3: Wish Creation
58
- **Objective:** Comprehensive implementation blueprint
59
-
60
- **Deliverables:**
61
- - Complete wish document with multiple implementation groups
62
- - Phased rollout strategy (Group A → B → C → D)
63
- - Timeline with milestones
64
- - Success criteria and validation checkpoints
65
-
66
- **Example Structure (Issue #120):**
67
- - 4 implementation groups (A: Core, B: Streaming, C: Advanced, D: Testing)
68
- - 4-week timeline with phased rollout
69
- - Clear success metrics per group
70
-
71
- ## Evidence Tracking
72
-
73
- **During Investigation:**
74
- - Document all findings in `.genie/reports/` with descriptive names
75
- - Track investigation progress in learning task (Forge)
76
- - Update pre-wish summary as understanding evolves
77
-
78
- **During Wish Creation:**
79
- - Reference investigation reports in wish document
80
- - Include decision rationale with evidence pointers
81
- - Document assumptions and risks with supporting evidence
82
-
83
- **After Implementation:**
84
- - Append Done Report to wish with final outcomes
85
- - Document deviations from plan with justification
86
- - Record lessons learned for future similar wishes
87
-
88
- ## Anti-Patterns
89
-
90
- ❌ **Jumping to Wish without investigation:** Creates incomplete requirements, missed risks
91
- ❌ **Investigation without decision checkpoint:** Wastes effort on exploratory work without commitment
92
- ❌ **Wish creation without stakeholder buy-in:** Implementation starts without alignment
93
- ❌ **No evidence tracking:** Decisions lack justification, can't validate assumptions later
94
-
95
- ## Evidence
96
-
97
- **Pattern discovered:** Issue #120 investigation → wish creation flow (2025-10-18 09:00-13:15 UTC)
98
- - Learn task session tracked entire investigation process
99
- - Pre-wish summary enabled quick decision (9.2/10 - STRONG YES)
100
- - Comprehensive wish enabled focused implementation planning
@@ -1,3 +0,0 @@
1
- {
2
- "entries": []
3
- }
@@ -1,16 +0,0 @@
1
- {
2
- "version": "2.5.27-rc.4",
3
- "installedAt": "2025-11-23T13:42:06.789Z",
4
- "updatedAt": "2025-11-23T13:42:06.789Z",
5
- "commit": "98eb883",
6
- "packageName": "automagik-genie",
7
- "customizedFiles": [],
8
- "deletedFiles": [],
9
- "lastUpgrade": null,
10
- "previousVersion": null,
11
- "upgradeHistory": [],
12
- "migrationInfo": {
13
- "backupId": "n/a",
14
- "claudeBackedUp": false
15
- }
16
- }