libr-agent
AGENTS.md11 starsChanged 18 days agoMITView on GitHub
LibrAgent: A High-Freedom AI Agent Platform - Infinitely Expandable with MCP! LibrAgent is a next-generation desktop AI agent platform that combines the lightness of Tauri with the intuitiveness of React. Users can automate all daily tasks by giving AI agents their own unique personalities and abilities. This workspace contains both application code (React/TypeScript frontend + Rust/Tauri backend) and extensive documentation. Follow the relevant section for each task. [!CAUTION] 이 프로젝트는 100만 동접 분산 웹서비스가 아닌 개인 로컬(Tauri + SQLite) 데스크톱…
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository48 other files it gives its agents.
- .agents/skills/react-best-practices/AGENTS.mdAGENTS.md
- .agents/skills/react-native-skills/AGENTS.mdAGENTS.md
- .agents/skills/react-view-transitions/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-initSkill
- agy-delegateSkill
- audit-docsSkill
- code-audit-expertSkill
- computer-diagnosisSkill
- create-builtin-toolSkill
- create-prSkill
- critique-builtin-toolSkill
- doc-auditorSkill
- docxSkill
- extract-log-debugSkill
- feature-refactor-proposalSkill
- gatekeeper-loopSkill
- harbor-harness-improvement-loopSkill
- i18n-language-standardsSkill
- jobs-trace-analyzerSkill
- lean-builtin-tool-auditorSkill
- libragent-qualitySkill
- libr-delegateSkill
- libr-tool-e2e-harness-loopSkill
- modular-large-file-refactorSkill
- performance-auditSkill
- pptxSkill
- vercel-react-best-practicesSkill
- vercel-react-native-skillsSkill
- vercel-react-view-transitionsSkill
- readme-showcase-syncSkill
- refactor-builtin-toolSkill
- release-managerSkill
- review-local-changesSkill
- review-pr-commentsSkill
- science-searchSkill
- setup-wizardSkill
- skill-creatorSkill
- soul-awakeningSkill
- sqlite-analyzerSkill
- sync-pending-approvalsSkill
- tool-creatorSkill
- trace-analyzerSkill
- trace-eval-loopSkill
- vitepress-doc-syncSkill
- worker-loopSkill
- x-cliSkill
The file
Show its rules and text
We split this agents.md into the rules it gives an agent
15 rules. About 1 is common, 6 are distinctive, and 8 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 44
Start development: pnpm tauri dev (full desktop app with backend) or pnpm dev (frontend only)
- Distinctive: line 101
All API communication through typed service modules with error handling
- Distinctive: line 110
All comments in English
- Very specific: line 114
Follow Rust Style Guide and use rustfmt
- Distinctive: line 122
Follow Prettier and ESLint configurations
- Very specific: line 131
Use shadcn/ui components as primary building blocks
- Very specific: line 202
Prefer new modules under tests/integration/ (Linux/macOS integration_tests).
- Distinctive: line 204
Test Tauri commands with mock data
- Common: line 220
Never commit API keys to version control
- Very specific: line 278
Assets: Place in docs/assets/ or alongside related docs
- Distinctive: line 285
Update: Keep docs current with code changes (update policy: update when changing user-facing behavior)
- Very specific: line 291
No internals: Do not put implementation details on the project site: tool or function names (agent__*), API routes and ports, curl or git …
- Distinctive: line 292
Explain with everyday words: Use short sentences and plain terms.
- Very specific: line 324
CSP Warning: Do NOT add Content Security Policy to tauri.conf.json for desktop apps — causes blank screens in release builds.
- Very specific: line 325
Rust Tests: Prefer integration tests in src-tauri/tests/ for harness-heavy coverage.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.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
🚀 LibrAgent Project Guidelines
Project Overview
LibrAgent: A High-Freedom AI Agent Platform - Infinitely Expandable with MCP!
LibrAgent is a next-generation desktop AI agent platform that combines the lightness of Tauri with the intuitiveness of React. Users can automate all daily tasks by giving AI agents their own unique personalities and abilities.
This workspace contains both application code (React/TypeScript frontend + Rust/Tauri backend) and extensive documentation. Follow the relevant section for each task.
🚫 절대 원칙: 오버엔지니어링 & 불필요한 추상화 금지 (KISS / YAGNI)
[!CAUTION] 이 프로젝트는 100만 동접 분산 웹서비스가 아닌 개인 로컬(Tauri + SQLite) 데스크톱 앱입니다. 수십~수백 개 수준의 데이터를 다루는 로컬 환경에 분산 시스템급의 과도한 계층 분리나 불필요한 다중 추상화를 절대 도입하지 마십시오.
- Dual State / Dual ID 설계 절대 금지:
- 프롬프트 토큰 몇 바이트 아끼겠다고 ID를 잘라내거나(Display vs Storage 분리), 불필요한 상태 이원화를 만들어 복잡한 역방향 매핑(reverse lookup) 및 불일치 버그를 유발하지 마십시오.
- 단일 고유 ID(SSOT) 원칙을 철저히 유지하십시오. 에이전트가 보는 ID와 DB/내부 시스템이 찾는 ID는 100% 동일해야 합니다.
- 방어 코드 남발보다 단순한 구조 우선:
- 복잡도를 키우는 수백 줄의 껍데기 래퍼, 뉴타입, 매핑 알고리즘보다 처음부터 문제가 생기지 않는 단순하고 직관적인 설계를 우선하십시오.
- YAGNI (You Aren't Gonna Need It):
- "나중에 필요할지도 모른다"는 상상 속의 확장성을 위해 코드를 미리 꼬아놓지 마십시오. 당장 필요한 기능만 가장 단순한 형태로 구현하십시오.
Code Guidelines
Technology Stack
- Package Manager: pnpm@12.8.1 (pinned via
packageManagerin package.json and enforced by preinstall script) - Language: TypeScript 5.6 (frontend), Rust 2021 edition (backend)
- Framework: React 18.3 + Vite 6.x (frontend), Tauri 2.x (desktop framework)
- Build System: Vite (frontend), Cargo (backend)
- Test Framework: Vitest (frontend),
pnpm rust:test(Rust — sequential per-target link viarun-rust-tests-sequential.cjs; use--test <name>for a single target)
Environment Setup
- Install Rust via rustup.rs and Node.js 20+
- Enable pinned pnpm:
corepack enable && corepack prepare pnpm@12.8.1 --activate - Install dependencies:
pnpm install --frozen-lockfile - Start development:
pnpm tauri dev(full desktop app with backend) orpnpm dev(frontend only) - Build for production:
pnpm tauri build - API keys are managed in-app via Settings modal (not in .env files)
See README.md for detailed setup instructions.
Development Scripts & Workflow
| Command | Purpose |
pnpm dev | Start Vite dev server (frontend only) |
pnpm tauri dev | Start full Tauri desktop app with hot reload |
pnpm build | Build frontend for production |
pnpm tauri build | Create production desktop app bundle |
pnpm tauri:build:appimage-ort | Linux AppImageHub build (shared ORT / glibc 2.35; used by release CI) |
pnpm lint | Run ESLint on TypeScript/React code |
pnpm format | Format code with Prettier |
pnpm rust:fmt | Format Rust code with rustfmt |
pnpm rust:fmt:check | Check Rust formatting without modifying files |
pnpm rust:check | Fast type/syntax check on Rust code |
pnpm rust:clippy | Run Rust linter (clippy) |
pnpm rust:test | Full Rust integration suite — one test binary linked at a time (OOM-safe) |
pnpm rust:test --test <target> | Single Rust integration target (faster while iterating) |
pnpm dead-code | Find unused code with unimported |
pnpm refactor:validate | Complete validation pipeline (lint, format, Rust validation, build, dead-code) |
[!CAUTION] 🚫 Raw
cargo test/cargo test --tests직접 실행 절대 금지:src-tauri/tests/*.rs각각이 ~600MB+ Tauri 바이너리로 링크됩니다. barecargo test --tests는 여러 타깃을 한 그래프에서 링크해 32GB 머신도 OOM/프리즈합니다. 반드시pnpm rust:…를 쓰십시오. 전체 스위트는pnpm rust:test(순차 격리)이고, 평소엔pnpm rust:test --test <target>로 좁히십시오.pnpm rust:check/clippy/fmt도 rawcargo대신 pnpm 래퍼를 사용하십시오.
Key Architecture Patterns
Agent V2 Architecture (Session-Isolated):
- Per-Session Tool Instances: Each agent session gets isolated
MCPServiceProxywith dedicated builtin server instances - Session-Specific MCP Managers: Separate
HttpSessionManagerandSessionMCPManagerper session - Context Registry System: Dynamic context providers (time/location, skills) inject state into system prompts
- Rust-Orchestrated Workflows: Think-Act-Observe loop managed entirely in Rust backend (
AgentSessionManager)
MCP Integration Architecture:
- External MCP Servers: Stdio/HTTP protocol via
rmcplibrary, managed by session-isolated managers - Builtin MCP Servers: Native Rust implementations via
BuiltinMCPServertrait (Planning, Knowledge, Browser, Workspace, Content Store, etc.) - Unified Tool Discovery:
MCPServiceProxyroutes calls to builtin or external servers transparently
Feature-Based Organization:
- Each feature in
src/features/typically contains components, hooks, and logic specific to that feature - Compound component patterns (e.g.,
Chat.Header,Chat.Messages,Chat.Input) - React Context providers for state sharing (
ChatProvider,AgentSessionProvider,AgentChatProvider)
Service Layer Pattern:
src/lib/backend/contains Tauri command wrappers with centralizedsafeInvoke()utility- Centralized logging via
getLogger('ComponentName')instead of console methods - All API communication through typed service modules with error handling
Coding Style
General:
- 2 spaces indentation across all files
- Descriptive variable names in both Rust and TypeScript
- Consistent naming conventions for files and directories
- All comments in English
Rust Backend (src-tauri/):
- Follow Rust Style Guide and use
rustfmt - snake_case for functions, variables, module names
- PascalCase for types, structs, enums
- Comprehensive doc comments (
///) for public APIs - Explicit error handling with
Result<T, E>types
Frontend (src/):
- Follow Prettier and ESLint configurations
- camelCase for variables and functions
- PascalCase for React components and TypeScript interfaces
- Functional components with hooks over class components
- TypeScript interfaces for type definitions
- Never use
any— use precise types,unknownwith type guards, or Zod schemas for validation
CSS/Styling:
- Use
shadcn/uicomponents as primary building blocks - Tailwind CSS utility classes (avoid arbitrary class names)
- Custom classes in CSS files or safelist in
tailwind.config.jsif needed
Type Safety Principles
- No blind type assertions — validate before casting
- No
JSON.parsewithout schema validation — use Zod - No backend response assumptions — validate with type guards
- Generic functions require validator parameters
See Type Safety Guide for conventions and patterns.
Error Handling
- Backend commands return
Result<T, String>in Rust - Frontend wraps all Tauri calls via
safeInvoke()with centralized error logging - Structured error objects with
MCPErrortype for protocol errors - Builtin tools return
Result<MCPResult, String>for consistent error handling
File Organization
Frontend (src/):
src/
├── app/ # App entry, root layout, global providers
├── assets/ # Static assets (images, svgs)
├── components/ # Shared, generic UI components (reusable)
├── features/ # Feature-specific components, logic, hooks
├── config/ # Static config files
├── context/ # React context providers
├── hooks/ # Generic, reusable hooks
├── lib/ # Service layer, business logic, data, API
├── locales/ # i18n translation files (en, ko, etc.)
├── models/ # TypeScript types and interfaces
├── styles/ # Global or shared CSS
├── test/ # Test utilities
└── types/ # Global ambient and module type declarationsBackend (src-tauri/src/):
src-tauri/src/
├── agent/ # Agent orchestration (session lifecycle, LLM interaction, tool execution)
├── browser_extension_bridge/ # Everyday Chrome MV3 bridge server
├── browser_sidecar/ # Browser automation (Playwright/CDP)
├── commands/ # Tauri command handlers
├── entity/ # SeaORM entities
├── lifecycle/ # Session creation/recovery
├── mcp/ # MCP integration (builtin servers, external managers)
├── media_assist/ # Audio/image/video transcription & media processing
├── models/ # Data models
├── repositories/ # Data access layer
├── scheduled/ # Scheduled tasks
├── search/ # Search functionality
├── server/ # HTTP server
├── services/ # Browser, workspace, etc.
├── session/ # Session management
├── session_export/ # ATIF and Markdown session export formats
├── session_isolation/ # Session isolation logic
├── utils/ # Shared utilities
└── main.rs # Entry pointTesting
- Frontend: Vitest for unit/component tests (
pnpm test:run) - Backend:
pnpm rust:test→run-rust-tests-sequential.cjsruns--libfirst, then eachsrc-tauri/tests/*.rstarget one binary at a time (never barecargo test --tests)- Iterate:
pnpm rust:test --test <target>orpnpm rust:test --lib - Prefer new modules under
tests/integration/(Linux/macOSintegration_tests). Root-leveltests/*.rsremain for Windows-safe coverage (integration_testsis#![cfg(not(windows))])
- Iterate:
- Rust
#[cfg(test)]insrc/does run in CI via the sequential--libstep (Windows needs ComCtl32 v6 link arg inbuild.rs— #2122). Prefertests/for full Tauri/DB harness coverage. - Test Tauri commands with mock data
- Verify cross-platform compatibility
CI / Pull Requests
- GitHub Actions for CI and releases (
.github/workflows/ci.yml,release.yml) - Node.js 20, pnpm@12.8.1 pinned
- CI runs
pnpm install --frozen-lockfile, lint, format check, Rust fmt/clippy, build, tests pnpm refactor:validatemirrors the full CI pipeline locally
Security
- Tauri allowlist configuration restricts API access
- Validate all frontend-to-backend input
- Sanitize data before MCP server communication
- Secure API key storage via in-app Settings modal
- Never commit API keys to version control
Performance Guidelines
- React.memo for expensive components
- Proper useEffect dependency arrays
- Lazy load components when appropriate
- Minimize database round-trips from UI
- Async/await for non-blocking Rust operations
- Cache frequently accessed data
- Optimize MCP server communication
Documentation Guidelines
Audience: Developers and contributors working on LibrAgent
Documentation Tree
docs/
├── README.md # Documentation index
├── api/
│ ├── tauri-commands.md # Tauri command reference
│ └── http_api.md # HTTP API for remote management
├── guides/
│ ├── getting-started.md # Setup and quick start
│ ├── navigation-guide.md # Internal structure and UI routes
│ ├── system-prompt-guide.md # Assistant prompt guidelines
│ ├── builtin_tool_bp.md # Built-in tool design standards
│ └── session-export-formats.md # Session trajectory export formats (ATIF / Markdown)
├── architecture/
│ ├── agent-workflow-architecture.md
│ ├── media-assist-architecture.md # Host multimodal plugin engine
│ ├── gemini-caching-implementation.md
│ ├── session-lineage-and-tree-ui.md
│ ├── agent-vibe-charter.md
│ ├── ai-soul-manifesto.md
│ ├── soul-lounge-recovery-loop.md
│ └── open-source-launch-manifesto.md
├── analysis/
│ ├── product-analysis.md
│ ├── ai-agent-platform-competitive-landscape.md
│ └── libragent-comparative-analysis.md
├── contributing/
│ ├── coding-standards.md
│ ├── open-source-launch-finale.md
│ └── github-release-notes-template.md
└── sprints/
└── README.md # Archived sprint logsDocument Conventions
- Naming: kebab-case for markdown files (e.g.,
tauri-commands.md) - Frontmatter: None required (hand-written docs)
- Linking: Relative paths within docs; absolute URLs for external refs
- Assets: Place in
docs/assets/or alongside related docs - Generated vs Hand-written: Hand-written unless a path/header indicates generated content
Documentation Workflow
- Writing: Match existing document tone and structure
- Review: PRs for doc changes follow same process as code
- Update: Keep docs current with code changes (update policy: update when changing user-facing behavior)
User Docs (docs/user, published VitePress site)
docs/user is the public project site. Its readers are non-developers (laypeople), not contributors. These rules are mandatory:
- No internals. Do not put implementation details on the project site: tool or function names (
agent__*), API routes and ports,curlorgitcommands, file or crate paths, data formats, limits taken from code constants. Put them indocs/architecture,docs/api, ordocs/guidesfor developers. - Explain with everyday words. Use short sentences and plain terms. If a technical word is unavoidable, explain it in one line. English text follows ASD-STE100 (Simplified Technical English).
- Convey design philosophy, not mechanics. Each page should make the product's consistent principles clear: work stays on your machine, you stay in control, start with the smallest structure, results are checked before they are trusted, and the same concepts behave the same way on every screen.
- Show tasks, not code. Examples use everyday work (reports, documents, research, files). Do not use developer-only scenarios as the main example.
- Keep Korean and English pages equal in meaning.
Documentation Quality
- Spell-check and verify links before merging
- Maintain cross-references in
docs/README.md
Security
- Tauri security model: allowlist, capability system (no CSP in desktop apps)
- API keys: in-app secure storage, never in repo
- Input validation on all Tauri command boundaries
- MCP server communication: protocol validation, sandboxed execution
Performance
- Frontend: React concurrent features, virtualization (react-virtuoso), SWR caching
- Backend: Tokio async runtime, connection pooling (reqwest), SeaORM query optimization
- MCP: Session-isolated tool instances prevent cross-session contention
- Bundle: Vite code-splitting, bundle size monitoring (
pnpm perf:bundle)
Additional Notes
- CSP Warning: Do NOT add Content Security Policy to
tauri.conf.jsonfor desktop apps — causes blank screens in release builds. Use Tauri's native security features instead. - Rust Tests: Prefer integration tests in
src-tauri/tests/for harness-heavy coverage;#[cfg(test)]insrc/runs viapnpm rust:test's--libstep (#2122). - Agent Sessions: Each session has isolated workspace at
<data_dir>/workspaces/<session_id>/—agents.mdplaced there is auto-loaded into system prompt. - Validation Command:
pnpm refactor:validateis the single command to run before any PR.
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.

