CL

Claude (Anthropic)

ai-ml vOpus 4.6

Claude (Anthropic)

Version: Opus 4.6

Overview

Claude is the primary frontier AI model powering the Prismatic Platform's most sophisticated operations. Developed by Anthropic, Claude Opus 4.6 provides the reasoning, code generation, and analysis capabilities that drive the platform's autonomous agent system, quality enforcement, and self-evolution mechanisms. Claude is not merely an API integration -- it is the cognitive engine behind the platform's most ambitious capabilities, from autonomous code generation to epistemic verification.

The Prismatic Platform integrates Claude through its Agent SDK for interactive development sessions, code review and generation, architecture analysis, and complex problem-solving. Claude serves as the "brain" behind the platform's most advanced operations -- from the ARCHER SUPREME tactical commander to the quality DNA evolution system. Every line of platform code written with Claude assistance passes through the same NO MERCY quality gates as manually written code, ensuring AI-generated output meets production standards.

Claude's integration extends beyond simple API calls -- the platform maintains sophisticated session context management, stack-based conversation tracking, and quality-aware prompting that ensures every Claude interaction adheres to the platform's doctrines and standards. The session lifecycle system tracks conversation state, enforces quality gates before and after each interaction, and maintains persistent context across development sessions for continuity.

Key Features

Claude provides a comprehensive set of AI capabilities that the platform leverages across code generation, analysis, and autonomous agent operations.

  • Advanced Reasoning: Multi-step logical reasoning for complex architecture decisions and debugging scenarios
  • Code Generation: Production-quality Elixir, TypeScript, SQL, and infrastructure code with type specifications
  • Long Context: 200K+ token context window enabling analysis of entire application modules and cross-module dependencies
  • Tool Use: Function calling for structured agent interactions, enabling Claude to invoke platform tools and APIs
  • Vision: Image and document analysis capabilities for UI review, architecture diagrams, and security screenshot analysis
  • Safety: Constitutional AI alignment ensuring reliable, consistent outputs aligned with platform values
  • Session Continuity: Persistent context across development sessions through the stack-based conversation system
  • Quality Awareness: Integration with platform quality gates ensuring all generated code meets the zero-defect standard
CapabilityPlatform ApplicationIntegration Point
Code generationNew module creation, refactoringClaude Agent SDK sessions
Architecture analysisCross-module dependency reviewLong context window
Bug diagnosisRoot cause analysis from error tracesReasoning + tool use
Test generationComprehensive test suite creationCode generation + ExUnit patterns
Quality enforcementCredo/Dialyzer complianceSession lifecycle hooks
DocumentationModule and function documentationCode generation + docstrings
Security reviewVulnerability pattern detectionReasoning + platform knowledge

Platform Integration

Claude powers the platform's AI-driven development and analysis workflows through a dedicated OTP application that manages session state, conversation history, and lifecycle hooks.

defmodule PrismaticClaude.SessionLifecycle do
  @moduledoc """
  Manages Claude session lifecycle with quality gate enforcement.
  Triggers platform hooks at session start, pre/post-command, and session end.
  """
  use GenServer

  @impl true
  def init(state) do
    hooks = PrismaticClaude.SessionHooks.default_hooks()
    {:ok, Map.put(state, :hooks, hooks)}
  end

  @spec trigger(atom()) :: {:ok, list()}
  def trigger(phase) when phase in [:session_start, :pre_command, :post_command, :session_end] do
    GenServer.call(__MODULE__, {:trigger, phase})
  end

  @impl true
  def handle_call({:trigger, phase}, _from, state) do
    results = execute_hooks(state.hooks, phase)
    {:reply, {:ok, results}, state}
  end

  defp execute_hooks(hooks, phase) do
    hooks
    |> Enum.filter(& &1.phase == phase)
    |> Enum.sort_by(& &1.priority)
    |> Enum.map(&execute_single_hook/1)
  end

  defp execute_single_hook(hook) do
    case hook.function.() do
      {:ok, result} -> {:ok, hook.name, result}
      {:error, reason} -> {:error, hook.name, reason}
    end
  end
end

The stack-based conversation system maintains immutable frames that track the evolution of a development session:

defmodule PrismaticClaude.StackConversation do
  @moduledoc """
  Stack-based conversation tracking with immutable frames.
  Provides /stack, /frame, /pop, /fork, /checkpoint, /goto commands.
  """
  use GenServer

  @type frame :: %{
    id: non_neg_integer(),
    input_summary: String.t(),
    output_summary: String.t(),
    assumptions: [String.t()],
    decisions: [String.t()],
    timestamp: DateTime.t()
  }

  @spec push_frame(frame()) :: :ok
  def push_frame(frame) do
    GenServer.call(__MODULE__, {:push, frame})
  end

  @spec get_stack() :: [frame()]
  def get_stack do
    GenServer.call(__MODULE__, :get_stack)
  end

  @spec checkpoint(String.t()) :: :ok
  def checkpoint(name) do
    GenServer.call(__MODULE__, {:checkpoint, name})
  end
