xp-gate 0.5.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 (90) hide show
  1. package/adapter-common.sh +192 -0
  2. package/adapters/cpp.sh +76 -0
  3. package/adapters/dart.sh +41 -0
  4. package/adapters/flutter.sh +41 -0
  5. package/adapters/go.sh +59 -0
  6. package/adapters/iac.sh +189 -0
  7. package/adapters/java.sh +191 -0
  8. package/adapters/kotlin.sh +77 -0
  9. package/adapters/objectivec.sh +38 -0
  10. package/adapters/powershell.sh +138 -0
  11. package/adapters/python.sh +104 -0
  12. package/adapters/shell.sh +55 -0
  13. package/adapters/swift.sh +44 -0
  14. package/adapters/typescript.sh +61 -0
  15. package/bin/xp-gate.js +157 -0
  16. package/hooks/adapter-common.sh +192 -0
  17. package/hooks/pre-commit +1667 -0
  18. package/hooks/pre-push +395 -0
  19. package/lib/__tests__/detect-deps.test.js +209 -0
  20. package/lib/__tests__/doctor.test.js +448 -0
  21. package/lib/__tests__/download-skill.test.js +281 -0
  22. package/lib/__tests__/init.test.js +327 -0
  23. package/lib/__tests__/install-skill.test.js +326 -0
  24. package/lib/__tests__/migrate.test.js +212 -0
  25. package/lib/__tests__/rollback.test.js +183 -0
  26. package/lib/__tests__/ui-detector.test.ts +200 -0
  27. package/lib/__tests__/uninstall-skill.test.js +189 -0
  28. package/lib/__tests__/uninstall.test.js +589 -0
  29. package/lib/__tests__/update-skill.test.js +276 -0
  30. package/lib/detect-deps.js +157 -0
  31. package/lib/doctor.js +370 -0
  32. package/lib/download-skill.js +96 -0
  33. package/lib/init.js +367 -0
  34. package/lib/install-skill.js +184 -0
  35. package/lib/migrate.js +120 -0
  36. package/lib/rollback.js +78 -0
  37. package/lib/ui-detector.ts +99 -0
  38. package/lib/uninstall-skill.js +69 -0
  39. package/lib/uninstall.js +401 -0
  40. package/lib/update-skill.js +90 -0
  41. package/package.json +39 -0
  42. package/plugins/claude-code/.claude-plugin/plugin.json +21 -0
  43. package/plugins/claude-code/bin/delphi-review-guard.sh +68 -0
  44. package/plugins/claude-code/bin/xp-gate-check +47 -0
  45. package/plugins/claude-code/hooks/hooks.json +37 -0
  46. package/skills/delphi-review/.delphi-config.json.example +45 -0
  47. package/skills/delphi-review/AGENTS.md +54 -0
  48. package/skills/delphi-review/INSTALL.md +152 -0
  49. package/skills/delphi-review/SKILL.md +371 -0
  50. package/skills/delphi-review/evals/evals.json +82 -0
  51. package/skills/delphi-review/opencode.json.delphi.example +56 -0
  52. package/skills/delphi-review/references/code-walkthrough.md +486 -0
  53. package/skills/ralph-loop/SKILL.md +330 -0
  54. package/skills/ralph-loop/evals/evals.json +311 -0
  55. package/skills/ralph-loop/evolution-history.json +59 -0
  56. package/skills/ralph-loop/evolution-log.md +16 -0
  57. package/skills/ralph-loop/references/components/memory.md +55 -0
  58. package/skills/ralph-loop/references/components/middleware.md +54 -0
  59. package/skills/ralph-loop/references/components/skill-invocations.md +39 -0
  60. package/skills/ralph-loop/references/components/system-prompt.md +24 -0
  61. package/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
  62. package/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  63. package/skills/ralph-loop/templates/progress-log.md +36 -0
  64. package/skills/sprint-flow/SKILL.md +600 -0
  65. package/skills/sprint-flow/evals/evals.json +78 -0
  66. package/skills/sprint-flow/evolution-history.json +39 -0
  67. package/skills/sprint-flow/evolution-log.md +23 -0
  68. package/skills/sprint-flow/references/components/memory.md +87 -0
  69. package/skills/sprint-flow/references/components/middleware.md +72 -0
  70. package/skills/sprint-flow/references/components/skill-invocations.md +104 -0
  71. package/skills/sprint-flow/references/components/system-prompt.md +27 -0
  72. package/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
  73. package/skills/sprint-flow/references/phase-0-think.md +115 -0
  74. package/skills/sprint-flow/references/phase-1-plan.md +178 -0
  75. package/skills/sprint-flow/references/phase-2-build.md +198 -0
  76. package/skills/sprint-flow/references/phase-3-review.md +213 -0
  77. package/skills/sprint-flow/references/phase-4-uat.md +125 -0
  78. package/skills/sprint-flow/references/phase-5-feedback.md +100 -0
  79. package/skills/sprint-flow/references/phase-6-ship.md +193 -0
  80. package/skills/sprint-flow/references/phase-7-land.md +140 -0
  81. package/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
  82. package/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  83. package/skills/sprint-flow/templates/pain-document-template.md +115 -0
  84. package/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
  85. package/skills/test-specification-alignment/AGENTS.md +59 -0
  86. package/skills/test-specification-alignment/SKILL.md +605 -0
  87. package/skills/test-specification-alignment/evals/evals.json +75 -0
  88. package/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  89. package/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  90. package/skills/test-specification-alignment/references/specification-format.md +348 -0
