Implementation

Developer Notes

Guidance for extending the product without breaking local data contracts, engine abstractions, or long-running agent workflows.

Repository Orientation

AreaFiles
App entry and terminal UIcodepro2/codepro2App.swift, GhosttyTerminal.swift
Engine abstractionEngine/AIEngine.swift, SessionEngineBackend.swift, ClaudeSessionBackend.swift, CodexSessionBackend.swift
Kanban and project modelKanbanModel.swift, KanbanView.swift
Plans and EPICsPlansManager.swift, PlansView.swift, EpicInbox.swift, EpicAggregator.swift
ApprovalsPermissions/, NotchUI/
AnalyticsAnalyticsView.swift, DESIGN_ANALYTICS.md
Git changesGitChangesView.swift and git helpers in codepro2App.swift

Building GhosttyKit

The Xcode project links ghostty/macos/GhosttyKit.xcframework. This framework is generated from the pinned Ghostty submodule and is not stored directly in the repository.

Prerequisites

From the repository root, prepare and build the framework:

git submodule update --init --recursive
brew install zig@0.15
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcodebuild -downloadComponent MetalToolchain
./scripts/build_ghostty.sh

The build script automatically uses Homebrew's keg-only zig@0.15 binary when the default zig command is an incompatible version. It also discovers and selects Xcode's registered Metal toolchain, which Xcode 26 may not select implicitly for command-line builds. The build is complete when ghostty/macos/GhosttyKit.xcframework exists. After generating it for the first time, clean and rebuild the app in Xcode.

Missing XCFramework

If Xcode reports There is no XCFramework found at '.../ghostty/macos/GhosttyKit.xcframework', first check whether ghostty/ is empty. An empty directory means the submodule has not been initialized; run the submodule command above, then run ./scripts/build_ghostty.sh. If the script rejects the active developer directory, select the full Xcode installation with the command above rather than the standalone Command Line Tools. If the build says it cannot execute metal, install the Metal Toolchain component with xcodebuild -downloadComponent MetalToolchain and retry.

Design Rules

Adding A New Engine

  1. Add a case to AIEngine with display name, short name, and accent color.
  2. Implement SessionEngineBackend.
  3. Register the backend in KanbanManager and AutoResumeService.
  4. Add launch, resume, and fork command generation.
  5. Update analytics parsing if the new engine has transcripts or token data.
  6. Update UI engine selectors and documentation.

Changing EPIC Schema

EpicRecord is the on-disk schema. Any schema change must preserve existing JSONL parsing or include a migration path. Because agents may write inbox commands independently, update both the app parser and the managed EPIC skill text if command shape changes.

Changing Approval Hooks

Hook changes involve bundled Python resources, hook installer paths, app-side socket decoding, permission models, and analytics. Keep wire JSON stable unless both hook scripts and HookSocketServer are updated together.

Validation Checklist

Bundled Wiki Maintenance

This wiki is a static bundle under docs/wiki. Pages use local assets/wiki.css and assets/wiki.js, so they can be opened directly from disk or served by any static file server. When the product changes, update the relevant topic page and keep the sidebar links identical across pages.