This documentation is intended for contributors working on openvino-notes.
The repository already has a meaningful CI and build setup, while the application code is still at an early implementation stage. The goal of these documents is to help contributors understand the project quickly and reproduce the same checks that gate pull requests and main.
What is already in place:
- a four-module Android build
- reusable GitHub Actions workflows
- shared formatting, lint, and coverage policy
What is still mostly scaffolded:
- domain contracts
- data-layer behavior
- OpenVINO integration
- app-level product flows
- Application code:
app,domain,data,ai - Automation and CI:
.github
This documentation describes the Domain layer of the openvino-notes application. It is intended for contributors working on business logic, AI integration, and unit testing.
The Domain layer is the central part of the architecture, defining business rules for notes and folders, AI operations, and repository contracts. It is independent of storage, UI, and AI implementation details.
- Maintain business logic separately from UI, storage, and AI.
- Define domain entities, repository contracts, and use cases.
- Provide testable interfaces for both normal and AI-enhanced operations.
The Domain layer contains:
- Domain models (
Note,NoteFolder) - Repository interfaces (
NotesRepository,NoteFolderRepository) - Use cases for notes and folders
- AI service interface (
NoteAiService) - AI-related use cases (
SuggestSummaryUseCase,ApplyTagsUseCase, etc.)
The Domain layer does not contain:
- UI elements or ViewModels
- Android-specific code
- Implementation details of repositories or AI
- OpenVINO or network code
domain/ ├─ ai/ │ └─ NoteAiService.kt ├─ aiusecase/ │ ├─ ApplySummaryUseCase.kt │ ├─ ApplyTagsUseCase.kt │ ├─ SuggestSummaryUseCase.kt │ └─ SuggestTagsUseCase.kt ├─ model/ │ ├─ Note.kt │ ├─ NoteFolder.kt │ └─ ContentItem.kt ├─ repository/ │ ├─ NotesRepository.kt │ └─ NoteFolderRepository.kt └─ usecase/ ├─ CreateNoteUseCase.kt ├─ DeleteNoteUseCase.kt ├─ GetNoteUseCase.kt ├─ UpdateNoteUseCase.kt └─ MoveNoteToFolderUseCase.kt
id: unique identifiertitle: note titlefolderId: optional folder IDcontentItems: list ofContentItemcreatedAt: creation timestampupdatedAt: last update timestamptags: set of tagsisFavorite: favorite flagsummary: optional AI-generated summary
Sealed class representing a note's content:
Text: text blockImage: image block (LocalorRemotesource)File: file attachmentLink: URL link
PLAIN,MARKDOWN,HTML
Local: local file pathRemote: remote URL
id: unique identifiername: folder namecreatedAt,updatedAt: timestampsmetadata: optional extra info
observeNotes(): flow of all notesobserveNotesByFolder(folderId): flow of notes for a foldergetNoteById(id): retrieve note by IDcreateNote(note): create noteupdateNote(note): update notedeleteNote(id): delete note
observeFolders(): flow of folderscreateFolder(folder): create folderrenameFolder(id, name): rename folderdeleteFolder(id): delete foldergetFolderById(id): retrieve folder by IDupdateFolder(folder): update folder
Repositories abstract storage for testable domain logic.
CreateFolderUseCaseDeleteFolderUseCaseGetFolderUseCaseObserveFoldersUseCaseUpdateFolderUseCase
CreateNoteUseCaseDeleteNoteUseCaseGetNoteUseCaseUpdateNoteUseCaseMoveNoteToFolderUseCaseObserveNotesUseCaseObserveNotesByFolderUseCase
Interface for AI operations.
suspend fun summarize(text: String): Stringsuspend fun tagTXT(text: String): Set<String>suspend fun tagIMGs(images: List<String>): Set<String>
SuggestSummaryUseCase: extract text, call AI, return proposed summarySuggestTagsUseCase: extract text/images, call AI, return combined tagsApplySummaryUseCase: update note with AI-generated summaryApplyTagsUseCase: update note with AI-generated tags
AI operations are separated into suggest (proposal) and apply (commit) stages.
- UI triggers an action
- ViewModel calls a use case
- Use case interacts with repository
- Repository returns or saves domain models
- Result propagates back to ViewModel
- ViewModel updates UI
- UI triggers AI action
- ViewModel calls
SuggestSummaryUseCaseorSuggestTagsUseCase - Use case retrieves note from repository
- Use case extracts content
- Use case calls
NoteAiService - AI returns results
- ViewModel receives results
- If confirmed,
ApplySummaryUseCaseorApplyTagsUseCaseupdates the note
- Android-agnostic
- Storage-agnostic
- AI-implementation-agnostic
- “Suggest” and “Apply” AI operations are separated
- Models are extensible
Unit tests cover:
- Creating, updating, deleting notes and folders
- Moving notes between folders
- Observing notes and folders
- Getting AI-generated summaries and tags
- Applying summaries and tags
- Error handling for missing notes
Fake repositories and fake AI service enable testing without Android or OpenVINO dependencies.