Back to .md Directory

CC Director - Comprehensive Code Review Guide

**Target Framework:** .NET 10

May 2, 2026
0 downloads
1 views
ai claude
View source

CC Director - Comprehensive Code Review Guide

Version: 1.1.0 Target Framework: .NET 10 Platform: Windows 10/11 (WPF Desktop Application) Last Updated: 2026-02-21


Table of Contents

  1. Executive Summary
  2. Architecture Overview
  3. Project Structure
  4. Core Domain Model
  5. Key Components Deep Dive
  6. External Dependencies
  7. Feature Inventory
  8. Data Flow & IPC
  9. Configuration
  10. Testing Strategy
  11. Coding Standards
  12. Security Considerations
  13. Known Constraints
  14. Review Focus Areas

1. Executive Summary

CC Director is a Windows desktop application for managing multiple Claude Code CLI sessions simultaneously. It provides:

  • Multi-session management: Run independent Claude Code instances side-by-side, each working on a different repository
  • Real-time activity tracking: Color-coded status indicators showing Claude's cognitive state (Idle, Working, Waiting for Input, etc.)
  • Session persistence: Sessions survive application restarts with automatic reconnection
  • Embedded console hosting: Native Windows console windows overlaid onto the WPF application
  • Git integration: Repository status display with staged/unstaged changes
  • Voice mode: Speech-to-text and text-to-speech integration for voice interaction with Claude

Core Problem Solved

Developers using Claude Code often need to work on multiple codebases simultaneously. CC Director eliminates the need to switch between terminal windows by providing a unified interface to spawn, monitor, and interact with multiple Claude Code sessions.

Technical Approach

The application uses Windows Pseudo Console (ConPTY) for terminal hosting, Windows Named Pipes for IPC with Claude Code hooks, and standard WPF patterns for the UI layer.


2. Architecture Overview

Layer Diagram

+------------------------------------------------------------------+
|                         WPF UI Layer                              |
|  (CcDirector.Wpf)                                                 |
|  - MainWindow, Dialogs, Controls, ViewModels                     |
|  - EmbeddedBackend (console overlay)                             |
+------------------------------------------------------------------+
                              |
                              v
+------------------------------------------------------------------+
|                      Core Services Layer                          |
|  (CcDirector.Core)                                               |
|  +------------+  +------------+  +------------+  +------------+  |
|  |  Sessions  |  |    Hooks   |  |   Pipes    |  |    Git     |  |
|  +------------+  +------------+  +------------+  +------------+  |
|  +------------+  +------------+  +------------+  +------------+  |
|  |  Backends  |  |  ConPTY    |  |   Voice    |  | Utilities  |  |
|  +------------+  +------------+  +------------+  +------------+  |
+------------------------------------------------------------------+
                              |
                              v
+------------------------------------------------------------------+
|                    Native Windows APIs                            |
|  - ConPTY (CreatePseudoConsole, ResizePseudoConsole)            |
|  - Named Pipes (NamedPipeServerStream)                           |
|  - Process Management (CreateProcessW)                           |
|  - Win32 Window Management (for console embedding)               |
+------------------------------------------------------------------+

Key Architectural Patterns

PatternImplementationPurpose
Strategy PatternISessionBackend interface with 3 implementationsAbstracts terminal hosting modes
Observer PatternEvents (StatusChanged, OnActivityStateChanged)UI updates on state changes
State MachineActivityState enum with HandlePipeEvent()Claude's cognitive state tracking
Producer-ConsumerBlockingCollection<string> in FileLogThread-safe async logging
Repository PatternRecentSessionStore, RepositoryRegistryPersistence abstraction

Design Principles

  1. No DI Containers: Explicit construction with new for clarity
  2. No Web Dependencies: Pure WPF desktop application
  3. Fail Fast: Validate early, throw specific exceptions
  4. No Fallbacks: Fix root causes, don't hide problems
  5. Responsive UI: Immediate visual feedback for all user actions

3. Project Structure

Solution Layout

