Integrations

Claude Code Adapter

Capture Claude Code hooks and stream-json output, generate hook settings, and understand model replay limitations.

@isplay/adapter-claude-code captures Claude Code managed runtime evidence through hooks and stream-json ingestion.

Exports

ExportPurpose
createClaudeCodeAdapter(options?)Returns capabilities, hook handler, stream line ingestor, and stream event ingestor.
claudeCodeCapabilitiesCapability manifest for Claude Code.
ClaudeCodeHookHandlerHandles prompt, pre-tool, post-tool, and stop hooks.
ClaudeStreamIngestorConverts stream-json events into model records and events.
createClaudeCodeSettings(command?)Emits Claude Code hook settings.

Setup

import { init } from "@isplay/sdk";
import { createClaudeCodeAdapter } from "@isplay/adapter-claude-code";

init({
  projectId: process.env.ISPLAY_PROJECT_ID!,
  baseUrl: process.env.ISPLAY_API_URL,
});

const claude = createClaudeCodeAdapter({
  runKey: (event) => String(event.session_id ?? "claude-code"),
  replacementMode: "post_tool_context",
});

Hook Handling

const output = await claude.handleHook(input);
EventCaptured behavior
UserPromptSubmitRecords event, annotates prompt, optionally returns additional context.
PreToolUseRecords proposal, starts tool execution, consults fixture gateway, can deny or defer.
PostToolUseFinishes tool execution and can add injected output as post-tool context.
StopAnnotates final assistant message.

The settings helper also lists PreCompact, SubagentStart, and SubagentStop, but the current handler only special-cases prompt, pre/post tool, and stop.

Stream-JSON Ingestion

await claude.ingestStreamLine(line);
await claude.ingestStreamEvent(event);
Event typeCapture
systemEnsures a model call exists and records stream event.
assistantEnsures a model call exists and records stream event.
resultFinishes the model call with output and usage.
otherRecords stream event.

Settings Generation

import { createClaudeCodeSettings } from "@isplay/adapter-claude-code";

const settings = createClaudeCodeSettings("isplay-claude-hook");

The generated object configures command hooks for user prompt, pre-tool, post-tool, stop, compact, and subagent events.

Capabilities

Claude Code is managed_replay.

PrimitiveStatusMode
Context inventorymanaged_replayobserve_only
Prompt patchmanaged_replaynative_replace
Model captureobservability_onlyobserve_only
Model replayunsupportedobserve_only
Tool capturemanaged_replayobserve_only
Tool fixture replaymanaged_replaypost_result_replace
Checkpointingmanaged_replayobserve_only

Warnings

  • Claude Code does not expose a stable public model-output injection API, so model replay is unsupported.
  • Built-in tool output replacement after execution cannot undo side effects.
  • Use deny/defer before execution for risky tools and isplay-owned MCP/proxy tools for fixture-safe replay.

On this page