flock
CLAUDE.md1.1k starsChanged 5 months agoApache-2.0View on GitHub
Flock is a multi-provider AI agent desktop application with tool orchestration, sandbox execution, visual workflow, and browser/computer-use capabilities. It's a Rust workspace with a Tauri-based desktop UI (React + TypeScript + Mantine). Agent Engine (flock-agent/src/engine.rs): - AgentEngine orchestrates the LLM interaction loop - Uses LangGraph CompiledStateGraph for execution flow - Manages conversation history via SQLite checkpointer - Handles tool approval, context compression, plan mode Tool System (flock-tools/src/lib.rs): - Tool trait defines the interface: name(), description(), input_schema(), execute() - ToolRegistry manages…
- Installs packages
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 180
Do not treat repository-wide cargo fmt --check diffs or warnings such as unused imports/variables as blockers unless they are introduced by …
- Distinctive: line 188
When modifying the codebase or interacting with the user, please strictly adhere to the following rules:
- Very specific: line 191
State & Logic Abstraction: Always separate state management and command logic from UI components.
- Very specific: line 192
Strict i18n Internationalization: All newly introduced UI components must leverage i18next for user-facing texts (e.g.
- Very specific: line 194
UI Specification Compliance: Ensure any new styling aligns with the design tokens defined in docs/resources/ui_specification.md (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 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
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Flock is a multi-provider AI agent desktop application with tool orchestration, sandbox execution, visual workflow, and browser/computer-use capabilities. It's a Rust workspace with a Tauri-based desktop UI (React + TypeScript + Mantine).
Build & Development Commands
Rust Backend
# Build the CLI
cargo build --release
# Run in single-shot mode
cargo run -- "your question"
# Run interactive REPL
cargo run
# Run with specific provider/profile
cargo run -- --profile deepseek "your question"
# Run tests (workspace-wide)
cargo test
# Run a single crate's tests
cargo test -p flock-core
cargo test -p flock-agent
cargo test -p flock-tools
cargo test -p flock-skills
# Run a specific test
cargo test -p flock-core test_name
# Lint
cargo clippy --workspaceTauri Desktop UI
cd flock-ui
# Install dependencies
npm install
# Development server
npm run dev
# or
npm run tauri dev
# Build for production
npm run build
# or
npm run tauri build
# Lint frontend
npm run lintArchitecture
Workspace Crates
| Crate | Purpose |
flock-core | Core types, config, database, IPC interface, crypto, model factory |
flock-agent | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |
flock-tools | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |
flock-skills | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |
flock-ui/src-tauri | Tauri desktop app backend (commands, agent state, workspace management) |
workspace-hack | cargo-hakari build optimization |
Key Dependencies
- LangGraph: Rust reimplementation (langgraph-rust) for agent graph orchestration
- LLM Providers: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex
- Database: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows
- Async Runtime: Tokio
- Sandbox: Daytona cloud container runtime for isolated code execution
- Browser Automation: Playwright (Python, runs inside sandbox via CDP)
Core Architecture Patterns
Agent Engine (flock-agent/src/engine.rs):
AgentEngineorchestrates the LLM interaction loop- Uses LangGraph
CompiledStateGraphfor execution flow - Manages conversation history via SQLite checkpointer
- Handles tool approval, context compression, plan mode
Tool System (flock-tools/src/lib.rs):
Tooltrait defines the interface:name(),description(),input_schema(),execute()ToolRegistrymanages all registered tools- Built-in tools: Read, Write, Edit, Bash, Grep, Glob
- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance
- Extensible via MCP servers and custom tool providers
Workflow Engine (flock-agent/src/workflow_graph/):
- Visual workflow builder with ReactFlow canvas
- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor
build_workflow_graph()compiles ReactFlow JSON into LangGraphStateGraph- Streaming execution with human-in-the-loop interrupts
Sandbox System (flock-tools/src/daytona/):
- Cloud-based Daytona container runtime for isolated execution
- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)
- Lifecycle management: create, destroy, set-public, snapshot
- Human takeover via VNC with approval flow
Skills System (flock-skills/):
- Markdown files with YAML frontmatter in
.flock/skills/ - Supports
$ARGUMENTSsubstitution, shell execution, conditional activation - Two execution contexts:
inline(same agent) andfork(sub-agent) - Hot-reload via file watcher
Memory System (flock-agent/src/memory/):
- Four types:
user,feedback,project,reference - Stored as Markdown files with frontmatter in
<config>/flock/projects/<project>/memory/ MEMORY.mdindex file auto-loaded into system prompt
IPC Interface (flock-core/src/ipc_interface/):
- JSON-based protocol for host ↔ agent communication
- Events (Agent → Host):
ready,stream_start,text_delta,tool_request,tool_result, etc. - Commands (Host → Agent):
message,stop,tool_approve,tool_deny,set_mode,set_config
Configuration (flock-core/src/config/settings.rs):
- Config priority: CLI args/env > project
flock.toml> global config - Supports profiles with inheritance (
extends) - Provider compatibility settings (
ProviderCompat) for API differences
Tauri Desktop UI
Frontend Stack:
- React 18 + TypeScript
- Mantine UI v8 (components, notifications)
- Zustand (state management)
- React Query (server state)
- react-markdown + react-syntax-highlighter (message rendering)
- i18next (internationalization)
- ReactFlow (workflow visual editor)
State Stores (flock-ui/src/store/):
agentStore: Agent connection status, messages, pending approvalsuiStore: Theme, sidebar state, active view, file treeworkspaceStore: Active workspace/conversation, persisted to localStorageworkflowStore: ReactFlow nodes/edges, execution state, dirty tracking
Key Views:
HomeView: Welcome screen, assistant selection, workspace pickerWorkspaceView: Chat panel + file tree + optional preview panel (VNC, sandbox runner)WorkflowEditor: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panelAssistantPage: CRUD for custom assistantsSkillsPage: Tools, MCP servers, and skills managementSettingsModal: Model providers, basic settings, sandbox settings, system settings
Tauri Commands (flock-ui/src-tauri/src/commands/):
- Agent control:
start_agent,stop_agent,send_message,approve_tool,deny_tool - Workspace:
list_workspaces,create_workspace,delete_workspace - Conversations:
list_conversations,create_conversation,load_conversation_history - Database:
list_providers,upsert_provider,list_models,upsert_model - MCP:
list_mcp_servers,upsert_mcp_server,test_mcp_server - Skills:
list_skills,get_extra_skill_dirs,add_extra_skill_dir - Workflow:
list_workflows,get_workflow,create_workflow,update_workflow,delete_workflow,run_workflow,stop_workflow
Data Flow
- User sends message via UI → Tauri command
send_message AgentStateforwards toAgentEngine::run()- Engine builds LangGraph, invokes LLM with tools
- LLM response streamed as
ProtocolEvents viaTauriProtocolEmitter - Frontend
useEventStreamhook listens to Tauri events, updatesagentStore - Tool calls require approval (unless auto-approved) →
ToolApprovalInlinecomponent - Approved tools execute → results fed back to LLM for next turn
Code Style
- Rust edition 2024
- Workspace lints:
unused = "allow",unused_imports = "allow" - Do not treat repository-wide
cargo fmt --checkdiffs or warnings such as unused imports/variables as blockers unless they are introduced by the current change or explicitly requested. Focus verification on build/test failures and behavior regressions. - Error handling:
anyhowfor applications,thiserrorfor libraries - Async: Tokio runtime throughout
- Frontend: ESLint with TypeScript rules, React hooks plugin
Global Guidelines & Core Principles
When modifying the codebase or interacting with the user, please strictly adhere to the following rules:
- Git Commit Format: Upon completing a task, always output a single-line English
git commitmessage beginning with standard prefixes (feat:,fix:,chore:, etc.). Provide the message text clearly, but DO NOT execute git commit commands or auto-submit. - State & Logic Abstraction: Always separate state management and command logic from UI components. Place custom Hooks in
src/hooksand Zustand stores insrc/storerather than defining them inside component files. - Strict i18n Internationalization: All newly introduced UI components must leverage
i18nextfor user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX. - Component Granularity: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested
/componentsfolder). Avoid keeping all view code inside single massiveindex.tsxfiles. - UI Specification Compliance: Ensure any new styling aligns with the design tokens defined in
docs/resources/ui_specification.md(e.g. cold gray colors,--flock-accentsolid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
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.

