pgserve 2.1.3 → 2.2.1

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 (235) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +105 -1
  3. package/bin/autopg-wrapper.cjs +16 -0
  4. package/bin/pgserve-wrapper.cjs +32 -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 +14 -2
  27. package/scripts/postinstall.cjs +60 -0
  28. package/src/cli-config.cjs +310 -0
  29. package/src/cli-install.cjs +112 -11
  30. package/src/cli-restart.cjs +228 -0
  31. package/src/cli-ui.cjs +580 -0
  32. package/src/cluster.js +43 -38
  33. package/src/postgres.js +141 -19
  34. package/src/settings-loader.cjs +235 -0
  35. package/src/settings-migrate.cjs +212 -0
  36. package/src/settings-pg-args.cjs +146 -0
  37. package/src/settings-schema.cjs +422 -0
  38. package/src/settings-validator.cjs +416 -0
  39. package/src/settings-writer.cjs +288 -0
  40. package/src/upgrade/index.js +65 -0
  41. package/src/upgrade/runner.js +23 -0
  42. package/src/upgrade/steps/binary-cache-flush.js +67 -0
  43. package/src/upgrade/steps/consumer-signal.js +40 -0
  44. package/src/upgrade/steps/env-refresh.js +89 -0
  45. package/src/upgrade/steps/health-validate.js +53 -0
  46. package/src/upgrade/steps/plpgsql-resolve.js +66 -0
  47. package/src/upgrade/steps/port-reconcile.js +52 -0
  48. package/.claude/context/windows-debug.md +0 -119
  49. package/.genie/AGENTS.md +0 -15
  50. package/.genie/agents/README.md +0 -110
  51. package/.genie/agents/analyze.md +0 -176
  52. package/.genie/agents/forge.md +0 -290
  53. package/.genie/agents/garbage-cleaner.md +0 -324
  54. package/.genie/agents/garbage-collector.md +0 -596
  55. package/.genie/agents/github-issue-gc.md +0 -618
  56. package/.genie/agents/review.md +0 -380
  57. package/.genie/agents/semantic-analyzer/find-duplicates.md +0 -90
  58. package/.genie/agents/semantic-analyzer/find-orphans.md +0 -99
  59. package/.genie/agents/semantic-analyzer.md +0 -101
  60. package/.genie/agents/update.md +0 -182
  61. package/.genie/agents/wish.md +0 -357
  62. package/.genie/brainstorms/pgserve-v2/DESIGN.md +0 -174
  63. package/.genie/code/AGENTS.md +0 -694
  64. package/.genie/code/agents/audit/risk.md +0 -173
  65. package/.genie/code/agents/audit/security.md +0 -189
  66. package/.genie/code/agents/audit.md +0 -145
  67. package/.genie/code/agents/challenge.md +0 -230
  68. package/.genie/code/agents/change-reviewer.md +0 -295
  69. package/.genie/code/agents/code-garbage-collector.md +0 -425
  70. package/.genie/code/agents/code-quality.md +0 -410
  71. package/.genie/code/agents/commit-suggester.md +0 -255
  72. package/.genie/code/agents/commit.md +0 -124
  73. package/.genie/code/agents/consensus.md +0 -204
  74. package/.genie/code/agents/daily-standup.md +0 -722
  75. package/.genie/code/agents/docgen.md +0 -48
  76. package/.genie/code/agents/explore.md +0 -79
  77. package/.genie/code/agents/fix.md +0 -100
  78. package/.genie/code/agents/git/commit-advisory.md +0 -219
  79. package/.genie/code/agents/git/workflows/issue.md +0 -244
  80. package/.genie/code/agents/git/workflows/pr.md +0 -179
  81. package/.genie/code/agents/git/workflows/release.md +0 -460
  82. package/.genie/code/agents/git/workflows/report.md +0 -342
  83. package/.genie/code/agents/git.md +0 -432
  84. package/.genie/code/agents/implementor.md +0 -161
  85. package/.genie/code/agents/install.md +0 -515
  86. package/.genie/code/agents/issue-creator.md +0 -344
  87. package/.genie/code/agents/polish.md +0 -116
  88. package/.genie/code/agents/qa.md +0 -653
  89. package/.genie/code/agents/refactor.md +0 -294
  90. package/.genie/code/agents/release.md +0 -1129
  91. package/.genie/code/agents/roadmap.md +0 -885
  92. package/.genie/code/agents/tests.md +0 -557
  93. package/.genie/code/agents/tracer.md +0 -50
  94. package/.genie/code/agents/update/upstream-update.md +0 -85
  95. package/.genie/code/agents/update/versions/generic-update.md +0 -305
  96. package/.genie/code/agents/vibe.md +0 -1317
  97. package/.genie/code/spells/agent-configuration.md +0 -58
  98. package/.genie/code/spells/automated-rc-publishing.md +0 -106
  99. package/.genie/code/spells/branch-tracker-guidance.md +0 -28
  100. package/.genie/code/spells/debug.md +0 -320
  101. package/.genie/code/spells/emoji-naming-convention.md +0 -303
  102. package/.genie/code/spells/evidence-storage.md +0 -26
  103. package/.genie/code/spells/file-naming-rules.md +0 -35
  104. package/.genie/code/spells/forge-code-blueprints.md +0 -195
  105. package/.genie/code/spells/genie-integration.md +0 -153
  106. package/.genie/code/spells/publishing-protocol.md +0 -61
  107. package/.genie/code/spells/team-consultation-protocol.md +0 -284
  108. package/.genie/code/spells/tool-requirements.md +0 -20
  109. package/.genie/code/spells/triad-maintenance-protocol.md +0 -154
  110. package/.genie/code/teams/tech-council/council.md +0 -328
  111. package/.genie/code/teams/tech-council/jt.md +0 -352
  112. package/.genie/code/teams/tech-council/nayr.md +0 -305
  113. package/.genie/code/teams/tech-council/oettam.md +0 -375
  114. package/.genie/neurons/README.md +0 -193
  115. package/.genie/neurons/forge.md +0 -106
  116. package/.genie/neurons/genie.md +0 -63
  117. package/.genie/neurons/review.md +0 -106
  118. package/.genie/neurons/wish.md +0 -104
  119. package/.genie/product/README.md +0 -20
  120. package/.genie/product/cli-automation.md +0 -359
  121. package/.genie/product/environment.md +0 -60
  122. package/.genie/product/mission.md +0 -60
  123. package/.genie/product/roadmap.md +0 -44
  124. package/.genie/product/tech-stack.md +0 -34
  125. package/.genie/product/templates/context-template.md +0 -218
  126. package/.genie/product/templates/qa-done-report-template.md +0 -68
  127. package/.genie/product/templates/review-report-template.md +0 -89
  128. package/.genie/product/templates/wish-template.md +0 -120
  129. package/.genie/scripts/helpers/analyze-commit.js +0 -195
  130. package/.genie/scripts/helpers/bullet-counter.js +0 -194
  131. package/.genie/scripts/helpers/bullet-find.js +0 -289
  132. package/.genie/scripts/helpers/bullet-id.js +0 -244
  133. package/.genie/scripts/helpers/check-secrets.js +0 -237
  134. package/.genie/scripts/helpers/count-tokens.js +0 -200
  135. package/.genie/scripts/helpers/create-frontmatter.js +0 -456
  136. package/.genie/scripts/helpers/detect-markers.js +0 -293
  137. package/.genie/scripts/helpers/detect-todos.js +0 -267
  138. package/.genie/scripts/helpers/detect-unlabeled-blocks.js +0 -135
  139. package/.genie/scripts/helpers/embeddings.js +0 -344
  140. package/.genie/scripts/helpers/find-empty-sections.js +0 -158
  141. package/.genie/scripts/helpers/index.js +0 -319
  142. package/.genie/scripts/helpers/validate-frontmatter.js +0 -578
  143. package/.genie/scripts/helpers/validate-links.js +0 -207
  144. package/.genie/scripts/helpers/validate-paths.js +0 -373
  145. package/.genie/spells/README.md +0 -9
  146. package/.genie/spells/ace-protocol.md +0 -118
  147. package/.genie/spells/ask-one-at-a-time.md +0 -175
  148. package/.genie/spells/backup-analyzer.md +0 -542
  149. package/.genie/spells/blocker.md +0 -12
  150. package/.genie/spells/break-things-move-fast.md +0 -56
  151. package/.genie/spells/context-candidates.md +0 -72
  152. package/.genie/spells/context-critic.md +0 -51
  153. package/.genie/spells/defer-to-expertise.md +0 -278
  154. package/.genie/spells/delegate-dont-do.md +0 -292
  155. package/.genie/spells/error-investigation-protocol.md +0 -328
  156. package/.genie/spells/evidence-based-completion.md +0 -273
  157. package/.genie/spells/experiment.md +0 -65
  158. package/.genie/spells/file-creation-protocol.md +0 -229
  159. package/.genie/spells/forge-integration.md +0 -281
  160. package/.genie/spells/forge-orchestration.md +0 -514
  161. package/.genie/spells/gather-context.md +0 -18
  162. package/.genie/spells/global-health-check.md +0 -34
  163. package/.genie/spells/global-noop-roundtrip.md +0 -25
  164. package/.genie/spells/install-genie.md +0 -1232
  165. package/.genie/spells/install.md +0 -82
  166. package/.genie/spells/investigate-before-commit.md +0 -112
  167. package/.genie/spells/know-yourself.md +0 -288
  168. package/.genie/spells/learn.md +0 -828
  169. package/.genie/spells/mcp-diagnostic-protocol.md +0 -246
  170. package/.genie/spells/mcp-first.md +0 -124
  171. package/.genie/spells/multi-step-execution.md +0 -67
  172. package/.genie/spells/orchestration-boundary-protocol.md +0 -256
  173. package/.genie/spells/orchestrator-not-implementor.md +0 -189
  174. package/.genie/spells/prompt.md +0 -746
  175. package/.genie/spells/reflect.md +0 -404
  176. package/.genie/spells/routing-decision-matrix.md +0 -368
  177. package/.genie/spells/run-in-parallel.md +0 -12
  178. package/.genie/spells/session-state-updater-example.md +0 -196
  179. package/.genie/spells/session-state-updater.md +0 -220
  180. package/.genie/spells/track-long-running-tasks.md +0 -133
  181. package/.genie/spells/troubleshoot-infrastructure.md +0 -176
  182. package/.genie/spells/upgrade-genie.md +0 -415
  183. package/.genie/spells/url-presentation-protocol.md +0 -301
  184. package/.genie/spells/wish-initiation.md +0 -158
  185. package/.genie/spells/wish-issue-linkage.md +0 -410
  186. package/.genie/spells/wish-lifecycle.md +0 -100
  187. package/.genie/state/provider-status.json +0 -3
  188. package/.genie/state/version.json +0 -16
  189. package/.genie/wishes/canonical-pgserve-pm2-supervision/WISH.md +0 -290
  190. package/.genie/wishes/pgserve-v2/BRIEF-from-genie-pgserve.md +0 -99
  191. package/.genie/wishes/pgserve-v2/WISH.md +0 -442
  192. package/.genie/wishes/release-system-genie-pattern/WISH.md +0 -268
  193. package/.genie/wishes/release-system-genie-pattern/validation.md +0 -205
  194. package/.gitguardian.yaml +0 -29
  195. package/.gitguardianignore +0 -16
  196. package/.github/workflows/ci.yml +0 -122
  197. package/.github/workflows/release.yml +0 -289
  198. package/.github/workflows/version.yml +0 -228
  199. package/.husky/pre-commit +0 -2
  200. package/AGENTS.md +0 -433
  201. package/CLAUDE.md +0 -1
  202. package/Makefile +0 -285
  203. package/assets/icon.ico +0 -0
  204. package/bun.lock +0 -435
  205. package/bunfig.toml +0 -28
  206. package/ecosystem.config.cjs +0 -23
  207. package/eslint.config.js +0 -63
  208. package/examples/multi-tenant-demo.js +0 -104
  209. package/install.sh +0 -123
  210. package/knip.json +0 -9
  211. package/tests/audit.test.js +0 -189
  212. package/tests/backpressure.test.js +0 -167
  213. package/tests/benchmarks/runner.js +0 -1197
  214. package/tests/benchmarks/vector-generator.js +0 -368
  215. package/tests/cli-install.test.js +0 -322
  216. package/tests/control-db.test.js +0 -285
  217. package/tests/daemon-args.test.js +0 -86
  218. package/tests/daemon-control.test.js +0 -171
  219. package/tests/daemon-fingerprint-integration.test.js +0 -111
  220. package/tests/daemon-pr24-regression.test.js +0 -198
  221. package/tests/fingerprint.test.js +0 -263
  222. package/tests/fixtures/240-orphan-seed.sql +0 -30
  223. package/tests/multi-tenant.test.js +0 -374
  224. package/tests/orphan-cleanup.test.js +0 -390
  225. package/tests/pg-version-regex.test.js +0 -129
  226. package/tests/quick-bench.js +0 -135
  227. package/tests/router-handshake-retry.test.js +0 -119
  228. package/tests/router-handshake-watchdog.test.js +0 -110
  229. package/tests/sdk.test.js +0 -71
  230. package/tests/stale-postmaster-pid.test.js +0 -85
  231. package/tests/stress-test.js +0 -439
  232. package/tests/sync-perf-test.js +0 -150
  233. package/tests/tcp-listen.test.js +0 -368
  234. package/tests/tenancy.test.js +0 -403
  235. package/tests/wrapper-supervision.test.js +0 -107
