ai-consultants 2.10.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 (62) hide show
  1. package/.claude/commands/ai-consultants:consult.md +94 -0
  2. package/.claude/commands/ai-consultants:debate.md +103 -0
  3. package/.claude/commands/ai-consultants:help.md +30 -0
  4. package/CLAUDE.md +839 -0
  5. package/LICENSE +21 -0
  6. package/README.md +758 -0
  7. package/SKILL.md +156 -0
  8. package/bin/ai-consultants +96 -0
  9. package/docs/COST_RATES.md +172 -0
  10. package/docs/JSON_SCHEMA.md +305 -0
  11. package/docs/SETUP.md +879 -0
  12. package/docs/SMART_ROUTING.md +219 -0
  13. package/docs/cost_rates.json +143 -0
  14. package/package.json +47 -0
  15. package/references/configuration.md +141 -0
  16. package/references/details.md +60 -0
  17. package/scripts/build_context.sh +562 -0
  18. package/scripts/classify_question.sh +148 -0
  19. package/scripts/config.sh +753 -0
  20. package/scripts/configure.sh +1093 -0
  21. package/scripts/consult_all.sh +934 -0
  22. package/scripts/debate_round.sh +421 -0
  23. package/scripts/doctor.sh +642 -0
  24. package/scripts/followup.sh +197 -0
  25. package/scripts/install.sh +319 -0
  26. package/scripts/lib/api.sh +640 -0
  27. package/scripts/lib/api_query.sh +228 -0
  28. package/scripts/lib/cache.sh +338 -0
  29. package/scripts/lib/chunking.sh +880 -0
  30. package/scripts/lib/code_optimizer.sh +671 -0
  31. package/scripts/lib/common.sh +1088 -0
  32. package/scripts/lib/costs.sh +674 -0
  33. package/scripts/lib/personas.sh +372 -0
  34. package/scripts/lib/progress.sh +251 -0
  35. package/scripts/lib/reflection.sh +447 -0
  36. package/scripts/lib/routing.sh +566 -0
  37. package/scripts/lib/schema.json +165 -0
  38. package/scripts/lib/session.sh +327 -0
  39. package/scripts/lib/symbol_map.sh +445 -0
  40. package/scripts/lib/voting.sh +495 -0
  41. package/scripts/peer_review.sh +460 -0
  42. package/scripts/preflight_check.sh +452 -0
  43. package/scripts/query_aider.sh +83 -0
  44. package/scripts/query_amp.sh +67 -0
  45. package/scripts/query_claude.sh +99 -0
  46. package/scripts/query_codex.sh +92 -0
  47. package/scripts/query_cursor.sh +72 -0
  48. package/scripts/query_deepseek.sh +17 -0
  49. package/scripts/query_gemini.sh +85 -0
  50. package/scripts/query_glm.sh +17 -0
  51. package/scripts/query_grok.sh +17 -0
  52. package/scripts/query_kilo.sh +140 -0
  53. package/scripts/query_kimi.sh +67 -0
  54. package/scripts/query_minimax.sh +17 -0
  55. package/scripts/query_mistral.sh +97 -0
  56. package/scripts/query_ollama.sh +328 -0
  57. package/scripts/query_qwen3.sh +93 -0
  58. package/scripts/setup_wizard.sh +367 -0
  59. package/scripts/skillport-install.sh +196 -0
  60. package/scripts/synthesize.sh +332 -0
  61. package/templates/consultation_report.md +323 -0
  62. package/templates/synthesis_prompt.md +120 -0