cc-director.sln
|
+-- src/
|   +-- CcDirector.Core/              # Core business logic (no UI)
|   |   +-- Backends/                 # Session backend implementations
|   |   |   +-- ISessionBackend.cs    # Backend interface
|   |   |   +-- PipeBackend.cs        # Stateless pipe mode
|   |   +-- Claude/                   # Claude Code integration
|   |   |   +-- ClaudeSessionReader.cs
|   |   |   +-- ClaudeSessionMetadata.cs
|   |   +-- Configuration/            # App configuration
|   |   |   +-- AgentOptions.cs
|   |   |   +-- RepositoryRegistry.cs
|   |   |   +-- RepositoryConfig.cs
|   |   +-- ConPty/                   # Windows Pseudo Console
|   |   |   +-- NativeMethods.cs      # P/Invoke declarations
|   |   |   +-- ProcessHost.cs        # Process spawning
|   |   |   +-- PseudoConsole.cs      # ConPTY wrapper
|   |   +-- Git/                      # Git integration
|   |   |   +-- GitStatusProvider.cs
|   |   |   +-- GitSyncStatusProvider.cs
|   |   +-- Hooks/                    # Claude Code hook system
|   |   |   +-- HookInstaller.cs      # settings.json manipulation
|   |   |   +-- HookRelayScript.cs    # PowerShell relay source
|   |   +-- Memory/                   # Terminal buffer
|   |   |   +-- CircularTerminalBuffer.cs
|   |   +-- Pipes/                    # Named pipe IPC
|   |   |   +-- DirectorPipeServer.cs
|   |   |   +-- PipeMessage.cs
|   |   |   +-- EventRouter.cs
|   |   +-- Sessions/                 # Session management
|   |   |   +-- Session.cs            # Central session abstraction
|   |   |   +-- SessionManager.cs     # Lifecycle management
|   |   |   +-- ActivityState.cs      # Cognitive state enum
|   |   |   +-- RecentSessionStore.cs # Persistence
|   |   +-- Utilities/
|   |   |   +-- FileLog.cs            # Thread-safe logging
|   |   |   +-- NulFileWatcher.cs     # Windows nul file cleanup
|   |   +-- Voice/                    # Voice mode services
|   |       +-- VoiceModeController.cs
|   |       +-- WhisperSttService.cs
|   |       +-- OpenAiSttService.cs
|   |       +-- OpenAiTtsService.cs
|   |       +-- PiperTtsService.cs
|   |       +-- ClaudeSummarizer.cs
|   |
|   +-- CcDirector.Wpf/               # WPF desktop application
|   |   +-- App.xaml / App.xaml.cs    # Application entry point
|   |   +-- MainWindow.xaml/.cs       # Main window
|   |   +-- Backends/
|   |   |   +-- EmbeddedBackend.cs    # Console overlay implementation
|   |   +-- Controls/
|   |   |   +-- EmbeddedConsoleHost.cs
|   |   +-- Helpers/
|   |   |   +-- TerminalCell.cs
|   |   +-- Voice/
|   |   |   +-- [Voice UI components]
|   |   +-- *Dialog.xaml/.cs          # Modal dialogs
|   |   +-- appsettings.json          # Configuration file
|   |   +-- app.ico                   # Application icon
|   |
|   +-- CcDirector.Core.Tests/        # xUnit test suite
|   |   +-- ActivityStateTests.cs
|   |   +-- CircularTerminalBufferTests.cs
|   |   +-- DirectorPipeServerTests.cs
|   |   +-- EventRouterTests.cs
|   |   +-- GitStatusProviderTests.cs
|   |   +-- GitSyncStatusProviderTests.cs
|   |   +-- HookInstallerTests.cs
|   |   +-- RepositoryRegistryTests.cs
|   |   +-- SessionManagerTests.cs
|   |   +-- SessionPersistenceTests.cs
|   |   +-- SessionVerificationTests.cs
|   |   +-- TerminalVerificationIntegrationTests.cs
|   |   +-- VoiceModeControllerTests.cs
|   |   +-- Voice/
|   |       +-- [Voice-specific tests]
|   |
|   +-- CcDirector.TestHarness/       # Integration testing
|   +-- CcClick/                      # UI automation utility
|   +-- ConPtyTest/                   # ConPTY testing
|   +-- ConsoleDiagnostic/            # Diagnostic utility
|
+-- docs/                             # Documentation
|   +-- CodingStyle.md                # Coding standards
|   +-- VisualStyle.md                # UI design guide
|   +-- [Other design docs]
|
+-- local_builds/
|   +-- cc-director.exe               # Local build output
|
+-- images/                           # Screenshots for README
+-- CLAUDE.md                         # Project instructions for Claude
+-- HANDOVER.md                       # Development handover document
+-- README.md                         # Project overview

