lumo / src-tauri
CLAUDE.md147 starsChanged 8 months agoMITView on GitHub
The Tauri backend provides the desktop application shell with native OS integration, IPC command handlers, business services, and daemon lifecycle management. Services contain business logic and should NOT hold state (except caches): Response types live in src/types/ with #[typeshare] annotation for TypeScript generation: Important: typeshare-cli does NOT support i64. Use f64 for large numbers (timestamps, IDs, counts) in typeshare-annotated structs. Defined in lib.rs: Plugin permissions are configured in src-tauri/capabilities/default.json.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 86
Create service in src/services/, export in mod.rs
- Very specific: line 87
Create commands in src/commands/ with #[command], export in mod.rs
- Very specific: line 89
Run pnpm generate-types to generate TypeScript types
- Very specific: line 99
Ensure daemon is installed and running via DaemonManager
- Distinctive: line 102
Start session file watcher (background)
- Distinctive: line 103
Start notification poller (background)
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tauri Backend Module
The Tauri backend provides the desktop application shell with native OS integration, IPC command handlers, business services, and daemon lifecycle management.
Architecture
Frontend (React) --> invoke() --> Commands --> Services --> Repositories --> SQLite
|
Types (typeshare)Layers
| Directory | Responsibility |
src/commands/ | IPC handlers exposed to frontend via #[command] |
src/services/ | Business logic, data aggregation, calculations |
src/types/ | Response types with #[typeshare] for TypeScript generation |
src/daemon/ | Daemon binary lifecycle (install, health, launchd) |
src/database/ | DB setup (delegates to shared crate) |
Command Pattern
#[command]
pub async fn get_summary_stats(
app_handle: AppHandle,
time_range: String,
) -> Result<SummaryStats, String> {
let pool = app_handle.state::<SqlitePool>();
StatsService::get_summary_stats(&pool, &time_range)
.await
.map_err(|e| e.to_string())
}Conventions
- Always async (
pub async fn) app_handle: AppHandleas first parameter when state access is needed- Return
Result<T, String>for serialization - Access pool via
app_handle.state::<SqlitePool>() - Delegate to service methods (not directly to repositories)
- Register in
app_commands!macro incommands/mod.rs
Service Pattern
Services contain business logic and should NOT hold state (except caches):
pub struct StatsService;
impl StatsService {
pub async fn get_summary_stats(
pool: &SqlitePool,
time_range: &str,
) -> anyhow::Result<SummaryStats> {
let range = TimeRange::parse(time_range)?;
let sessions_count = SessionRepository::count_in_range(pool, &range).await?;
// ... aggregate and return
}
}Types Pattern (Typeshare)
Response types live in src/types/ with #[typeshare] annotation for TypeScript generation:
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[typeshare]
pub struct SummaryStats {
pub total_sessions: f64, // Use f64, NOT i64 (typeshare limitation)
pub total_cost: f64,
pub total_tokens: f64,
}Important: typeshare-cli does NOT support i64. Use f64 for large numbers (timestamps, IDs, counts) in typeshare-annotated structs.
Adding New Functionality
- Define response types in
src/types/with#[typeshare], export inmod.rs - Create service in
src/services/, export inmod.rs - Create commands in
src/commands/with#[command], export inmod.rs - Register commands in
app_commands!macro incommands/mod.rs - Run
pnpm generate-typesto generate TypeScript types
App Startup Sequence
Defined in lib.rs:
- Register plugins (clipboard, dialog, updater, process, notification, window-state, log)
- Initialize
SessionDetailCacheas managed state - In
setup():- Initialize database and run migrations
- Ensure daemon is installed and running via
DaemonManager - Configure Claude Code OTEL settings (
~/.claude/settings.json) - Configure Claude Code hooks
- Start session file watcher (background)
- Start notification poller (background)
Tauri Plugins
| Plugin | Purpose |
tauri-plugin-log | Structured logging |
tauri-plugin-clipboard-manager | Clipboard access (share card) |
tauri-plugin-dialog | Native file dialogs (export) |
tauri-plugin-updater | Auto-update via GitHub releases |
tauri-plugin-process | Process management |
tauri-plugin-notification | OS notifications |
tauri-plugin-window-state | Remember window position/size |
Plugin permissions are configured in src-tauri/capabilities/default.json.
Development Commands
pnpm tauri:dev # Run Tauri with frontend dev server
pnpm tauri build # Build production app
cargo check -p app # Type-check Tauri crate (package name is "app")
pnpm generate-types # Generate TypeScript types from Rust structsDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