@@ -1,281 +0,0 @@
1
- ---
2
- name: Forge Integration
3
- description: Complete Forge integration - architecture, API, entry point patterns, meta-learning
4
- ---
5
-
6
- # Forge Integration - Complete Guide
7
-
8
- **Purpose:** Comprehensive understanding of Forge as primary entry point, architecture, and API integration
9
-
10
- ---
11
-
12
- ## Part 1: Forge as Main Entry Point 🔴 CRITICAL
13
-
14
- **Core Principle:** Forge is the PRIMARY entry point for ALL work (not secondary orchestrator).
15
-
16
- **Workflow:**
17
- ```
18
- GitHub issue → Forge task card → worktree + feature branch → PR back to main
19
- ```
20
-
21
- **Architecture:**
22
- 1. **One forge task = one PR** (direct 1:1 mapping)
23
- 2. **All PRs converge on main** (single integration point, no branch hierarchies)
24
- 3. **Work units are atomic** at forge card level (complete deliverable per card)
25
- 4. **Parallel safety** via independent worktrees (no branch conflicts)
26
-
27
- **Why This Matters:**
28
- - [forge-int-001] helpful=0 harmful=0: **Clear ownership:** Each forge task card owns exactly one PR
29
- - [forge-int-002] helpful=0 harmful=0: **Parallel safety:** Independent worktrees enable simultaneous work without conflicts
30
- - [forge-int-003] helpful=0 harmful=0: **Traceability:** Complete chain: GitHub issue ←→ forge card ←→ worktree ←→ PR
31
- - [forge-int-004] helpful=0 harmful=0: **Main stays clean:** Only merged PRs (not work-in-progress branches)
32
- - [forge-int-005] helpful=0 harmful=0: **Atomic delivery:** Each PR is self-contained, reviewable, revertable
33
-
34
- **Enforcement Constraints:**
35
- - [forge-int-006] helpful=0 harmful=0: ❌ **NEVER** create GitHub issue without forge task card
36
- - [forge-int-007] helpful=0 harmful=0: ❌ **NEVER** create forge task card without exactly one worktree/branch
37
- - [forge-int-008] helpful=0 harmful=0: ❌ **NEVER** create worktree without exactly one PR back to main
38
- - [forge-int-009] helpful=0 harmful=0: ❌ **NEVER** merge PR without corresponding forge task completion
39
- - [forge-int-010] helpful=0 harmful=0: ✅ **ALWAYS** GitHub issue → forge card → worktree → PR → main (complete chain)
40
-
41
- **Example Flow:**
42
- ```
43
- Issue #123: "Fix auth bug"
44
-
45
- Forge card: task-fix-auth-bug
46
-
47
- Worktree: .worktrees/task-fix-auth-bug/
48
- Branch: task/fix-auth-bug
49
-
50
- PR #124: "Fix: Auth token validation" → main
51
-
52
- Merge to main + archive worktree
53
- ```
54
-
55
- **Validation:**
56
- - [forge-int-011] helpful=0 harmful=0: Every active forge card MUST have corresponding worktree
57
- - [forge-int-012] helpful=0 harmful=0: Every worktree MUST have corresponding open PR (or be in progress)
58
- - [forge-int-013] helpful=0 harmful=0: Every merged PR MUST have completed forge card
59
- - [forge-int-014] helpful=0 harmful=0: Main branch MUST only receive PRs (no direct commits for forge work)
60
-
61
- ---
62
-
63
- ## Part 2: Forge as Meta-Agent (Continuous Learning) 🔴 CRITICAL
64
-
65
- **Core Principle:** Forge is not just for code implementation. Forge can host ANY persistent work unit, including continuous learning. When Forge hosts a "learn" task, results are VISIBLE to the user.
66
-
67
- **Why This Matters:**
68
- - [forge-int-015] helpful=0 harmful=0: **Visibility:** User sees learning results directly in Forge UI (not hidden in MCP session logs)
69
- - [forge-int-016] helpful=0 harmful=0: **Persistence:** Learning task lives alongside all other work (integrated development + learning)
70
- - [forge-int-017] helpful=0 harmful=0: **Coordination:** Learning integrated with code tasks, not separate workflow
71
- - [forge-int-018] helpful=0 harmful=0: **Continuity:** Each learning session builds on previous ones documented in Forge task
72
- - [forge-int-019] helpful=0 harmful=0: **Accountability:** Learning outcomes traceable + reviewable just like code
73
-
74
- **How It Works:**
75
-
76
- 1. **Create Forge "learn" task** (permanent, ongoing):
77
- - Task type: meta-learning
78
- - Description: "Continuous framework learning from user corrections and patterns"
79
- - Status: always active (never closed)
80
- - Updates: Each learning session appends findings
81
-
82
- 2. **Learning Loop:**
83
- ```
84
- Teaching Signal (user correction, new pattern, framework gap)
85
-
86
- Create/Update Forge "learn" task description with observation
87
-
88
- Genie delegates to learn agent via MCP
89
-
90
- Learn agent analyzes + documents finding
91
-
92
- Learn agent updates framework files (spells, agents, docs)
93
-
94
- Forge task updated with conclusion + changed files
95
-
96
- User sees result immediately in Forge UI
97
-
98
- Framework permanently updated with new knowledge
99
- ```
100
-
101
- **Benefits Over MCP-Only Learning:**
102
-
103
- **MCP-only approach (old):**
104
- - [forge-int-020] helpful=0 harmful=0: ❌ Learning happens in hidden session logs
105
- - [forge-int-021] helpful=0 harmful=0: ❌ User must use `mcp__genie__view` to see outcomes
106
- - [forge-int-022] helpful=0 harmful=0: ❌ No integration with development workflow
107
- - [forge-int-023] helpful=0 harmful=0: ❌ Learning sessions disconnected from code work
108
-
109
- **Forge-hosted learning (new):**
110
- - [forge-int-024] helpful=0 harmful=0: ✅ Learning visible in same UI as code tasks
111
- - [forge-int-025] helpful=0 harmful=0: ✅ User sees results immediately (no tool invocation needed)
112
- - [forge-int-026] helpful=0 harmful=0: ✅ Learning integrated with development (one workflow)
113
- - [forge-int-027] helpful=0 harmful=0: ✅ Each learning session builds on previous (documented in Forge task)
114
- - [forge-int-028] helpful=0 harmful=0: ✅ Traceable: What was learned + when + which files changed
115
-
116
- ---
117
-
118
- ## Part 3: Forge Architecture Understanding
119
-
120
- **Purpose:** Know how Forge creates tasks, worktrees, branches, and encodes metadata
121
-
122
- ### Forge Task Lifecycle
123
-
124
- **1. Task Creation**
125
- - [forge-int-029] helpful=0 harmful=0: **API:** `mcp__automagik_forge__create_task`
126
- - [forge-int-030] helpful=0 harmful=0: **Returns:** task_id (UUID format, e.g., `e84ff7e9-db49-4cdb-8f5b-3c1afd2df94f`)
127
- - [forge-int-031] helpful=0 harmful=0: **Status:** starts as "todo"
128
-
129
- **2. Task Attempt Start**
130
- - [forge-int-032] helpful=0 harmful=0: **API:** `mcp__automagik_forge__start_task_attempt`
131
- - [forge-int-033] helpful=0 harmful=0: **Parameters:** task_id, executor (CLAUDE_CODE, etc.)
132
- - [forge-int-034] helpful=0 harmful=0: **Returns:** attempt_id (UUID format, e.g., `35a403e3-fe62-4545-bffe-0285dbfa472d`)
133
-
134
- **3. Worktree Creation (Automatic)**
135
- Forge automatically creates a worktree with the pattern:
136
-
137
- ```
138
- <attempt-id-prefix>-<abbreviated-task-title>
139
- ```
140
-
141
- **Example:**
142
- - [forge-int-035] helpful=0 harmful=0: Attempt ID: `35a403e3-fe62-4545-bffe-0285dbfa472d`
143
- - [forge-int-036] helpful=0 harmful=0: Prefix (first 4 chars): `35a4`
144
- - [forge-int-037] helpful=0 harmful=0: Task title: "Forge Metadata Investigation - Extract task_id structure"
145
- - [forge-int-038] helpful=0 harmful=0: Abbreviation: "test-forge-metad"
146
- - [forge-int-039] helpful=0 harmful=0: **Worktree dir:** `35a4-test-forge-metad`
147
- - [forge-int-040] helpful=0 harmful=0: **Location:** `/var/tmp/automagik-forge/worktrees/35a4-test-forge-metad/`
148
-
149
- **4. Branch Creation (Automatic)**
150
- Forge creates a forge branch with the pattern:
151
-
152
- ```
153
- forge/<attempt-id-prefix>-<abbreviated-task-title>
154
- ```
155
-
156
- **Example:** `forge/35a4-test-forge-metad`
157
-
158
- ### Metadata Encoding
159
-
160
- **Data Structure:**
161
- ```
162
- Task Layer (Forge API):
163
- ├─ task_id: e84ff7e9-db49-4cdb-8f5b-3c1afd2df94f (full UUID, persistent)
164
- └─ task metadata: title, description, status (todo/in-progress/complete)
165
-
166
- Attempt Layer (Forge API):
167
- ├─ attempt_id: 35a403e3-fe62-4545-bffe-0285dbfa472d (full UUID)
168
- └─ Created when: start_task_attempt() called
169
-
170
- Worktree Layer (File System):
171
- ├─ directory: /var/tmp/automagik-forge/worktrees/35a4-test-forge-metad/
172
- ├─ prefix: 35a4 (first 4 chars of attempt_id)
173
- └─ branch: forge/35a4-test-forge-metad
174
-
175
- Wish Layer (Genie):
176
- ├─ wish slug: extracted from abbreviated task title
177
- ├─ wish file: .genie/wishes/<slug>/<slug>-wish.md
178
- └─ must be linked in SESSION-STATE.md
179
- ```
180
-
181
- **Key Insights for Automation:**
182
-
183
- 1. **Worktree directory name is the primary signal** - it contains both:
184
- - Attempt ID prefix (first 4 chars) - identifies the Forge task attempt
185
- - Abbreviated task title - helps identify wish
186
-
187
- 2. **Git branch also encodes this** - `forge/35a4-...` is always available and reliable
188
-
189
- 3. **No additional metadata files needed** - Forge doesn't leave .forge-context.json or similar
190
- - All metadata is in file system paths and git branch names
191
-
192
- 4. **Pre-commit hook has enough info** to:
193
- - Extract attempt prefix (identify task)
194
- - Find wish slug (identify work)
195
- - Link them in SESSION-STATE.md
196
- - No external API calls needed (except optional Forge MCP query)
197
-
198
- ---
199
-
200
- ## Part 4: Forge API Integration
201
-
202
- **Purpose:** Canonical rules for synchronising Genie agent metadata with Automagik Forge
203
-
204
- ### Executor Profiles (`/api/profiles`)
205
-
206
- - [forge-int-041] helpful=0 harmful=0: **Endpoint:** `GET /api/profiles` returns an object with `executors` mapping executor keys to profile variants
207
- - [forge-int-042] helpful=0 harmful=0: **Update constraints:**
208
- - Forge rejects top-level strings; the payload MUST be `{"executors": {...}}`
209
- - Variants are stored under upper-case keys (`DEFAULT`, `QA_CHECKLIST`, etc.)
210
- - Store everything upper-case to avoid mismatches
211
- - Valid knob names: `append_prompt`, `model`, `model_reasoning_effort`, `sandbox`, `additional_params`, `allow_all_tools`, `dangerously_skip_permissions`, `dangerously_allow_all`, `plan`, `approvals`, `force`, `yolo`
212
- - `append_prompt` exists even when the UI omits it; populate it explicitly when we need prompt suffixes
213
-
214
- **Example (adds `QA_CHECKLIST` variant for `OPENCODE`):**
215
- ```json
216
- PUT /api/profiles
217
- {
218
- "executors": {
219
- "OPENCODE": {
220
- "DEFAULT": { "OPENCODE": { "append_prompt": null } },
221
- "QA_CHECKLIST": {
222
- "OPENCODE": {
223
- "append_prompt": "## QA Automation Checklist Mode",
224
- "additional_params": [
225
- { "key": "playbook", "value": "qa-automation-checklist" },
226
- { "key": "evidence_mode", "value": "strict" }
227
- ]
228
- }
229
- }
230
- }
231
- }
232
- }
233
- ```
234
-
235
- - [forge-int-043] helpful=0 harmful=0: **CLI impact:** Agents can specify a variant via front-matter (`genie.executorProfile: QA_CHECKLIST`). `genie run --executor opencode` will push `{ executor: "OPENCODE", variant: "QA_CHECKLIST" }` to Forge.
236
-
237
- ### Task Templates (`/api/templates`)
238
-
239
- - [forge-int-044] helpful=0 harmful=0: Templates are simple `{template_name, title, description, project_id}` records
240
- - [forge-int-045] helpful=0 harmful=0: Description is free-form markdown/plain text
241
- - [forge-int-046] helpful=0 harmful=0: Use them to surface Genie instructions inside Forge's UI
242
- - [forge-int-047] helpful=0 harmful=0: They do not control execution or models
243
-
244
- **Example sync:**
245
- ```ts
246
- const templateBody = fs.readFileSync('.genie/create/agents/wish.md', 'utf8');
247
- await forge.createTaskTemplate({
248
- template_name: 'genie-wish-qa-codex',
249
- title: 'Genie Wish: QA Codex Automation Checklist',
250
- description: templateBody,
251
- project_id: null
252
- });
253
- ```
254
-
255
- Remember: this only mirrors content. Execution still depends on executor profiles / Genie front-matter.
256
-
257
- ### Sessions
258
-
259
- - [forge-int-048] helpful=0 harmful=0: Forge session creation expects `{ executor_profile_id: { executor, variant } }`
260
- - [forge-int-049] helpful=0 harmful=0: `variant` must match one of the profile keys (defaults to `DEFAULT`)
261
- - [forge-int-050] helpful=0 harmful=0: Genie session metadata stores both `executor` and `executorVariant`
262
- - [forge-int-051] helpful=0 harmful=0: Ensure we set both when forging sessions (fallbacks removed)
263
-
264
- ### Best Practices & Lessons
265
-
266
- - [forge-int-052] helpful=0 harmful=0: 🔁 **Roundtrip test before mutating profiles:** Slam the existing `profiles.content` into `PUT /api/profiles` to verify format, then mutate
267
- - [forge-int-053] helpful=0 harmful=0: 🪪 **Keep history:** Save every API interaction log in `.genie/qa/evidence/forge-api-report-YYYYMMDDHHMM.md`
268
- - [forge-int-054] helpful=0 harmful=0: 📜 **Front-matter contract:** Every agent that declares `genie.executor` SHOULD also declare the matching Forge variant if it is not `DEFAULT`
269
- - [forge-int-055] helpful=0 harmful=0: 🧩 **Future work:** Consider scripted export/import (CLI verb) to sync collectives → Forge templates & profile variants automatically
270
-
271
- ---
272
-
273
- ## References
274
-
275
- - [forge-int-056] helpful=0 harmful=0: `@.genie/spells/forge-orchestration.md` - Workflow delegation and orchestration patterns
276
- - [forge-int-057] helpful=0 harmful=0: `@.genie/code/workflows/forge.md` - Forge workflow documentation
277
- - [forge-int-058] helpful=0 harmful=0: `@.genie/spells/orchestrator-not-implementor.md` - Agent role boundaries
278
-
279
- ---
280
-
281
- **Evidence:** Merged from 3 spell files (forge-architecture, forge-api-integration, forge-integration) on 2025-10-23 during duplicate cleanup initiative.