Project Dependencies

CcDirector.Wpf  -->  CcDirector.Core
                         |
CcDirector.Core.Tests -->+

4. Core Domain Model

Session State Model

+-------------------+     +------------------+
|    SessionStatus  |     |   ActivityState  |
+-------------------+     +------------------+
| Starting          |     | Starting         |  <- Session created
| Running           |     | Idle             |  <- Claude finished response (Stop hook)
| Exiting           |     | Working          |  <- User sent prompt / tool executing
| Exited            |     | WaitingForInput  |  <- Claude asking for input
| Failed            |     | WaitingForPerm   |  <- Permission prompt shown
+-------------------+     | Exited           |  <- Session ended
                          +------------------+

SessionStatus = Process lifecycle (is claude.exe running?)
ActivityState = Claude's cognitive state (what is Claude doing?)

Session Entity

public class Session
{
    // Identity
    public Guid Id { get; }
    public string RepoPath { get; }
    public string? ClaudeSessionId { get; set; }  // From hook events

    // State
    public SessionStatus Status { get; }
    public ActivityState ActivityState { get; }
    public VerificationStatus VerificationStatus { get; }

    // Display
    public string? CustomName { get; set; }
    public string? CustomColor { get; set; }

    // Backend
    public ISessionBackend Backend { get; }
    public CircularTerminalBuffer? Buffer { get; }

    // Events
    public event Action<SessionStatus, SessionStatus>? StatusChanged;
    public event Action<ActivityState, ActivityState>? OnActivityStateChanged;

    // Methods
    public void HandlePipeEvent(PipeMessage msg);  // State machine
    public Task SendTextAsync(string text);
    public Task SendEnterAsync();
}

Backend Abstraction

public interface ISessionBackend
{
    int ProcessId { get; }
    SessionStatus Status { get; }
    bool IsRunning { get; }
    bool HasExited { get; }
    CircularTerminalBuffer? Buffer { get; }

    void Start(string workingDirectory, string command, string arguments);
    void Write(byte[] data);
    Task SendTextAsync(string text);
    Task SendEnterAsync();
    void Resize(int width, int height);
    Task GracefulShutdownAsync(int timeoutMs);

    event Action<SessionStatus, SessionStatus>? StatusChanged;
    event Action<int>? ProcessExited;
}

Implementations:

BackendDescriptionUse Case
EmbeddedBackendNative console window overlayPrimary mode - full terminal fidelity
ConPtyBackendWindows Pseudo Console with WPF renderingAlternative mode - custom rendering
PipeBackendStateless, spawns process per promptHeadless/API mode

5. Key Components Deep Dive

5.1 Session Management

SessionManager.cs - Orchestrates session lifecycle

public class SessionManager
{
    private readonly ConcurrentDictionary<Guid, Session> _sessions;
    private readonly ConcurrentDictionary<string, Guid> _claudeSessionMap;  // session_id -> Guid

    public Session CreateSession(string repoPath, string? claudeArgs);
    public Session? RestoreEmbeddedSession(SessionState state);
    public void RegisterClaudeSession(string claudeSessionId, Guid sessionId);
    public Session? GetSessionByClaudeId(string claudeSessionId);
    public Task KillSessionAsync(Guid sessionId);
}

5.2 Hook Infrastructure

HookInstaller.cs - Manages Claude Code hooks in ~/.claude/settings.json

  • Installs 12 hook event types
  • Preserves existing user hooks (merge, not overwrite)
  • Creates backups before modification
  • All hooks are async: true (non-blocking)

Hook Events Captured:

EventPurpose
SessionStartDetect new session
UserPromptSubmitUser sent prompt -> Working
PreToolUseTool about to execute -> Working
PostToolUseTool completed
PostToolUseFailureTool failed
PermissionRequestPermission prompt shown -> WaitingForPerm
NotificationGeneric notification
SubagentStartSubagent spawned
SubagentStopSubagent completed
StopResponse complete -> Idle
PreCompactContext compaction
SessionEndSession terminated

