Codebase Map
May 19, 2026 ยท View on GitHub
This is the practical map of the live codebase. Update it when major ownership seams move.
High-Level Shape
The app has three main loops:
- App/bootstrap loop
AC/ACApp.swift,AC/Core/AppController.swift, and focusedAppController+*.swiftextensions - Monitoring loop
AC/Core/BrainService.swiftdrivingMonitoringAlgorithmRegistryandLLMMonitorAlgorithm - Companion/support loops chat, memory consolidation, policy-memory updates, telemetry, and inspector replay
Directory Map
AC/
The shipping app target.
AC/ACApp.swiftApp entry point,AppDelegate, menu bar item, orb/popover lifecycle.AC/Core/App orchestration and behavior seams.AC/Models/Persisted state, monitoring configuration, policy memory, focus profiles, chat models.AC/Services/IO and side-effect services: storage, screenshots, runtime setup, inference, logs, telemetry exports, calendar, permissions.AC/UI/SwiftUI views for the companion, chat, onboarding, overlays, stats, and settings.
ACShared/
Shared code used by both AC and ACInspector.
ACShared/ACPromptSets.swiftSingle source of truth for all prompt text and prompt rendering.ACShared/AITier.swiftAI tier catalog and model defaults.ACShared/Telemetry/Telemetry event models, stats snapshots, and the file-backed telemetry store.
ACInspector/
Local companion app for reading telemetry and replaying prompts.
InspectorController.swiftInspector state, telemetry refresh loop, annotation flow, Prompt Lab orchestration.TelemetryIndexStore.swiftBuilds a queryable index over telemetry sessions.PromptLabRunner.swiftReplays scenarios against selected prompt/runtime combinations.
ACTests/
Unit tests, regression tests, and fixtures.
FakeRuntimeFixture.swiftDeterministic fake runtime for LLM-facing tests.Goldens/Golden JSON for prompt/output style regression coverage.
Supporting folders
docs/Onboarding and implementation references.dev/agents/accountycat-debugger/Runtime-debugging skill and triage references._Legacy/Parked old implementations. Ignore.
Ownership Seams
App lifecycle and persisted state
AC/Core/AppController.swiftAC/Core/AppControllerSupport.swiftAC/Core/AppController+RuntimeSetup.swiftAC/Core/AppController+Profiles.swiftAC/Core/AppController+ConversationLearning.swiftAC/Core/AppController+Interventions.swiftAC/Services/StorageService.swiftAC/Models/ACModels.swift
If a change mutates settings, persisted state, chat side effects, setup status, onboarding state, profile activation, or UI wiring, start here.
Monitoring and nudging
AC/Core/BrainService.swiftAC/Core/BrainService+Telemetry.swiftAC/Core/MonitoringAlgorithm.swiftAC/Core/LLMMonitorAlgorithm.swiftAC/Core/LLMMonitorAlgorithm+ExplicitDirectives.swiftAC/Core/CompanionPolicy.swiftAC/Core/DistractionLadder.swiftAC/Core/ExecutiveArm.swiftAC/Services/AppFocusAXObserver.swiftACShared/PromptBudgetGuard.swift
This is the path from observed context to a user-visible nudge or overlay.
Runtime, models, and provider routing
AC/Services/RuntimeSetupService.swiftAC/Core/AppController+RuntimeSetup.swiftAC/Services/LocalModelRuntime.swiftAC/Services/OnlineModelService.swiftAC/Services/OnlineProviderRouting.swiftACShared/AITier.swiftAC/Models/MonitoringModels.swift
This area owns local setup, remote calls, model defaults, and the backend selection seam.
Learning and memory
AC/Services/CompanionChatService.swiftAC/Services/ProfileActionParser.swiftAC/Core/AppController+ConversationLearning.swiftAC/Core/AppController+Profiles.swiftAC/Services/PolicyMemoryService.swiftAC/Services/MemoryConsolidationService.swiftAC/Services/SafelistPromotionService.swiftAC/Models/PolicyMemoryModels.swiftACShared/MemoryEntry.swift
This area is where AC learns user preferences, proposes or applies rules, and consolidates memory.
Telemetry and debugging
ACShared/Telemetry/TelemetryStore.swiftAC/Core/BrainService+Telemetry.swiftAC/Core/TelemetryAdapters.swiftAC/Services/LLMTelemetryRecorder.swiftAC/Services/ACDebugBundleService.swiftACInspector/*
This is the main path for runtime debugging, Inspector views, and exported debug bundles.
Current Runtime Flow
AppDelegatebuilds the UI shell and bootstrapsAppController.AppController.bootstrap()refreshes state, configuresBrainService, and starts telemetry if applicable.BrainServiceruns a periodic tick, event-driven app/window/title change detection, plus a slower fallback probe.- Each tick gathers context, heuristics, optional screenshot data, and policy/profile state.
MonitoringAlgorithmRegistryresolvesllm_monitor_v1.LLMMonitorAlgorithmdecides whether to skip, stay silent, nudge, overlay, or abstain.CompanionPolicyconverts model output into a concreteCompanionAction.ExecutiveArmrenders the UI consequence.AppControllerand its focused extensions persist state, record chat/memory/policy side effects, and surface user feedback back into the system.
Where To Edit Common Changes
| Change | Start here |
|---|---|
| App settings or onboarding | AC/Core/AppController.swift, AC/Core/AppController+RuntimeSetup.swift, AC/UI/Settings/*, AC/UI/Onboarding* |
| Monitoring cadence or heuristics | AC/Models/MonitoringModels.swift, AC/Core/MonitoringHeuristics.swift, AC/Core/BrainService.swift |
| Prompt wording or schemas | ACShared/ACPromptSets.swift |
| Rule learning or profile-scoped policy | AC/Services/PolicyMemoryService.swift, AC/Models/PolicyMemoryModels.swift, AC/Core/AppController+ConversationLearning.swift, AC/Core/AppController+Profiles.swift |
| Local runtime install or model download | AC/Services/RuntimeSetupService.swift, AC/Services/DependencyInstallerService.swift, AC/Core/AppController+RuntimeSetup.swift, AC/UI/OnboardingDialogView.swift |
| Online model failures or provider routing | AC/Services/OnlineModelService.swift, AC/Services/OnlineProviderRouting.swift |
| Telemetry/Inspector/debug bundles | ACShared/Telemetry/TelemetryStore.swift, AC/Core/BrainService+Telemetry.swift, ACInspector/*, AC/Services/ACDebugBundleService.swift |