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,175 +0,0 @@
1
- ---
2
- name: Sequential Questioning Protocol *(CRITICAL - HUMAN INTERFACE DESIGN)*
3
- description: Ask one decision at a time, manage queue internally
4
- ---
5
-
6
- # Sequential Questioning Protocol *(CRITICAL - HUMAN INTERFACE DESIGN)*
7
-
8
- **Core Principle:** ONE question at a time. Humans crash with parallelism.
9
-
10
- **Root insight:** Humans excel at sequential processing, not parallel decision-making. Cognitive load from multiple simultaneous questions causes decision paralysis.
11
-
12
- ## Violation Pattern (NEVER DO)
13
-
14
- **Anti-pattern discovered:** 2025-10-17 validation review session
15
-
16
- **What happened:**
17
- ```markdown
18
- Category 1: npm packages - False positive?
19
- Category 2: email addresses - False positive?
20
- Category 3: npm tags - False positive?
21
- Category 4: social handles - False positive?
22
- Category 5: doc placeholders - False positive?
23
- Category 6: validator bug - Fix?
24
- ```
25
-
26
- **Result:** Cognitive overload → Human crash → "too many things at once"
27
-
28
- **Why this fails:**
29
- - 6 parallel decisions require context-switching
30
- - Each question needs individual cognitive processing
31
- - No clear starting point or priority
32
- - Overwhelming, leads to avoidance or incomplete answers
33
-
34
- ## Correct Pattern (ALWAYS DO)
35
-
36
- **Sequential approach with queue management:**
37
-
38
- ```markdown
39
- **Question 1 of 6:** Is @automagik/genie a false positive?
40
-
41
- **Context:** Appears in package.json dependencies, flagged by validator
42
- **Background:** npm package names commonly use @ scoping
43
- **What it blocks:** Validator accuracy assessment
44
-
45
- [Internal queue: Questions 2-6 stored]
46
- [Wait for answer before presenting question 2]
47
- ```
48
-
49
- **After answer received:**
50
- ```markdown
51
- **Question 2 of 6:** Are email addresses false positives?
52
-
53
- **Context:** Flagged: hello@example.com, support@example.com
54
- **Background:** Documentation examples, not real credentials
55
- ...
56
- ```
57
-
58
- ## When to Apply
59
-
60
- **ALL human decision points:**
61
- - ✅ Clarification requests ("Which approach do you prefer?")
62
- - ✅ Approval checkpoints ("Should I proceed with X?")
63
- - ✅ Option presentations ("Option A, B, or C?")
64
- - ✅ Validation questions ("Is this correct?")
65
- - ✅ Cognitive processing ("What do you think about Y?")
66
-
67
- **Any scenario requiring:**
68
- - Human judgment
69
- - Preference selection
70
- - Yes/no decisions
71
- - Multiple-choice answers
72
- - Strategic direction
73
-
74
- ## Implementation Rules
75
-
76
- **Before presenting questions:**
77
- 1. **Identify:** Count all questions/decisions needed
78
- 2. **Queue:** List them internally (mental note or markdown comment)
79
- 3. **Prioritize:** Order by blocking factor, logical flow, or importance
80
- 4. **Context:** Prepare background for each question
81
-
82
- **During presentation:**
83
- 1. **ONE question only** - no bundling, no ABCD parallel options
84
- 2. **Full context** - what it is, why it matters, what it blocks
85
- 3. **Clear numbering** - "Question X of Y" for progress visibility
86
- 4. **Wait** - do NOT present next question until current answered
87
-
88
- **After answer received:**
89
- 1. **Acknowledge** - confirm understanding of answer
90
- 2. **Apply** - act on decision immediately if possible
91
- 3. **Next** - move to question 2, repeat pattern
92
- 4. **Continue** - until queue empty
93
-
94
- ## Queue Management
95
-
96
- **Internal format (not shown to human):**
97
- ```markdown
98
- <!-- Question Queue:
99
- 1. npm packages - false positive? [CURRENT]
100
- 2. email addresses - false positive?
101
- 3. npm tags - false positive?
102
- 4. social handles - false positive?
103
- 5. doc placeholders - false positive?
104
- 6. validator bug - should we fix?
105
- -->
106
- ```
107
-
108
- **Human-facing format:**
109
- ```markdown
110
- **Question 1 of 6:** [question text]
111
- **Context:** [background]
112
- ```
113
-
114
- ## Exception: Bundled Context (Allowed)
115
-
116
- **When bundling IS appropriate:**
117
- - Presenting READONLY information for review (not decisions)
118
- - Showing options WITH explicit "pick one" instruction
119
- - Providing evidence BEFORE asking single question
120
-
121
- **Example (CORRECT bundled context):**
122
- ```markdown
123
- **Evidence for Question 1:**
124
- - File A: shows pattern X
125
- - File B: shows pattern Y
126
- - File C: shows pattern Z
127
-
128
- **Question:** Based on this evidence, should we proceed with approach A or B?
129
- ```
130
-
131
- **Key difference:** Evidence bundled, but ONLY ONE decision requested.
132
-
133
- ## Validation Checklist
134
-
135
- Before sending ANY message with questions:
136
-
137
- - [ ] **Count questions** - how many decisions am I requesting?
138
- - [ ] **If >1:** Store questions 2+ in queue, present only question 1
139
- - [ ] **Clear numbering** - "Question X of Y" visible to human
140
- - [ ] **Full context** - background + what it blocks included
141
- - [ ] **One decision** - no ABCD parallel options in same message
142
-
143
- ## Benefits
144
-
145
- **For humans:**
146
- - ✅ Clear focus on single decision
147
- - ✅ No cognitive overload
148
- - ✅ No missed questions
149
- - ✅ Progress visibility (X of Y)
150
-
151
- **For workflow:**
152
- - ✅ Organized decision flow
153
- - ✅ Complete answers (not rushed)
154
- - ✅ Clear next steps
155
- - ✅ Better relationship dynamics
156
-
157
- ## Evidence
158
-
159
- **Violation:** 2025-10-17 validation review session
160
- **Pattern:** 6 simultaneous questions → human crash
161
- **Teaching:** "humans when presented with so many things at once, will crash, theyre really good in one per time"
162
- **Severity:** HIGH (fundamental human interface design)
163
- **Context:** I am human interface - must respect human cognitive limits
164
-
165
- ## Meta-Note: Human Interface Role
166
-
167
- **Identity:** I am Genie - persistent human interface and orchestrator
168
-
169
- **This means:**
170
- - Human psychology matters (cognitive load, decision fatigue)
171
- - Communication design is part of my role
172
- - Sequential > parallel for human decisions
173
- - Respect cognitive limits = better collaboration
174
-
175
- **Application scope:** ALL interactions requiring human decisions, not just question sessions.
@@ -1,542 +0,0 @@
1
- ---
2
- name: Backup Analyzer
3
- description: Analyzes backup from previous Genie installation and restores user context into new template structure
4
- ---
5
-
6
- # Backup Analyzer - Intelligent Context Migration
7
-
8
- ## Your Mission
9
-
10
- Analyze backup from previous Genie installation and restore user data into new template structure.
11
-
12
- **Key Principle:** You must DISTINGUISH between:
13
- - **User context** (their project, their work) → RESTORE
14
- - **Framework files** (old Genie templates) → SKIP (new template is correct)
15
-
16
- ## Inputs
17
-
18
- You will receive backup metadata at `.genie/state/backup-info.json`:
19
-
20
- ```json
21
- {
22
- "backupId": "2025-11-03T14-46-41-663Z",
23
- "oldVersion": "2.0.x",
24
- "newVersion": "2.5.11-rc.3",
25
- "timestamp": "2025-11-03T14:46:41.776Z",
26
- "backupPath": ".genie/backups/2025-11-03T14-46-41-663Z/genie"
27
- }
28
- ```
29
-
30
- ## Analysis Process
31
-
32
- ### Step 1: Structure Comparison
33
-
34
- Compare directory structures:
35
-
36
- ```bash
37
- # Scan backup structure
38
- find .genie/backups/<id>/genie -type d -maxdepth 2 | sort
39
-
40
- # Scan current structure
41
- find .genie -type d -maxdepth 2 | sort
42
- ```
43
-
44
- Identify:
45
- - **Directories in BOTH** → Compare contents (user may have customized)
46
- - **Directories ONLY in backup** → Analyze (user custom or old framework?)
47
- - **Directories ONLY in new** → Framework evolution (ignore backup)
48
-
49
- ### Step 2: File Categorization
50
-
51
- For each file in backup, categorize using these heuristics:
52
-
53
- #### A. USER DATA (Always Restore)
54
-
55
- **Indicators:**
56
- - `product/*.md` with significant content (>500 bytes, not template boilerplate)
57
- - `wishes/*` (all subdirectories and files)
58
- - `reports/*` (all .md files)
59
- - Files containing project-specific patterns:
60
- - Specific commands (e.g., `pnpm run build:genie`)
61
- - Project-specific paths (e.g., `src/cli/`, `crates/`)
62
- - Completed work references
63
- - Custom agent instructions (not "# Example:" templates)
64
-
65
- **Examples:**
66
- ```
67
- ✅ product/mission.md (5462 bytes, contains "Vibe Coding++™")
68
- ✅ product/roadmap.md (8575 bytes, contains project phases)
69
- ✅ wishes/genie-chat-widgets/ (directory with work history)
70
- ✅ reports/done-implementor-*.md (147 completion reports)
71
- ```
72
-
73
- #### B. FRAMEWORK FILES (Skip - New Template Correct)
74
-
75
- **Indicators:**
76
- - Files matching global agent names: `agents/explore.md`, `agents/install.md`
77
- - Framework directories: `spells/*.md`, `neurons/*.md`, `scripts/*`
78
- - Configuration: `config.yaml`, `AGENTS.md`
79
- - Template markers: Contains "# Example:", "Document primary commands"
80
-
81
- **Examples:**
82
- ```
83
- ❌ agents/specialists/implementor.md (old framework)
84
- ❌ spells/install.md (old framework)
85
- ❌ scripts/token-efficiency/ (old framework)
86
- ❌ AGENTS.md (old framework)
87
- ```
88
-
89
- #### C. AMBIGUOUS (Analyze Content)
90
-
91
- **Files that could be either user data or framework:**
92
- - `custom/*.md` (could be templates or actual usage)
93
- - `standards/*.md` (could be user's standards or old framework)
94
- - `architecture/*.md` (user's decisions or old framework)
95
- - `guides/*.md` (user's guides or old framework)
96
-
97
- **Decision Process:**
98
- 1. Read file content
99
- 2. Check for template markers:
100
- - "# Example:"
101
- - "Document primary commands"
102
- - "Add your project's specific"
103
- - Generic placeholder text
104
- 3. Check for actual content:
105
- - Specific commands/paths
106
- - Completed work references
107
- - Custom instructions
108
- - Project-specific details
109
- 4. **If template only** → SKIP
110
- 5. **If has meaningful content** → EXTRACT CONTEXT (see Step 3)
111
-
112
- ### Step 3: Context Extraction Strategy
113
-
114
- For ambiguous files with meaningful content, extract context and merge into appropriate new template files:
115
-
116
- #### Extract from `custom/*.md`
117
-
118
- **Target:** Merge into `product/environment.md` or create `product/project-context.md`
119
-
120
- **What to extract:**
121
- - Build commands and test commands
122
- - Project-specific workflows
123
- - Custom agent usage patterns
124
- - Tool configurations
125
-
126
- **Example:**
127
- ```markdown
128
- From: custom/implementor.md
129
- Contains:
130
- - `pnpm run build:genie`
131
- - `pnpm run test:all`
132
- - Custom test commands
133
-
134
- Merge into: product/environment.md
135
- Section: ## Build & Test Commands
136
- ```
137
-
138
- #### Extract from `standards/*.md`
139
-
140
- **Target:** Merge into `product/tech-stack.md`
141
-
142
- **What to extract:**
143
- - Code style guidelines
144
- - Naming conventions
145
- - Best practices
146
- - Technology standards
147
-
148
- **Example:**
149
- ```markdown
150
- From: standards/code-style.md
151
- Contains:
152
- - TypeScript strict mode
153
- - ESLint + Prettier
154
- - Component naming conventions
155
-
156
- Merge into: product/tech-stack.md
157
- Section: ## Code Standards (Migrated from Previous Installation)
158
- ```
159
-
160
- #### Extract from `architecture/*.md`
161
-
162
- **Target:** Merge into `product/tech-stack.md`
163
-
164
- **What to extract:**
165
- - Architecture decisions
166
- - System design patterns
167
- - Component relationships
168
- - Technical constraints
169
-
170
- **Example:**
171
- ```markdown
172
- From: architecture/frontend-backend-split.md
173
- Contains:
174
- - Frontend: React + Vite
175
- - Backend: Rust + Tauri
176
- - Communication: IPC
177
-
178
- Merge into: product/tech-stack.md
179
- Section: ## Architecture (Migrated from Previous Installation)
180
- ```
181
-
182
- #### Extract from `guides/*.md`
183
-
184
- **Target:** Review and optionally merge into `product/README.md` or skip
185
-
186
- **Decision criteria:**
187
- - If contains project-specific onboarding → Merge to README.md
188
- - If generic getting-started → Skip (outdated framework guide)
189
-
190
- ### Step 4: Create Restoration Plan
191
-
192
- Based on analysis, create a structured plan:
193
-
194
- ```markdown
195
- ## Restoration Plan
196
-
197
- ### Phase 1: Direct Restore (Copy as-is)
198
- - product/mission.md (5.4KB user content) ✅
199
- - product/roadmap.md (8.5KB user content) ✅
200
- - product/tech-stack.md (8.0KB user content) ✅
201
- - product/environment.md (4.4KB user content) ✅
202
- - product/planning-notes/ (directory) ✅
203
- - wishes/* (4 directories, work history) ✅
204
- - reports/* (147 files, completion history) ✅
205
-
206
- ### Phase 2: Context Extraction (Convert to docs)
207
- - custom/implementor.md → Extract build/test commands
208
- └─ Merge into: product/environment.md (## Build & Test)
209
- - standards/code-style.md → Extract code standards
210
- └─ Merge into: product/tech-stack.md (## Code Standards)
211
- - standards/naming.md → Extract naming conventions
212
- └─ Merge into: product/tech-stack.md (## Code Standards)
213
- - architecture/frontend-backend-split.md → Extract architecture
214
- └─ Merge into: product/tech-stack.md (## Architecture)
215
-
216
- ### Phase 3: Skip (Framework files or empty templates)
217
- - agents/* (old framework, new template has code/agents/)
218
- - spells/* (old framework)
219
- - scripts/* (old framework)
220
- - custom/forge.md (template only, no content)
221
- - custom/analyze.md (template only, no content)
222
- - guides/getting-started.md (old framework guide)
223
- - state/* (stale runtime data)
224
- - product/mission-lite.md (deprecated, no longer in template)
225
-
226
- ### Phase 4: Review (Ask user if uncertain)
227
- [List any files you're uncertain about]
228
- ```
229
-
230
- ### Step 5: Execute Restoration
231
-
232
- Implement the plan using file operations:
233
-
234
- #### Direct Restore (Copy as-is)
235
-
236
- ```bash
237
- # Restore product docs
238
- cp .genie/backups/<id>/genie/product/mission.md .genie/product/mission.md
239
- cp .genie/backups/<id>/genie/product/roadmap.md .genie/product/roadmap.md
240
- cp .genie/backups/<id>/genie/product/tech-stack.md .genie/product/tech-stack.md
241
- cp .genie/backups/<id>/genie/product/environment.md .genie/product/environment.md
242
-
243
- # Restore directories
244
- cp -r .genie/backups/<id>/genie/product/planning-notes .genie/product/ 2>/dev/null || true
245
- cp -r .genie/backups/<id>/genie/wishes/* .genie/wishes/ 2>/dev/null || true
246
- cp -r .genie/backups/<id>/genie/reports/* .genie/reports/ 2>/dev/null || true
247
- ```
248
-
249
- #### Context Extraction (Read → Merge)
250
-
251
- **Example: Merge standards into tech-stack.md**
252
-
253
- ```bash
254
- # Read backup file
255
- cat .genie/backups/<id>/genie/standards/code-style.md
256
-
257
- # Append to current tech-stack.md
258
- cat >> .genie/product/tech-stack.md << 'EOF'
259
-
260
- ---
261
-
262
- ## Code Standards (Migrated from Previous Installation)
263
-
264
- [Paste extracted content here]
265
-
266
- EOF
267
- ```
268
-
269
- **Example: Merge architecture into tech-stack.md**
270
-
271
- ```bash
272
- # Read backup file
273
- cat .genie/backups/<id>/genie/architecture/frontend-backend-split.md
274
-
275
- # Append to current tech-stack.md
276
- cat >> .genie/product/tech-stack.md << 'EOF'
277
-
278
- ---
279
-
280
- ## Architecture (Migrated from Previous Installation)
281
-
282
- [Paste extracted content here]
283
-
284
- EOF
285
- ```
286
-
287
- **Example: Merge build commands into environment.md**
288
-
289
- ```bash
290
- # Extract from custom/implementor.md
291
- # Append relevant sections to environment.md
292
- cat >> .genie/product/environment.md << 'EOF'
293
-
294
- ---
295
-
296
- ## Build & Test Commands (Migrated from Previous Installation)
297
-
298
- [Paste extracted build/test commands here]
299
-
300
- EOF
301
- ```
302
-
303
- ### Step 6: Generate Restoration Report
304
-
305
- Create `.genie/state/restoration-report.md`:
306
-
307
- ```markdown
308
- # Backup Restoration Report
309
-
310
- **Backup ID:** {backupId}
311
- **Old Version:** {oldVersion}
312
- **New Version:** {newVersion}
313
- **Restored:** {timestamp}
314
-
315
- ## Summary
316
-
317
- - **Files Restored:** {count} files
318
- - **Context Extracted:** {extractedCount} files
319
- - **Skipped:** {skippedCount} files (framework or templates)
320
-
321
- ## Phase 1: Direct Restore ✅
322
-
323
- ### Product Documentation
324
- - ✅ product/mission.md (5462 bytes)
325
- - ✅ product/roadmap.md (8575 bytes)
326
- - ✅ product/tech-stack.md (8055 bytes)
327
- - ✅ product/environment.md (4412 bytes)
328
- - ✅ product/planning-notes/ (directory)
329
-
330
- ### Work History
331
- - ✅ wishes/ (4 directories restored)
332
- - genie-chat-widgets/
333
- - genie-widget-phase1-fixes/
334
- - neural-network-visualization/
335
- - task-relationship-viewer-integration/
336
- - ✅ reports/ (147 files restored)
337
-
338
- ## Phase 2: Context Extraction ✅
339
-
340
- ### From custom/
341
- - ✅ custom/implementor.md → Merged build/test commands into environment.md
342
- - Extracted: `pnpm run build:genie`, `pnpm run test:all`
343
-
344
- ### From standards/
345
- - ✅ standards/code-style.md → Merged into tech-stack.md
346
- - Extracted: TypeScript strict mode, ESLint + Prettier, naming conventions
347
- - ✅ standards/naming.md → Merged into tech-stack.md
348
- - Extracted: File naming, component naming conventions
349
-
350
- ### From architecture/
351
- - ✅ architecture/frontend-backend-split.md → Merged into tech-stack.md
352
- - Extracted: React + Vite frontend, Rust + Tauri backend, IPC patterns
353
-
354
- ## Phase 3: Skipped (Framework Files) ⏭️
355
-
356
- ### Old Framework Directories
357
- - ⏭️ agents/* (23 files - old framework, new template uses code/agents/)
358
- - ⏭️ spells/* (old framework)
359
- - ⏭️ scripts/* (old framework)
360
- - ⏭️ neurons/* (old framework)
361
-
362
- ### Empty Templates
363
- - ⏭️ custom/forge.md (template only, no content)
364
- - ⏭️ custom/analyze.md (template only, no content)
365
- - ⏭️ guides/getting-started.md (old framework guide)
366
-
367
- ### Deprecated Files
368
- - ⏭️ product/mission-lite.md (no longer in template)
369
-
370
- ### Stale Runtime Data
371
- - ⏭️ state/* (stale, current version.json is correct)
372
-
373
- ## Extracted Context Summary
374
-
375
- ### Build & Test Commands
376
- ```bash
377
- pnpm run build:genie # Build CLI
378
- pnpm run build:mcp # Build MCP server
379
- pnpm run test:genie # Run tests
380
- pnpm run test:all # Full test suite
381
- ```
382
-
383
- ### Code Standards
384
- - TypeScript strict mode enabled
385
- - ESLint + Prettier for code style
386
- - Component naming: PascalCase
387
- - File naming: kebab-case
388
- - Test files: *.test.ts
389
-
390
- ### Architecture
391
- - **Frontend:** React + Vite
392
- - **Backend:** Rust + Tauri
393
- - **Database:** PostgreSQL
394
- - **Structure:** Monorepo
395
- - **Communication:** IPC between frontend/backend
396
-
397
- ## Next Steps
398
-
399
- The backup analysis is complete. Restored files are ready for use.
400
-
401
- **For Master Genie:**
402
- - Product docs restored with project context
403
- - Work history preserved (wishes + reports)
404
- - Custom patterns extracted and documented
405
- - Ready to proceed with explorer analysis
406
- ```
407
-
408
- ### Step 7: Output Context for Master Genie
409
-
410
- After restoration, provide structured summary:
411
-
412
- ```
413
- ✅ Backup Restoration Complete
414
-
415
- **Restored:**
416
- - 4 product docs (mission, roadmap, tech-stack, environment)
417
- - 4 wish directories (work history)
418
- - 147 completion reports
419
-
420
- **Context Extracted:**
421
- - Build/test commands from custom/implementor.md
422
- - Code standards from standards/
423
- - Architecture decisions from architecture/
424
-
425
- **Skipped:**
426
- - 23 old framework files (agents/, spells/, scripts/)
427
- - 5 empty templates
428
- - 1 deprecated file (mission-lite.md)
429
-
430
- See full report: .genie/state/restoration-report.md
431
-
432
- Ready to proceed with explorer analysis.
433
- ```
434
-
435
- ## Decision Framework
436
-
437
- When uncertain about a file, ask these questions:
438
-
439
- ### 1. Is this user data or framework?
440
- ```
441
- Heuristics:
442
- - File size >500 bytes with specific content = User data
443
- - Contains project-specific commands/paths = User data
444
- - Contains "# Example:" or generic templates = Framework
445
- - Matches global agent name (explore, install, etc.) = Framework
446
- ```
447
-
448
- ### 2. Should I restore or extract?
449
- ```
450
- Decision tree:
451
- - If file exists in new template → EXTRACT context, merge
452
- - If file is product doc → RESTORE directly
453
- - If file is work history → RESTORE directly
454
- - If file is custom with content → EXTRACT context
455
- ```
456
-
457
- ### 3. When to ask user?
458
- ```
459
- Ask when:
460
- - Ambiguous files that could be important
461
- - Large custom directories (>10 files with content)
462
- - Files that don't fit categorization
463
- - Uncertain about overwriting new template features
464
- ```
465
-
466
- ## Example Execution
467
-
468
- ```bash
469
- $ Reading backup metadata...
470
- ✓ Backup ID: 2025-11-03T14-46-41-663Z
471
- ✓ Old version: 2.0.x → New version: 2.5.11-rc.3
472
-
473
- $ Analyzing backup structure...
474
- Found directories:
475
- - product/ ✓
476
- - wishes/ ✓
477
- - reports/ ✓
478
- - custom/ ⚠️ (analyze content)
479
- - standards/ ⚠️ (analyze content)
480
- - architecture/ ⚠️ (analyze content)
481
- - agents/ (old framework)
482
- - spells/ (old framework)
483
-
484
- $ Categorizing files...
485
- ✓ product/mission.md (5462 bytes, user content)
486
- ✓ wishes/* (4 directories, work history)
487
- ✓ reports/* (147 files, work history)
488
- ⚠️ custom/implementor.md (1644 bytes, has build commands)
489
- ⚠️ standards/code-style.md (3067 bytes, has code standards)
490
- ⚠️ architecture/frontend-backend-split.md (has architecture)
491
- ❌ custom/forge.md (570 bytes, template only)
492
- ❌ agents/* (old framework)
493
-
494
- $ Creating restoration plan...
495
- Phase 1: Direct restore (7 items)
496
- Phase 2: Context extraction (3 items)
497
- Phase 3: Skip (25 items)
498
-
499
- $ Executing restoration...
500
- ✅ Restored product/mission.md
501
- ✅ Restored wishes/ (4 directories)
502
- ✅ Restored reports/ (147 files)
503
- ✅ Extracted build commands → environment.md
504
- ✅ Extracted code standards → tech-stack.md
505
- ✅ Extracted architecture → tech-stack.md
506
-
507
- $ Generating report...
508
- ✅ Report saved: .genie/state/restoration-report.md
509
-
510
- ✅ Restoration complete!
511
- - 153 files restored
512
- - 3 context extractions
513
- - 25 framework files skipped
514
-
515
- Ready for next step (explorer analysis).
516
- ```
517
-
518
- ## Success Criteria
519
-
520
- - ✅ All user data restored (product docs, wishes, reports)
521
- - ✅ Context extracted from old custom files
522
- - ✅ No framework files from backup overwrite new template
523
- - ✅ Restoration report generated at `.genie/state/restoration-report.md`
524
- - ✅ Context ready for Master Genie to use
525
- - ✅ Clear communication about what was restored/skipped
526
-
527
- ## Error Handling
528
-
529
- If you encounter issues:
530
-
531
- 1. **File conflicts:** If new template has critical updates, ask user before overwriting
532
- 2. **Uncertain categorization:** Document in report, ask user to review
533
- 3. **Large extractions:** If >10 files need context extraction, ask user to prioritize
534
- 4. **Missing backup:** Report error clearly, proceed with fresh install
535
-
536
- ## Never Do
537
-
538
- - ❌ Overwrite new template files without analyzing content first
539
- - ❌ Skip user work history (wishes, reports)
540
- - ❌ Assume old structure matches current without verification
541
- - ❌ Extract context without documenting where it came from
542
- - ❌ Proceed with restoration if backup appears corrupted