5.3 Pipe IPC System

DirectorPipeServer.cs - Named pipe server

public class DirectorPipeServer
{
    private const string PipeName = "CC_ClaudeDirector";

    public event Action<PipeMessage>? OnMessageReceived;

    public void Start();   // Begin async accept loop
    public void Stop();    // Shutdown server
}

Data Flow:

Claude Code Session
       |
       | (hook fires)
       v
PowerShell Relay Script (hook-relay.ps1)
       |
       | (reads stdin JSON, writes to named pipe)
       v
\\.\pipe\CC_ClaudeDirector
       |
       | (NamedPipeServerStream accepts connection)
       v
DirectorPipeServer
       |
       | (deserializes JSON to PipeMessage)
       v
EventRouter
       |
       | (maps session_id to Session)
       v
Session.HandlePipeEvent(PipeMessage)
       |
       | (state machine transition)
       v
UI Update (via INotifyPropertyChanged)

5.4 Terminal Buffer

CircularTerminalBuffer.cs - Thread-safe ring buffer for terminal output

public class CircularTerminalBuffer
{
    private readonly byte[] _buffer;           // Ring buffer storage
    private readonly int _capacity;            // Default: 2 MB
    private long _totalBytesWritten;           // Monotonic counter
    private readonly ReaderWriterLockSlim _lock;

    public void Write(byte[] data);
    public byte[] ReadAll();
    public byte[] ReadFrom(long position);     // For streaming reads
}

5.5 Git Integration

GitStatusProvider.cs - Async git status polling

public static class GitStatusProvider
{
    public static Task<GitStatusResult> GetStatusAsync(string repoPath);
}

public class GitStatusResult
{
    public bool Success { get; }
    public List<GitFileChange> StagedChanges { get; }
    public List<GitFileChange> UnstagedChanges { get; }
    public string? ErrorMessage { get; }
}

public enum GitFileStatus
{
    Modified, Added, Deleted, Renamed, Copied, Untracked, Unknown
}

5.6 Session Verification

ClaudeSessionReader.cs - Validates sessions against Claude's .jsonl files

The application can lose track of which Claude Code session corresponds to which Director session (e.g., after restart). Session verification:

  1. Reads terminal content from the console
  2. Extracts user prompts from Claude's .jsonl transcript files
  3. Performs text matching (whitespace-insensitive)
  4. Confirms session identity when sufficient matches found
public class ClaudeSessionReader
{
    public VerificationResult VerifyWithTerminalContent(
        string terminalText,
        string repoPath);
}

5.7 Voice Mode

VoiceModeController.cs - Orchestrates voice interaction flow

State Machine:
Idle -> Recording -> Transcribing -> SendingToSession ->
WaitingForResponse -> SummarizingResponse -> Speaking -> Idle

Services:

ServicePurpose
WhisperSttServiceLocal speech-to-text (Whisper.net)
OpenAiSttServiceCloud speech-to-text (OpenAI API)
WhisperLocalStreamingServiceStreaming transcription
OpenAiTtsServiceText-to-speech (OpenAI API)
PiperTtsServiceLocal TTS (Piper)
ClaudeSummarizerSummarizes Claude's response for speaking

5.8 Logging

FileLog.cs - Thread-safe file logging

public static class FileLog
{
    // Location: %LOCALAPPDATA%\CcDirector\logs\director-YYYY-MM-DD-{PID}.log

    public static void Start();
    public static void Write(string message);  // Thread-safe, async queue
    public static void Stop();
}

Log format:

2026-02-21 14:32:15.123 [SessionManager] CreateSession: repoPath=D:\Repos\myproject
2026-02-21 14:32:15.456 [SessionManager] Session created: id=abc123, pid=12345

6. External Dependencies

NuGet Packages

PackageVersionProjectPurpose
Whisper.net1.*CoreLocal speech-to-text transcription
Whisper.net.Runtime1.*CoreNative Whisper binaries
NAudio2.*WpfAudio recording/playback for voice mode
Microsoft.NET.Test.Sdk17.*TestsTest framework support
xunit2.*TestsUnit testing framework
xunit.runner.visualstudio2.*TestsVisual Studio test runner

System Dependencies