end

Architecture

Claude integration follows a layered architecture that separates the AI model interface from the platform's business logic and quality enforcement.

LayerComponentResponsibility
Model InterfaceAnthropic API ClientHTTP communication, token management, retry logic
Session ManagementSessionLifecycle GenServerLifecycle hooks, phase management, circuit breaker
Conversation StateStackConversation GenServerImmutable frame tracking, checkpoints, branching
Quality GatesSessionHooksPre/post-command quality checks, autoheal triggers
Context PersistenceSession Context Files.claude/session-context/ file management
Quality DNAQuality State Tracking.claude/quality-dna/current-state.json maintenance
Agent IntegrationPrismaticAgentsClaude-powered autonomous agent behaviors

The circuit breaker pattern protects the platform from cascading failures when Claude API calls fail, automatically opening after 3 consecutive failures and resetting after 60 seconds. This ensures that transient API issues do not disrupt other platform operations.

Performance Characteristics

Claude integration performance is optimized for interactive development sessions where response latency directly impacts developer productivity.

MetricTypical ValueNotes
Simple query response2-5 secondsShort code generation, Q&A
Complex generation10-30 secondsFull module creation with tests
Architecture analysis15-45 secondsCross-module dependency review
Context window utilization50-150K tokensTypical session with codebase context
Session hook overhead< 500msQuality gate checks per interaction
Conversation frame creation< 10msLocal GenServer operation
Session context save< 100msFile write to disk

The platform caches Claude responses in ETS for repeated queries (e.g., module documentation lookups) to reduce API calls and improve responsiveness during iterative development cycles.

Configuration

Claude integration is configured through the application environment with model selection, token limits, and session management parameters.

config :prismatic_claude,
  model: "claude-opus-4-6",
  max_tokens: 8192,
  session_context_path: ".claude/session-context/",
  stack_conversation_enabled: true,
  quality_dna_path: ".claude/quality-dna/current-state.json",
  circuit_breaker: [
    max_failures: 3,
    reset_timeout: 60_000
  ],
  hooks: [
    session_start: [:autoheal_baseline, :load_session_context],
    pre_command: [:quality_gates_check],
    post_command: [:autoevolve_scan],
    session_end: [:autoheal_cycle, :save_session_context]
  ]

Best Practices

The platform enforces specific practices for Claude integration to ensure AI-assisted development maintains the same quality standards as manual development.

  • Always run quality gates on generated code -- Claude output passes through the same Credo, Dialyzer, and compilation checks as manually written code
  • Maintain session context -- save and load session context files to maintain continuity across development sessions
  • Use the stack conversation system -- track assumptions and decisions in immutable frames for audit trail and context recovery
  • Never bypass quality hooks -- the SessionLifecycle hooks enforce quality standards at every interaction point
  • Provide sufficient context -- leverage the 200K+ token window to include relevant module source, test files, and documentation
  • Review all generated code -- AI-generated code requires the same review rigor as human-written code before committing
  • Monitor API costs -- track token usage per session to optimize prompt engineering and reduce unnecessary API calls
  • Use local AI as fallback -- the platform supports Ollama as a local fallback for non-critical operations

Comparison

Claude was selected as the platform's primary AI model after evaluating multiple frontier models on Elixir code generation quality, reasoning depth, and tool use reliability. Its understanding of OTP patterns and supervision tree design makes it particularly effective for Elixir-specific architecture recommendations.

CriterionClaude (Opus 4.6)GPT-4GeminiLocal (Ollama)
Elixir code qualityExcellentGoodGoodModerate
Long context200K tokens128K tokens1M tokens8-32K tokens
Tool use reliabilityExcellentGoodGoodLimited
Reasoning depthExcellentExcellentGoodLimited
API latency2-30s2-20s2-15s1-5s
Cost per sessionModerateModerateLowerFree (local)
PrivacyCloud APICloud APICloud APIFully local
Platform integrationDeep (Agent SDK)API onlyAPI onlyOllama Coordinator
  • Ollama - Local AI alternative for offline development and non-critical operations
  • Elixir - Primary language that Claude generates and analyzes
  • BEAM - Runtime hosting the Claude integration GenServers
  • ETS - Response caching for repeated queries
  • Credo - Code quality validation applied to Claude-generated code
  • Dialyzer - Type safety verification for AI-generated functions
  • prismatic_claude - Claude integration layer with SessionLifecycle and StackConversation
  • prismatic_agents - Claude-powered autonomous agent behaviors and decision making
  • prismatic_safety - Quality enforcement applied to all Claude-generated output

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL