* chore: add Cargo.toml and Cargo.lock for rust-core workspace - Introduced a new workspace for the rust-core module with its own Cargo.toml. - Added Cargo.lock to manage dependencies for the rust-core module. - Updated .gitignore to exclude the target directory generated by Cargo. - Modified GitHub Actions workflow to build from the new rust-core path instead of src-tauri. * feat: enhance memory and authentication models in rust-core - Added new `memory` module to handle persistent memory operations for skills, including methods for storing and querying skill data. - Introduced `models` module with `auth` and `socket` submodules to manage user session and socket connection states. - Updated `lib.rs` to include new modules and ensure proper integration within the rust-core workspace. - Modified `eslint.config.js` to ignore target directories in linting processes. * feat: integrate Tauri and QuickJS support in rust-core - Added `tauri` and `rquickjs` as optional dependencies in `Cargo.toml` to enable Tauri integration and JavaScript execution. - Introduced `CronScheduler` and `PingScheduler` modules for managing scheduled tasks and health checks for skills. - Implemented `MemoryState` struct for shared app-state management in the memory client. - Updated the runtime module to include new schedulers and ensure proper integration with Tauri features. - Enhanced the skill registry to support new functionalities related to skill management and communication. * chore: update ESLint configuration and refactor Rust module imports - Added 'rust-core/**' to ESLint ignore list to streamline linting processes. - Refactored import paths in Rust modules to directly reference the `memory` module, enhancing clarity and maintainability. - Improved formatting in JavaScript files for better readability and consistency. * refactor: rename rust-core to openhuman-core and update dependencies - Renamed the `rust-core` module to `openhuman-core` across all files for consistency. - Updated `Cargo.lock` to include `openhuman-core` as a new dependency and removed `rust-core`. - Adjusted import paths in the codebase to reflect the new module name, ensuring all references are updated. - Enhanced the Tauri integration by modifying dependencies in `src-tauri/Cargo.toml` to point to `openhuman-core`. * refactor: simplify platform detection using match statements - Replaced multiple if-else statements with match expressions in `current_platform`, `get_platform`, and `register` functions for improved readability and maintainability. - Removed unnecessary conditional compilation for Android and iOS in the `SocketManager` and `tauri_bridge` modules, streamlining the codebase. - Enhanced the `send_notification` function to handle platform checks more efficiently. * refactor: update platform detection to use std::env::consts - Replaced `cfg!(target_os = "os_name")` checks with `std::env::consts::OS` for improved clarity and consistency across the codebase. - Added `rppal` as an optional dependency in `Cargo.toml` for Raspberry Pi support. - Cleaned up platform-specific code in various modules, enhancing maintainability. * refactor: streamline platform-specific code and improve readability - Replaced conditional compilation with `std::env::consts::OS` checks in various modules to enhance clarity and maintainability. - Simplified platform detection logic in `available_disk_space_mb`, `ensure_arduino_cli`, and `open_in_brave` functions. - Updated `screenshot_command_exists` test to conditionally skip based on the operating system. - Cleaned up unnecessary `#[cfg]` attributes, focusing on a more consistent approach across the codebase. * feat: introduce comprehensive AI configuration and memory management - Added multiple configuration files for OpenHuman AI, including `AGENTS.md`, `BOOTSTRAP.md`, `CONSCIOUS_LOOP.md`, `IDENTITY.md`, `MEMORY.md`, `README.md`, `SOUL.md`, `TOOLS.md`, and `USER.md` to define agent roles, onboarding processes, identity, memory management, and tool capabilities. - Implemented an encryption layer for AI memory storage in `encryption.rs`, utilizing AES-256-GCM for secure data handling. - Updated `lib.rs` to include the new AI module structure, enhancing the overall architecture and maintainability of the codebase. * refactor: update dependencies and configuration for improved structure - Removed `android_logger` and related packages from `Cargo.lock` and `Cargo.toml`, streamlining the dependency list. - Adjusted the `APP_IDENTIFIER` constant in `config.rs` to reflect the new application identifier. - Updated resource paths in `tauri.conf.json` for better organization. - Enhanced platform-specific dependency management in `Cargo.toml` for clarity and maintainability. * fix(core): gate ai module behind tauri-host feature * refactor: update AI loading mechanisms and improve platform handling - Refactored the AI configuration loading in `loader.ts` and `tools/loader.ts` to utilize Tauri commands for desktop environments, enhancing performance and reliability. - Updated paths for AI markdown files to reflect the new `rust-core` structure. - Introduced a new end-to-end test for Tauri command interactions in `tauriCoreBridge.e2e.test.ts`. - Cleaned up platform-specific code across various modules, ensuring a more consistent approach to handling desktop and web contexts. * feat: add sidecar core binary build and staging for Tauri bundler - Implemented build steps for the sidecar core binary in multiple workflows, targeting both x86_64-unknown-linux-gnu and aarch64-apple-darwin architectures. - Added staging steps to copy the built binaries into the Tauri resources directory, ensuring proper integration for application bundling. - Updated relevant workflows to enhance the build process and streamline artifact management. * refactor: enhance AI loading logic for Tauri integration - Updated `loader.ts` and `tools/loader.ts` to prioritize Tauri commands for loading configurations in desktop environments, with a fallback to bundled markdown files for web contexts. - Adjusted test mocks to reflect the new file paths for tools markdown. - Improved test setup to mock Tauri API behavior accurately. * docs: update CLAUDE.md and remove Android build scripts from package.json - Added a new section in CLAUDE.md detailing the runtime scope, clarifying that Tauri is desktop-only and should not include mobile or web branches. - Removed Android development and build scripts from package.json to streamline the project for desktop platforms only. * refactor: streamline import statements and enhance test mock structure - Reordered import statements in `loader.ts` and `tools/loader.ts` for consistency. - Simplified mock implementation in `tauriCoreBridge.e2e.test.ts` to improve readability and maintainability. - Added external binary configuration in `build.rs` to support resource management during local builds. * test: stabilize core/unit test paths and tauri build-test config * chore: update subproject commit reference in skills * chore: update Tauri build configuration to include custom environment variable - Modified the Tauri build command in the GitHub Actions workflow to set a custom configuration for updater artifacts, enhancing the build process for the x86_64-unknown-linux-gnu target.
27 KiB
Project Summary
Cross-platform crypto community communication platform built with Tauri v2 (React 19 + Rust). Targets desktop (Windows, macOS) and mobile (Android, iOS). Features deep Telegram integration via MTProto, real-time Socket.io communication, V8-based skill execution engine, and an MCP (Model Context Protocol) tool system for AI-driven Telegram interactions.
Runtime Scope
- Tauri host/runtime is desktop-only.
- Always run and validate Tauri codepaths as desktop (
windows,macOS,linux). - Do not add or maintain Android/iOS/web runtime branches inside
src-tauri.
App Theme & Design System
Design Philosophy: Premium, sophisticated crypto platform with calm, trustworthy aesthetic.
Color Palette
- Primary: Ocean blue (
#4A83DD) optimized for dark backgrounds - Sage: Success green (
#4DC46F) for growth indicators - Amber: Warning (
#E8A838) for attention states - Coral: Error (
#F56565) soft professional red - Canvas: Background layers (
#FAFAF9to#D4D4D1) with subtle warmth - Market Colors: Bullish green, bearish red, Bitcoin orange, Ethereum purple
Typography
- Primary: Inter (premium font stack)
- Display: Cabinet Grotesk for headings
- Mono: JetBrains Mono for code
- Scale: Sophisticated sizing with negative letter spacing for elegance
Component System
- Shadows: Glow effects, subtle to float depth levels
- Animations: Fade-in, slide-in, scale-in with cubic-bezier easing
- Border Radius: Smooth system from
xs(0.25rem) to5xl(2rem) - Spacing: Extended scale including custom values (4.5, 13, 15, etc.)
Current UI State
- Uses HashRouter (not BrowserRouter) as seen in
App.tsx:1 - 153 TypeScript files total in src/
- Sophisticated Tailwind config with custom color system and animations
Commands
# Frontend dev server only (port 1420)
yarn dev
# Desktop dev with hot-reload (starts Vite + Tauri)
yarn tauri dev
# Desktop dev with enhanced debugging (RUST_BACKTRACE and RUST_LOG enabled)
yarn dev:app
# Production build (TypeScript compile + Vite build + Tauri bundle)
yarn tauri build
# Debug build with .app bundle (required for deep link testing on macOS)
# On macOS, openhuman:// only works when running the .app, not `tauri dev`
yarn tauri build --debug --bundles app
yarn macos:dev
# Android
yarn tauri android dev
yarn tauri android build
# iOS
yarn tauri ios dev
yarn tauri ios build
# Skills development
yarn skills:build # Build skills in development mode
yarn skills:watch # Watch skills for changes
# AI Configuration
yarn tools:generate # Discover tools from V8 runtime and generate TOOLS.md
# Rust checks
cargo check --manifest-path src-tauri/Cargo.toml
cargo clippy --manifest-path src-tauri/Cargo.toml
No test framework is currently configured. ESLint and Prettier are configured with Husky pre-commit/pre-push hooks for code quality enforcement.
Architecture
Provider Chain (App.tsx)
The app wraps in this order: Redux Provider → PersistGate → SocketProvider → TelegramProvider → HashRouter → AppRoutes. Note: Now uses HashRouter instead of BrowserRouter. This ordering matters because Socket.io and Telegram providers depend on Redux auth state.
State Management (Redux Toolkit + Persist)
State lives in src/store/ using Redux Toolkit slices:
- authSlice — JWT token, onboarding completion flag (persisted)
- userSlice — user profile
- socketSlice — connection status, socket ID
- telegramSlice — connection/auth status, chats, messages, threads (selectively persisted; loading/error states excluded)
- aiSlice — AI system state, memory management, session tracking
- skillsSlice — skills catalog, setup status, management state, V8 runtime integration
- teamSlice — team management, member invites, permissions
Redux Persist stores auth and telegram state (storage backend is configurable; default uses localStorage). The telegram slice has a complex nested structure in src/store/telegram/ with separate files for types, reducers, extraReducers, and thunks.
LocalStorage
- Do not use
localStorage(orsessionStorage) for app state or feature logic. Use Redux (and Redux Persist where needed) instead. - Remove any existing
localStorageusage when touching related code. User-scoped data (auth, onboarding, Telegram session, socket state) lives in Redux, keyed by user id where applicable. Telegram session is intelegram.byUser[userId].sessionString, not localStorage. - Exceptions: Redux-persist may use a localStorage-backed storage adapter by default; that is the persistence layer, not app logic. Any other remaining usage (e.g. deep-link
deepLinkHandledflag) should be migrated to Redux or similar when that code is modified. - General rule: Avoid adding new
localStorageorsessionStorageusage; prefer Redux and remove existing usage when you work on affected areas.
Service Layer (Singletons)
- mtprotoService (
src/services/mtprotoService.ts) — Telegram MTProto client viatelegramnpm package. Session stored in Redux (telegram.byUser[userId].sessionString), not localStorage. Auto-retries FLOOD_WAIT up to 60s. - socketService (
src/services/socketService.ts) — Socket.io client. Auth token passed in socketauthobject (not query string). Transports: polling first, then WebSocket. Enhanced with Rust-native Socket.io client for persistent connections. - apiClient (
src/services/apiClient.ts) — HTTP client for REST backend.
MCP System (src/lib/mcp/)
Model Context Protocol implementation for AI tool execution over Socket.io:
transport.ts— Socket.io JSON-RPC 2.0 transport with 30s timeouttelegram/server.ts— TelegramMCPServer manages 99 tool definitionstelegram/tools/— Individual tool files (one per Telegram API operation)- Tools use
big-integerlibrary for Telegram's large integer IDs
Routing (src/AppRoutes.tsx)
/ → Welcome (public)
/login → Login (public)
/onboarding → Onboarding (protected, requires auth, not yet onboarded)
/home → Home (protected, requires auth + onboarded)
* → DefaultRedirect (routes based on auth state)
PublicRoute redirects authenticated users away. ProtectedRoute enforces auth and optionally onboarding status.
Deep Link Auth Flow
Web-to-desktop handoff using openhuman:// URL scheme:
- User authenticates in browser
- Browser redirects to
openhuman://auth?token=<loginToken> - Tauri catches the deep link, Rust
exchange_tokencommand calls backend viareqwest(bypasses CORS) - Backend returns
sessionToken+ user object - App stores session in Redux, navigates to onboarding/home
Key file: src/utils/desktopDeepLinkListener.ts (lazy-loaded in main.tsx). Uses a deepLinkHandled flag to prevent infinite reload loops. Deep links do NOT work in tauri dev on macOS — must use built .app bundle.
Rust Backend (src-tauri/src/lib.rs)
Enhanced Rust backend with comprehensive skill execution and runtime management:
Core Commands:
greet— demo commandexchange_token— CORS-free HTTP POST to backend for token exchange (desktop only)
Runtime Management:
discover_skills— V8 skill discovery and manifest parsingenable_skill/disable_skill— skill lifecycle managementget_skill_preferences/set_skill_preferences— skill configurationconnect_to_socket— Rust-native Socket.io connectionget_socket_status— connection status monitoring
Android Support:
RuntimeService— background service for skill execution- Notification permissions and foreground service management
- Android logging integration with logcat
Deep link plugin registered at setup. register_all() called only on Windows/Linux (panics on macOS).
V8 Runtime System (src-tauri/src/runtime/)
Advanced JavaScript execution engine for skills using V8 (via deno_core):
Core Components:
v8_engine.rs— V8 JavaScript runtime initialization and managementv8_skill_instance.rs— Individual skill execution contexts and lifecycleskill_registry.rs— Skill discovery, registration, and state managementmanifest.rs— Skill manifest parsing with platform compatibility checkssocket_manager.rs— Persistent Socket.io connections with reconnection logiccron_scheduler.rs— Scheduled task execution for time-based skillspreferences.rs— Skill configuration and settings persistence
Bridge System (src-tauri/src/runtime/bridge/):
skills_bridge.rs— Skill-to-skill communication and state sharingtauri_bridge.rs— Frontend-backend IPC and environment accessnet.rs— HTTP/fetch operations for skillsdb.rs— Database operations and storage managementstore.rs— Key-value storage for skill datalog_bridge.rs— Structured logging from skillscron_bridge.rs— Cron job scheduling and management
Quickjs Integration (src-tauri/src/services/quickjs/):
service.rs— High-level client management with V8 integrationbootstrap.js— V8 JavaScript bootstrap environmentops/mod.rs— Native operations for WebSocket, timers, and async handlingstorage.rs— Persistent storage for sessions and data
Platform Support:
- Desktop platforms: Full V8 runtime with all features
- Mobile platforms: Error handling with feature availability checks
- Platform-specific skill filtering based on manifest declarations
Environment Variables
Set in .env (Vite exposes VITE_* prefixed vars):
| Variable | Purpose |
|---|---|
VITE_BACKEND_URL |
Backend API URL (default: http://localhost:5005) |
VITE_SENTRY_DSN |
Sentry DSN for error reporting (optional) |
VITE_DEBUG |
Debug mode flag |
OPENHUMAN_DAEMON_INTERNAL |
Force internal daemon mode (default: false, uses external services) |
Production defaults are in src/utils/config.ts.
AI Configuration System
OpenHumanuses an OpenClaw-compliant AI configuration system that automatically injects persona and tool context into every user message for consistent AI behavior.
Configuration Files
All AI configuration lives in the /ai/ directory:
/ai/SOUL.md- AI personality, voice, tone, and behavior patterns/ai/TOOLS.md- Auto-generated documentation of all available tools (generated viayarn tools:generate)/ai/IDENTITY.md- Core identity and values (TODO)/ai/AGENTS.md- Agent roles and specializations (TODO)/ai/USER.md- User adaptation strategies (TODO)/ai/BOOTSTRAP.md- Initialization procedures (TODO)/ai/MEMORY.md- Long-term knowledge and patterns (TODO)
Modular Loader System
// Individual loaders with multi-layer caching
loadSoul() → SoulConfig // Personality, voice, behavior
loadTools() → ToolsConfig // Available tools and capabilities
// Unified loader
loadAIConfig() → AIConfig // Combined SOUL + TOOLS configuration
Caching Strategy:
- Memory cache (immediate)
- localStorage cache (30min TTL)
- GitHub remote (latest)
- Bundled fallback (reliable)
TODO: Set up public AI configuration repository to eliminate 404 fallback errors
- Current: AI config loaders try GitHub URLs first (fail with 404), then fallback to bundled files
- Console shows: "Failed to load resource: the server responded with a status of 404"
- Affected: Settings → AI Configuration "Refresh Soul/Tools" buttons
- Files:
src/lib/ai/soul/loader.ts,src/lib/ai/tools/loader.ts
Unified Injection System
Every user message automatically gets AI context injected:
// Unified injection (recommended)
import { injectAll } from '../lib/ai/injector';
// Individual injections (for specific needs)
import { injectSoul, injectTools } from '../lib/ai/injector';
const injectedMessage = await injectAll(userMessage);
const soulMessage = await injectSoul(userMessage);
const toolsMessage = await injectTools(userMessage);
Message Format:
[PERSONA_CONTEXT]
I am OpenHuman that incredibly smart, funny friend who loves helping people get stuff done
Personality: Curious & Enthusiastic, Witty & Engaging, Empathetic
Voice: Conversational, Use humor naturally but don't force it
[/PERSONA_CONTEXT]
[TOOLS_CONTEXT]
4 tools across 3 skills
Categories: Communication (2), Productivity (1), Email (1)
Key skills: telegram, notion, gmail
[/TOOLS_CONTEXT]
User message: Hello!
Dynamic TOOLS.md Generation
TOOLS.md is automatically generated from the V8 skills runtime:
# Discover tools and generate documentation
yarn tools:generate
# Integration in build pipeline
yarn skills:build && yarn tools:generate && tsc && vite build
Process:
- Discovery: Spawns Tauri runtime to call
runtime_all_tools() - Parsing: Extracts tool definitions with JSON Schema
- Formatting: Generates OpenClaw-compliant markdown
- Bundling: Includes in app for AI context injection
Generated Output:
- Professional documentation with usage examples
- Environment-specific configurations
- Tool categorization by skill
- Statistics and metadata
Integration Points
AI context injection happens in 4 places:
src/pages/Conversations.tsx- Main chat interfacesrc/store/threadSlice.ts- Redux sendMessage thunksrc/services/api/threadApi.ts- API layersrc/utils/tauriCommands.ts- Tauri agent chat
All use the unified injectAll() function for consistency.
Settings UI
View and manage AI configuration in Settings → AI Configuration:
- Live SOUL personality preview
- TOOLS statistics and categories
- Individual refresh buttons
- Source indicators (GitHub vs bundled)
- Combined "Refresh All" functionality
Recent Changes
Key updates from recent commits (cd9ebcd to current):
Major Runtime Transition
- V8 Runtime Migration (
99c20ea,0f6a092): Complete transition from QuickJS to V8- Replaced QuickJS with V8 (via deno_core) for improved JavaScript execution and WASM support
- Enhanced skill management with V8 runtime including improved performance and compatibility
- New V8 skill instance handling with advanced execution contexts
- Updated dependencies and Cargo.toml to reflect V8 integration
- Platform compatibility checks and enhanced manifest handling
Android Platform Support
- Full Android Integration (
ce06cfc,a2578b9): Production-ready mobile platform support- Complete Android project generation with MainActivity and RuntimeService
- Background service for persistent skill execution on Android
- Notification permission handling and foreground service management
- Android logging integration with logcat for better debugging
- Deep link support configuration in AndroidManifest.xml
Enhanced Socket & Runtime Management
- Rust-Native Socket.io Client (
68d397e): Persistent connection infrastructure- Native Rust Socket.io implementation for improved reliability
- Enhanced socket connection handling with reconnection logic
- Dynamic backend URL configuration support
- Improved error handling and connection status monitoring
Skills System Improvements
- Advanced Skill Management (
e841c86,719e6e5): Enhanced skill lifecycle and configuration- Skill setup pipeline with contextual Enable/Setup/Configure/Retry buttons
- Platform filtering for skills with manifest-based compatibility checks
- Enhanced skill status derivation and connection indicators
- Environment variable exposure to skills (whitelisted values)
- Improved skill discovery and manifest processing with logging
Major Additions
- ESLint & Prettier Integration (
5896966): Complete code quality toolchain- ES module syntax for ESLint configuration with enhanced TypeScript support
- Husky pre-commit/pre-push hooks for automatic formatting and linting
- Type-only imports standardization across codebase
- Consolidated import statements and improved code organization
- GitHub workflows updated with Prettier and ESLint checks
- Advanced Skills System (
10ec1b3): Comprehensive skill management platform- Dynamic skills loading from local directory via Rust integration
- SkillSetupModal with conditional rendering (wizard vs management panel)
- Background GitHub sync for skills catalog updates
- Skills table with setup status indicators and management controls
- Enhanced skill metadata with setup hooks and descriptions
- Team Management Features (
10ec1b3): Multi-user collaboration system- TeamPanel, TeamMembersPanel, and TeamInvitesPanel components
- Redux state management for teams, members, and invites
- Team API integration with CRUD operations
- Settings modal routing for team management paths
- Role-based permissions and invitation system
- AI System Enhancements: Advanced memory and session management
- Hybrid search with encryption for AI memory
- Constitution-based AI behavior with GitHub integration
- Entity graph migration to Neo4j backend
- Session capture and transcript management
- Memory chunking and context formatting
- Enhanced CI/CD Pipeline (
b1d7bce): Production-ready deployment- XGH_TOKEN authentication for openhumanxyz/openhuman releases
- Python sidecar setup and caching for cross-platform builds
- Tauri configuration updates (com.openhuman.app identifier)
- GitHub Pages deployment with optimized workflows
- Version tagging and environment variable management
- Device Detection & Download System (
9d74721,b5bccd2): Enhanced multi-architecture download support- Optimized asset parsing using Maps for unique architecture links per platform
- Enhanced DownloadScreen.tsx with architecture-specific download options
- Improved device detection for Windows, macOS, Linux, and Android platforms
- Added preference logic for more specific filenames in asset parsing
- Support for multiple architectures (x64, aarch64) with intelligent sorting
- Version Bump: Project updated to v0.20.0 (
891517c)
Design System Updates
- Settings Modal UI: Clean 520px white modal contrasting with glass morphism theme
- Animations: 200ms entry animations, 250ms panel transitions, chevron hover effects
- Lottie Animations: Integrated into onboarding flow (
334673e) - Connection Components: Added Telegram and Gmail connection indicators
- Routing: Switched to HashRouter for better desktop app compatibility
- Theme: Implemented sophisticated color system with premium crypto aesthetic
Component Structure
- 200+ TypeScript files across
src/directory with comprehensive tooling - AI System Architecture (
src/lib/ai/): Advanced artificial intelligence platform- Memory management with encryption, chunking, and hybrid search
- Constitution-based behavior with GitHub integration
- Entity graph with Neo4j backend integration
- Session capture, transcript management, and tool compression
- Provider system with OpenAI integration and custom providers
- Skills Management System: Dynamic skill platform with Rust integration
- SkillsGrid.tsx - Skills catalog with setup status and management
- SkillSetupModal.tsx - Conditional wizard/management panel rendering
- SkillProvider.tsx - GitHub sync and local directory integration
- Skills submodule integration with background updates
- Team Collaboration Features: Multi-user workspace management
- TeamPanel.tsx - Team overview with member management
- TeamMembersPanel.tsx - Member roles and permissions
- TeamInvitesPanel.tsx - Invitation system with role assignment
- Team API integration with Redux state management
- Settings Modal System: Comprehensive configuration interface
- SettingsModal.tsx - Main container with URL routing
- SettingsLayout.tsx - Modal wrapper with createPortal
- Enhanced panels: Billing, Team, Connections, Privacy, Profile
- Hooks: useSettingsNavigation.ts, useSettingsAnimation.ts
- Download System: Enhanced multi-platform distribution
- DownloadScreen.tsx - Platform detection with architecture support
- deviceDetection.ts - Comprehensive device/architecture utilities
- GitHub API integration for real-time release assets
- Code Quality Infrastructure: ESLint, Prettier, and Husky integration
- Pre-commit/pre-push hooks with TypeScript compilation checks
- Standardized type-only imports and consolidated statements
- GitHub workflow integration with automated quality checks
Git Workflow
- Repository visibility: The project is public.
- Push target: Pushes should go to your working branch in the public repository (or your fork if your access model requires it).
- PR target: Open pull requests against the public upstream repository, targeting the
mainbranch. - PR template required: Use
.github/pull_request_template.mdfor all pull requests. - AI tooling rule: Any AI-generated PR description must follow the template sections in order and keep all checklist items.
Key Patterns
- MANDATORY: Pre-completion checks: Before considering ANY task complete, ALWAYS run these checks and fix all errors:
npx prettier --check .(formatting)npx eslint .(lint)npx tsc --noEmit(TypeScript)cargo fmt --manifest-path src-tauri/Cargo.toml(Rust formatting, if Rust files were changed)cargo check --manifest-path src-tauri/Cargo.toml(Rust compilation, if Rust files were changed)
- Code Quality: ESLint and Prettier enforce code standards with Husky hooks. Use type-only imports (
import type) and consolidate imports from same modules. - No dynamic imports: All imports must be static
importstatements at the top of the file. Do not useawait import()orimport().then()inside functions or code blocks. Use try/catch around Tauri API calls for non-Tauri environments instead. - No localStorage: Avoid
localStorageandsessionStorage; use Redux (and persist) for app state. Remove any direct usage when working on affected code. - AI System Integration: Use
src/lib/ai/for memory management, constitution loading, entity queries, and session capture. AI providers abstracted through interface pattern. - AI Configuration System: OpenClaw-compliant AI configuration with dynamic TOOLS.md generation. Use
loadSoul(),loadTools(),loadAIConfig()for configuration loading, andinjectAll()for unified SOUL + TOOLS injection into user messages. - V8 Skills Runtime: Skills execute in V8 JavaScript engine on desktop platforms. Use
SkillProviderfor GitHub sync,SkillsGridfor management interface, and Rust runtime commands for lifecycle management. Platform filtering ensures skills only run on supported platforms. - Team Collaboration: Team features in
src/components/settings/panels/Team*. Use ReduxteamSlicefor state management andteamApifor backend operations. - Device Detection: Use
deviceDetection.tsutilities for platform/architecture detection. Support multiple architectures per platform (x64, aarch64) with intelligent preference logic. - GitHub Integration: Fetch release assets via GitHub API (
fetchLatestRelease()) and parse by architecture (parseReleaseAssetsByArchitecture()). Use Maps for efficient unique architecture tracking. - Download System: Platform-specific file type support (.exe/.msi for Windows, .dmg for macOS, .AppImage/.deb/.rpm for Linux, .apk for Android) with fallback links.
- Modal System: Settings modal uses
createPortalpattern with URL-based routing. Clean white design (not glass morphism) for system settings. Navigate with/settingspaths for different panels. - Component Reuse: Connection management reuses
connectOptionsarray and components from onboarding flow. Maintains consistent UX patterns across features. - Redux Integration: Multiple slices (auth, user, telegram, ai, skills, team) with Redux Persist. Use typed hooks and selectors. State functions accept optional
userIdparam. - Node polyfills: Vite config (
vite.config.ts) polyfillsbuffer,process,util,os,crypto,streamfor thetelegrampackage which requires Node APIs. - Telegram IDs: Use
big-integerlibrary, not native JS numbers (Telegram IDs exceedNumber.MAX_SAFE_INTEGER). - MCP tool files: Each tool in
src/lib/mcp/telegram/tools/exports a handler conforming toTelegramMCPToolHandlerinterface. Tool names are typed insrc/lib/mcp/telegram/types.ts. - Tauri IPC: Frontend calls Rust via
invoke()from@tauri-apps/api/core. Rust commands are registered ingenerate_handler![]macro. Enhanced with runtime management commands for V8 skill execution and Socket.io integration. - CORS workaround: External HTTP requests from the WebView hit CORS. Use Rust
reqwestvia Tauri commands instead of browserfetch(). - Hash Routing: Uses HashRouter for desktop app compatibility and deep link handling.
- Integration Libraries: Each integration (Telegram, future Gmail, etc.) lives under
src/lib/<integration>/with its ownstate/,services/,api/subdirectories. Domain-specific services belong in the integration folder, not insrc/services/(which holds only cross-cutting services like socketService, apiClient). - Unit Tests: All unit tests live in
__tests__/folders co-located with the code they test. Use Jest with TypeScript support. - Runtime Platform Differences: V8 runtime is desktop-only. Mobile platforms use feature detection and graceful degradation. Skills with platform restrictions are filtered during discovery.
- Socket Management: Rust-native Socket.io client provides persistent connections with automatic reconnection. Use
connect_to_socketcommand instead of frontend-only socket connections for reliability. - Dual Socket Codebase: Socket event handling exists in both the TypeScript frontend (
src/services/socketService.ts,src/utils/tauriSocket.ts) and the Rust backend (src-tauri/src/runtime/socket_manager.rs). Any new socket event or protocol change must be implemented in both codebases. The web frontend handles events directly via Socket.io; the Rust backend handles them over raw WebSocket with Engine.IO/Socket.IO framing. Example:tool:syncis emitted from bothsrc/lib/skills/sync.ts(web mode) andsocket_manager.rs(Rust mode, on connect + skill lifecycle changes).
Platform Gotchas
- macOS deep links: Require
.appbundle (nottauri dev). Clear WebKit caches when debugging stale content:rm -rf ~/Library/WebKit/com.openhuman.app ~/Library/Caches/com.openhuman.app - Cargo caching: May serve stale frontend assets on incremental builds. Run
cargo clean --manifest-path src-tauri/Cargo.tomlif the app shows outdated UI. window.__TAURI__: Not available at module load time. Use static imports and try/catch around Tauri API calls (not around imports).- Android background services: RuntimeService requires notification permissions (API 33+) and foreground service type specification (API 34+). Use Android logging (
android_logger) for debug output in logcat. - V8 runtime limitations: V8 engine is desktop-only. Android skills should use lightweight alternatives or server-side execution patterns.
- Socket connections: Persistent Socket.io connections via Rust backend work better than WebView-based connections on mobile platforms.