DependencyPurpose
.NET 10 Desktop RuntimeApplication runtime
Windows Console Host (conhost.exe)Required for embedded console mode
Claude Code CLIThe claude executable must be on PATH
GitFor git status integration
PowerShellFor hook relay script execution

Native Windows APIs Used

APIPurpose
CreatePseudoConsoleConPTY creation
ResizePseudoConsoleTerminal resize
CreateProcessWProcess spawning with ConPTY
SetParentConsole window embedding
MoveWindowConsole positioning
NamedPipeServerStreamIPC with hooks

7. Feature Inventory

Implemented Features

FeatureDescriptionKey Files
Multi-session managementRun multiple Claude sessions side-by-sideSessionManager.cs, MainWindow.xaml
Embedded consoleNative console overlay in WPFEmbeddedBackend.cs, EmbeddedConsoleHost.cs
Activity indicatorsColor-coded status (Idle/Working/Waiting)ActivityState.cs, Session.HandlePipeEvent()
Hook integrationCaptures 12 Claude Code event typesHookInstaller.cs, DirectorPipeServer.cs
Session persistenceSurvives app restartsRecentSessionStore.cs, SessionStateStore.cs
Terminal verificationMatches terminal to .jsonl filesClaudeSessionReader.cs
Git integrationShows staged/unstaged changesGitStatusProvider.cs, Source Control tab
Repository managementRegister, clone, initialize reposRepositoryRegistry.cs, Repositories tab
Voice modeRecord/transcribe/send/speakVoiceModeController.cs, Voice/
Pipe message loggingDebug view of hook eventsPipe Messages tab
File loggingDaily logs to %LOCALAPPDATA%FileLog.cs
Drag-and-drop sessionsReorder sessions in sidebarMainWindow.xaml.cs
Custom session names/colorsPersonalize session displayRenameSessionDialog.xaml

Pending/Future Features

FeatureStatusNotes
Permission prompt UIPlannedHandle permission_request hook events
Prompt historyPlannedRecall previously sent prompts
Subagent visualizationPlannedShow subagent tree
Tool execution displayPlannedShow tools as they execute
Task trackingPlannedTrack todos from Claude

8. Data Flow & IPC

Hook Event Flow

+------------------+     stdin JSON     +---------------------+
|  Claude Code     | -----------------> | hook-relay.ps1      |
|  (claude.exe)    |                    | (PowerShell script) |
+------------------+                    +---------------------+
                                                  |
                                                  | Named Pipe Write
                                                  v
                                        +---------------------+
                                        | DirectorPipeServer  |
                                        | \\.\pipe\CC_        |
                                        | ClaudeDirector      |
                                        +---------------------+
                                                  |
                                                  | OnMessageReceived
                                                  v
                                        +---------------------+
                                        | EventRouter         |
                                        | (session_id -> Guid)|
                                        +---------------------+
                                                  |
                                                  | HandlePipeEvent
                                                  v
                                        +---------------------+
                                        | Session             |
                                        | (state machine)     |
                                        +---------------------+
                                                  |
                                                  | PropertyChanged
                                                  v
                                        +---------------------+
                                        | WPF UI              |
                                        | (data binding)      |
                                        +---------------------+

Session Lifecycle

User clicks "New Session"
         |
         v
+-------------------+
| SessionManager    |
| .CreateSession()  |
+-------------------+
         |
         v
+-------------------+       +-------------------+
| EmbeddedBackend   | ----> | conhost.exe       |
| .Start()          |       | + claude.exe      |
+-------------------+       +-------------------+
         |
         v
+-------------------+
| Session created   |
| Status: Starting  |
| Activity: Starting|
+-------------------+
         |
         | (Hook: SessionStart)
         v
+-------------------+
| SessionManager    |
| .RegisterClaude   |
| Session()         |
+-------------------+
         |
         | (Claude sends welcome)
         | (Hook: Stop)
         v
+-------------------+
| Activity: Idle    |
+-------------------+
         |
         | User sends prompt
         v
+-------------------+
| Activity: Working |
+-------------------+
         |
         | (Claude working...)
         | (Hook: PreToolUse, PostToolUse, etc.)
         | (Hook: Stop)
         v
+-------------------+
| Activity: Idle    |
+-------------------+

Persistence Storage

