zenii
CLAUDE.md24 starsChanged 6 months agoMITView on GitHub
Zenii is a Rust workspace producing 5 binaries (Desktop, Mobile, CLI, TUI, Daemon) from a single shared core. All clients communicate via HTTP+WebSocket gateway (axum at 127.0.0.1:18981). Rust 2024 | Tokio | rig-core | rusqlite + sqlite-vec | axum | Svelte 5 + Tauri 2 | openclaw-channels | comrak + Tera → Full module detail in docs/architecture.md → Verbose details for credential naming, dark-mode select, and no-magic-numbers in docs/conventions.md
- Installs packages
- Commits and pushes
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
16 rules. About 0 are common, 6 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 83
No magic numbers: all tunables defined as AppConfig fields in schema.rs
- Distinctive: line 93
Do not duplicate work an agent is already doing.
- Very specific: line 97
Always start in Plan Mode for: new features, new phases, architectural changes, or tasks spanning multiple files.
- Very specific: line 102
Every phase has 3 user gates — no skipping.
- Very specific: line 104
Gate 1 — Plan: Write plans/phaseN_*.md. Include scope, API signatures, dependency research (compare alternatives on size/maintenance), v1 …
- Distinctive: line 106
Gate 2 — Tests: Write unit tests based on approved plan.
- Very specific: line 108
Post-Gate — Docs: Update docs/architecture.md, docs/phases.md, docs/processes.md, README.md, no_commit/todo_tracker.md.
- Distinctive: line 111
Ask user for design decisions between gates.
- Distinctive: line 117
Ask when unclear: stop and name what's confusing.
- Distinctive: line 118
Minimal changes: only change what's needed.
- Very specific: line 120
Dead code rule: remove imports/variables/functions YOUR changes made unused.
- Very specific: line 122
Validate before done: run cargo test --workspace && cargo clippy --workspace.
- Distinctive: line 125
No dead code: no commented-out code, unused imports, or placeholder stubs.
- Very specific: line 126
Latest packages: always use latest stable versions.
- Very specific: line 131
After Gate 3 approval: update docs/architecture.md, docs/phases.md, docs/processes.md, README.md, and no_commit/todo_tracker.md before …
- Very specific: line 171
Always prefix commands with
rtk: If RTK has a dedicated filter, it uses it.
≈ “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
CLAUDE.md -- Zenii
Project Overview
Zenii is a Rust workspace producing 5 binaries (Desktop, Mobile, CLI, TUI, Daemon) from a single shared core. All clients communicate via HTTP+WebSocket gateway (axum at 127.0.0.1:18981).
v2 Philosophy
- Use proven crates, don't hand-roll --
sysinfo,websearch,rig-core,ignoreover custom implementations. - Port patterns, not code -- port v1 design (trait-based tools, security policy, memory abstraction) adapted to v2 conventions.
- Lean by default -- feature-gate optional modules. Default binary includes only core operation.
- Single shared core -- ALL business logic in
zenii-core. Binary crates are thin shells (<100 lines).
Tech Stack
Rust 2024 | Tokio | rig-core | rusqlite + sqlite-vec | axum | Svelte 5 + Tauri 2 | openclaw-channels | comrak + Tera
Commands
cargo check --workspace # Compile check
cargo test --workspace # Run all tests
cargo clippy --workspace # Lint
cargo run -p zenii-daemon # Start daemon
cargo run -p zenii-cli -- chat # CLI chat
cd web && bun run dev # Frontend dev
cd crates/zenii-desktop && cargo tauri dev # Desktop app
./scripts/build.sh --target native --release # Build binariesWorkspace Structure
→ Full module detail in docs/architecture.md
crates/zenii-core/ # Shared library — ALL business logic, NO Tauri dep
crates/zenii-desktop/ # Tauri 2 shell (macOS, Windows, Linux)
crates/zenii-mobile/ # Tauri 2 shell (iOS, Android)
crates/zenii-cli/ # clap CLI (thin wrapper)
crates/zenii-tui/ # ratatui TUI (thin wrapper)
crates/zenii-daemon/ # Headless daemon (thin wrapper)
web/ # Svelte 5 frontend (shared by desktop + mobile)
docs/ # Architecture diagrams, phase details, process flows
plans/ # Detailed per-phase implementation plans
tests/ # Per-phase test plans and resultsStrict Rules
- No std::sync::Mutex in async paths -- use tokio::sync::Mutex or DashMap
- No block_on() -- use tokio::spawn or .await
- No Result<T, String> -- use ZeniiError enum (thiserror)
- All SQLite ops via spawn_blocking -- rusqlite is sync
- Zero business logic in binary crates -- everything in zenii-core
- No code duplication -- if used twice, extract to zenii-core
- TDD gate order: plan → user approves → write tests → user approves → implement → cargo test → user validates
- No phase proceeds without user confirmation at all 3 gates
- All public functions must have unit tests
- Feature flags for optional modules -- keep default binary lean
- Research before adding dependencies -- compare alternatives, document rationale in
plans/ - Binary size matters -- prefer lightweight crates, check dependency trees
- Never skip the workflow -- plan file in
plans/+ test plan intests/MUST exist on disk before any.rsfile is created or modified. No exceptions.
Conventions
→ Verbose details for credential naming, dark-mode select, and no-magic-numbers in docs/conventions.md
- Error handling:
ZeniiErrorenum with thiserror, no.map_err(|e| e.to_string()) - Async: tokio::sync primitives only, never std::sync in async code
- Concurrency: DashMap for concurrent HashMaps, tokio::sync::Mutex for async locks
- Testing:
#[cfg(test)]in same file, integration tests intests/; test success + failure paths - Naming: snake_case (Rust), camelCase (TypeScript/Svelte)
- Imports: std → external crates → internal modules (blank line separated)
- Logging:
tracingmacros only (info!, warn!, error!, debug!), never println! - Paths: absolute in code, relative when referencing to user
- SQL: parameterized queries only, WAL mode, migrations in transactions
- Security: never log credentials, use zeroize for sensitive data, keyring for storage
- Credential keys: colon-separated namespacing —
api_key:{provider_id},channel:{id}:{field} - Structs: derive
Debug, Clone, Serialize, Deserializeon all public structs - Enums:
#[non_exhaustive]on public enums that may grow - Async locks: never hold across
.awaitpoints - No magic numbers: all tunables defined as
AppConfigfields inschema.rs - Native
<select>dark mode: usebg-background text-foreground, neverbg-transparent
Agent Usage
- Explore agents: broad codebase research, deep traversal, or unfamiliar modules (>3 queries).
- Parallel task agents: independent workstreams (e.g., updating unrelated modules simultaneously).
- Research agents: dependency research, v1 analysis, documentation lookups.
- Skip agents: single Glob/Grep suffices, sequential steps, trivial 1-2 file edits.
Do not duplicate work an agent is already doing. Delegate, then use the results.
Plan Mode Requirement
Always start in Plan Mode for: new features, new phases, architectural changes, or tasks spanning
multiple files. Enter EnterPlanMode first, outline steps, exit only when the plan is clear.
Phase Gate Workflow
Every phase has 3 user gates — no skipping. → Full checklist in docs/phases.md
- Gate 1 — Plan: Write
plans/phaseN_*.md. Include scope, API signatures, dependency research (compare alternatives on size/maintenance), v1 analysis, assumptions. User approves before any code. - Gate 2 — Tests: Write unit tests based on approved plan. User approves before implementation.
- Gate 3 — Completion: Implement →
cargo test→cargo clippy→ present summary. User confirms. - Post-Gate — Docs: Update
docs/architecture.md,docs/phases.md,docs/processes.md,README.md,no_commit/todo_tracker.md. Mandatory before next phase.
Ask user for design decisions between gates. Never assume.
Best Practices
- Read before write: understand existing code before modifying.
- Think first: state assumptions explicitly before implementing. If multiple interpretations exist, present them — don't pick silently. Push back when a simpler approach exists.
- Ask when unclear: stop and name what's confusing. Don't assume and run with it.
- Minimal changes: only change what's needed; don't refactor adjacent code. Every changed line must trace directly to the user's request.
- Surgical edits: modify only the relevant function/block. Match existing style, even if you'd do it differently. Don't improve adjacent comments or formatting.
- Dead code rule: remove imports/variables/functions YOUR changes made unused. Don't delete pre-existing dead code unless asked — mention it instead.
- No verbose output: responses must be concise. Use bullet lists or tables — not paragraphs. Omit preamble ("I'll now..."), narration, and trailing summaries.
- Validate before done: run
cargo test --workspace && cargo clippy --workspace. - Verifiable goals: transform tasks into success criteria — "fix bug" → "write test that reproduces it, then make it pass". Multi-step tasks need a brief plan with a verify step per step.
- Atomic commits: one logical change per commit.
- No dead code: no commented-out code, unused imports, or placeholder stubs.
- Latest packages: always use latest stable versions; check with
cargo upgrade --dry-run. - Learn from errors: save root cause + fix to memory so the same mistake is never repeated.
Documentation Requirement
After Gate 3 approval: update docs/architecture.md, docs/phases.md, docs/processes.md,
README.md, and no_commit/todo_tracker.md before proceeding. Not optional.
Markdown / Mermaid Rules
→ Full rules in docs/style-guide.md. Key points: use <br> not <br/>, escape ( as #40;,
avoid subgraph/node ID collisions, no 1. numbered lists in node labels.
TODO / MOCK / FIX Tracking
Tag incomplete work in code and in no_commit/todo_tracker.md:
// TODO: <description> — <phase>
// MOCK: <description> — <what it replaces, when to remove>
// FIX: <description> — <what's wrong, severity>
// STUB: <description> — <what it should become>Tracker table format and status values are defined in no_commit/todo_tracker.md.
Feature Flags
cargo build -p zenii-daemon # Core only
cargo build -p zenii-daemon --features channels # + messaging
cargo build -p zenii-daemon --features scheduler # + cron
cargo build -p zenii-daemon --features web-dashboard # + web UI
cargo build -p zenii-daemon --all-features # EverythingWiki
LLM wiki in wiki/. Schema: wiki/SCHEMA.md (read first). Sources: wiki/sources/. Ops: ingest, query, lint — see docs/wiki.md.
<!-- rtk-instructions v2 -->RTK (Rust Token Killer) - Token-Optimized Commands
Golden Rule
Always prefix commands with rtk. If RTK has a dedicated filter, it uses it. If not, it passes through unchanged. This means RTK is always safe to use.
Important: Even in command chains with &&, use rtk:
# ❌ Wrong
git add . && git commit -m "msg" && git push
# ✅ Correct
rtk git add . && rtk git commit -m "msg" && rtk git pushRTK Commands by Workflow
Build & Compile (80-90% savings)
rtk cargo build # Cargo build output
rtk cargo check # Cargo check output
rtk cargo clippy # Clippy warnings grouped by file (80%)
rtk tsc # TypeScript errors grouped by file/code (83%)
rtk lint # ESLint/Biome violations grouped (84%)
rtk prettier --check # Files needing format only (70%)
rtk next build # Next.js build with route metrics (87%)Test (90-99% savings)
rtk cargo test # Cargo test failures only (90%)
rtk vitest run # Vitest failures only (99.5%)
rtk playwright test # Playwright failures only (94%)
rtk test <cmd> # Generic test wrapper - failures onlyGit (59-80% savings)
rtk git status # Compact status
rtk git log # Compact log (works with all git flags)
rtk git diff # Compact diff (80%)
rtk git show # Compact show (80%)
rtk git add # Ultra-compact confirmations (59%)
rtk git commit # Ultra-compact confirmations (59%)
rtk git push # Ultra-compact confirmations
rtk git pull # Ultra-compact confirmations
rtk git branch # Compact branch list
rtk git fetch # Compact fetch
rtk git stash # Compact stash
rtk git worktree # Compact worktreeNote: Git passthrough works for ALL subcommands, even those not explicitly listed.
GitHub (26-87% savings)
rtk gh pr view <num> # Compact PR view (87%)
rtk gh pr checks # Compact PR checks (79%)
rtk gh run list # Compact workflow runs (82%)
rtk gh issue list # Compact issue list (80%)
rtk gh api # Compact API responses (26%)JavaScript/TypeScript Tooling (70-90% savings)
rtk pnpm list # Compact dependency tree (70%)
rtk pnpm outdated # Compact outdated packages (80%)
rtk pnpm install # Compact install output (90%)
rtk npm run <script> # Compact npm script output
rtk npx <cmd> # Compact npx command output
rtk prisma # Prisma without ASCII art (88%)Files & Search (60-75% savings)
rtk ls <path> # Tree format, compact (65%)
rtk read <file> # Code reading with filtering (60%)
rtk grep <pattern> # Search grouped by file (75%)
rtk find <pattern> # Find grouped by directory (70%)Analysis & Debug (70-90% savings)
rtk err <cmd> # Filter errors only from any command
rtk log <file> # Deduplicated logs with counts
rtk json <file> # JSON structure without values
rtk deps # Dependency overview
rtk env # Environment variables compact
rtk summary <cmd> # Smart summary of command output
rtk diff # Ultra-compact diffsInfrastructure (85% savings)
rtk docker ps # Compact container list
rtk docker images # Compact image list
rtk docker logs <c> # Deduplicated logs
rtk kubectl get # Compact resource list
rtk kubectl logs # Deduplicated pod logsNetwork (65-70% savings)
rtk curl <url> # Compact HTTP responses (70%)
rtk wget <url> # Compact download output (65%)Meta Commands
rtk gain # View token savings statistics
rtk gain --history # View command history with savings
rtk discover # Analyze Claude Code sessions for missed RTK usage
rtk proxy <cmd> # Run command without filtering (for debugging)
rtk init # Add RTK instructions to CLAUDE.md
rtk init --global # Add RTK to ~/.claude/CLAUDE.mdToken Savings Overview
| Category | Commands | Typical Savings |
| Tests | vitest, playwright, cargo test | 90-99% |
| Build | next, tsc, lint, prettier | 70-87% |
| Git | status, log, diff, add, commit | 59-80% |
| GitHub | gh pr, gh run, gh issue | 26-87% |
| Package Managers | pnpm, npm, npx | 70-90% |
| Files | ls, read, grep, find | 60-75% |
| Infrastructure | docker, kubectl | 85% |
| Network | curl, wget | 65-70% |
Overall average: 60-90% token reduction on common development operations.
<!-- /rtk-instructions -->Does 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.