@@ -0,0 +1,90 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ // Cross-platform home directory resolution
6
+ const HOME = process.env.HOME || process.env.USERPROFILE || os.homedir();
7
+
8
+ const CONFIG_DIR = path.join(HOME, '.config', 'xp-gate');
9
+ const SKILLS_DIR = path.join(HOME, '.config', 'opencode', 'skills');
10
+
11
+ async function updateSkill(name, options = {}) {
12
+ const { all = false, check = false, verbose = false } = options;
13
+
14
+ if (check) {
15
+ console.log('Checking for updates...');
16
+ const config = getConfig();
17
+ const skills = config.installedSkills || {};
18
+
19
+ for (const [skillName, info] of Object.entries(skills)) {
20
+ console.log(` ${skillName}: ${info.version || 'unknown'}`);
21
+ }
22
+ console.log('Update check complete');
23
+ return 0;
24
+ }
25
+
26
+ if (all) {
27
+ const config = getConfig();
28
+ const skills = config.installedSkills || {};
29
+
30
+ console.log('Updating all skills...');
31
+ let hasErrors = false;
32
+
33
+ for (const skillName of Object.keys(skills)) {
34
+ try {
35
+ await updateSingleSkill(skillName, verbose);
36
+ } catch (err) {
37
+ console.error(`Failed to update ${skillName}: ${err.message}`);
38
+ hasErrors = true;
39
+ }
40
+ }
41
+
42
+ return hasErrors ? 1 : 0;
43
+ }
44
+
45
+ if (!name) {
46
+ console.error('Error: Skill name required');
47
+ console.error('Usage: xp-gate update-skill <name> or --all');
48
+ return 1;
49
+ }
50
+
51
+ const config = getConfig();
52
+ const skills = config.installedSkills || {};
53
+
54
+ if (!skills[name]) {
55
+ console.error(`Error: ${name} is not installed`);
56
+ return 1;
57
+ }
58
+
59
+ return updateSingleSkill(name, verbose);
60
+ }
61
+
62
+ async function updateSingleSkill(name, verbose) {
63
+ console.log(`Updating ${name}...`);
64
+
65
+ const targetDir = path.join(SKILLS_DIR, name);
66
+ if (fs.existsSync(targetDir)) {
67
+ fs.rmSync(targetDir, { recursive: true });
68
+ }
69
+
70
+ const { installSkill } = require('./install-skill.js');
71
+ const result = await installSkill(name, { force: true, verbose });
72
+
73
+ if (result === 0) {
74
+ console.log(`✓ ${name} updated`);
75
+ }
76
+
77
+ return result;
78
+ }
79
+
80
+ function getConfig() {
81
+ const configFile = path.join(CONFIG_DIR, 'xp-gate.json');
82
+ if (fs.existsSync(configFile)) {
83
+ try {
84
+ return JSON.parse(fs.readFileSync(configFile, 'utf8'));
85
+ } catch {}
86
+ }
87
+ return {};
88
+ }
89
+
90
+ module.exports = { updateSkill };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "xp-gate",
3
+ "version": "0.5.1",
4
+ "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
5
+ "bin": {
6
+ "xp-gate": "./bin/xp-gate.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "hooks/",
11
+ "adapters/",
12
+ "lib/",
13
+ "skills/",
14
+ "plugins/",
15
+ "adapter-common.sh"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/boyingliu01/xp-gate"
20
+ },
21
+ "publishConfig": {},
22
+ "engines": {
23
+ "node": ">=18.0.0"
24
+ },
25
+ "scripts": {
26
+ "version": "node scripts/sync-package-content.js && git add -A skills/ plugins/ 2>/dev/null || true",
27
+ "prepack": "node scripts/sync-package-content.js",
28
+ "test": "echo \"Run tests\" && exit 0"
29
+ },
30
+ "keywords": [
31
+ "xp-gate",
32
+ "quality-gates",
33
+ "delphi-review",
34
+ "sprint-flow",
35
+ "ai-development"
36
+ ],
37
+ "author": "boyingliu01",
38
+ "license": "MIT"
39
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "xp-gate",
3
+ "version": "0.4.0",
4
+ "displayName": "XP-Gate",
5
+ "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 6 quality gates, Sprint Flow, and Delphi multi-expert review.",
6
+ "author": {
7
+ "name": "boyingliu01"
8
+ },
9
+ "homepage": "https://github.com/boyingliu01/xp-gate",
10
+ "repository": "https://github.com/boyingliu01/xp-gate",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "quality-gates",
14
+ "sprint-flow",
15
+ "delphi-review",
16
+ "xp",
17
+ "ai-development"
18
+ ],
19
+ "skills": "./skills/",
20
+ "hooks": "./hooks/hooks.json"
21
+ }
@@ -0,0 +1,68 @@
1
+ #!/bin/bash
2
+ # delphi-review-guard.sh — PreToolUse Hook Guard
3
+ #
4
+ # PURPOSE: Physically prevent LLM from editing/writing code before
5
+ # delphi-review is APPROVED. Blocks Edit/Write/ApplyEdit tools.
6
+ #
7
+ # INTEGRATION: Registered in plugins/claude-code/hooks/hooks.json
8
+ # as a PreToolUse hook.
9
+ #
10
+ # MECHANISM:
11
+ # - Reads .sprint-state/delphi-reviewed.json
12
+ # - If file missing or verdict != "APPROVED" → deny
13
+ # - If verdict == "APPROVED" → allow
14
+ #
15
+ # GRACEFUL DEGRADATION:
16
+ # - If .sprint-state/ directory doesn't exist → ALLOW (not a sprint project)
17
+ # - If jq not available → ALLOW with warning (zero degradation for existing projects)
18
+
19
+ # Check if this is a sprint project
20
+ SPRINT_STATE_DIR="$(git rev-parse --show-toplevel 2>/dev/null)/.sprint-state"
21
+ APPROVED_FILE="$SPRINT_STATE_DIR/delphi-reviewed.json"
22
+
23
+ # If no .sprint-state directory, this isn't a sprint project → allow
24
+ if [ ! -d "$SPRINT_STATE_DIR" ]; then
25
+ exit 0
26
+ fi
27
+
28
+ # If delphi-reviewed.json doesn't exist, delphi-review hasn't completed → DENY
29
+ if [ ! -f "$APPROVED_FILE" ]; then
30
+ echo '{"decision":"deny","reason":"delphi-review not APPROVED. Complete Phase 1 delphi-review before any code modification. Run: /delphi-review"}'
31
+ exit 1
32
+ fi
33
+
34
+ # Check jq availability
35
+ if ! command -v jq &> /dev/null; then
36
+ # jq not available → warn but allow (degradation for existing project)
37
+ echo '{"decision":"allow","warning":"jq not available, cannot verify delphi-review verdict. Install jq for full protection."}'
38
+ exit 0
39
+ fi
40
+
41
+ # Validate JSON
42
+ if ! jq empty "$APPROVED_FILE" 2>/dev/null; then
43
+ echo '{"decision":"deny","reason":"delphi-reviewed.json is not valid JSON. Re-run: /delphi-review"}'
44
+ exit 1
45
+ fi
46
+
47
+ # Check verdict
48
+ VERDICT=$(jq -r '.verdict' "$APPROVED_FILE" 2>/dev/null)
49
+ MODE=$(jq -r '.mode' "$APPROVED_FILE" 2>/dev/null)
50
+
51
+ if [ "$VERDICT" != "APPROVED" ]; then
52
+ DENY_MSG="{\"decision\":\"deny\",\"reason\":\"delphi-review verdict is '${VERDICT}', not APPROVED. Fix issues and re-run: /delphi-review\"}"
53
+ echo "$DENY_MSG"
54
+ exit 1
55
+ fi
56
+
57
+ # APPROVED → allow
58
+ if [ "$MODE" = "design" ]; then
59
+ SPEC_PATH=$(jq -r '.specification_path // "not found"' "$APPROVED_FILE" 2>/dev/null)
60
+ echo "{\"decision\":\"allow\",\"message\":\"delphi-review design APPROVED. specification: ${SPEC_PATH}\"}"
61
+ elif [ "$MODE" = "code-walkthrough" ]; then
62
+ COMMIT=$(jq -r '.commit // "unknown"' "$APPROVED_FILE" 2>/dev/null)
63
+ echo "{\"decision\":\"allow\",\"message\":\"delphi-review code-walkthrough APPROVED. commit: ${COMMIT}\"}"
64
+ else
65
+ echo '{"decision":"allow","message":"delphi-review APPROVED"}'
66
+ fi
67
+
68
+ exit 0
@@ -0,0 +1,47 @@
1
+ #!/bin/bash
2
+ # xp-gate-check: Quality gate wrapper for Claude Code plugin
3
+ # Usage: xp-gate-check <file_path>
4
+ #
5
+ # Graceful degradation: if xp-gate CLI unavailable, logs warning to stderr and exits 0.
6
+ # This script always exits 0 to avoid blocking Claude Code sessions.
7
+
8
+ set -euo pipefail
9
+
10
+ FILE_PATH="${1:-}"
11
+
12
+ if [ -z "$FILE_PATH" ]; then
13
+ exit 0
14
+ fi
15
+
16
+ # Skip if file doesn't exist
17
+ [ -f "$FILE_PATH" ] || exit 0
18
+
19
+ # Skip non-source files
20
+ case "$FILE_PATH" in
21
+ *.ts|*.tsx|*.js|*.jsx|*.py|*.go|*.java|*.kt|*.rb|*.rs)
22
+ ;;
23
+ *)
24
+ exit 0
25
+ ;;
26
+ esac
27
+
28
+ # Resolve repo root from script location (avoids dependence on CLAUDE_PLUGIN_ROOT env var)
29
+ # Plugin is at plugins/claude-code/bin/, repo root is 3 dirname calls up:
30
+ # bin/ → claude-code/ → plugins/ → repo-root/
31
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
32
+ REPO_ROOT="$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")")"
33
+
34
+ if command -v xp-gate >/dev/null 2>&1; then
35
+ # xp-gate globally installed — run principles check on the file
36
+ npx -y tsx "${REPO_ROOT}/src/principles/index.ts" --files "$FILE_PATH" --format console 2>&1 || true
37
+ elif [ -f "${REPO_ROOT}/src/principles/index.ts" ]; then
38
+ # Fallback: run principles checker directly from repo source
39
+ echo "[XP-Gate] Running principles check (xp-gate CLI not installed)" >&2
40
+ npx -y tsx "${REPO_ROOT}/src/principles/index.ts" --files "$FILE_PATH" --format console 2>&1 || true
41
+ else
42
+ # Graceful degradation: log once per session
43
+ echo "[XP-Gate] Quality check skipped: xp-gate not installed. Run 'npm install -g xp-gate'" >&2
44
+ fi
45
+
46
+ # Always exit 0 to avoid blocking the Claude session
47
+ exit 0
@@ -0,0 +1,37 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Edit|Write|ApplyEdit",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "\"$CLAUDE_PLUGIN_ROOT\"/bin/delphi-review-guard.sh"
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "PostToolUse": [
15
+ {
16
+ "matcher": "Edit|Write",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "\"$CLAUDE_PLUGIN_ROOT\"/bin/xp-gate-check \"${TOOL_INPUT_FILE}\""
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "Stop": [
26
+ {
27
+ "matcher": ".*",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "echo \"[XP-Gate] Session complete. Run 'xp-gate init' for full git hook integration.\""
32
+ }
33
+ ]
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "./.delphi-config.schema.json",
3
+ "version": 1,
4
+ "description": "Delphi review expert mapping — customize with your own models. Copy to .delphi-config.json and edit.",
5
+ "num_experts": 3,
6
+ "model_policy": {
7
+ "domestic_only": true,
8
+ "description": "Only domestic Chinese open-source models are allowed. NEVER use Anthropic, OpenAI, Google, or other foreign expensive models.",
9
+ "allowed_models": [
10
+ "glm-5.1", "glm-5.0",
11
+ "kimi-k2.6", "kimi-k2.5",
12
+ "minimax-m2.7", "minimax-m2.5",
13
+ "qwen3.6-plus", "qwen3.5-plus",
14
+ "deepseek-v4-pro", "deepseek-v4-lite"
15
+ ]
16
+ },
17
+ "experts": {
18
+ "architecture": {
19
+ "agent_name": "delphi-reviewer-architecture",
20
+ "perspective": "Architecture and requirements alignment",
21
+ "requirements_alignment": true,
22
+ "recommended_model": "deepseek-v4-pro",
23
+ "alternatives": ["qwen3.6-plus", "glm-5.1"]
24
+ },
25
+ "technical": {
26
+ "agent_name": "delphi-reviewer-technical",
27
+ "perspective": "Technical implementation, code correctness, edge cases",
28
+ "requirements_alignment": true,
29
+ "recommended_model": "kimi-k2.6",
30
+ "alternatives": ["deepseek-v4-pro", "minimax-m2.7"]
31
+ },
32
+ "feasibility": {
33
+ "agent_name": "delphi-reviewer-feasibility",
34
+ "perspective": "Feasibility analysis, risk assessment, execution complexity",
35
+ "requirements_alignment": true,
36
+ "recommended_model": "qwen3.6-plus",
37
+ "alternatives": ["kimi-k2.6", "glm-5.1"]
38
+ }
39
+ },
40
+ "consensus": {
41
+ "threshold_percent": 95,
42
+ "max_review_rounds": 5,
43
+ "cross_provider_required": true
44
+ }
45
+ }
@@ -0,0 +1,54 @@
1
+ # SKILLS/DEPHI-REVIEW KNOWLEDGE BASE
2
+
3
+ **Generated:** 2026-05-02
4
+ **Commit:** 1f6bc7d
5
+ **Branch:** main
6
+
7
+ ## OVERVIEW
8
+ Delphi Consensus Review - Multi-round anonymous review system to reach expert consensus on code changes and design decisions.
9
+
10
+ ## STRUCTURE
11
+ ```
12
+ skills/delphi-review/
13
+ ├── SKILL.md # Core Delphi review methodology
14
+ ├── INSTALL.md # Setup instructions
15
+ ├── references/ # Code walkthrough mode specification
16
+ └── .delphi-config.json.example # 3-expert config template
17
+ ```
18
+
19
+ ## WHERE TO LOOK
20
+ | Task | Location | Notes |
21
+ |------|----------|-------|
22
+ | Core Logic | SKILL.md | Main Delphi methodology and workflow |
23
+
24
+ ## CODE MAP
25
+ | Symbol | Type | Location | Refs | Role |
26
+ |--------|------|----------|------|------|
27
+ | Delphi Method | Review Process | SKILL.md | N/A | Anonymous multi-round consensus |
28
+
29
+ ## CONVENTIONS
30
+ - Experts work anonymously in Round 1 to avoid bias
31
+ - Iterative review till consensus reached (>=95% agreement)
32
+ - Zero tolerance quality checks required
33
+ - No skipping rounds when disagreement occurs
34
+
35
+ ## ANTI-PATTERNS (THIS PROJECT)
36
+ - Do NOT terminate before achieving true consensus
37
+ - Do NOT reveal other experts' opinions during Round 1
38
+ - Do NOT accept partial agreement without resolution
39
+
40
+ ## UNIQUE STYLES
41
+ - Anonymous expert reviews
42
+ - Multiple rounds until full agreement
43
+ - Statistical consensus measurement (>=95% threshold)
44
+ - Mandatory agreement before approval
45
+
46
+ ## COMMANDS
47
+ ```bash
48
+ # Trigger Delphi review
49
+ /delphi-review
50
+ ```
51
+
52
+ ## NOTES
53
+ - Implements traditional Delphi method for anonymous expert consensus
54
+ - Used by code-walkthrough mode
@@ -0,0 +1,152 @@
1
+ # Installing and Configuring Delphi Review
2
+
3
+ This guide walks you through setting up the Delphi consensus review skill in your OpenCode environment.
4
+
5
+ ## Prerequisites
6
+
7
+ - OpenCode installed and configured
8
+ - At least **2 different model providers** available (cross-provider requirement prevents homogenized blind spots)
9
+ - Access to at least 3 different models (for 3-expert mode) or 2 models (for 2-expert mode)
10
+
11
+ > **Why cross-provider?** Using models from the same vendor (e.g., all OpenAI) means they share training data and biases, defeating the purpose of multi-expert consensus.
12
+
13
+ ## Quick Setup (3 steps)
14
+
15
+ ### Step 1: Copy the configuration template
16
+
17
+ ```bash
18
+ # From your project root (where opencode.json lives):
19
+ cp skills/delphi-review/.delphi-config.json.example .delphi-config.json
20
+ ```
21
+
22
+ This file maps abstract expert roles to agent names. You typically don't need to edit this unless you want custom agent names.
23
+
24
+ ### Step 2: Add agent definitions to opencode.json
25
+
26
+ Copy the `agent` block from `skills/delphi-review/opencode.json.delphi.example` into your `opencode.json`.
27
+
28
+ Then replace the provider/model placeholders:
29
+
30
+ ```json
31
+ // Before (template):
32
+ "model": "YOUR_PROVIDER/YOUR_MODEL_A"
33
+
34
+ // After (your config):
35
+ "model": "openai/gpt-4o"
36
+ // or
37
+ "model": "anthropic/claude-sonnet-4-20250514"
38
+ // or
39
+ "model": "bailian-coding-plan/qwen3.6-plus"
40
+ ```
41
+
42
+ ### Step 3: Ensure provider configuration exists
43
+
44
+ Your `opencode.json` must have the provider definitions. If you're using OpenCode's built-in providers (OpenAI, Anthropic, etc.), you just need API keys set in your environment.
45
+
46
+ For custom providers (like Ali Bailian), add a provider entry:
47
+
48
+ ```json
49
+ "provider": {
50
+ "my-custom-provider": {
51
+ "npm": "@ai-sdk/anthropic",
52
+ "name": "My Custom Provider",
53
+ "options": {
54
+ "baseURL": "https://your-api-endpoint.com/v1",
55
+ "apiKey": "your-api-key"
56
+ },
57
+ "models": {
58
+ "my-model-name": {
59
+ "name": "My Model Name",
60
+ "modalities": {
61
+ "input": ["text"],
62
+ "output": ["text"]
63
+ },
64
+ "limit": {
65
+ "context": 128000,
66
+ "output": 8192
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Model Recommendations
75
+
76
+ The skill requires at least 2 experts for code changes, 3 for architecture decisions. Here are recommended model selections:
77
+
78
+ | Expert Role | Recommended | Alternatives |
79
+ |-------------|-------------|-------------|
80
+ | **Architecture (Expert A)** | Claude Sonnet 4 | GPT-4o, Qwen-Plus, Gemini 2.5 Pro |
81
+ | **Technical (Expert B)** | Claude Haiku | Qwen-Coder, DeepSeek-Coder, GPT-4o-mini |
82
+ | **Feasibility (Expert C)** | Claude Opus | GPT-4, Gemini 2.5 Pro, Qwen-Max |
83
+
84
+ **Minimum viable setup** (2-expert mode):
85
+ - Expert A: Any reasoning-strong model
86
+ - Expert B: Any code-understanding-strong model
87
+ - **Must be from different providers**
88
+
89
+ ## Configuration File Reference
90
+
91
+ ### `.delphi-config.json`
92
+
93
+ | Field | Description | Default |
94
+ |-------|-------------|---------|
95
+ | `num_experts` | Number of experts to use (2 or 3) | 3 |
96
+ | `experts.architecture` | Architecture reviewer configuration | Required |
97
+ | `experts.technical` | Technical reviewer configuration | Required |
98
+ | `experts.feasibility` | Feasibility reviewer configuration | Required for 3-expert mode |
99
+ | `consensus.threshold_percent` | Agreement threshold | 95 |
100
+ | `consensus.max_review_rounds` | Maximum review rounds | 5 |
101
+ | `consensus.cross_provider_required` | Require different providers | true |
102
+
103
+ ### `opencode.json` agent block
104
+
105
+ | Field | Description |
106
+ |-------|-------------|
107
+ | `model` | Provider/model identifier (e.g., `openai/gpt-4o`) |
108
+ | `mode` | Must be `"subagent"` |
109
+ | `prompt` | Expert role instructions |
110
+ | `tools` | Tool permissions (read: true, write: false recommended) |
111
+
112
+ ## Usage
113
+
114
+ Once configured, invoke the skill via:
115
+
116
+ ```bash
117
+ /delphi-review
118
+ ```
119
+
120
+ Or reference it in your workflows. The skill will automatically use the agents defined in your `opencode.json`.
121
+
122
+ ## Troubleshooting
123
+
124
+ ### "Agent delphi-reviewer-xxx not found"
125
+
126
+ The agent definitions in `opencode.json` don't match the names in `.delphi-config.json`. Verify:
127
+ 1. Agent names in `.delphi-config.json` match keys in `opencode.json` `agent` block
128
+ 2. opencode.js is valid JSON (use `jq . opencode.json` to verify)
129
+
130
+ ### "Model YOUR_PROVIDER/YOUR_MODEL not available"
131
+
132
+ You forgot to replace the placeholder. Search for `YOUR_PROVIDER` in your opencode.json and replace with actual values.
133
+
134
+ ### Both experts gave identical feedback
135
+
136
+ Your models are from the same provider. Configure agents to use different providers.
137
+
138
+ ### Review takes too long / costs too much
139
+
140
+ Reduce to 2-expert mode in `.delphi-config.json`: set `num_experts: 2`.
141
+
142
+ ## Advanced: JSON Schema Validation
143
+
144
+ For IDE autocompletion and validation, reference the schema in your `.delphi-config.json`:
145
+
146
+ ```json
147
+ {
148
+ "$schema": "https://example.com/delphi-config.schema.json"
149
+ }
150
+ ```
151
+
152
+ The schema file is available at `.delphi-config.schema.json` in this directory.