FileLocationContents
sessions.json~/Documents/CcDirector/Active session state
repositories.json~/Documents/CcDirector/Registered repositories
settings.json~/.claude/Claude Code hooks config
director-*.log%LOCALAPPDATA%\CcDirector\logs\Daily log files

9. Configuration

appsettings.json

{
  "Agent": {
    "ClaudePath": "claude",
    "DefaultBufferSizeBytes": 2097152,
    "GracefulShutdownTimeoutSeconds": 5
  },
  "Repositories": [
    { "Name": "my-project", "Path": "D:\\Repos\\my-project" }
  ]
}

AgentOptions.cs

PropertyDefaultDescription
ClaudePath"claude"Path to claude executable
DefaultClaudeArgs"--dangerously-skip-permissions"Default CLI args
DefaultBufferSizeBytes2097152 (2 MB)Terminal buffer size
GracefulShutdownTimeoutSeconds5Shutdown wait time

Environment Requirements

  • claude must be on PATH (or absolute path in config)
  • Default terminal must be Windows Console Host (not Windows Terminal)
  • PowerShell must be available for hook relay

10. Testing Strategy

Test Project

  • Framework: xUnit 2.x
  • Location: src/CcDirector.Core.Tests/
  • Coverage areas: All Core library public methods

Test Organization

Test FileCoverage
ActivityStateTests.csHook event state transitions
CircularTerminalBufferTests.csRing buffer operations, wraparound
DirectorPipeServerTests.csNamed pipe message handling
EventRouterTests.csEvent routing logic
GitStatusProviderTests.csGit status parsing
GitSyncStatusProviderTests.csBranch sync status
HookInstallerTests.cssettings.json merge logic
RepositoryRegistryTests.csRepo registry persistence
SessionManagerTests.csSession creation, lifecycle
SessionPersistenceTests.csSave/load state
SessionVerificationTests.csTerminal matching
TerminalVerificationIntegrationTests.csEnd-to-end verification
VoiceModeControllerTests.csVoice flow orchestration

Test Patterns

[Fact]
public void MethodName_Scenario_ExpectedResult()
{
    // Arrange
    var sut = new SystemUnderTest();

    // Act
    var result = sut.MethodUnderTest(input);

    // Assert
    Assert.Equal(expected, result);
}

Running Tests

dotnet test src/CcDirector.Core.Tests/CcDirector.Core.Tests.csproj

11. Coding Standards

Philosophy

  1. Enterprise Quality - Production software, not prototype
  2. Fail Fast, Fail Loud - Validate early, throw specific exceptions
  3. No Fallbacks - Fix root causes, don't add workarounds
  4. Responsive UI - Immediate feedback for every action
  5. Test Everything - Every feature needs unit tests
  6. Zero Warnings - Treat warnings as errors

Error Handling Rules

Try-catch ONLY at boundaries:

  • Event handlers (Button_Click)
  • Lifecycle methods (Loaded, OnStartup)
  • Timer callbacks
  • External event subscriptions

Never in:

  • Helper methods
  • Service layer methods
  • Business logic

Null Safety

  • Null-forgiving operator (!) is FORBIDDEN
  • Use explicit null checks with throw
  • Use pattern matching: if (x is null)
  • In tests: use Assert.NotNull()

Logging Requirements

public void PublicMethod(string param)
{
    FileLog.Write($"[ClassName] MethodName: param={param}");
    try
    {
        // work
        FileLog.Write($"[ClassName] MethodName completed: result={result}");
    }
    catch (Exception ex)
    {
        FileLog.Write($"[ClassName] MethodName FAILED: {ex.Message}");
        throw;
    }
}

Naming Conventions

ElementConventionExample
ClassesPascalCase + suffixSessionManager, ConPtyBackend
InterfacesIPascalCaseISessionBackend
MethodsPascalCase, Verb+NounCreateSession(), SendTextAsync()
Private fields_camelCase_sessionManager, _sessions
Async methodsSuffix AsyncKillSessionAsync()
TestsMethod_Scenario_ResultCreateSession_InvalidPath_Throws

Project Configuration

<PropertyGroup>
  <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  <Nullable>enable</Nullable>
  <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

12. Security Considerations

Process Execution

  • All paths validated before Process.Start
  • No shell command construction from user input
  • Process arguments passed as arrays, not concatenated strings

