Zing Forum

Reading

Paprwork V2: A Locally-First AI Desktop Assistant Refactored with TypeScript and Mastra

Paprwork is a locally-first AI desktop assistant application. The V2 version has been completely rewritten using TypeScript and the Mastra framework, supporting multiple model providers, a tool system, sub-agents, scheduled tasks, and an intelligent memory system.

AI assistantdesktop appTypeScriptElectronMastralocal-firstmulti-providersub-agentsautomation
Published 2026-04-06 05:14Recent activity 2026-04-06 05:21Estimated read 5 min
Paprwork V2: A Locally-First AI Desktop Assistant Refactored with TypeScript and Mastra
1

Section 01

Paprwork V2: A Locally-First AI Desktop Assistant Refactored with TypeScript and Mastra (Introduction)

Paprwork V2 is a locally-first AI desktop assistant application, completely rewritten using TypeScript and the Mastra framework. It addresses the technical debt of the V1 version and builds a production-ready architecture. Core features include support for multiple model providers, an extensible tool system, sub-agents, scheduled tasks, an intelligent memory system, etc. It balances privacy and functional scalability, making it suitable for AI interaction scenarios that require local data processing.

2

Section 02

Background: Technical Debt in V1 and the Necessity of V2 Refactoring

The V1 version had severe technical debt: a single file with over 30,000 lines of code, 90% code duplication across processes, tool calls requiring multiple patches, and a lack of type safety. These issues hindered long-term maintenance, so V2 was completely rewritten with the goal of building a maintainable and extensible codebase.

3

Section 03

Technical Architecture: Modular Design and Introduction of the Mastra Framework

V2 adopts a modular layered architecture. The core directory core/ serves as a shared library to eliminate code duplication, and all components are 100% TypeScript with no any types. The Mastra framework is introduced as the AI orchestration layer to solve the fragility of tool calls, providing a unified Agent abstraction, robust tool calls, and streaming processing capabilities. The architecture is inspired by OpenClaw but adjusted for desktop environments (e.g., Electron+React UI).

4

Section 04

Core Features and Privacy Protection

V2's core features include: multi-model support (Claude/GPT/Gemini), streaming responses, extensible tools (Bash/file operations, etc.), parallel sessions, scheduled task automation, intelligent memory, Mini-Apps, sub-agents, and secure key management. Regarding privacy: telemetry consists of anonymous rough events (can be turned off), users can customize telemetry endpoints, and API keys are stored encrypted.

5

Section 05

Development Experience Optimization and Testing System

V2 uses Rust tools to improve development efficiency: oxlint replaces ESLint (50-100 times faster), and oxfmt replaces Prettier (30 times faster). Development supports hot reloading, and the testing system is comprehensive: unit/integration/E2E tests, type checks, formatting checks, code line limits, all of which can be run with one click via npm run check.

6

Section 06

Application Scenarios and Quick Start Guide

Application scenarios include personal knowledge management, automated workflows, multi-model comparison, and privacy-first AI interactions. Quick start requires Node.js v24+ and npm v10+: clone the repository → install dependencies → configure .env.local → start the application (npm start).

7

Section 07

Conclusion: A Mature Transition from Prototype to Product

Paprwork V2 has achieved a transition from prototype to product, resolving the technical debt of V1, introducing a modern tech stack (TypeScript/Mastra/Rust tools) and strict standards, and building a maintainable and extensible architecture. It has reference value for both users of locally-first AI assistants and developers involved in refactoring.