Askimo Development & Customization Guide
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
Welcome to the Askimo development hub. These guides show you how to extend and customize Askimo—whether you’re adding a new CLI command, integrating a new AI model provider, building reusable prompt recipes, or contributing localization for a new language.
Project Structure
Section titled “Project Structure”Askimo uses a monorepo architecture with three main modules:
askimo/├── cli/ # Command-line interface (GraalVM Native Image)├── desktop/ # Desktop application (Compose Multiplatform)├── shared/ # Shared core logic, models, and providers└── docs/ # DocumentationModule Overview
Section titled “Module Overview”-
cli/: Terminal-based REPL for interactive AI conversations and automation scripts. Built with GraalVM Native Image for fast startup and single-binary distribution. -
desktop/: Native desktop application with Material Design 3 UI. Built with Compose Multiplatform for a modern, responsive user experience. -
shared/: Core business logic shared between CLI and Desktop, including: -
AI provider implementations (OpenAI, Anthropic, Gemini, X AI, Ollama)
-
Chat models and message handling
-
Configuration and parameter management
-
Security utilities
What You Can Customize
Section titled “What You Can Customize”CLI Customization
Section titled “CLI Customization”- Commands: Add new
:yourcommandinteractions in the REPL - Recipes: Create reusable YAML-based prompt workflows
- Projects & RAG: Index local codebases for retrieval-augmented chat
Desktop Customization
Section titled “Desktop Customization”- Localization: Add support for new languages (see Contributing a New Locale)
- UI Components: Extend the Compose UI with new views and dialogs
- Themes: Customize colors and typography
Shared Customization
Section titled “Shared Customization”- Model Providers: Plug in any chat model API via a factory
- Parameters & Presets: Tune style, verbosity, and provider-specific settings
- Chat Models: Implement custom model behaviors
Prerequisites
Section titled “Prerequisites”Before extending Askimo, make sure you can build and run it locally:
git clone git@github.com:haiphucnguyen/askimo.gitcd askimo./gradlew buildRequirements:
- JDK 21 or higher
- Gradle 8.x or higher
- For GraalVM Native Image (CLI): GraalVM distribution
Development Conventions
Section titled “Development Conventions”- Keep public APIs documented (KDoc for Kotlin classes).
- Use clear, emoji-enhanced user feedback (✅, ⚠️, ❌, 🧹, 📦).
- Favor small, focused handlers/factories.
- Fail fast with helpful messages when configuration is missing.
- Avoid hardcoding secrets—use parameters (e.g.,
api_key).
Building and Testing
Section titled “Building and Testing”Build All Modules
Section titled “Build All Modules”Build the entire project:
./gradlew buildBuild specific modules:
./gradlew :cli:build # CLI only./gradlew :desktop:build # Desktop only./gradlew :shared:build # Shared library onlyRun the Applications
Section titled “Run the Applications”CLI (Development Mode):
./gradlew :cli:runDesktop:
./gradlew :desktop:runTesting Your Changes
Section titled “Testing Your Changes”Run the test suite for all modules:
./gradlew testCLI: Building Native Image
Section titled “CLI: Building Native Image”The CLI can be built as a GraalVM Native Image for single-binary distribution. This is ideal for CLI tools: ultra-fast cold startup, lower memory footprint, simpler installation (just drop the askimo executable in PATH), reduced attack surface (no dynamic classloading), and predictable runtime behavior.
Benefits at a glance:
- 🚀 Startup speed: Native image avoids JVM warm-up
- 📦 Single file distribution: Easier for Homebrew, archives, Docker slim images
- 🧠 Lower memory: Only reachable code is compiled in; smaller RSS for short-lived commands
- 🔒 Security: Fewer moving parts (no runtime bytecode loading)
Build steps:
# Ensure you have a GraalVM distribution compatible with the Gradle build.# (If using SDKMAN or Homebrew, set JAVA_HOME accordingly.)./gradlew :cli:nativeCompileThe resulting executable will appear here:
ls cli/build/native/nativeCompile/askimo./cli/build/native/nativeCompile/askimo --helpDistribute it by copying cli/build/native/nativeCompile/askimo into a release archive or a package manager formula. End users can run it directly without installing Java.
Troubleshooting:
- If the native build fails due to missing resources, check
cli/src/main/resourcesand reflection config. - Increase memory for the build if needed:
export JAVA_TOOL_OPTIONS="-Xmx4G"./gradlew :cli:nativeCompile- On Linux distributions without
glibc, consider building inside a container matching target libc.
Desktop: Creating Distributable Package
Section titled “Desktop: Creating Distributable Package”Create platform-specific packages:
# Create distributable packages (DMG for macOS, MSI for Windows, DEB/RPM for Linux)./gradlew :desktop:packageDistributionForCurrentOS
# Or create a runtime image./gradlew :desktop:createDistributableThe packages will be in desktop/build/compose/binaries/.
Testing Your Changes in Context
Section titled “Testing Your Changes in Context”Testing CLI Commands
Section titled “Testing CLI Commands”# Start the CLI./gradlew :cli:run
# Test commandsaskimo> :yourcommandaskimo> :set-provider YOUR_PROVIDERaskimo> :set-param api_key sk-***askimo> :modelsaskimo> :set-param model my-modelaskimo> Explain vector embeddings in 2 sentences.Testing Desktop Features
Section titled “Testing Desktop Features”# Start the desktop app./gradlew :desktop:run
# Navigate through:# - Chat interface# - Settings dialog# - Session management# - Localization (if you added a new locale)Feedback & Contribution
Section titled “Feedback & Contribution”If you build a new provider or command that others may benefit from:
- Fork the repo.
- Add your feature + docs under this section.
- Open a pull request following CONTRIBUTING.md.
Happy hacking! 🚀