Sensitive Data

  • No API keys in source code
  • Credentials read from environment variables
  • Logs truncate file contents (~100 chars)
  • Never log secrets (tokens, passwords)

IPC Security

  • Named pipe accessible only on local machine
  • No network-exposed endpoints
  • Pipe messages validated before processing

File System

  • Session state stored in user documents folder
  • Logs stored in %LOCALAPPDATA%
  • No privileged file system access required

13. Known Constraints

Platform Constraints

ConstraintReason
Windows onlyUses ConPTY, Win32 window management
Windows Console Host requiredEmbedded mode needs conhost.exe, not Windows Terminal
.NET 10 requiredTarget framework

Claude Code Constraints

ConstraintReason
Hooks snapshot at session startExisting sessions won't pick up settings.json changes
Claude Code must be on PATHOr absolute path in config
--resume flag behaviorRequired for session persistence

Technical Constraints

ConstraintReason
Single instance per repoMultiple sessions on same repo would conflict
2 MB terminal bufferFixed size ring buffer
Hook relay latency~200ms PowerShell startup time

14. Review Focus Areas

High-Priority Areas

  1. Hook System (Hooks/, Pipes/)

    • HookInstaller JSON merge logic
    • DirectorPipeServer concurrent connection handling
    • EventRouter session mapping
    • State machine transitions in Session.HandlePipeEvent()
  2. Session Verification (Claude/)

    • Terminal content matching algorithm
    • .jsonl file parsing
    • Edge cases (word wrapping, normalization)
  3. ConPTY Integration (ConPty/)

    • Native API P/Invoke correctness
    • Process lifecycle management
    • Terminal resize handling
  4. Thread Safety

    • CircularTerminalBuffer locking
    • ConcurrentDictionary usage
    • UI thread dispatch (Dispatcher.BeginInvoke)
    • ObservableCollection modifications
  5. Error Handling

    • Exception boundaries (UI entry points only)
    • Logging coverage
    • User-facing error messages

Medium-Priority Areas

  1. Voice Mode (Voice/)

    • State machine transitions
    • Audio resource cleanup
    • Streaming transcription
  2. Git Integration (Git/)

    • Async process execution
    • Status parsing edge cases
  3. Session Persistence

    • Save/load round-trip
    • State recovery after crash

Code Quality Checks

  • No null! (null-forgiving operator)
  • No .Result or .Wait() (deadlock risk)
  • No try-catch in helper methods
  • All public methods logged
  • All public methods have tests
  • No compiler warnings
  • No fallback logic (try X, fallback to Y)

Appendix A: File Locations Reference

PurposeLocation
Application logs%LOCALAPPDATA%\CcDirector\logs\
Session state~/Documents/CcDirector/sessions.json
Repository registry~/Documents/CcDirector/repositories.json
Claude hooks config~/.claude/settings.json
Claude transcripts~/.claude/projects/{folder}/{session-id}.jsonl
Claude sessions index~/.claude/sessions-index.json

Appendix B: Key Type Hierarchy

ISessionBackend (interface)
    +-- ConPtyBackend
    +-- EmbeddedBackend
    +-- PipeBackend

Session
    +-- uses ISessionBackend
    +-- has ActivityState
    +-- has SessionStatus

SessionManager
    +-- manages Collection<Session>
    +-- maps claudeSessionId -> Session

DirectorPipeServer
    +-- receives PipeMessage
    +-- fires OnMessageReceived

EventRouter
    +-- routes PipeMessage to Session
    +-- uses SessionManager

HookInstaller
    +-- modifies ~/.claude/settings.json
    +-- installs PowerShell relay

Appendix C: Build & Run Commands

# Build
dotnet build src/CcDirector.Wpf/CcDirector.Wpf.csproj

# Run
dotnet run --project src/CcDirector.Wpf/CcDirector.Wpf.csproj

# Test
dotnet test src/CcDirector.Core.Tests/CcDirector.Core.Tests.csproj

# Publish single-file executable
dotnet publish src/CcDirector.Wpf/CcDirector.Wpf.csproj -c Release -r win-x64 --self-contained false /p:PublishSingleFile=true

Document generated for CC Director v1.1.0 code review

Related Documents