How seifateek/afm-gui works
AFM Chat is a native, offline macOS client for Apple’s on-device Foundation Model. The main workflow is composing a message (optionally with an image or skill), sending it through AppState for streaming generation, then viewing and managing the reply. AppState also handles conversation context and summarization; the UI provides chat organization, settings, and artifact previews. The graph combines sampled calls and imports with documented capabilities; some feature-level wiring is not visible in the excerpts, so those links are omitted or marked unverified.
Main entry points: AppState.swift Chat runtime · Views.swift Chat views · Composer.swift Message composer · Models.swift Artifact extraction
Components 15
App and interface
- App entry
Sources/AFMChat/App.swift - Chat views
Sources/AFMChat/Views.swift - Message composer
Sources/AFMChat/Composer.swift - Settings UI
Sources/AFMChat/Settings.swift
Conversation runtime
- Chat runtime
Sources/AFMChat/AppState.swift - On-device model
- Context management
Sources/AFMChat/AppState.swift
Chat data
- Chat and skill data
Sources/AFMChat/Models.swift - Local chat store
Sources/AFMChat/Models.swift - Markdown parsing
Sources/AFMChat/Models.swift - Image attachments
Sources/AFMChat/Models.swift
User capabilities
- Artifact extraction
Sources/AFMChat/Models.swift - Artifact preview
Sources/AFMChat/Artifacts.swift - Read aloud
Sources/AFMChat/Views.swift
Other components
- User
Connections 16
- User → Chat views: uses
README.md - App entry → Chat views: opens
Sources/AFMChat/App.swift - Chat views → Message composer: embeds
Sources/AFMChat/Views.swift - Chat views → Chat runtime: uses
Sources/AFMChat/Views.swift - Message composer → Chat runtime: sends prompts
Sources/AFMChat/Composer.swift - Chat runtime → On-device model: generates with
Sources/AFMChat/AppState.swift - Chat runtime → Context management: manages
Sources/AFMChat/AppState.swift - Chat runtime → Local chat store: saves chats
Sources/AFMChat/AppState.swift - Chat runtime → Image attachments: loads images
Sources/AFMChat/AppState.swift - Message composer → Image attachments: imports images
Sources/AFMChat/Composer.swift - Settings UI → Chat runtime: updates settings
Sources/AFMChat/Settings.swift - Chat views → Artifact preview: opens panel
Sources/AFMChat/Views.swift - Artifact preview → Artifact extraction: lists artifacts
Sources/AFMChat/Artifacts.swift - Artifact extraction → Markdown parsing: parses blocks
Sources/AFMChat/Models.swift - Chat views → Read aloud: offers playback
README.md - Chat and skill data → Local chat store: persists records
Sources/AFMChat/Models.swift