Skip to content

Architecture and request flow ​

Goal: locate the right layer for a change by following one task. The main Android app module uses Kotlin and Jetpack Compose; third_party/jlatexmath is included as a library module.

Open
View on GitHub

Request flow ​

text
Compose / web access / floating entry
  → ChatController and conversation lifecycle
  → OpenAiAgent request and tool loop
  → Protocol adapter → model text or tool call
  → Capability/scope checks → approval → Handler/executor
  → Structured result, file diff and state updates
  → Next model round or completion

Text responses and actual tool calls are separate events. Execution features need execution and result handling, beyond prompt or UI changes.

Source map ​

Paths below are relative to app/src/main/java/com/yukisoffd/lyracode/.

LayerEntry pointsResponsibility
Application/UIMainActivity.kt, ui/app/, ui/chat/, ui/settings/Navigation, conversations, settings
ConversationChatController.kt, ConversationRunLifecycle.ktUser actions, state, lifecycle
Agentai/agent/OpenAiAgent.ktModel loop, protocol requests, dispatch and approvals
Toolsai/agent/AgentToolSchemaFactory.kt, Agent*ToolHandler.ktDefinitions and domain operations
Persistencedata/ConversationStore.kt, data/settings/, data/BackupManager.ktChats, configuration, backup
Files/commandsworkspace/, termux/, ssh/, system/Paths, IO, terminal and system execution
Servicesmcp/, webaccess/, server/MCP, phone chat access and static serving
Device interactioninteraction/Perception, policy, actions, sessions, overlays and pets

PRoot managers, architecture detection, executors and tool definitions live under app/src/debianRuntime/java/.

Preserve boundaries ​

AgentToolSchemaFactory determines model-visible definitions; executeTool still checks disabled tools, sub-agent permissions, device sessions and approvals. Schema filtering is not a substitute for execution-time checks.

Workspace mutations use the file pipeline to record before/after content and diffs. Direct IO bypasses review evidence. Device tools are scoped to their session and must not escape through Shell, MCP or sub-agents.

Web access shares the Activity's controller and data rather than creating a separate Agent system. Consider phone, browser and floating-entry synchronization when changing state or lifecycle.

Continue with Agent tools, Providers or Workspaces.

Detailed reading paths ​

Structure and dependencies ​

Modules distinguishes Gradle/source-set/application layers, Handlers and resource owners. Persistence describes conversations, messages, branches, archive and migrations.

Lifecycles and contracts ​

Conversation lifecycle covers sending, reads, stops, continuation and stale callbacks. Hooks provides actual signatures, threading and editor ownership results.

Shared capabilities across entry points ​

Web access uses the controller for state sync; MCP exposes definitions and a dedicated execution entry. Consider session identity and approval behavior separately. Pet JS has its own module lifecycle.

Lyra Code. All rights reserved.