@@ -0,0 +1,197 @@
1
+ #!/bin/bash
2
+ # followup.sh - Follow-up queries for AI Consultants v2.0
3
+ #
4
+ # Allows continuing a previous consultation with follow-up
5
+ # questions that maintain context.
6
+ #
7
+ # Usage:
8
+ # ./followup.sh "Ask Gemini to elaborate on point X"
9
+ # ./followup.sh --clarify "Codex and Mistral disagree on Y"
10
+ # ./followup.sh --all "Reformulate with focus on performance"
11
+ # ./followup.sh --session <session_id> "Question"
12
+
13
+ set -euo pipefail
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ source "$SCRIPT_DIR/lib/common.sh"
17
+ source "$SCRIPT_DIR/lib/session.sh"
18
+
19
+ # =============================================================================
20
+ # ARGUMENT PARSING
21
+ # =============================================================================
22
+
23
+ MODE="default"
24
+ TARGET_CONSULTANT=""
25
+ SESSION_ID=""
26
+ INSTRUCTION=""
27
+
28
+ while [[ $# -gt 0 ]]; do
29
+ case "$1" in
30
+ --clarify)
31
+ MODE="clarify"
32
+ shift
33
+ ;;
34
+ --all)
35
+ MODE="all"
36
+ shift
37
+ ;;
38
+ --consultant|-c)
39
+ MODE="single"
40
+ TARGET_CONSULTANT="$2"
41
+ shift 2
42
+ ;;
43
+ --session|-s)
44
+ SESSION_ID="$2"
45
+ shift 2
46
+ ;;
47
+ --help|-h)
48
+ echo "Usage: $0 [options] \"instruction\""
49
+ echo ""
50
+ echo "Options:"
51
+ echo " --clarify Request clarification on a point of disagreement"
52
+ echo " --all Send follow-up to all consultants"
53
+ echo " --consultant, -c Send only to a specific consultant"
54
+ echo " --session, -s Use a specific session (default: current)"
55
+ echo " --help, -h Show this message"
56
+ echo ""
57
+ echo "Examples:"
58
+ echo " $0 \"Elaborate on the architecture point\""
59
+ echo " $0 --clarify \"Why do Codex and Mistral disagree?\""
60
+ echo " $0 -c Gemini \"Can you provide a code example?\""
61
+ exit 0
62
+ ;;
63
+ *)
64
+ INSTRUCTION="$1"
65
+ shift
66
+ ;;
67
+ esac
68
+ done
69
+
70
+ # =============================================================================
71
+ # VALIDATION
72
+ # =============================================================================
73
+
74
+ if [[ -z "$INSTRUCTION" ]]; then
75
+ log_error "Follow-up instruction required"
76
+ log_info "Usage: $0 \"instruction\""
77
+ exit 1
78
+ fi
79
+
80
+ # Load specific session if requested
81
+ if [[ -n "$SESSION_ID" ]]; then
82
+ session_data=$(get_session_by_id "$SESSION_ID")
83
+ if [[ -z "$session_data" || "$session_data" == "null" ]]; then
84
+ log_error "Session '$SESSION_ID' not found"
85
+ exit 1
86
+ fi
87
+ # Set as current session
88
+ echo "$session_data" > "$SESSION_FILE"
89
+ fi
90
+
91
+ # Verify there's an active session
92
+ if ! has_active_session; then
93
+ log_error "No active session. Run a consultation first."
94
+ log_info "Use: ./consult_all.sh \"question\""
95
+ exit 1
96
+ fi
97
+
98
+ # =============================================================================
99
+ # BUILD FOLLOW-UP CONTEXT
100
+ # =============================================================================
101
+
102
+ log_info "Building follow-up context..."
103
+
104
+ ORIGINAL_QUERY=$(get_current_query)
105
+ RESPONSES_DIR=$(get_current_responses_dir)
106
+
107
+ if [[ ! -d "$RESPONSES_DIR" ]]; then
108
+ log_error "Responses directory not found: $RESPONSES_DIR"
109
+ exit 1
110
+ fi
111
+
112
+ # Build complete context
113
+ FOLLOW_UP_CONTEXT=$(build_follow_up_context "$INSTRUCTION")
114
+
115
+ # =============================================================================
116
+ # EXECUTE FOLLOW-UP
117
+ # =============================================================================
118
+
119
+ # Directory for follow-up output
120
+ TIMESTAMP=$(date +%Y%m%d_%H%M%S)
121
+ FOLLOW_UP_DIR="${RESPONSES_DIR}/followup_${TIMESTAMP}"
122
+ mkdir -p "$FOLLOW_UP_DIR"
123
+
124
+ log_info "Executing follow-up (mode: $MODE)..."
125
+
126
+ case "$MODE" in
127
+ single)
128
+ # Follow-up to a single consultant
129
+ if [[ -z "$TARGET_CONSULTANT" ]]; then
130
+ log_error "Specify consultant with -c/--consultant"
131
+ exit 1
132
+ fi
133
+
134
+ log_info "Follow-up to $TARGET_CONSULTANT..."
135
+
136
+ case "$TARGET_CONSULTANT" in
137
+ Gemini|gemini)
138
+ "$SCRIPT_DIR/query_gemini.sh" "$FOLLOW_UP_CONTEXT" "" "$FOLLOW_UP_DIR/gemini.json"
139
+ ;;
140
+ Codex|codex)
141
+ "$SCRIPT_DIR/query_codex.sh" "$FOLLOW_UP_CONTEXT" "" "$FOLLOW_UP_DIR/codex.json"
142
+ ;;
143
+ Mistral|mistral)
144
+ "$SCRIPT_DIR/query_mistral.sh" "$FOLLOW_UP_CONTEXT" "" "$FOLLOW_UP_DIR/mistral.json"
145
+ ;;
146
+ Kilo|kilo)
147
+ "$SCRIPT_DIR/query_kilo.sh" "$FOLLOW_UP_CONTEXT" "" "$FOLLOW_UP_DIR/kilo.json"
148
+ ;;
149
+ *)
150
+ log_error "Unknown consultant: $TARGET_CONSULTANT"
151
+ exit 1
152
+ ;;
153
+ esac
154
+ ;;
155
+
156
+ clarify)
157
+ # Request clarification - focus on disagreement points
158
+ CLARIFY_PROMPT="$FOLLOW_UP_CONTEXT
159
+
160
+ NOTE: This is a CLARIFICATION request on a point of disagreement between consultants.
161
+ Explain your reasoning in detail and why your position differs from others."
162
+
163
+ log_info "Requesting clarification from all consultants..."
164
+ "$SCRIPT_DIR/consult_all.sh" "$CLARIFY_PROMPT"
165
+ ;;
166
+
167
+ all|default)
168
+ # Follow-up to all consultants
169
+ log_info "Follow-up to all consultants..."
170
+ "$SCRIPT_DIR/consult_all.sh" "$FOLLOW_UP_CONTEXT"
171
+ ;;
172
+ esac
173
+
174
+ # =============================================================================
175
+ # UPDATE SESSION
176
+ # =============================================================================
177
+
178
+ # Record follow-up in session
179
+ add_follow_up "$INSTRUCTION" "$FOLLOW_UP_DIR"
180
+
181
+ log_success "Follow-up completed"
182
+ log_info "Responses in: $FOLLOW_UP_DIR"
183
+
184
+ # Show summary
185
+ echo ""
186
+ echo "╔══════════════════════════════════════════════════════════════╗"
187
+ echo "║ Follow-up Summary ║"
188
+ echo "╚══════════════════════════════════════════════════════════════╝"
189
+ echo ""
190
+ echo " Original query: ${ORIGINAL_QUERY:0:50}..."
191
+ echo " Follow-up: ${INSTRUCTION:0:50}..."
192
+ echo " Mode: $MODE"
193
+ echo " Total follow-ups in session: $(get_follow_up_count)"
194
+ echo ""
195
+
196
+ # Output directory for calling scripts
197
+ echo "$FOLLOW_UP_DIR"
@@ -0,0 +1,319 @@
1
+ #!/usr/bin/env bash
2
+ # AI Consultants - Installation Script
3
+ #
4
+ # One-liner install:
5
+ # curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/scripts/install.sh | bash
6
+ #
7
+ # Or with options:
8
+ # curl -fsSL ... | bash -s -- --no-commands --branch dev
9
+ #
10
+ # Options:
11
+ # --branch <name> Install from specific branch (default: main)
12
+ # --no-commands Skip installing slash commands
13
+ # --update Update existing installation
14
+ # --uninstall Remove AI Consultants
15
+ # --help Show this help
16
+
17
+ set -euo pipefail
18
+
19
+ # =============================================================================
20
+ # CONFIGURATION
21
+ # =============================================================================
22
+
23
+ INSTALL_DIR="${AI_CONSULTANTS_DIR:-${HOME}/.claude/skills/ai-consultants}"
24
+ COMMANDS_DIR="${HOME}/.claude/commands"
25
+ REPO_URL="${AI_CONSULTANTS_REPO:-https://github.com/matteoscurati/ai-consultants.git}"
26
+ BRANCH="main"
27
+ INSTALL_COMMANDS=true
28
+ UPDATE_MODE=false
29
+ UNINSTALL_MODE=false
30
+
31
+ # Colors (if terminal supports them)
32
+ if [[ -t 1 ]]; then
33
+ RED='\033[0;31m'
34
+ GREEN='\033[0;32m'
35
+ YELLOW='\033[0;33m'
36
+ BLUE='\033[0;34m'
37
+ NC='\033[0m' # No Color
38
+ else
39
+ RED=''
40
+ GREEN=''
41
+ YELLOW=''
42
+ BLUE=''
43
+ NC=''
44
+ fi
45
+
46
+ # =============================================================================
47
+ # HELPER FUNCTIONS
48
+ # =============================================================================
49
+
50
+ print_header() {
51
+ echo ""
52
+ echo -e "${BLUE}+---------------------------------------------------------------+${NC}"
53
+ echo -e "${BLUE}| AI Consultants v2.10 - Installation |${NC}"
54
+ echo -e "${BLUE}+---------------------------------------------------------------+${NC}"
55
+ echo ""
56
+ }
57
+
58
+ log_info() {
59
+ echo -e "${BLUE}[INFO]${NC} $1"
60
+ }
61
+
62
+ log_success() {
63
+ echo -e "${GREEN}[OK]${NC} $1"
64
+ }
65
+
66
+ log_warn() {
67
+ echo -e "${YELLOW}[WARN]${NC} $1"
68
+ }
69
+
70
+ log_error() {
71
+ echo -e "${RED}[ERROR]${NC} $1" >&2
72
+ }
73
+
74
+ show_help() {
75
+ cat << 'EOF'
76
+ AI Consultants - Installation Script
77
+
78
+ Usage:
79
+ ./install.sh [options]
80
+
81
+ One-liner install:
82
+ curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/scripts/install.sh | bash
83
+
84
+ Options:
85
+ --branch <name> Install from specific branch (default: main)
86
+ --no-commands Skip installing slash commands to ~/.claude/commands
87
+ --update Update existing installation (git pull)
88
+ --uninstall Remove AI Consultants completely
89
+ --help Show this help message
90
+
91
+ Environment Variables:
92
+ AI_CONSULTANTS_DIR Override installation directory
93
+ AI_CONSULTANTS_REPO Override repository URL
94
+
95
+ Examples:
96
+ # Standard install
97
+ ./install.sh
98
+
99
+ # Install from dev branch
100
+ ./install.sh --branch dev
101
+
102
+ # Update existing installation
103
+ ./install.sh --update
104
+
105
+ # Uninstall
106
+ ./install.sh --uninstall
107
+ EOF
108
+ }
109
+
110
+ check_dependencies() {
111
+ local missing=()
112
+
113
+ if ! command -v git &> /dev/null; then
114
+ missing+=("git")
115
+ fi
116
+
117
+ if ! command -v jq &> /dev/null; then
118
+ missing+=("jq")
119
+ fi
120
+
121
+ if [[ ${#missing[@]} -gt 0 ]]; then
122
+ log_error "Missing required dependencies: ${missing[*]}"
123
+ echo ""
124
+ log_info "Install them with:"
125
+
126
+ if [[ "$(uname)" == "Darwin" ]]; then
127
+ for dep in "${missing[@]}"; do
128
+ echo " brew install $dep"
129
+ done
130
+ else
131
+ for dep in "${missing[@]}"; do
132
+ echo " apt install $dep # or: yum install $dep"
133
+ done
134
+ fi
135
+ return 1
136
+ fi
137
+
138
+ return 0
139
+ }
140
+
141
+ # =============================================================================
142
+ # ARGUMENT PARSING
143
+ # =============================================================================
144
+
145
+ while [[ $# -gt 0 ]]; do
146
+ case "$1" in
147
+ --branch)
148
+ BRANCH="$2"
149
+ shift 2
150
+ ;;
151
+ --no-commands)
152
+ INSTALL_COMMANDS=false
153
+ shift
154
+ ;;
155
+ --update)
156
+ UPDATE_MODE=true
157
+ shift
158
+ ;;
159
+ --uninstall)
160
+ UNINSTALL_MODE=true
161
+ shift
162
+ ;;
163
+ --help|-h)
164
+ show_help
165
+ exit 0
166
+ ;;
167
+ *)
168
+ log_error "Unknown option: $1"
169
+ show_help
170
+ exit 1
171
+ ;;
172
+ esac
173
+ done
174
+
175
+ # =============================================================================
176
+ # UNINSTALL
177
+ # =============================================================================
178
+
179
+ if [[ "$UNINSTALL_MODE" == "true" ]]; then
180
+ print_header
181
+ log_info "Uninstalling AI Consultants..."
182
+
183
+ if [[ -d "$INSTALL_DIR" ]]; then
184
+ rm -rf "$INSTALL_DIR"
185
+ log_success "Removed: $INSTALL_DIR"
186
+ else
187
+ log_warn "Installation directory not found: $INSTALL_DIR"
188
+ fi
189
+
190
+ # Remove commands (with confirmation)
191
+ if [[ -d "$COMMANDS_DIR" ]]; then
192
+ ai_commands=$(find "$COMMANDS_DIR" -name "ai-consultants*.md" -o -name "consult*.md" 2>/dev/null || true)
193
+ if [[ -n "$ai_commands" ]]; then
194
+ echo "$ai_commands" | while read -r cmd_file; do
195
+ rm -f "$cmd_file"
196
+ log_success "Removed command: $(basename "$cmd_file")"
197
+ done
198
+ fi
199
+ fi
200
+
201
+ echo ""
202
+ log_success "AI Consultants uninstalled successfully"
203
+ exit 0
204
+ fi
205
+
206
+ # =============================================================================
207
+ # INSTALL / UPDATE
208
+ # =============================================================================
209
+
210
+ print_header
211
+
212
+ # Check dependencies
213
+ log_info "Checking dependencies..."
214
+ if ! check_dependencies; then
215
+ exit 1
216
+ fi
217
+ log_success "All dependencies found"
218
+
219
+ # Create directories
220
+ log_info "Setting up directories..."
221
+ mkdir -p "$(dirname "$INSTALL_DIR")"
222
+ mkdir -p "$COMMANDS_DIR"
223
+
224
+ # Clone or update
225
+ if [[ -d "$INSTALL_DIR" ]]; then
226
+ if [[ "$UPDATE_MODE" == "true" ]]; then
227
+ log_info "Updating existing installation..."
228
+ cd "$INSTALL_DIR"
229
+
230
+ # Stash any local changes
231
+ if ! git diff --quiet 2>/dev/null; then
232
+ log_warn "Local changes detected, stashing..."
233
+ git stash
234
+ fi
235
+
236
+ # Pull updates
237
+ git fetch origin
238
+ git checkout "$BRANCH"
239
+ git pull origin "$BRANCH"
240
+ log_success "Updated to latest version"
241
+ else
242
+ log_warn "Installation already exists at: $INSTALL_DIR"
243
+ log_info "Use --update to update, or --uninstall to remove first"
244
+ exit 1
245
+ fi
246
+ else
247
+ log_info "Cloning repository..."
248
+ git clone --branch "$BRANCH" "$REPO_URL" "$INSTALL_DIR"
249
+ log_success "Cloned repository"
250
+ fi
251
+
252
+ # Set permissions
253
+ log_info "Setting executable permissions..."
254
+ chmod +x "$INSTALL_DIR"/scripts/*.sh 2>/dev/null || true
255
+ chmod +x "$INSTALL_DIR"/scripts/lib/*.sh 2>/dev/null || true
256
+ log_success "Permissions set"
257
+
258
+ # Install slash commands
259
+ if [[ "$INSTALL_COMMANDS" == "true" ]]; then
260
+ log_info "Installing slash commands..."
261
+
262
+ if [[ -d "$INSTALL_DIR/.claude/commands" ]]; then
263
+ cp "$INSTALL_DIR"/.claude/commands/*.md "$COMMANDS_DIR/" 2>/dev/null || true
264
+ cmd_count=$(ls -1 "$INSTALL_DIR/.claude/commands/"*.md 2>/dev/null | wc -l | tr -d ' ')
265
+ log_success "Installed $cmd_count slash commands"
266
+ else
267
+ log_warn "No slash commands found to install"
268
+ fi
269
+ fi
270
+
271
+ # Run doctor check
272
+ echo ""
273
+ log_info "Running health check..."
274
+ if "$INSTALL_DIR/scripts/doctor.sh" --json > /dev/null 2>&1; then
275
+ log_success "Health check passed"
276
+ else
277
+ log_warn "Some issues detected. Run: $INSTALL_DIR/scripts/doctor.sh"
278
+ fi
279
+
280
+ # =============================================================================
281
+ # POST-INSTALL
282
+ # =============================================================================
283
+
284
+ echo ""
285
+ echo -e "${GREEN}+---------------------------------------------------------------+${NC}"
286
+ echo -e "${GREEN}| Installation Complete! |${NC}"
287
+ echo -e "${GREEN}+---------------------------------------------------------------+${NC}"
288
+ echo ""
289
+
290
+ log_info "Installation directory: $INSTALL_DIR"
291
+ echo ""
292
+
293
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
294
+ echo ""
295
+ log_info "Option A: Use via Claude Code (recommended)"
296
+ echo ""
297
+ echo " Start consulting:"
298
+ echo " /ai-consultants:consult \"Your question here\""
299
+ echo ""
300
+
301
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
302
+ echo ""
303
+ log_info "Option B: Configure via Bash"
304
+ echo ""
305
+ echo " 1. Run the setup wizard:"
306
+ echo " $INSTALL_DIR/scripts/setup_wizard.sh"
307
+ echo ""
308
+ echo " 2. Run a consultation:"
309
+ echo " $INSTALL_DIR/scripts/consult_all.sh \"Your question\""
310
+ echo ""
311
+ echo " 3. Diagnose issues:"
312
+ echo " $INSTALL_DIR/scripts/doctor.sh"
313
+ echo ""
314
+
315
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
316
+ echo ""
317
+ log_info "Using another CLI? (Codex, Gemini, Cursor, Aider)"
318
+ echo " See: https://github.com/matteoscurati/ai-consultants#supported-cli-agents"
319
+ echo ""