pgserve 0.1.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 (158) hide show
  1. package/.genie/AGENTS.md +13 -0
  2. package/.genie/agents/README.md +110 -0
  3. package/.genie/agents/analyze.md +176 -0
  4. package/.genie/agents/forge.md +290 -0
  5. package/.genie/agents/garbage-cleaner.md +324 -0
  6. package/.genie/agents/garbage-collector.md +596 -0
  7. package/.genie/agents/github-issue-gc.md +618 -0
  8. package/.genie/agents/review.md +380 -0
  9. package/.genie/agents/semantic-analyzer/find-duplicates.md +90 -0
  10. package/.genie/agents/semantic-analyzer/find-orphans.md +99 -0
  11. package/.genie/agents/semantic-analyzer.md +101 -0
  12. package/.genie/agents/update.md +182 -0
  13. package/.genie/agents/wish.md +357 -0
  14. package/.genie/code/AGENTS.md +692 -0
  15. package/.genie/code/agents/audit/risk.md +173 -0
  16. package/.genie/code/agents/audit/security.md +189 -0
  17. package/.genie/code/agents/audit.md +145 -0
  18. package/.genie/code/agents/challenge.md +230 -0
  19. package/.genie/code/agents/change-reviewer.md +295 -0
  20. package/.genie/code/agents/code-garbage-collector.md +425 -0
  21. package/.genie/code/agents/code-quality.md +410 -0
  22. package/.genie/code/agents/commit-suggester.md +255 -0
  23. package/.genie/code/agents/commit.md +124 -0
  24. package/.genie/code/agents/consensus.md +204 -0
  25. package/.genie/code/agents/daily-standup.md +722 -0
  26. package/.genie/code/agents/docgen.md +48 -0
  27. package/.genie/code/agents/explore.md +79 -0
  28. package/.genie/code/agents/fix.md +100 -0
  29. package/.genie/code/agents/git/commit-advisory.md +219 -0
  30. package/.genie/code/agents/git/workflows/issue.md +244 -0
  31. package/.genie/code/agents/git/workflows/pr.md +179 -0
  32. package/.genie/code/agents/git/workflows/release.md +460 -0
  33. package/.genie/code/agents/git/workflows/report.md +342 -0
  34. package/.genie/code/agents/git.md +432 -0
  35. package/.genie/code/agents/implementor.md +161 -0
  36. package/.genie/code/agents/install.md +515 -0
  37. package/.genie/code/agents/issue-creator.md +344 -0
  38. package/.genie/code/agents/polish.md +116 -0
  39. package/.genie/code/agents/qa.md +653 -0
  40. package/.genie/code/agents/refactor.md +294 -0
  41. package/.genie/code/agents/release.md +1129 -0
  42. package/.genie/code/agents/roadmap.md +885 -0
  43. package/.genie/code/agents/tests.md +557 -0
  44. package/.genie/code/agents/tracer.md +50 -0
  45. package/.genie/code/agents/update/upstream-update.md +85 -0
  46. package/.genie/code/agents/update/versions/generic-update.md +305 -0
  47. package/.genie/code/agents/vibe.md +1317 -0
  48. package/.genie/code/spells/agent-configuration.md +58 -0
  49. package/.genie/code/spells/automated-rc-publishing.md +106 -0
  50. package/.genie/code/spells/branch-tracker-guidance.md +28 -0
  51. package/.genie/code/spells/debug.md +320 -0
  52. package/.genie/code/spells/emoji-naming-convention.md +303 -0
  53. package/.genie/code/spells/evidence-storage.md +26 -0
  54. package/.genie/code/spells/file-naming-rules.md +35 -0
  55. package/.genie/code/spells/forge-code-blueprints.md +195 -0
  56. package/.genie/code/spells/genie-integration.md +153 -0
  57. package/.genie/code/spells/publishing-protocol.md +61 -0
  58. package/.genie/code/spells/team-consultation-protocol.md +284 -0
  59. package/.genie/code/spells/tool-requirements.md +20 -0
  60. package/.genie/code/spells/triad-maintenance-protocol.md +154 -0
  61. package/.genie/code/teams/tech-council/council.md +328 -0
  62. package/.genie/code/teams/tech-council/jt.md +352 -0
  63. package/.genie/code/teams/tech-council/nayr.md +305 -0
  64. package/.genie/code/teams/tech-council/oettam.md +375 -0
  65. package/.genie/neurons/README.md +193 -0
  66. package/.genie/neurons/forge.md +106 -0
  67. package/.genie/neurons/genie.md +63 -0
  68. package/.genie/neurons/review.md +106 -0
  69. package/.genie/neurons/wish.md +104 -0
  70. package/.genie/product/README.md +20 -0
  71. package/.genie/product/cli-automation.md +359 -0
  72. package/.genie/product/environment.md +60 -0
  73. package/.genie/product/mission.md +60 -0
  74. package/.genie/product/roadmap.md +44 -0
  75. package/.genie/product/tech-stack.md +34 -0
  76. package/.genie/product/templates/context-template.md +218 -0
  77. package/.genie/product/templates/qa-done-report-template.md +68 -0
  78. package/.genie/product/templates/review-report-template.md +89 -0
  79. package/.genie/product/templates/wish-template.md +120 -0
  80. package/.genie/scripts/helpers/analyze-commit.js +195 -0
  81. package/.genie/scripts/helpers/bullet-counter.js +194 -0
  82. package/.genie/scripts/helpers/bullet-find.js +289 -0
  83. package/.genie/scripts/helpers/bullet-id.js +244 -0
  84. package/.genie/scripts/helpers/check-secrets.js +237 -0
  85. package/.genie/scripts/helpers/count-tokens.js +200 -0
  86. package/.genie/scripts/helpers/create-frontmatter.js +456 -0
  87. package/.genie/scripts/helpers/detect-markers.js +293 -0
  88. package/.genie/scripts/helpers/detect-todos.js +267 -0
  89. package/.genie/scripts/helpers/detect-unlabeled-blocks.js +135 -0
  90. package/.genie/scripts/helpers/embeddings.js +344 -0
  91. package/.genie/scripts/helpers/find-empty-sections.js +158 -0
  92. package/.genie/scripts/helpers/index.js +319 -0
  93. package/.genie/scripts/helpers/validate-frontmatter.js +578 -0
  94. package/.genie/scripts/helpers/validate-links.js +207 -0
  95. package/.genie/scripts/helpers/validate-paths.js +373 -0
  96. package/.genie/spells/README.md +9 -0
  97. package/.genie/spells/ace-protocol.md +118 -0
  98. package/.genie/spells/ask-one-at-a-time.md +175 -0
  99. package/.genie/spells/backup-analyzer.md +542 -0
  100. package/.genie/spells/blocker.md +12 -0
  101. package/.genie/spells/break-things-move-fast.md +56 -0
  102. package/.genie/spells/context-candidates.md +72 -0
  103. package/.genie/spells/context-critic.md +51 -0
  104. package/.genie/spells/defer-to-expertise.md +278 -0
  105. package/.genie/spells/delegate-dont-do.md +292 -0
  106. package/.genie/spells/error-investigation-protocol.md +328 -0
  107. package/.genie/spells/evidence-based-completion.md +273 -0
  108. package/.genie/spells/experiment.md +65 -0
  109. package/.genie/spells/file-creation-protocol.md +229 -0
  110. package/.genie/spells/forge-integration.md +281 -0
  111. package/.genie/spells/forge-orchestration.md +514 -0
  112. package/.genie/spells/gather-context.md +18 -0
  113. package/.genie/spells/global-health-check.md +34 -0
  114. package/.genie/spells/global-noop-roundtrip.md +25 -0
  115. package/.genie/spells/install-genie.md +1232 -0
  116. package/.genie/spells/install.md +82 -0
  117. package/.genie/spells/investigate-before-commit.md +112 -0
  118. package/.genie/spells/know-yourself.md +288 -0
  119. package/.genie/spells/learn.md +828 -0
  120. package/.genie/spells/mcp-diagnostic-protocol.md +246 -0
  121. package/.genie/spells/mcp-first.md +124 -0
  122. package/.genie/spells/multi-step-execution.md +67 -0
  123. package/.genie/spells/orchestration-boundary-protocol.md +256 -0
  124. package/.genie/spells/orchestrator-not-implementor.md +189 -0
  125. package/.genie/spells/prompt.md +746 -0
  126. package/.genie/spells/reflect.md +404 -0
  127. package/.genie/spells/routing-decision-matrix.md +368 -0
  128. package/.genie/spells/run-in-parallel.md +12 -0
  129. package/.genie/spells/session-state-updater-example.md +196 -0
  130. package/.genie/spells/session-state-updater.md +220 -0
  131. package/.genie/spells/track-long-running-tasks.md +133 -0
  132. package/.genie/spells/troubleshoot-infrastructure.md +176 -0
  133. package/.genie/spells/upgrade-genie.md +415 -0
  134. package/.genie/spells/url-presentation-protocol.md +301 -0
  135. package/.genie/spells/wish-initiation.md +158 -0
  136. package/.genie/spells/wish-issue-linkage.md +410 -0
  137. package/.genie/spells/wish-lifecycle.md +100 -0
  138. package/.genie/state/provider-status.json +3 -0
  139. package/.genie/state/version.json +16 -0
  140. package/AGENTS.md +422 -0
  141. package/CLAUDE.md +1 -0
  142. package/LICENSE +21 -0
  143. package/Makefile +235 -0
  144. package/README.md +323 -0
  145. package/bin/pglite-server.js +457 -0
  146. package/ecosystem.config.cjs +23 -0
  147. package/examples/multi-tenant-demo.js +104 -0
  148. package/package.json +47 -0
  149. package/src/detector.js +105 -0
  150. package/src/index.js +177 -0
  151. package/src/pool.js +320 -0
  152. package/src/ports.js +114 -0
  153. package/src/protocol.js +216 -0
  154. package/src/registry.js +134 -0
  155. package/src/router.js +289 -0
  156. package/src/server.js +265 -0
  157. package/tests/benchmarks/runner.js +489 -0
  158. package/tests/multi-tenant.test.js +201 -0
@@ -0,0 +1,153 @@
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)**
@@ -0,0 +1,61 @@
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.
@@ -0,0 +1,284 @@
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.
@@ -0,0 +1,20 @@
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.
@@ -0,0 +1,154 @@
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