Client Adapters
Adapters translate between AI agent wire formats and SigmaShake's internal ToolCall type. They also handle hook installation and capability classification.
Adapter interface
interface ClientAdapter {
readonly name: string;
detect(): boolean;
parseInput(raw: string): ToolCall;
formatOutput(result: EvalResult): string;
toolCapability(toolName: string): Capability;
install(projectDir: string): Promise<void>;
uninstall(projectDir: string): Promise<void>;
healthCheck(): Promise<boolean>;
}
Built-in adapters
Claude Code Adapter
Name: claude-code
Detection: Looks for CLAUDE_CODE_VERSION, CLAUDE_CODE_API_KEY, or CLAUDE_CODE_ENTRYPOINT environment variables.
Tool capability mapping: Hardcoded map for 30+ Claude Code tools:
Bash→executeRead→readWrite,Edit,MultiEdit→writeGlob,Grep→searchAgent→agentWebFetch,WebSearch→network
Hook installation: Creates .claude/hooks/ssg-check.sh as a PreToolUse hook. Includes circuit breaker protection (auto-allow after 5 consecutive denies to prevent lockout).
Generic Adapter
Name: generic
Detection: Always matches (fallback).
Wire format:
{"tool": "toolName", "input": {"key": "value"}}
Capability classification: Keyword-based prefix matching on tool name.
Adapter selection
Priority order:
SSG_CLIENTenvironment variable (explicit override)- Known client environment variables (e.g.,
CLAUDE_CODE_VERSION) - Generic adapter (fallback)
Creating custom adapters
Implement the ClientAdapter interface and register it in the adapter registry. Key considerations:
detect()should be fast — it runs on every evalparseInput()must handle malformed input gracefullytoolCapability()should cover all tools the client usesinstall()should be idempotent (safe to run multiple times)