feat(hcpctl): add claude-code LLM provider for snapshot analyze #7574
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 356 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.352
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #7574"
general
weight: 0.35
geoberle
Summary
https://redhat.atlassian.net/browse/ARO-30249
Adds a third LLM provider,
claude-code, tohcpctl snapshot analyze, alongside the existingcopilotandclaudeproviders. The new provider runs the Claude Code CLI as a subprocess (viagithub.com/roasbeef/claude-agent-sdk-gov1.1.0), giving the Claude path the same autonomous filesystem exploration (Read/Grep/Glob/Bash) that the Copilot path already has. This closes the capability gap where the in-processclaudeprovider only exposed thekusto_querytool and could not grep/read the cloned repo worktrees.The existing
copilotandclaudeproviders are unchanged; this is purely additive.What changed
pkg/agent/claude_code_provider.goimplementing the provider-neutralLLMProvider/LLMSessioninterfaces, backed by the roasbeef Claude Code Go SDK.kusto_queryexposed to the CLI agent via an in-process MCP server, wrapping the existingToolDefinition.Handler, so the custom tool behaves identically across providers.--strict-mcp-config(no filesystem MCP discovery), bypass-permissions for unattended/headless runs, working directory pinned to the analyze workspace, and best-effortCLAUDE.md/settings isolation.claude-sonnet-4-5-20250929when none is supplied (the SDK rejects an empty model); explicitConnectwith terminal-result handling so a silent/non-terminal query end is treated as an error.UsageReport/UsageBreakdownfrom the SDK'sResultMessage(TotalCostUSD/Usage/ModelUsage); a code comment notes this is coarser than the in-process Anthropic provider.cmd/snapshot/analyze_cmd.go: newproviderClaudeCode = "claude-code"constant, cases in both the validation and runtime-construction switches, withkustoToolregistered for this path.pkg/agent/claude_code_provider_test.go, mirroring the existingclaude_provider_test.gostyle (no network, no realclaudebinary required).Testing
make -C tooling/hcpctl build— passgo test ./...intooling/hcpctl(19 packages) — passgo vet ./...— passNotes / follow-ups
github.com/roasbeef/claude-agent-sdk-gois a community (unofficial) SDK, pinned tov1.1.0.CLAUDE.md/AGENTS.mdisolation is not currently expressible through the SDK; it is mitigated via an isolated working directory plus strict MCP config, and the residual limitation is documented in code.claudeprovider is not fully reproduced here; cost and aggregate token totals are reported.---
AI-generated. Review for accuracy.
@geoberle requested from Slack