The Problem
Scientists and engineers need a desktop authoring environment that keeps source files, LaTeX builds, and Python packages on‑disk while still offering AI‑assisted writing. Cloud‑only tools force every document to leave the local machine, creating privacy and latency concerns.
What This Does
ClaudePrism bundles a Tauri 2 native shell (Rust) with a React/TypeScript UI to deliver an offline‑first LaTeX workspace. The UI lives under apps/desktop/src/ – entry point src/main.tsx renders <App/> from src/App.tsx. App stitches together core panels (workspace, Claude chat, template gallery) that live in src/components/.
The Rust side under apps/desktop/src-tauri/ implements the heavy‑lifting back‑ends:
src-tauri/src/claude.rs– wraps Anthropic’s Claude API and exposes Tauri commands used bysrc/components/claude-chat/*.src-tauri/src/latex.rs– invokes the embedded Tectonic compiler for offline PDF generation.src-tauri/src/uv.rs– drives uv to create per‑project Python virtual environments.
All UI‑to‑backend calls go through Tauri’s invoke bridge, so a single JavaScript/TS call (e.g., invoke('compile_latex', {src})) ends up in the matching Rust function, which writes files under apps/desktop/public/examples/ or the user’s project folder.
How It Is Wired
- Process start –
apps/desktop/src-tauri/src/main.rsbuilds the Tauri application and servesapps/desktop/index.html. - Frontend bootstrap –
src/main.tsx(React entry) mounts<App/>. - Core UI flow –
App.tsxrenders the workspace layout (src/components/workspace/workspace-layout.tsx) and the Claude chat drawer (src/components/claude-chat/claude-chat-drawer.tsx). - AI interaction – UI components call
window.__TAURI__.invoke('prompt_claude', …). The call is handled bysrc-tauri/src/claude.rs, which formats the request, sends it to Anthropic, and returns the response. - LaTeX compilation – When the user clicks “Build PDF”,
src/components/workspace/editor/latex-editor.tsxinvokescompile_latex. The Rust handler insrc-tauri/src/latex.rsruns Tectonic, writes the PDF topublic/examples/..., and notifies the UI via an event channel. - Python env – The “UV Setup” button triggers
invoke('setup_uv')→src-tauri/src/uv.rs, which downloads and configuresuv, then creates a.venvfor the project.
Import‑graph hot spots – latex-editor imports six other modules (instability 0.86) and is the biggest blast‑radius front‑end file. The Rust claude.rs module also has deep call chains (no circular deps). These hubs are where most change impact propagates.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/claude-prism
cd claude-prism
# Install JS dependencies (pnpm is declared in root package.json)
pnpm install
# Install Rust toolchain (required by Tauri)
rustup target add x86_64-apple-darwin # macOS example
rustup target add x86_64-pc-windows-msvc # Windows example
# Copy example env and add your Anthropic API key
cp apps/desktop/src-tauri/.env.example apps/desktop/src-tauri/.env
# Edit apps/desktop/src-tauri/.env → set CLAUDE_API_KEY=<your key>
# Run the desktop app in development mode
pnpm tauri dev # script defined in apps/desktop/package.json
The build pipeline is defined in .github/workflows/build-desktop.yml (GitHub Actions) and the lockfile pnpm-lock.yaml guarantees reproducible JS installs.
Real‑World Use
A bioinformatics team can open a local LaTeX project, click “Create Python env”, and let Claude suggest code snippets for data analysis. The team compiles PDFs offline, stores all results in Git, and only the prompt/response payloads travel to Anthropic’s servers. No source or compiled PDFs leave the workstation.
Code Health & Issues
- HIGH cognitive_load – deep nesting (max depth 8) in
template-preview.tsx,src-tauri/src/claude.rs,src-tauri/src/history.rs. - HIGH clarity – duplicated 6‑line blocks across >30 files (e.g., test helpers in
stores/*). - HIGH cognitive_load – oversized files:
latex-editor.tsx(1,642 LOC),sidebar.tsx(1,582 LOC),src-tauri/src/claude.rs(1,489 LOC). - MEDIUM cognitive_load – high branching density in
lang-bibtex.ts,use-claude-events.ts,use-keyboard-shortcuts.ts.
All findings come from the static import‑graph analysis (110 internal modules, 40 import edges, no cycles). Tests (apps/desktop/src/__tests__/*.test.ts) and CI (.github/workflows/*.yml) are present, licence (MIT) is included, and no secrets are committed.
The Bottom Line
ClaudePrism delivers a functional offline LaTeX/Python workspace with AI assistance, backed by a clear Tauri/React split. The codebase works but contains several large, deeply nested modules and duplicated test logic that will increase maintenance cost. Teams comfortable with Rust‑JS interop can adopt it for privacy‑sensitive scientific writing; developers should plan refactoring of the highlighted hot spots before extending core functionality.