Reference

Architecture & Storage

askTerminal is a local-first SwiftUI/AppKit app built around managers, engine backends, file watchers, a Unix socket approval bridge, and project-local JSON files.

High-Level Components

ComponentRole
AppDelegateCreates the status item, main window, terminal manager, notch manager, Quick Agent, EPIC services, and desktop-space observers.
TerminalManagerOwns terminal lifecycle, selected terminal state, terminal windows, command execution, and system monitoring.
KanbanManagerLoads sessions, todos, skills, agents, instructions, file watchers, project context, and auto-resume context.
SessionEngineBackendProtocol that hides Claude/Codex storage differences from views.
PlansManagerReads and writes project EPICs and drains agent result files.
NotchManagerInstalls hooks, starts approval socket server, and owns the notch window controller.
QuickAgentManagerRegisters Cmd+K, manages quick session settings, streams agent output, and installs the EPIC skill into workspaces.
AnalyticsViewModelParses transcripts and builds session, tool, risk, heatmap, and comparison rows.

Storage Layout

PathOwnerPurpose
~/.claude/projectsClaude CodeProject transcript JSONL files.
~/.claude/tasksClaude Code / askTerminalPer-session todo data.
~/.codex/state_5.sqliteCodexThreads table used for Codex session listing and titles.
~/.codex/sessionsCodexCodex session transcripts.
~/.ask-terminal/projects.jsonaskTerminalKnown project registry.
~/.ask-terminal/state.jsonaskTerminalCross-project EPIC snapshot.
~/.ask-terminal/inboxAgents / askTerminalJSON command dropbox for EPIC operations.
<project>/.ask-terminal/epics.jsonlaskTerminalProject EPIC records.
<project>/.ask-terminal/sessionsAgents / askTerminalAgent result files for EPIC status updates.
<project>/.ask-terminal/skillsUser / askTerminalPrimary project skills.
<project>/.ask-terminal/agentsUser / askTerminalPrimary project agents.

Engine Backend Contract

Each backend lists projects and sessions, saves titles, deletes sessions, mutates todos if supported, provides launch commands, and exposes a watch directory. This contract keeps SwiftUI views engine-agnostic.

protocol SessionEngineBackend {
  var engine: AIEngine { get }
  func listProjects() throws -> [String]
  func listSessions(projectPath: String?) throws -> [TodoSession]
  func saveSessionTitle(sessionId: String, projectPath: String?, title: String) throws
  func updateTodo(_ todo: TodoItem, newStatus: TodoStatus) throws
  func newSessionCommand(projectPath: String) -> String
  func resumeSessionCommand(sessionId: String, prompt: String?) -> String
}

Approval Hook Flow

  1. HookInstaller copies bundled Python hooks into Claude and Codex hook directories.
  2. The hook connects to the local Unix socket server.
  3. HookSocketServer decodes hook JSON and creates permission requests.
  4. PermissionContext stores pending requests and continuations.
  5. ToolApprovalHandler sends approval responses back through the socket.

File Watching

The app uses file-system watchers to reload sessions, detect EPIC changes, process inbox commands, drain result files, and reflect Codex/Claude session updates without manual refresh.