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.
- package/CHANGELOG.md +96 -0
- package/README.md +105 -1
- package/bin/autopg-wrapper.cjs +16 -0
- package/bin/pgserve-wrapper.cjs +32 -6
- package/bin/postgres-server.js +56 -0
- package/console/README.md +131 -0
- package/console/api.js +173 -0
- package/console/app.jsx +483 -0
- package/console/colors_and_type.css +227 -0
- package/console/components.jsx +167 -0
- package/console/console.css +1666 -0
- package/console/data.jsx +350 -0
- package/console/index.html +31 -0
- package/console/screens/databases.jsx +5 -0
- package/console/screens/health.jsx +5 -0
- package/console/screens/ingress.jsx +5 -0
- package/console/screens/optimizer.jsx +5 -0
- package/console/screens/rlm-sim.jsx +5 -0
- package/console/screens/rlm-trace.jsx +5 -0
- package/console/screens/security.jsx +5 -0
- package/console/screens/settings.jsx +611 -0
- package/console/screens/sql.jsx +5 -0
- package/console/screens/sync.jsx +5 -0
- package/console/screens/tables.jsx +5 -0
- package/console/tweaks-panel.jsx +425 -0
- package/package.json +14 -2
- package/scripts/postinstall.cjs +60 -0
- package/src/cli-config.cjs +310 -0
- package/src/cli-install.cjs +112 -11
- package/src/cli-restart.cjs +228 -0
- package/src/cli-ui.cjs +580 -0
- package/src/cluster.js +43 -38
- package/src/postgres.js +141 -19
- package/src/settings-loader.cjs +235 -0
- package/src/settings-migrate.cjs +212 -0
- package/src/settings-pg-args.cjs +146 -0
- package/src/settings-schema.cjs +422 -0
- package/src/settings-validator.cjs +416 -0
- package/src/settings-writer.cjs +288 -0
- package/src/upgrade/index.js +65 -0
- package/src/upgrade/runner.js +23 -0
- package/src/upgrade/steps/binary-cache-flush.js +67 -0
- package/src/upgrade/steps/consumer-signal.js +40 -0
- package/src/upgrade/steps/env-refresh.js +89 -0
- package/src/upgrade/steps/health-validate.js +53 -0
- package/src/upgrade/steps/plpgsql-resolve.js +66 -0
- package/src/upgrade/steps/port-reconcile.js +52 -0
- package/.claude/context/windows-debug.md +0 -119
- package/.genie/AGENTS.md +0 -15
- package/.genie/agents/README.md +0 -110
- package/.genie/agents/analyze.md +0 -176
- package/.genie/agents/forge.md +0 -290
- package/.genie/agents/garbage-cleaner.md +0 -324
- package/.genie/agents/garbage-collector.md +0 -596
- package/.genie/agents/github-issue-gc.md +0 -618
- package/.genie/agents/review.md +0 -380
- package/.genie/agents/semantic-analyzer/find-duplicates.md +0 -90
- package/.genie/agents/semantic-analyzer/find-orphans.md +0 -99
- package/.genie/agents/semantic-analyzer.md +0 -101
- package/.genie/agents/update.md +0 -182
- package/.genie/agents/wish.md +0 -357
- package/.genie/brainstorms/pgserve-v2/DESIGN.md +0 -174
- package/.genie/code/AGENTS.md +0 -694
- package/.genie/code/agents/audit/risk.md +0 -173
- package/.genie/code/agents/audit/security.md +0 -189
- package/.genie/code/agents/audit.md +0 -145
- package/.genie/code/agents/challenge.md +0 -230
- package/.genie/code/agents/change-reviewer.md +0 -295
- package/.genie/code/agents/code-garbage-collector.md +0 -425
- package/.genie/code/agents/code-quality.md +0 -410
- package/.genie/code/agents/commit-suggester.md +0 -255
- package/.genie/code/agents/commit.md +0 -124
- package/.genie/code/agents/consensus.md +0 -204
- package/.genie/code/agents/daily-standup.md +0 -722
- package/.genie/code/agents/docgen.md +0 -48
- package/.genie/code/agents/explore.md +0 -79
- package/.genie/code/agents/fix.md +0 -100
- package/.genie/code/agents/git/commit-advisory.md +0 -219
- package/.genie/code/agents/git/workflows/issue.md +0 -244
- package/.genie/code/agents/git/workflows/pr.md +0 -179
- package/.genie/code/agents/git/workflows/release.md +0 -460
- package/.genie/code/agents/git/workflows/report.md +0 -342
- package/.genie/code/agents/git.md +0 -432
- package/.genie/code/agents/implementor.md +0 -161
- package/.genie/code/agents/install.md +0 -515
- package/.genie/code/agents/issue-creator.md +0 -344
- package/.genie/code/agents/polish.md +0 -116
- package/.genie/code/agents/qa.md +0 -653
- package/.genie/code/agents/refactor.md +0 -294
- package/.genie/code/agents/release.md +0 -1129
- package/.genie/code/agents/roadmap.md +0 -885
- package/.genie/code/agents/tests.md +0 -557
- package/.genie/code/agents/tracer.md +0 -50
- package/.genie/code/agents/update/upstream-update.md +0 -85
- package/.genie/code/agents/update/versions/generic-update.md +0 -305
- package/.genie/code/agents/vibe.md +0 -1317
- package/.genie/code/spells/agent-configuration.md +0 -58
- package/.genie/code/spells/automated-rc-publishing.md +0 -106
- package/.genie/code/spells/branch-tracker-guidance.md +0 -28
- package/.genie/code/spells/debug.md +0 -320
- package/.genie/code/spells/emoji-naming-convention.md +0 -303
- package/.genie/code/spells/evidence-storage.md +0 -26
- package/.genie/code/spells/file-naming-rules.md +0 -35
- package/.genie/code/spells/forge-code-blueprints.md +0 -195
- package/.genie/code/spells/genie-integration.md +0 -153
- package/.genie/code/spells/publishing-protocol.md +0 -61
- package/.genie/code/spells/team-consultation-protocol.md +0 -284
- package/.genie/code/spells/tool-requirements.md +0 -20
- package/.genie/code/spells/triad-maintenance-protocol.md +0 -154
- package/.genie/code/teams/tech-council/council.md +0 -328
- package/.genie/code/teams/tech-council/jt.md +0 -352
- package/.genie/code/teams/tech-council/nayr.md +0 -305
- package/.genie/code/teams/tech-council/oettam.md +0 -375
- package/.genie/neurons/README.md +0 -193
- package/.genie/neurons/forge.md +0 -106
- package/.genie/neurons/genie.md +0 -63
- package/.genie/neurons/review.md +0 -106
- package/.genie/neurons/wish.md +0 -104
- package/.genie/product/README.md +0 -20
- package/.genie/product/cli-automation.md +0 -359
- package/.genie/product/environment.md +0 -60
- package/.genie/product/mission.md +0 -60
- package/.genie/product/roadmap.md +0 -44
- package/.genie/product/tech-stack.md +0 -34
- package/.genie/product/templates/context-template.md +0 -218
- package/.genie/product/templates/qa-done-report-template.md +0 -68
- package/.genie/product/templates/review-report-template.md +0 -89
- package/.genie/product/templates/wish-template.md +0 -120
- package/.genie/scripts/helpers/analyze-commit.js +0 -195
- package/.genie/scripts/helpers/bullet-counter.js +0 -194
- package/.genie/scripts/helpers/bullet-find.js +0 -289
- package/.genie/scripts/helpers/bullet-id.js +0 -244
- package/.genie/scripts/helpers/check-secrets.js +0 -237
- package/.genie/scripts/helpers/count-tokens.js +0 -200
- package/.genie/scripts/helpers/create-frontmatter.js +0 -456
- package/.genie/scripts/helpers/detect-markers.js +0 -293
- package/.genie/scripts/helpers/detect-todos.js +0 -267
- package/.genie/scripts/helpers/detect-unlabeled-blocks.js +0 -135
- package/.genie/scripts/helpers/embeddings.js +0 -344
- package/.genie/scripts/helpers/find-empty-sections.js +0 -158
- package/.genie/scripts/helpers/index.js +0 -319
- package/.genie/scripts/helpers/validate-frontmatter.js +0 -578
- package/.genie/scripts/helpers/validate-links.js +0 -207
- package/.genie/scripts/helpers/validate-paths.js +0 -373
- package/.genie/spells/README.md +0 -9
- package/.genie/spells/ace-protocol.md +0 -118
- package/.genie/spells/ask-one-at-a-time.md +0 -175
- package/.genie/spells/backup-analyzer.md +0 -542
- package/.genie/spells/blocker.md +0 -12
- package/.genie/spells/break-things-move-fast.md +0 -56
- package/.genie/spells/context-candidates.md +0 -72
- package/.genie/spells/context-critic.md +0 -51
- package/.genie/spells/defer-to-expertise.md +0 -278
- package/.genie/spells/delegate-dont-do.md +0 -292
- package/.genie/spells/error-investigation-protocol.md +0 -328
- package/.genie/spells/evidence-based-completion.md +0 -273
- package/.genie/spells/experiment.md +0 -65
- package/.genie/spells/file-creation-protocol.md +0 -229
- package/.genie/spells/forge-integration.md +0 -281
- package/.genie/spells/forge-orchestration.md +0 -514
- package/.genie/spells/gather-context.md +0 -18
- package/.genie/spells/global-health-check.md +0 -34
- package/.genie/spells/global-noop-roundtrip.md +0 -25
- package/.genie/spells/install-genie.md +0 -1232
- package/.genie/spells/install.md +0 -82
- package/.genie/spells/investigate-before-commit.md +0 -112
- package/.genie/spells/know-yourself.md +0 -288
- package/.genie/spells/learn.md +0 -828
- package/.genie/spells/mcp-diagnostic-protocol.md +0 -246
- package/.genie/spells/mcp-first.md +0 -124
- package/.genie/spells/multi-step-execution.md +0 -67
- package/.genie/spells/orchestration-boundary-protocol.md +0 -256
- package/.genie/spells/orchestrator-not-implementor.md +0 -189
- package/.genie/spells/prompt.md +0 -746
- package/.genie/spells/reflect.md +0 -404
- package/.genie/spells/routing-decision-matrix.md +0 -368
- package/.genie/spells/run-in-parallel.md +0 -12
- package/.genie/spells/session-state-updater-example.md +0 -196
- package/.genie/spells/session-state-updater.md +0 -220
- package/.genie/spells/track-long-running-tasks.md +0 -133
- package/.genie/spells/troubleshoot-infrastructure.md +0 -176
- package/.genie/spells/upgrade-genie.md +0 -415
- package/.genie/spells/url-presentation-protocol.md +0 -301
- package/.genie/spells/wish-initiation.md +0 -158
- package/.genie/spells/wish-issue-linkage.md +0 -410
- package/.genie/spells/wish-lifecycle.md +0 -100
- package/.genie/state/provider-status.json +0 -3
- package/.genie/state/version.json +0 -16
- package/.genie/wishes/canonical-pgserve-pm2-supervision/WISH.md +0 -290
- package/.genie/wishes/pgserve-v2/BRIEF-from-genie-pgserve.md +0 -99
- package/.genie/wishes/pgserve-v2/WISH.md +0 -442
- package/.genie/wishes/release-system-genie-pattern/WISH.md +0 -268
- package/.genie/wishes/release-system-genie-pattern/validation.md +0 -205
- package/.gitguardian.yaml +0 -29
- package/.gitguardianignore +0 -16
- package/.github/workflows/ci.yml +0 -122
- package/.github/workflows/release.yml +0 -289
- package/.github/workflows/version.yml +0 -228
- package/.husky/pre-commit +0 -2
- package/AGENTS.md +0 -433
- package/CLAUDE.md +0 -1
- package/Makefile +0 -285
- package/assets/icon.ico +0 -0
- package/bun.lock +0 -435
- package/bunfig.toml +0 -28
- package/ecosystem.config.cjs +0 -23
- package/eslint.config.js +0 -63
- package/examples/multi-tenant-demo.js +0 -104
- package/install.sh +0 -123
- package/knip.json +0 -9
- package/tests/audit.test.js +0 -189
- package/tests/backpressure.test.js +0 -167
- package/tests/benchmarks/runner.js +0 -1197
- package/tests/benchmarks/vector-generator.js +0 -368
- package/tests/cli-install.test.js +0 -322
- package/tests/control-db.test.js +0 -285
- package/tests/daemon-args.test.js +0 -86
- package/tests/daemon-control.test.js +0 -171
- package/tests/daemon-fingerprint-integration.test.js +0 -111
- package/tests/daemon-pr24-regression.test.js +0 -198
- package/tests/fingerprint.test.js +0 -263
- package/tests/fixtures/240-orphan-seed.sql +0 -30
- package/tests/multi-tenant.test.js +0 -374
- package/tests/orphan-cleanup.test.js +0 -390
- package/tests/pg-version-regex.test.js +0 -129
- package/tests/quick-bench.js +0 -135
- package/tests/router-handshake-retry.test.js +0 -119
- package/tests/router-handshake-watchdog.test.js +0 -110
- package/tests/sdk.test.js +0 -71
- package/tests/stale-postmaster-pid.test.js +0 -85
- package/tests/stress-test.js +0 -439
- package/tests/sync-perf-test.js +0 -150
- package/tests/tcp-listen.test.js +0 -368
- package/tests/tenancy.test.js +0 -403
- package/tests/wrapper-supervision.test.js +0 -107
package/.genie/spells/blocker.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Blocker Protocol
|
|
3
|
-
description: Log blockers timestamped in wishes, wait for guidance before resuming
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Blocker Protocol
|
|
7
|
-
|
|
8
|
-
**When encountering blockers:**
|
|
9
|
-
|
|
10
|
-
1. Log the blocker directly in the wish (timestamped entry with findings and status).
|
|
11
|
-
2. Update the wish status log and notify stakeholders.
|
|
12
|
-
3. Resume only after guidance is updated.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: No Backwards Compatibility
|
|
3
|
-
description: Replace old behavior entirely, never preserve legacy features
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# No Backwards Compatibility
|
|
7
|
-
|
|
8
|
-
**Pattern:** This project does NOT support backwards compatibility or legacy features.
|
|
9
|
-
|
|
10
|
-
**When planning fixes or enhancements:**
|
|
11
|
-
- ❌ NEVER suggest `--metrics`, `--legacy`, `--compat` flags or similar
|
|
12
|
-
- ❌ NEVER propose preserving old behavior alongside new behavior
|
|
13
|
-
- ❌ NEVER say "we could add X flag for backwards compatibility"
|
|
14
|
-
- ✅ ALWAYS replace old behavior entirely with new behavior
|
|
15
|
-
- ✅ ALWAYS verify if suggested flags actually exist (search codebase first)
|
|
16
|
-
- ✅ ALWAYS simplify by removing obsolete code completely
|
|
17
|
-
|
|
18
|
-
**Example (WRONG):**
|
|
19
|
-
> "We could add a `--metrics` flag to preserve the old system metrics view for users who need it."
|
|
20
|
-
|
|
21
|
-
**Example (CORRECT):**
|
|
22
|
-
> "Replace the metrics view entirely with the conversation view. Remove all metrics-related code."
|
|
23
|
-
|
|
24
|
-
**Why:**
|
|
25
|
-
- This is a research preview / alpha project
|
|
26
|
-
- Breaking changes are acceptable and expected
|
|
27
|
-
- Cleaner codebase without legacy cruft
|
|
28
|
-
- Faster iteration without compatibility constraints
|
|
29
|
-
- **GENIE ONLY SELF-EVOLVES** - No dead code, no legacy sections, no "preserved for reference"
|
|
30
|
-
|
|
31
|
-
**Validation:**
|
|
32
|
-
- Before suggesting new flags, run: `grep -r "flag_name" .`
|
|
33
|
-
- If flag doesn't exist and solves backwards compat → it's hallucinated, remove it
|
|
34
|
-
|
|
35
|
-
## Critical Violation Pattern
|
|
36
|
-
|
|
37
|
-
**NEVER write "Legacy Content" or "Preserved for Reference" sections.**
|
|
38
|
-
|
|
39
|
-
**Anti-Pattern (WRONG):**
|
|
40
|
-
```markdown
|
|
41
|
-
## Migration Notice
|
|
42
|
-
This agent now delegates to spell...
|
|
43
|
-
|
|
44
|
-
## Legacy Content (Pre-Migration)
|
|
45
|
-
The content below is preserved for reference...
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Correct Pattern:**
|
|
49
|
-
```markdown
|
|
50
|
-
# Agent Name
|
|
51
|
-
[New behavior only, delete old content entirely]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**Why:** Genie self-evolves. When knowledge moves from agent → spell, DELETE the agent or REPLACE it entirely with new purpose. Never keep "legacy sections" or "backward compatibility" blocks.
|
|
55
|
-
|
|
56
|
-
**Evidence:** Learning session 2025-10-23 - Attempted to preserve debug agent content with "Legacy Content (Pre-Migration)" section. Violation. Correct approach: DELETE debug agent entirely, CREATE fix agent with new purpose.
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Context Candidates (ACE‑style)
|
|
3
|
-
description: Generate 2–3 task‑conditioned context variants, evaluate, and select under budget
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Context Candidates – Agentic Context Engineering Pattern
|
|
7
|
-
|
|
8
|
-
Goal: Before committing to a single context pack, propose 2–3 viable variants, evaluate quickly, and select the best tradeoff of quality, tokens, and latency.
|
|
9
|
-
|
|
10
|
-
When to use:
|
|
11
|
-
- New wish creation or major context refresh
|
|
12
|
-
- Uncertain retrieval scope or compression level
|
|
13
|
-
- Performance or token constraints are tight
|
|
14
|
-
|
|
15
|
-
Protocol:
|
|
16
|
-
1) Propose Candidates
|
|
17
|
-
- Build 2–3 variants with different knobs:
|
|
18
|
-
- Retrieval scope: narrow vs broad
|
|
19
|
-
- Compression: extractive vs abstractive
|
|
20
|
-
- Structure: order, grouping, summaries first vs full refs
|
|
21
|
-
- Cost target: low/med/high token budgets
|
|
22
|
-
- Output structure:
|
|
23
|
-
```
|
|
24
|
-
<context_candidates>
|
|
25
|
-
- id: C1
|
|
26
|
-
budget: low|med|high
|
|
27
|
-
ingredients: [@file, @doc, session, summary]
|
|
28
|
-
assembly: steps (filter/merge/summarize/reorder)
|
|
29
|
-
rationale: one line
|
|
30
|
-
- id: C2
|
|
31
|
-
...
|
|
32
|
-
- id: C3
|
|
33
|
-
...
|
|
34
|
-
</context_candidates>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
2) Evaluate Quickly
|
|
38
|
-
- Use cheap, task‑appropriate checks (pick 1–2):
|
|
39
|
-
- Answerability probe (can we answer the core question?)
|
|
40
|
-
- Coverage checklist (all required sections present?)
|
|
41
|
-
- Sanity metrics (duplication, staleness, token size)
|
|
42
|
-
- Score each as 0–1 on dimensions:
|
|
43
|
-
```
|
|
44
|
-
<context_scores>
|
|
45
|
-
- id: C1
|
|
46
|
-
quality: 0.0–1.0
|
|
47
|
-
cost: tokens or rough band (low/med/high)
|
|
48
|
-
latency: seconds (if known) or band
|
|
49
|
-
notes: brief observation
|
|
50
|
-
- id: C2 ...
|
|
51
|
-
</context_scores>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
3) Select and Commit
|
|
55
|
-
- Pick winner by quality first, then cost/latency
|
|
56
|
-
- Record selection + reason and proceed with the winner only
|
|
57
|
-
```
|
|
58
|
-
<selection>
|
|
59
|
-
winner: C2
|
|
60
|
-
reason: brief tradeoff statement
|
|
61
|
-
</selection>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
4) Record in Wish Markdown
|
|
65
|
-
- In the wish file's "Context Variants Considered" section, list candidates (C1/C2/C3), brief scores, and the selected winner with a one‑line reason.
|
|
66
|
-
|
|
67
|
-
Promotion (Durable Learning):
|
|
68
|
-
- If a recipe repeatedly wins for a task archetype, synthesize a tiny, reusable spell capturing the recipe (ingredients + assembly) and commit to `.genie/spells/`.
|
|
69
|
-
|
|
70
|
-
Notes:
|
|
71
|
-
- Keep candidate generation within a single neuron/agent attempt when possible.
|
|
72
|
-
- For heavier checks, create subtasks per candidate via `mcp__genie__create_subtask` and aggregate scores back.
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Context Critic (Lightweight Evaluator)
|
|
3
|
-
description: Score candidate contexts on answerability, coverage, and cost quickly
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Context Critic – Quick Scoring Heuristics
|
|
7
|
-
|
|
8
|
-
Purpose: Provide a cheap, fast evaluator to compare 2–3 context candidates before selection.
|
|
9
|
-
|
|
10
|
-
Scoring Dimensions (0.0–1.0 each):
|
|
11
|
-
- quality: Is the context sufficient to complete the immediate task? (answerability probe, clarity)
|
|
12
|
-
- coverage: Does it include required sections/files/constraints? (checklist tally)
|
|
13
|
-
- redundancy: Penalize duplication and irrelevant material
|
|
14
|
-
- cost: Normalized inverse token estimate (lower tokens → higher score)
|
|
15
|
-
- latency: Optional, if measurable during probes
|
|
16
|
-
|
|
17
|
-
Procedure:
|
|
18
|
-
1) Answerability Probe (quality)
|
|
19
|
-
- Attempt to answer the core question or draft the key section from each candidate; judge confidence.
|
|
20
|
-
|
|
21
|
-
2) Coverage Checklist (coverage)
|
|
22
|
-
- Compare against known required items (wish template sections, mandatory refs, constraints).
|
|
23
|
-
|
|
24
|
-
3) Redundancy Pass (redundancy)
|
|
25
|
-
- Note duplicated sections, stale copies, or unnecessary full texts; penalize.
|
|
26
|
-
|
|
27
|
-
4) Cost Estimate (cost)
|
|
28
|
-
- Rough token count bands: low(<2k), med(2–6k), high(>6k); invert to 0–1.
|
|
29
|
-
|
|
30
|
-
Output structure per candidate:
|
|
31
|
-
```
|
|
32
|
-
<critic_scores>
|
|
33
|
-
- id: C1
|
|
34
|
-
quality: 0.85
|
|
35
|
-
coverage: 0.90
|
|
36
|
-
redundancy: 0.20
|
|
37
|
-
cost: 0.70
|
|
38
|
-
latency: low|med|high
|
|
39
|
-
notes: one line
|
|
40
|
-
- id: C2 ...
|
|
41
|
-
</critic_scores>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Selection Guidance:
|
|
45
|
-
- Prefer higher quality and coverage first.
|
|
46
|
-
- Break ties by (1) lower redundancy, (2) lower cost, (3) lower latency.
|
|
47
|
-
|
|
48
|
-
Integration:
|
|
49
|
-
- Use inline within neuron/agent prompts after `<context_candidates>`.
|
|
50
|
-
- For heavier evaluation (e.g., run tests), spawn subtasks per candidate and summarize back.
|
|
51
|
-
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Defer to Expertise (Skills-First Decision Pattern)
|
|
3
|
-
description: For complex inquiries, load relevant spells and defer to their specialized knowledge. Humility + specialization > trying to know everything.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Defer to Expertise - Skills-First Decision Pattern
|
|
7
|
-
|
|
8
|
-
## Core Principle
|
|
9
|
-
|
|
10
|
-
**Humility + Specialization > Trying to Know Everything**
|
|
11
|
-
|
|
12
|
-
When facing complex user inquiries beyond simple answers:
|
|
13
|
-
1. Ask myself: "Are any of my spells useful for this?"
|
|
14
|
-
2. Load relevant spells
|
|
15
|
-
3. Defer to their specialized knowledge
|
|
16
|
-
|
|
17
|
-
## The Philosophy
|
|
18
|
-
|
|
19
|
-
**I don't need to know everything directly.** I need to know WHERE knowledge lives and HOW to load it.
|
|
20
|
-
|
|
21
|
-
**Spells are expertise.** Each spell is specialized knowledge about a specific pattern, workflow, or capability. When I encounter a situation that matches a spell's domain, I load it and let it guide me.
|
|
22
|
-
|
|
23
|
-
## When to Defer
|
|
24
|
-
|
|
25
|
-
### ✅ Defer to Spells When:
|
|
26
|
-
|
|
27
|
-
**Complex user inquiries:**
|
|
28
|
-
- [defer-001] helpful=0 harmful=0: Not simple greetings or basic questions
|
|
29
|
-
- [defer-002] helpful=0 harmful=0: Requires specialized behavioral pattern
|
|
30
|
-
- [defer-003] helpful=0 harmful=0: Involves decision framework or protocol
|
|
31
|
-
- [defer-004] helpful=0 harmful=0: Needs domain-specific expertise
|
|
32
|
-
|
|
33
|
-
**Uncertainty about approach:**
|
|
34
|
-
- [defer-005] helpful=0 harmful=0: "How should I handle this?"
|
|
35
|
-
- [defer-006] helpful=0 harmful=0: "What's the right protocol?"
|
|
36
|
-
- [defer-007] helpful=0 harmful=0: "Is there a pattern for this?"
|
|
37
|
-
|
|
38
|
-
**Behavioral decisions:**
|
|
39
|
-
- [defer-008] helpful=0 harmful=0: Should I create a wish?
|
|
40
|
-
- [defer-009] helpful=0 harmful=0: Should I delegate this work?
|
|
41
|
-
- [defer-010] helpful=0 harmful=0: How do I handle being blocked?
|
|
42
|
-
- [defer-011] helpful=0 harmful=0: Should I ask one question or multiple?
|
|
43
|
-
|
|
44
|
-
### ❌ Direct Response When:
|
|
45
|
-
|
|
46
|
-
**Simple interactions:**
|
|
47
|
-
- [defer-012] helpful=0 harmful=0: Greetings ("Hello", "Hi Genie")
|
|
48
|
-
- [defer-013] helpful=0 harmful=0: Basic questions with obvious answers
|
|
49
|
-
- [defer-014] helpful=0 harmful=0: Conversational acknowledgments
|
|
50
|
-
- [defer-015] helpful=0 harmful=0: Status updates
|
|
51
|
-
|
|
52
|
-
**No specialized knowledge needed:**
|
|
53
|
-
- [defer-016] helpful=0 harmful=0: General conversation
|
|
54
|
-
- [defer-017] helpful=0 harmful=0: Clarifying questions
|
|
55
|
-
- [defer-018] helpful=0 harmful=0: Simple confirmations
|
|
56
|
-
|
|
57
|
-
## The Decision Pattern
|
|
58
|
-
|
|
59
|
-
### Step 1: Classify the Inquiry
|
|
60
|
-
|
|
61
|
-
**Simple or Complex?**
|
|
62
|
-
- [defer-019] helpful=0 harmful=0: Simple: Answer directly
|
|
63
|
-
- [defer-020] helpful=0 harmful=0: Complex: Proceed to Step 2
|
|
64
|
-
|
|
65
|
-
### Step 2: Identify Relevant Spells
|
|
66
|
-
|
|
67
|
-
**Ask myself:**
|
|
68
|
-
- [defer-021] helpful=0 harmful=0: "Is this about delegation?" → Load `delegate-dont-do.md`
|
|
69
|
-
- [defer-022] helpful=0 harmful=0: "Is this about learning?" → Load `learn.md`
|
|
70
|
-
- [defer-023] helpful=0 harmful=0: "Is this about being blocked?" → Load `blocker-protocol.md`
|
|
71
|
-
- [defer-024] helpful=0 harmful=0: "Is this about file creation?" → Load `file-creation-protocol.md`
|
|
72
|
-
- [defer-025] helpful=0 harmful=0: "Is this about MCP tools?" → Load `mcp-first.md`
|
|
73
|
-
- [defer-026] helpful=0 harmful=0: "Am I investigating before acting?" → Load `investigate-before-commit.md`
|
|
74
|
-
|
|
75
|
-
### Step 3: Load Spells
|
|
76
|
-
|
|
77
|
-
**Use MCP tool (not Read):**
|
|
78
|
-
```javascript
|
|
79
|
-
mcp__genie__read_spell("delegate-dont-do")
|
|
80
|
-
mcp__genie__read_spell("learn")
|
|
81
|
-
// etc.
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**Multiple spells if needed:**
|
|
85
|
-
- [defer-027] helpful=0 harmful=0: Orchestration question → Load orchestrator + boundary spells
|
|
86
|
-
- [defer-028] helpful=0 harmful=0: Learning moment → Load learn + know-yourself spells
|
|
87
|
-
|
|
88
|
-
### Step 4: Defer to Expertise
|
|
89
|
-
|
|
90
|
-
**Let the spell guide me:**
|
|
91
|
-
- [defer-029] helpful=0 harmful=0: Read the spell content completely
|
|
92
|
-
- [defer-030] helpful=0 harmful=0: Follow its protocol/checklist
|
|
93
|
-
- [defer-031] helpful=0 harmful=0: Apply its decision framework
|
|
94
|
-
- [defer-032] helpful=0 harmful=0: Use its examples as patterns
|
|
95
|
-
|
|
96
|
-
**Don't improvise when spell exists.** Trust the specialized knowledge.
|
|
97
|
-
|
|
98
|
-
## Examples
|
|
99
|
-
|
|
100
|
-
### Example 1: User Teaches Something New
|
|
101
|
-
|
|
102
|
-
**Inquiry:** User explains "From now on, when X happens, do Y"
|
|
103
|
-
|
|
104
|
-
**Simple or Complex?** Complex (behavioral teaching)
|
|
105
|
-
|
|
106
|
-
**Identify Spell:** This is learning/teaching → `learn.md`
|
|
107
|
-
|
|
108
|
-
**Load Spell:**
|
|
109
|
-
```javascript
|
|
110
|
-
mcp__genie__read_spell("learn")
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Defer:** Follow learn.md protocol for capturing teaching
|
|
114
|
-
|
|
115
|
-
**Don't:** Try to remember teaching without loading learn.md
|
|
116
|
-
|
|
117
|
-
### Example 2: User Asks to Create Feature
|
|
118
|
-
|
|
119
|
-
**Inquiry:** "Help me implement feature X"
|
|
120
|
-
|
|
121
|
-
**Simple or Complex?** Complex (delegation decision)
|
|
122
|
-
|
|
123
|
-
**Identify Spells:**
|
|
124
|
-
- [defer-052] helpful=0 harmful=0: Routing decision → `routing-decision-matrix.md`
|
|
125
|
-
- [defer-053] helpful=0 harmful=0: Should I do or delegate? → `delegate-dont-do.md`
|
|
126
|
-
- [defer-054] helpful=0 harmful=0: Which collective? → Code vs Create routing
|
|
127
|
-
|
|
128
|
-
**Load Spells:**
|
|
129
|
-
```javascript
|
|
130
|
-
mcp__genie__read_spell("routing-decision-matrix")
|
|
131
|
-
mcp__genie__read_spell("delegate-dont-do")
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Defer:** Use routing matrix to decide Code vs Create, use delegate-dont-do to confirm delegation approach
|
|
135
|
-
|
|
136
|
-
**Don't:** Improvise routing without loading decision framework
|
|
137
|
-
|
|
138
|
-
### Example 3: Can't View Forge Progress
|
|
139
|
-
|
|
140
|
-
**Inquiry:** Forge MCP returns "backend unreachable"
|
|
141
|
-
|
|
142
|
-
**Simple or Complex?** Complex (infrastructure troubleshooting)
|
|
143
|
-
|
|
144
|
-
**Identify Spell:** Infrastructure issues → `troubleshoot-infrastructure.md`
|
|
145
|
-
|
|
146
|
-
**Load Spell:**
|
|
147
|
-
```javascript
|
|
148
|
-
mcp__genie__read_spell("troubleshoot-infrastructure")
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**Defer:** Follow 5-step diagnostic protocol from spell
|
|
152
|
-
|
|
153
|
-
**Don't:** Assume agent failed and start implementing myself
|
|
154
|
-
|
|
155
|
-
### Example 4: Greeting
|
|
156
|
-
|
|
157
|
-
**Inquiry:** "Hello!"
|
|
158
|
-
|
|
159
|
-
**Simple or Complex?** Simple (greeting)
|
|
160
|
-
|
|
161
|
-
**Response:** "Hello! How can I help you today?"
|
|
162
|
-
|
|
163
|
-
**Don't:** Load spells for simple greeting
|
|
164
|
-
|
|
165
|
-
## Why This Works
|
|
166
|
-
|
|
167
|
-
### Enables Indefinite Learning
|
|
168
|
-
|
|
169
|
-
**Without spells:**
|
|
170
|
-
- [defer-033] helpful=0 harmful=0: All knowledge in base prompt
|
|
171
|
-
- [defer-034] helpful=0 harmful=0: Limited by context window
|
|
172
|
-
- [defer-035] helpful=0 harmful=0: Can't learn indefinitely
|
|
173
|
-
|
|
174
|
-
**With spells:**
|
|
175
|
-
- [defer-036] helpful=0 harmful=0: Specialized knowledge on-demand
|
|
176
|
-
- [defer-037] helpful=0 harmful=0: Load only what's needed
|
|
177
|
-
- [defer-038] helpful=0 harmful=0: Can have hundreds of spells
|
|
178
|
-
- [defer-039] helpful=0 harmful=0: Learn indefinitely without bloat
|
|
179
|
-
|
|
180
|
-
### Maintains Quality
|
|
181
|
-
|
|
182
|
-
**Spells are refined over time:**
|
|
183
|
-
- [defer-040] helpful=0 harmful=0: Each spell is tested and validated
|
|
184
|
-
- [defer-041] helpful=0 harmful=0: Learnings update spells surgically
|
|
185
|
-
- [defer-042] helpful=0 harmful=0: Single source of truth per domain
|
|
186
|
-
- [defer-043] helpful=0 harmful=0: Consistent behavior across sessions
|
|
187
|
-
|
|
188
|
-
**Improvising is error-prone:**
|
|
189
|
-
- [defer-044] helpful=0 harmful=0: No validation
|
|
190
|
-
- [defer-045] helpful=0 harmful=0: Inconsistent approaches
|
|
191
|
-
- [defer-046] helpful=0 harmful=0: Forgotten best practices
|
|
192
|
-
- [defer-047] helpful=0 harmful=0: Repeated mistakes
|
|
193
|
-
|
|
194
|
-
### Reduces Cognitive Load
|
|
195
|
-
|
|
196
|
-
**Don't try to remember everything:**
|
|
197
|
-
- [defer-048] helpful=0 harmful=0: Know spell exists
|
|
198
|
-
- [defer-049] helpful=0 harmful=0: Load when needed
|
|
199
|
-
- [defer-050] helpful=0 harmful=0: Follow its guidance
|
|
200
|
-
- [defer-051] helpful=0 harmful=0: Trust the expertise
|
|
201
|
-
|
|
202
|
-
**Result:** Better decisions, fewer violations, consistent quality
|
|
203
|
-
|
|
204
|
-
## Anti-Patterns
|
|
205
|
-
|
|
206
|
-
### ❌ Improvising When Spell Exists
|
|
207
|
-
|
|
208
|
-
**Wrong:**
|
|
209
|
-
```
|
|
210
|
-
User: "I'm blocked on X"
|
|
211
|
-
Genie: "Let me try different approaches..."
|
|
212
|
-
[Improvises without loading blocker-protocol.md]
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
**Right:**
|
|
216
|
-
```
|
|
217
|
-
User: "I'm blocked on X"
|
|
218
|
-
Genie: [Loads blocker-protocol.md]
|
|
219
|
-
Genie: "Following blocker protocol: [spell guidance]"
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### ❌ Loading Spells for Simple Questions
|
|
223
|
-
|
|
224
|
-
**Wrong:**
|
|
225
|
-
```
|
|
226
|
-
User: "Hi!"
|
|
227
|
-
Genie: [Loads greeting-response.md, know-yourself.md, ...]
|
|
228
|
-
Genie: "Hello! Based on my identity framework..."
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**Right:**
|
|
232
|
-
```
|
|
233
|
-
User: "Hi!"
|
|
234
|
-
Genie: "Hello! How can I help you today?"
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### ❌ Loading Too Many Spells
|
|
238
|
-
|
|
239
|
-
**Wrong:**
|
|
240
|
-
```
|
|
241
|
-
User: "Create feature X"
|
|
242
|
-
Genie: [Loads 10 different spells preemptively]
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
**Right:**
|
|
246
|
-
```
|
|
247
|
-
User: "Create feature X"
|
|
248
|
-
Genie: [Loads routing-decision-matrix.md, delegate-dont-do.md]
|
|
249
|
-
Genie: "This is code work, delegating to Code collective..."
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Principle:** Load only what's needed, when needed
|
|
253
|
-
|
|
254
|
-
## Checklist: Should I Load a Spell?
|
|
255
|
-
|
|
256
|
-
- [defer-055] helpful=0 harmful=0: [ ] Is this inquiry complex (not greeting/simple answer)?
|
|
257
|
-
- [defer-056] helpful=0 harmful=0: [ ] Do I know which spell(s) are relevant?
|
|
258
|
-
- [defer-057] helpful=0 harmful=0: [ ] Would the spell provide better guidance than improvising?
|
|
259
|
-
- [defer-058] helpful=0 harmful=0: [ ] Am I about to make a behavioral decision?
|
|
260
|
-
- [defer-059] helpful=0 harmful=0: [ ] Am I uncertain about the correct protocol?
|
|
261
|
-
|
|
262
|
-
**If yes to any:** Load relevant spell(s) and defer to their expertise
|
|
263
|
-
|
|
264
|
-
**If no to all:** Respond directly
|
|
265
|
-
|
|
266
|
-
## Evidence
|
|
267
|
-
|
|
268
|
-
**Origin:** AGENTS.md "Skill System Philosophy" section
|
|
269
|
-
**Principle:** "Defer to Expertise (Skills-First Decision Pattern)"
|
|
270
|
-
**Philosophy:** Humility + specialization > trying to know everything directly
|
|
271
|
-
**Architecture:** Spells enable unbounded learning without context bloat
|
|
272
|
-
|
|
273
|
-
## Related
|
|
274
|
-
|
|
275
|
-
- [defer-060] helpful=0 harmful=0: `@.genie/spells/learn.md` - How to learn and update framework
|
|
276
|
-
- [defer-061] helpful=0 harmful=0: `@.genie/spells/know-yourself.md` - Identity and self-awareness
|
|
277
|
-
- [defer-062] helpful=0 harmful=0: `@AGENTS.md` - Skill System Philosophy section
|
|
278
|
-
- [defer-063] helpful=0 harmful=0: All spells in `.genie/spells/` - Specialized expertise domains
|