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,153 +0,0 @@
1
- ---
2
- name: Genie Integration Framework
3
- description: Use genie agent for second opinions, pressure-tests, and decision audits
4
- genie:
5
- executor: [CLAUDE_CODE, CODEX, OPENCODE]
6
- forge:
7
- CLAUDE_CODE:
8
- model: sonnet
9
- CODEX: {}
10
- OPENCODE: {}
11
- ---
12
-
13
- # Genie Integration Framework
14
-
15
- **Purpose:** `genie` spell is GENIE's partner for second opinions, plan pressure-tests, deep dives, and decision audits. Use it to reduce risk, surface blind spots, and document reasoning without blocking implementation work.
16
-
17
- **Success criteria:**
18
- ✅ Clear purpose, chosen spell, and outcomes logged (wish discovery or Done Report).
19
- ✅ Human reviews Genie Verdict (with confidence) before high-impact decisions.
20
- ✅ Evidence captured when Genie recommendations change plan/implementation.
21
-
22
- ## When To Use
23
-
24
- - Ambiguity: requirements unclear or conflicting.
25
- - High-risk decision: architectural choices, irreversible migrations, external dependencies.
26
- - Cross-cutting design: coupling, scalability, observability, simplification.
27
- - Unknown root cause: puzzling failures/flakiness; competing hypotheses.
28
- - Compliance/regulatory: controls, evidence, and sign-off mapping.
29
- - Test strategy: scope, layering, rollback/monitoring concerns.
30
- - Retrospective: extract wins/misses/lessons for future work.
31
-
32
- ## Agent Consultation
33
-
34
- Genie operates through **universal agents** (reasoning, analysis, audit) and **execution specialists** (code, git, tests, etc.).
35
-
36
- ### Universal Agents (Domain-Agnostic)
37
-
38
- **Reasoning Modes (4 total - via reasoning/*):**
39
-
40
- Use `mcp__genie__run with agent="reasoning/<mode>"`:
41
- - `reasoning/challenge` – Adversarial pressure-testing and critical evaluation
42
- - `reasoning/explore` – Discovery-focused investigation without adversarial pressure
43
- - `reasoning/consensus` – Multi-perspective synthesis and agreement-building
44
- - `reasoning/socratic` – Question-driven inquiry to uncover assumptions
45
-
46
- **Analysis & Audit:**
47
- - `analyze` – System analysis and focused investigation (universal framework)
48
- - `audit` – Risk and impact assessment (universal framework with workflows)
49
- - `audit/risk` – General risk audit workflow
50
- - `audit/security` – Security audit workflow (OWASP, CVE)
51
-
52
- **Autonomous Execution:**
53
- - `vibe` – Fully autonomous task execution mode
54
-
55
- ### Code-Specific Agents
56
-
57
- **Execution Specialists:**
58
- - `implementor` – Feature implementation and code writing
59
- - `tests` – Test strategy, generation, authoring across all layers
60
- - `polish` – Code refinement and cleanup
61
- - `review` – Wish audits, code review, QA validation
62
- - `git` – ALL git and GitHub operations (branch, commit, PR, issues)
63
- - `release` – GitHub release and npm publish orchestration
64
-
65
- **Code Analysis & Tools:**
66
- - `analyze` (code) – Includes universal analyze + TypeScript/performance examples
67
- - `debug` – Root cause investigation for code issues
68
- - `refactor` – Design review and refactor planning
69
-
70
- > **Architecture Note:** Universal agents work across ALL domains (code, legal, medical, finance). Code agents extend or specialize for code development.
71
-
72
- ## How To Run (MCP)
73
-
74
- - Start: `mcp__genie__run` with agent="genie" and prompt="Mode: plan. Objective: pressure-test @.genie/wishes/<slug>/<slug>-wish.md. Deliver 3 risks, 3 missing validations, 3 refinements. Finish with Genie Verdict + confidence."
75
- - Resume: `mcp__genie__resume` with sessionId="<session-id>" and prompt="Follow-up: address risk #2 with options + trade-offs."
76
- - Sessions: reuse the same agent name; MCP persists session id automatically and can be viewed with `mcp__genie__list_sessions`.
77
- - Logs: check full transcript with `mcp__genie__view` with sessionId and full=true.
78
-
79
- ## Quick Reference
80
-
81
- **Universal Agents:**
82
- - **Reasoning (4):** challenge, explore, consensus, socratic (in reasoning/)
83
- - **Analysis (1):** analyze (universal framework, 173 lines)
84
- - **Audit (1 + 2 workflows):** audit (universal framework, 138 lines) + risk, security
85
- - **Autonomous (1):** vibe
86
-
87
- **Code-Specific Agents:**
88
- - **Execution (6):** implementor, tests, polish, review, git, release
89
- - **Code Tools (3):** analyze (code), debug, refactor
90
-
91
- **Include Pattern:**
92
- - Universal agents: `.genie/code/agents/{analyze,audit}.md`
93
- - Reasoning modes: `.genie/code/agents/reasoning/{challenge,explore,consensus,socratic}.md`
94
- - Audit workflows: `.genie/code/agents/audit/{risk,security}.md`
95
- - Code extensions: `.genie/code/agents/analyze.md` (includes universal + code examples)
96
- - Project notes: Add a "Project Notes" section inside the relevant `.genie/code/agents/*` or `.genie/spells/*` doc (no separate `custom/` directory)
97
-
98
- ## Outputs & Evidence
99
-
100
- - Low-stakes: append a short summary to the wish discovery section.
101
- - High-stakes: save a Done Report at `.genie/wishes/<slug>/reports/done-genie-<slug>-<YYYYMMDDHHmm>.md` with scope, findings, recommendations, disagreements.
102
- - Always include "Genie Verdict: <summary> (confidence: <low|med|high>)".
103
-
104
- ## Genie Verdict Format
105
-
106
- Verdict templates live inside the specialized spell files (e.g., `.genie/agents/refactor.md`). Core files remain immutable.
107
-
108
- ## Real-Time Agent Monitoring (Added 2025-10-21)
109
-
110
- **Problem:** `genie view` may show "Forge backend unreachable" errors even when agents are actively working and completing tasks successfully.
111
-
112
- **Root cause:** Display bug in Genie CLI - checks wrong port (8888 vs 8887) or uses HTTP health check instead of MCP connectivity verification.
113
-
114
- **Investigation before panic:**
115
- 1. Check Forge MCP connectivity: `mcp__automagik_forge__list_tasks(project_id="...")`
116
- 2. Check task status: Look for task in "in-progress" state
117
- 3. Check executor process: `ps aux | grep <executor-name>` (opencode, claude, etc.)
118
- 4. Check Forge process: `ps aux | grep forge` and `netstat -tlnp | grep 8887`
119
-
120
- **If Forge MCP works:** Trust delegation, ignore "unreachable" message in genie view
121
-
122
- **Monitoring pattern:**
123
- ```bash
124
- # Don't poll rapidly - use intervals
125
- sleep 30 # or 60 seconds between checks
126
- # Then check status again
127
- ```
128
-
129
- **Decision tree:**
130
- - `genie view` shows "unreachable" + Forge MCP works → Display bug, trust delegation
131
- - `genie view` shows "unreachable" + Forge MCP fails → Real failure, investigate
132
- - Task status "in-progress" + process running → Wait patiently
133
- - Task status "failed" + process not running → Actual failure, investigate logs
134
-
135
- **Future improvements needed:**
136
- - Fix Genie CLI port detection (use 8887, not 8888)
137
- - Use MCP connectivity check instead of HTTP health endpoint
138
- - Add real-time status polling to `genie view` using Forge advanced APIs
139
- - Create `genie status` command for quick health checks
140
- - Implement session→task→attempt mapping for better monitoring
141
-
142
- **See also:** `@.genie/spells/error-investigation-protocol.md` for complete investigation toolkit
143
-
144
- **Evidence:** RC 37 failure analysis (2025-10-21) - orchestrator panicked due to misleading "unreachable" message, created redundant sessions, lost work. Meanwhile agents completed successfully.
145
-
146
- ## Anti-Patterns
147
-
148
- - Using Genie to bypass human approval.
149
- - Spawning Genie repeatedly without integrating prior outcomes.
150
- - Treating Genie outputs as implementation orders without validation.
151
- - **Panicking due to "unreachable" errors without investigating actual system state (Added 2025-10-21)**
152
- - **Creating redundant agent sessions instead of monitoring existing ones (Added 2025-10-21)**
153
- - **Bypassing delegation when display shows errors but system is working (Added 2025-10-21)**
@@ -1,61 +0,0 @@
1
- ---
2
- name: Publishing Protocol *(CRITICAL)*
3
- description: Never publish directly; always delegate to the release agent
4
- genie:
5
- executor: [CLAUDE_CODE, CODEX, OPENCODE]
6
- forge:
7
- CLAUDE_CODE:
8
- model: sonnet
9
- CODEX: {}
10
- OPENCODE: {}
11
- ---
12
-
13
- # Publishing Protocol *(CRITICAL)*
14
-
15
- **NEVER** execute `npm publish` or `gh release create` directly. **ALWAYS** delegate to release agent.
16
-
17
- ## Forbidden Actions
18
-
19
- - ❌ `npm publish` (bypasses validation, GitHub release, audit trail)
20
- - ❌ `gh release create` (direct command - let agent orchestrate)
21
- - ❌ Manual version tagging without release agent
22
- - ❌ Using `/release` slash command with arguments (incorrect invocation)
23
-
24
- ## Required Workflow
25
-
26
- **If you ARE the release agent:**
27
- - ✅ Execute workflow directly: run pre-flight checks, create GitHub release via `gh release create`, monitor Actions
28
- - ❌ NEVER delegate to yourself or invoke `mcp__genie__run` with agent="release"
29
-
30
- **If you are NOT the release agent (genie/planner/main):**
31
- 1. Commit code + version bump to main
32
- 2. Delegate to release agent: `mcp__genie__run with agent="release" and prompt="Create release for vX.Y.Z"`
33
- 3. Release agent validates, creates GitHub release, monitors npm publish
34
- 4. Provide release URL to user
35
-
36
- ## Why This Matters
37
-
38
- - **Safety**: Pre-flight checks (clean git, tests pass, version valid)
39
- - **Consistency**: Follows project workflow (GitHub Actions)
40
- - **Audit trail**: All releases documented in GitHub
41
- - **Rollback**: Structured process easier to revert
42
-
43
- ## Recent Violations
44
-
45
- **2025-10-14:**
46
- - Attempted `gh release create` manually (bypassed validation)
47
- - Attempted `npm publish` directly (timed out, triggered background agent)
48
- - Attempted `/release` with arguments instead of proper MCP invocation
49
- - **Result**: Inconsistent state, manual cleanup required
50
- - **Evidence**: Commits 0c6ef02, 30dce09, GitHub Actions runs 18506885592
51
-
52
- **2025-10-17:**
53
- - Session ~00:50Z: Recognized RC5 release work but attempted direct handling
54
- - Failed to check routing matrix before acting on release request
55
- - Acknowledged "I'm learning" but did NOT invoke learn agent for documentation
56
- - **Result**: Routing pattern not propagated to framework
57
- - **Evidence**: User teaching 2025-10-17
58
-
59
- ## Validation
60
-
61
- When user says "publish" or "release", immediately check routing matrix and delegate to release agent via MCP. When user identifies routing failures, invoke learn agent immediately to document correction.
@@ -1,284 +0,0 @@
1
- ---
2
- name: Team Consultation Protocol
3
- description: When and how to invoke advisory teams for architectural decisions
4
- genie:
5
- executor: [CLAUDE_CODE, CODEX, OPENCODE]
6
- forge:
7
- CLAUDE_CODE:
8
- model: sonnet
9
- CODEX: {}
10
- OPENCODE: {}
11
- ---
12
-
13
- # Team Consultation Protocol
14
-
15
- **Purpose:** Define triggers, workflows, and evidence requirements for team consultations
16
-
17
- ---
18
-
19
- ## 🎯 What Teams Are
20
-
21
- **Teams** are advisory collectives that:
22
- - Analyze codebases and proposals
23
- - Provide multi-persona recommendations
24
- - Build consensus through voting
25
- - Never execute code (read-only + own folder writes)
26
-
27
- **Distinction:** Agents execute, teams advise. Collectives coordinate execution, teams coordinate analysis.
28
-
29
- ---
30
-
31
- ## 🚦 When to Invoke Teams
32
-
33
- ### Tech-Council Triggers
34
-
35
- **Architectural decisions requiring tech-council consultation:**
36
-
37
- **Technology Choices:**
38
- - "Should we use [X] or [Y]?"
39
- - "Replace [technology] with [alternative]"
40
- - "Evaluate [framework/library]"
41
-
42
- **Performance Concerns:**
43
- - "Optimize [component] for performance"
44
- - "This is too slow, how do we speed it up?"
45
- - "Benchmark [approach A] vs [approach B]"
46
-
47
- **Refactoring Decisions:**
48
- - "Refactor [component/module]"
49
- - "Redesign [architecture]"
50
- - "Simplify [complex system]"
51
-
52
- **Pattern Decisions:**
53
- - "What's the best way to implement [feature]?"
54
- - "Review this architectural approach"
55
- - "Is this over-engineered?"
56
-
57
- ### Other Teams (Future)
58
-
59
- **Security-council:**
60
- - Security audits
61
- - Threat modeling
62
- - Vulnerability assessment
63
-
64
- **UX-council:**
65
- - User experience reviews
66
- - Interface design decisions
67
- - Accessibility considerations
68
-
69
- ---
70
-
71
- ## 🔄 Consultation Workflow
72
-
73
- ### Standard Pattern
74
-
75
- ```
76
- 1. User request (architectural trigger detected)
77
-
78
- 2. Base Genie recognizes need for team consultation
79
-
80
- 3. Invoke team (e.g., tech-council)
81
-
82
- 4. Team routes to personas in parallel
83
-
84
- 5. Personas analyze + provide individual recommendations
85
-
86
- 6. Team synthesizes + votes (2/3 approval required)
87
-
88
- 7. Team writes evidence to own folder
89
-
90
- 8. Base Genie presents recommendation to user
91
-
92
- 9. If approved → delegate to implementor agent
93
- ```
94
-
95
- ### MCP Invocation
96
-
97
- ```typescript
98
- // Invoke tech-council
99
- mcp__genie__run({
100
- agent: "tech-council",
101
- name: "architectural-decision-[topic]",
102
- prompt: `Evaluate this architectural decision:
103
-
104
- Context: [current state]
105
- Proposal: [what user wants to do]
106
- Constraints: [performance/compatibility/etc.]
107
- Question: [specific decision to make]
108
-
109
- Please provide:
110
- 1. Individual persona analysis (nayr, oettam, jt)
111
- 2. Consensus vote (approve/reject/modify)
112
- 3. Recommendation with rationale
113
- 4. Implementation guidance (if approved)
114
- `
115
- })
116
- ```
117
-
118
- ---
119
-
120
- ## 📋 Evidence Requirements
121
-
122
- ### What Teams Must Document
123
-
124
- **Every consultation must produce:**
125
-
126
- 1. **Consultation Record** (`.genie/teams/[team]/evidence/[date]-[topic].md`)
127
- - Original request
128
- - Context provided
129
- - Constraints identified
130
-
131
- 2. **Persona Responses** (inline or separate)
132
- - nayr: Assumption challenges
133
- - oettam: Performance analysis
134
- - jt: Simplicity assessment
135
-
136
- 3. **Voting Record**
137
- - Individual votes (approve/reject/abstain)
138
- - Vote rationale
139
- - Consensus threshold met? (2/3)
140
-
141
- 4. **Final Recommendation**
142
- - Approved/rejected/modified proposal
143
- - Rationale for decision
144
- - Implementation guidance
145
- - Risk assessment
146
-
147
- ### Evidence Storage Location
148
-
149
- ```
150
- .genie/teams/tech-council/
151
- ├── evidence/
152
- │ ├── 20251019-forge-executor-architecture.md
153
- │ ├── 20251020-session-storage-refactor.md
154
- │ └── 20251021-mcp-protocol-version.md
155
- └── reports/
156
- └── monthly-consultation-summary-202510.md
157
- ```
158
-
159
- ---
160
-
161
- ## 🎭 Persona Characteristics
162
-
163
- ### Tech-Council Personas
164
-
165
- **nayr (Ryan Dahl inspiration):**
166
- - **Style:** Questioning, foundational thinking
167
- - **Focus:** "Why are we doing this? Is there a simpler way?"
168
- - **Triggers:** Assumptions, complexity, dependencies
169
- - **Example:** "Do we really need this abstraction? What problem does it solve?"
170
-
171
- **oettam (Matteo Collina inspiration):**
172
- - **Style:** Performance-obsessed, benchmark-driven
173
- - **Focus:** "What's the impact on throughput/latency?"
174
- - **Triggers:** Loops, I/O operations, memory allocation
175
- - **Example:** "Show me the benchmarks. What's the p99 latency?"
176
-
177
- **jt (TJ Holowaychuk inspiration):**
178
- - **Style:** Terse, opinionated, simplicity-focused
179
- - **Focus:** "Can we delete code instead of adding it?"
180
- - **Triggers:** Bloat, over-engineering, unnecessary features
181
- - **Example:** "No. Just use [simpler approach]. Ship it."
182
-
183
- ---
184
-
185
- ## 🔒 Permissions & Constraints
186
-
187
- ### What Teams CAN Do
188
-
189
- ✅ **Read entire codebase** - Full analysis capability
190
- ✅ **Use all spells** - Evidence-based thinking, routing, etc.
191
- ✅ **Write to own folder** - Evidence, reports, recommendations
192
- ✅ **Multi-turn sessions** - Resume for clarification
193
- ✅ **Parallel persona invocation** - All three at once
194
-
195
- ### What Teams CANNOT Do
196
-
197
- ❌ **Execute code changes** - No Edit/Write to codebase
198
- ❌ **Create branches** - No git operations
199
- ❌ **Run tests** - No execution environment
200
- ❌ **Deploy/publish** - No release operations
201
- ❌ **Delegate to agents** - Advisory only, not orchestrators
202
-
203
- ---
204
-
205
- ## 🎯 Voting Mechanism
206
-
207
- ### 2/3 Approval Threshold
208
-
209
- **Required for approval:** At least 2 of 3 personas vote "approve"
210
-
211
- **Vote options:**
212
- - **Approve** - Recommended as proposed
213
- - **Approve with modifications** - Recommended with changes
214
- - **Reject** - Not recommended, provide alternative
215
- - **Abstain** - Insufficient information to decide
216
-
217
- **Examples:**
218
-
219
- ```
220
- Proposal: Replace JSON.parse with faster alternative
221
- - nayr: Approve (reduces dependency on slow native method)
222
- - oettam: Approve (benchmarks show 2x improvement)
223
- - jt: Reject (added complexity not worth 2x gain)
224
- Result: 2/3 approve → APPROVED (with note about jt's concern)
225
- ```
226
-
227
- ```
228
- Proposal: Add new abstraction layer
229
- - nayr: Reject (solving hypothetical future problem)
230
- - oettam: Abstain (no performance data)
231
- - jt: Reject (more code to maintain)
232
- Result: 0/3 approve → REJECTED
233
- ```
234
-
235
- ---
236
-
237
- ## 🧪 Testing Team Consultations
238
-
239
- ### Validation Scenarios
240
-
241
- **Scenario 1: Clear approval**
242
- - Request: "Should we use Bun instead of Node for performance?"
243
- - Expected: oettam approves (benchmarks), nayr approves (less complexity), jt approves (modern)
244
-
245
- **Scenario 2: Split decision**
246
- - Request: "Add caching layer to reduce database calls"
247
- - Expected: oettam approves (performance), nayr questions (premature optimization?), jt rejects (more code)
248
-
249
- **Scenario 3: Clear rejection**
250
- - Request: "Add ORM framework to simplify queries"
251
- - Expected: nayr rejects (adds dependency), oettam rejects (performance overhead), jt rejects (SQL is fine)
252
-
253
- ---
254
-
255
- ## 📊 Success Metrics
256
-
257
- **Team consultations are effective when:**
258
- - ✅ Recommendations are actionable
259
- - ✅ Rationale is evidence-based
260
- - ✅ Voting reflects genuine analysis (not rubber-stamping)
261
- - ✅ Evidence trail supports future decisions
262
- - ✅ Users trust team recommendations
263
-
264
- **Red flags indicating problems:**
265
- - ❌ All votes are unanimous (personas not differentiated)
266
- - ❌ Recommendations lack specifics
267
- - ❌ Evidence not stored properly
268
- - ❌ Users bypass team consultations
269
-
270
- ---
271
-
272
- ## 🔗 Integration with Other Spells
273
-
274
- **Related spells:**
275
- - `@.genie/spells/routing-decision-matrix.md` - Add team triggers
276
- - `@.genie/spells/investigate-before-commit.md` - Framework for analysis
277
- - `@.genie/spells/know-yourself.md` - Self-awareness of teams capability
278
-
279
- **Update routing matrix:**
280
- Add tech-council as routing target for architectural triggers
281
-
282
- ---
283
-
284
- **Remember:** Teams advise, agents execute. Always get consensus before major architectural changes.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Tool Requirements
3
- description: Validate with pnpm run check and cargo test --workspace
4
- genie:
5
- executor: [CLAUDE_CODE, CODEX, OPENCODE]
6
- forge:
7
- CLAUDE_CODE:
8
- model: sonnet
9
- CODEX: {}
10
- OPENCODE: {}
11
- ---
12
-
13
- # Tool Requirements
14
-
15
- **Primary stack:** Rust + Node/TS; metrics/test hooks captured in wishes/forge plans.
16
-
17
- **Success criteria:**
18
- ✅ Use `pnpm run check` and `cargo test --workspace` for validation.
19
- ✅ Generate types/metrics via documented scripts where applicable.
20
- ✅ Python/uv only if introduced and documented.
@@ -1,154 +0,0 @@
1
- ---
2
- name: Triad Maintenance Protocol *(CRITICAL - AUTOMATIC ENFORCEMENT)*
3
- description: Validate state files before commits via git pre-commit hooks
4
- genie:
5
- executor: [CLAUDE_CODE, CODEX, OPENCODE]
6
- forge:
7
- CLAUDE_CODE:
8
- model: sonnet
9
- CODEX: {}
10
- OPENCODE: {}
11
- ---
12
-
13
- # Triad Maintenance Protocol *(CRITICAL - AUTOMATIC ENFORCEMENT)*
14
-
15
- **NEVER** claim task completion without validating triad files. Git pre-commit hook **AUTOMATICALLY BLOCKS** commits with stale STATE.md.
16
-
17
- **Root cause:** Files load automatically via @ in CLAUDE.md, but updates happened ad-hoc (forgotten). Now **ENFORCED** by git.
18
-
19
- ## Architecture: Shared vs Per-User
20
-
21
- **Shared (committed, always validated):**
22
- - `.genie/STATE.md` - Repository health, version, production status
23
- - Everyone sees same state
24
- - Pre-commit ALWAYS validates
25
-
26
- **Per-user (gitignored, not validated):**
27
- - `.genie/USERCONTEXT.md` - Your preferences (from USERCONTEXT.template.md)
28
- - Todo - Task tracking (session-based)
29
- - Each developer maintains their own
30
- - Pre-commit does NOT validate (user-specific)
31
-
32
- ## Natural Context Acquisition
33
-
34
- - Hook teaches setup on first commit
35
- - Hook validates gitignored files (doesn't commit them)
36
- - Clear setup instructions in error messages
37
- - Files load automatically via @ in CLAUDE.md
38
-
39
- ## Automatic Enforcement
40
-
41
- - ✅ Pre-commit hook runs `.genie/scripts/check-triad.sh` before EVERY commit
42
- - ✅ Cannot commit with stale STATE.md (git rejects)
43
- - ✅ Self-validating metadata in STATE.md
44
- - ✅ Clear error messages with setup instructions
45
-
46
- ## Forbidden Patterns
47
-
48
- - ❌ Completing task without updating Todo status
49
- - ❌ Publishing release without updating STATE.md version info
50
- - ❌ Saying "I'm learning" without invoking learn agent to document
51
- - ❌ Claiming "done" when STATE.md is stale
52
-
53
- ## File Details
54
-
55
- **STATE.md (shared repository state):**
56
- - **Committed**: Yes (shared across team)
57
- - **Validated**: Always (pre-commit blocks if stale)
58
- - Update when: Version changes, major feature commit, release published
59
- - Metadata tracks: last_version, last_commit, last_updated
60
- - Validation: version matches package.json, not stale (< 5 commits behind)
61
-
62
- **Todo (per-user task tracking):**
63
- - **Committed**: No (session-based)
64
- - **Validated**: Not validated (session-specific)
65
- - Update when: Task starts (pending → in progress) or completes (in progress → complete)
66
- - Before claiming "done" in chat, verify Todo status updated
67
- - Used during active sessions only
68
-
69
- **USERCONTEXT.md (per-user preferences):**
70
- - **Committed**: No (gitignored)
71
- - **Validated**: Not validated (free-form per user)
72
- - Update when: Significant behavioral patterns emerge (rarely)
73
- - Pattern documented with evidence from teaching session
74
- - Initialize: `cp .genie/USERCONTEXT.template.md .genie/USERCONTEXT.md`
75
-
76
- ## Automatic Validation System
77
-
78
- **Files:**
79
- - `.genie/scripts/check-triad.sh` - Self-validating checker
80
- - `.git/hooks/pre-commit` - Automatic enforcement
81
- - STATE.md - Embedded validation metadata
82
-
83
- **How it works:**
84
- 1. Before commit, pre-commit hook runs check-triad.sh
85
- 2. Script extracts validation commands from file metadata
86
- 3. Checks version match (STATE.md vs package.json)
87
- 4. Validates staleness (< 5 commits behind HEAD)
88
- 5. If ANY check fails → commit BLOCKED with clear error
89
- 6. Fix STATE.md, stage it, retry commit
90
-
91
- ## Example Errors
92
-
93
- **Version mismatch (STATE.md):**
94
- ```
95
- ❌ version_match failed (metadata: 2.4.0-rc.7, package.json: 999.0.0)
96
-
97
- Fix with:
98
- 1. Update .genie/STATE.md (version, commits)
99
- 2. Mark tasks complete in Todo
100
- 3. Run: git add .genie/STATE.md
101
- 4. Retry commit
102
- ```
103
-
104
- **First time setup (colleague clones repo):**
105
- ```
106
- ℹ️ TODO.md not found (optional per-user file)
107
- Initialize: cp .genie/TODO.template.md .genie/TODO.md
108
-
109
- ✅ Triad validation passed
110
- ```
111
-
112
- ## Completion Checklist (AUTOMATED BY GIT)
113
-
114
- - Git enforces STATE.md/TODO.md freshness automatically
115
- - Pre-commit hook cannot be bypassed (except `--no-verify` emergency)
116
- - No memory required - system enforces correctness
117
-
118
- ## Why This Works
119
-
120
- - ✅ Automatic: Git enforces, not Claude memory
121
- - ✅ Catches mistakes: Version mismatches, stale files detected
122
- - ✅ Self-correcting: Clear error messages guide fixes
123
- - ✅ Low overhead: Only runs on commit attempt
124
- - ✅ Definite: Can't commit without passing validation
125
-
126
- ## Manual Validation (for testing)
127
-
128
- ```bash
129
- bash .genie/scripts/check-triad.sh
130
- # Checks STATE.md and TODO.md without committing
131
- ```
132
-
133
- ## Bypass (emergency only)
134
-
135
- ```bash
136
- git commit --no-verify
137
- # Skips all git hooks - USE SPARINGLY
138
- ```
139
-
140
- ## Context
141
-
142
- - 2025-10-17: Discovered triad files loaded but never maintained
143
- - Felipe demanded "definite solution" - result is automatic enforcement
144
- - Architecture evolved: shared STATE.md (committed) vs per-user TODO.md/USERCONTEXT.md (gitignored)
145
- - Hook validates ALL files (even gitignored) but only commits shared state
146
- - Natural context acquisition: hook teaches setup, validates optionally
147
-
148
- ## Your Colleague's Experience
149
-
150
- 1. Clones repo → gets STATE.md automatically
151
- 2. First commit → hook shows "Initialize: cp .genie/TODO.template.md .genie/TODO.md"
152
- 3. Creates TODO.md → hook validates it going forward
153
- 4. Each developer has their own work queue
154
- 5. Everyone shares same STATE.md