{"owner":"Onelevenvy","repo":"flock","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md","CLAUDE.md"],"skills":{"AGENTS.md":"# AGENTS.md\n\nThis file provides guidance to CodeX when working with code in this repository.\n\n## Project Overview\n\nFlock 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).\n\n## Build & Development Commands\n\n### Rust Backend\n```bash\n# Build the CLI\ncargo build --release\n\n# Run in single-shot mode\ncargo run -- \"your question\"\n\n# Run interactive REPL\ncargo run\n\n# Run with specific provider/profile\ncargo run -- --profile deepseek \"your question\"\n\n# Run tests (workspace-wide)\ncargo test\n\n# Run a single crate's tests\ncargo test -p flock-core\ncargo test -p flock-agent\ncargo test -p flock-tools\ncargo test -p flock-skills\n\n# Run a specific test\ncargo test -p flock-core test_name\n\n# Lint\ncargo clippy --workspace\n```\n\n### Tauri Desktop UI\n```bash\ncd flock-ui\n\n# Install dependencies\nnpm install\n\n# Development server\nnpm run dev\n# or\nnpm run tauri dev\n\n# Build for production\nnpm run build\n# or\nnpm run tauri build\n\n# Lint frontend\nnpm run lint\n```\n\n## Architecture\n\n### Workspace Crates\n\n| Crate | Purpose |\n|-------|---------|\n| `flock-core` | Core types, config, database, IPC interface, crypto, model factory |\n| `flock-agent` | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |\n| `flock-tools` | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |\n| `flock-skills` | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |\n| `flock-ui/src-tauri` | Tauri desktop app backend (commands, agent state, workspace management) |\n| `workspace-hack` | cargo-hakari build optimization |\n\n### Key Dependencies\n\n- **LangGraph**: Rust reimplementation ([langgraph-rust](https://github.com/Onelevenvy/langgraph-rust)) for agent graph orchestration\n- **LLM Providers**: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex\n- **Database**: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows\n- **Async Runtime**: Tokio\n- **Sandbox**: Daytona cloud container runtime for isolated code execution\n- **Browser Automation**: Playwright (Python, runs inside sandbox via CDP)\n\n### Core Architecture Patterns\n\n**Agent Engine** (`flock-agent/src/engine.rs`):\n- `AgentEngine` orchestrates the LLM interaction loop\n- Uses LangGraph `CompiledStateGraph` for execution flow\n- Manages conversation history via SQLite checkpointer\n- Handles tool approval, context compression, plan mode\n\n**Tool System** (`flock-tools/src/lib.rs`):\n- `Tool` trait defines the interface: `name()`, `description()`, `input_schema()`, `execute()`\n- `ToolRegistry` manages all registered tools\n- Built-in tools: Read, Write, Edit, Bash, Grep, Glob\n- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance\n- Extensible via MCP servers and custom tool providers\n\n**Workflow Engine** (`flock-agent/src/workflow_graph/`):\n- Visual workflow builder with ReactFlow canvas\n- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor\n- `build_workflow_graph()` compiles ReactFlow JSON into LangGraph `StateGraph`\n- Streaming execution with human-in-the-loop interrupts\n\n**Sandbox System** (`flock-tools/src/daytona/`):\n- Cloud-based Daytona container runtime for isolated execution\n- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)\n- Lifecycle management: create, destroy, set-public, snapshot\n- Human takeover via VNC with approval flow\n\n**Skills System** (`flock-skills/`):\n- Markdown files with YAML frontmatter in `.flock/skills/`\n- Supports `$ARGUMENTS` substitution, shell execution, conditional activation\n- Two execution contexts: `inline` (same agent) and `fork` (sub-agent)\n- Hot-reload via file watcher\n\n**Memory System** (`flock-agent/src/memory/`):\n- Four types: `user`, `feedback`, `project`, `reference`\n- Stored as Markdown files with frontmatter in `<config>/flock/projects/<project>/memory/`\n- `MEMORY.md` index file auto-loaded into system prompt\n\n**IPC Interface** (`flock-core/src/ipc_interface/`):\n- JSON-based protocol for host ↔ agent communication\n- Events (Agent → Host): `ready`, `stream_start`, `text_delta`, `tool_request`, `tool_result`, etc.\n- Commands (Host → Agent): `message`, `stop`, `tool_approve`, `tool_deny`, `set_mode`, `set_config`\n\n**Configuration** (`flock-core/src/config/settings.rs`):\n- Config priority: CLI args/env > project `flock.toml` > global config\n- Supports profiles with inheritance (`extends`)\n- Provider compatibility settings (`ProviderCompat`) for API differences\n\n### Tauri Desktop UI\n\n**Frontend Stack**:\n- React 18 + TypeScript\n- Mantine UI v8 (components, notifications)\n- Zustand (state management)\n- React Query (server state)\n- react-markdown + react-syntax-highlighter (message rendering)\n- i18next (internationalization)\n- ReactFlow (workflow visual editor)\n\n**State Stores** (`flock-ui/src/store/`):\n- `agentStore`: Agent connection status, messages, pending approvals\n- `uiStore`: Theme, sidebar state, active view, file tree\n- `workspaceStore`: Active workspace/conversation, persisted to localStorage\n- `workflowStore`: ReactFlow nodes/edges, execution state, dirty tracking\n\n**Key Views**:\n- `HomeView`: Welcome screen, assistant selection, workspace picker\n- `WorkspaceView`: Chat panel + file tree + optional preview panel (VNC, sandbox runner)\n- `WorkflowEditor`: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel\n- `AssistantPage`: CRUD for custom assistants\n- `SkillsPage`: Tools, MCP servers, and skills management\n- `SettingsModal`: Model providers, basic settings, sandbox settings, system settings\n\n**Tauri Commands** (`flock-ui/src-tauri/src/commands/`):\n- Agent control: `start_agent`, `stop_agent`, `send_message`, `approve_tool`, `deny_tool`\n- Workspace: `list_workspaces`, `create_workspace`, `delete_workspace`\n- Conversations: `list_conversations`, `create_conversation`, `load_conversation_history`\n- Database: `list_providers`, `upsert_provider`, `list_models`, `upsert_model`\n- MCP: `list_mcp_servers`, `upsert_mcp_server`, `test_mcp_server`\n- Skills: `list_skills`, `get_extra_skill_dirs`, `add_extra_skill_dir`\n- Workflow: `list_workflows`, `get_workflow`, `create_workflow`, `update_workflow`, `delete_workflow`, `run_workflow`, `stop_workflow`\n\n### Data Flow\n\n1. User sends message via UI → Tauri command `send_message`\n2. `AgentState` forwards to `AgentEngine::run()`\n3. Engine builds LangGraph, invokes LLM with tools\n4. LLM response streamed as `ProtocolEvent`s via `TauriProtocolEmitter`\n5. Frontend `useEventStream` hook listens to Tauri events, updates `agentStore`\n6. Tool calls require approval (unless auto-approved) → `ToolApprovalInline` component\n7. Approved tools execute → results fed back to LLM for next turn\n\n## Code Style\n\n- Rust edition 2024\n- Workspace lints: `unused = \"allow\"`, `unused_imports = \"allow\"`\n- Do not treat repository-wide `cargo fmt --check` diffs 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.\n- Error handling: `anyhow` for applications, `thiserror` for libraries\n- Async: Tokio runtime throughout\n- Frontend: ESLint with TypeScript rules, React hooks plugin\n\n## Global Guidelines & Core Principles\n\nWhen modifying the codebase or interacting with the user, please strictly adhere to the following rules:\n\n1. **Git Commit Format**: Upon completing a task, always output a single-line English `git commit` message beginning with standard prefixes (`feat:`, `fix:`, `chore:`, etc.). Provide the message text clearly, but **DO NOT** execute git commit commands or auto-submit.\n2. **State & Logic Abstraction**: Always separate state management and command logic from UI components. Place custom Hooks in `src/hooks` and Zustand stores in `src/store` rather than defining them inside component files.\n3. **Strict i18n Internationalization**: All newly introduced UI components must leverage `i18next` for user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX.\n4. **Component Granularity**: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested `/components` folder). Avoid keeping all view code inside single massive `index.tsx` files.\n5. **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-accent` solid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.\n","CLAUDE.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nFlock 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).\n\n## Build & Development Commands\n\n### Rust Backend\n```bash\n# Build the CLI\ncargo build --release\n\n# Run in single-shot mode\ncargo run -- \"your question\"\n\n# Run interactive REPL\ncargo run\n\n# Run with specific provider/profile\ncargo run -- --profile deepseek \"your question\"\n\n# Run tests (workspace-wide)\ncargo test\n\n# Run a single crate's tests\ncargo test -p flock-core\ncargo test -p flock-agent\ncargo test -p flock-tools\ncargo test -p flock-skills\n\n# Run a specific test\ncargo test -p flock-core test_name\n\n# Lint\ncargo clippy --workspace\n```\n\n### Tauri Desktop UI\n```bash\ncd flock-ui\n\n# Install dependencies\nnpm install\n\n# Development server\nnpm run dev\n# or\nnpm run tauri dev\n\n# Build for production\nnpm run build\n# or\nnpm run tauri build\n\n# Lint frontend\nnpm run lint\n```\n\n## Architecture\n\n### Workspace Crates\n\n| Crate | Purpose |\n|-------|---------|\n| `flock-core` | Core types, config, database, IPC interface, crypto, model factory |\n| `flock-agent` | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |\n| `flock-tools` | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |\n| `flock-skills` | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |\n| `flock-ui/src-tauri` | Tauri desktop app backend (commands, agent state, workspace management) |\n| `workspace-hack` | cargo-hakari build optimization |\n\n### Key Dependencies\n\n- **LangGraph**: Rust reimplementation ([langgraph-rust](https://github.com/Onelevenvy/langgraph-rust)) for agent graph orchestration\n- **LLM Providers**: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex\n- **Database**: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows\n- **Async Runtime**: Tokio\n- **Sandbox**: Daytona cloud container runtime for isolated code execution\n- **Browser Automation**: Playwright (Python, runs inside sandbox via CDP)\n\n### Core Architecture Patterns\n\n**Agent Engine** (`flock-agent/src/engine.rs`):\n- `AgentEngine` orchestrates the LLM interaction loop\n- Uses LangGraph `CompiledStateGraph` for execution flow\n- Manages conversation history via SQLite checkpointer\n- Handles tool approval, context compression, plan mode\n\n**Tool System** (`flock-tools/src/lib.rs`):\n- `Tool` trait defines the interface: `name()`, `description()`, `input_schema()`, `execute()`\n- `ToolRegistry` manages all registered tools\n- Built-in tools: Read, Write, Edit, Bash, Grep, Glob\n- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance\n- Extensible via MCP servers and custom tool providers\n\n**Workflow Engine** (`flock-agent/src/workflow_graph/`):\n- Visual workflow builder with ReactFlow canvas\n- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor\n- `build_workflow_graph()` compiles ReactFlow JSON into LangGraph `StateGraph`\n- Streaming execution with human-in-the-loop interrupts\n\n**Sandbox System** (`flock-tools/src/daytona/`):\n- Cloud-based Daytona container runtime for isolated execution\n- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)\n- Lifecycle management: create, destroy, set-public, snapshot\n- Human takeover via VNC with approval flow\n\n**Skills System** (`flock-skills/`):\n- Markdown files with YAML frontmatter in `.flock/skills/`\n- Supports `$ARGUMENTS` substitution, shell execution, conditional activation\n- Two execution contexts: `inline` (same agent) and `fork` (sub-agent)\n- Hot-reload via file watcher\n\n**Memory System** (`flock-agent/src/memory/`):\n- Four types: `user`, `feedback`, `project`, `reference`\n- Stored as Markdown files with frontmatter in `<config>/flock/projects/<project>/memory/`\n- `MEMORY.md` index file auto-loaded into system prompt\n\n**IPC Interface** (`flock-core/src/ipc_interface/`):\n- JSON-based protocol for host ↔ agent communication\n- Events (Agent → Host): `ready`, `stream_start`, `text_delta`, `tool_request`, `tool_result`, etc.\n- Commands (Host → Agent): `message`, `stop`, `tool_approve`, `tool_deny`, `set_mode`, `set_config`\n\n**Configuration** (`flock-core/src/config/settings.rs`):\n- Config priority: CLI args/env > project `flock.toml` > global config\n- Supports profiles with inheritance (`extends`)\n- Provider compatibility settings (`ProviderCompat`) for API differences\n\n### Tauri Desktop UI\n\n**Frontend Stack**:\n- React 18 + TypeScript\n- Mantine UI v8 (components, notifications)\n- Zustand (state management)\n- React Query (server state)\n- react-markdown + react-syntax-highlighter (message rendering)\n- i18next (internationalization)\n- ReactFlow (workflow visual editor)\n\n**State Stores** (`flock-ui/src/store/`):\n- `agentStore`: Agent connection status, messages, pending approvals\n- `uiStore`: Theme, sidebar state, active view, file tree\n- `workspaceStore`: Active workspace/conversation, persisted to localStorage\n- `workflowStore`: ReactFlow nodes/edges, execution state, dirty tracking\n\n**Key Views**:\n- `HomeView`: Welcome screen, assistant selection, workspace picker\n- `WorkspaceView`: Chat panel + file tree + optional preview panel (VNC, sandbox runner)\n- `WorkflowEditor`: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel\n- `AssistantPage`: CRUD for custom assistants\n- `SkillsPage`: Tools, MCP servers, and skills management\n- `SettingsModal`: Model providers, basic settings, sandbox settings, system settings\n\n**Tauri Commands** (`flock-ui/src-tauri/src/commands/`):\n- Agent control: `start_agent`, `stop_agent`, `send_message`, `approve_tool`, `deny_tool`\n- Workspace: `list_workspaces`, `create_workspace`, `delete_workspace`\n- Conversations: `list_conversations`, `create_conversation`, `load_conversation_history`\n- Database: `list_providers`, `upsert_provider`, `list_models`, `upsert_model`\n- MCP: `list_mcp_servers`, `upsert_mcp_server`, `test_mcp_server`\n- Skills: `list_skills`, `get_extra_skill_dirs`, `add_extra_skill_dir`\n- Workflow: `list_workflows`, `get_workflow`, `create_workflow`, `update_workflow`, `delete_workflow`, `run_workflow`, `stop_workflow`\n\n### Data Flow\n\n1. User sends message via UI → Tauri command `send_message`\n2. `AgentState` forwards to `AgentEngine::run()`\n3. Engine builds LangGraph, invokes LLM with tools\n4. LLM response streamed as `ProtocolEvent`s via `TauriProtocolEmitter`\n5. Frontend `useEventStream` hook listens to Tauri events, updates `agentStore`\n6. Tool calls require approval (unless auto-approved) → `ToolApprovalInline` component\n7. Approved tools execute → results fed back to LLM for next turn\n\n## Code Style\n\n- Rust edition 2024\n- Workspace lints: `unused = \"allow\"`, `unused_imports = \"allow\"`\n- Do not treat repository-wide `cargo fmt --check` diffs 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.\n- Error handling: `anyhow` for applications, `thiserror` for libraries\n- Async: Tokio runtime throughout\n- Frontend: ESLint with TypeScript rules, React hooks plugin\n\n\n## Global Guidelines & Core Principles\n\nWhen modifying the codebase or interacting with the user, please strictly adhere to the following rules:\n\n1. **Git Commit Format**: Upon completing a task, always output a single-line English `git commit` message beginning with standard prefixes (`feat:`, `fix:`, `chore:`, etc.). Provide the message text clearly, but **DO NOT** execute git commit commands or auto-submit.\n2. **State & Logic Abstraction**: Always separate state management and command logic from UI components. Place custom Hooks in `src/hooks` and Zustand stores in `src/store` rather than defining them inside component files.\n3. **Strict i18n Internationalization**: All newly introduced UI components must leverage `i18next` for user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX.\n4. **Component Granularity**: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested `/components` folder). Avoid keeping all view code inside single massive `index.tsx` files.\n5. **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-accent` solid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.\n"},"files":{"AGENTS.md":"# AGENTS.md\n\nThis file provides guidance to CodeX when working with code in this repository.\n\n## Project Overview\n\nFlock 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).\n\n## Build & Development Commands\n\n### Rust Backend\n```bash\n# Build the CLI\ncargo build --release\n\n# Run in single-shot mode\ncargo run -- \"your question\"\n\n# Run interactive REPL\ncargo run\n\n# Run with specific provider/profile\ncargo run -- --profile deepseek \"your question\"\n\n# Run tests (workspace-wide)\ncargo test\n\n# Run a single crate's tests\ncargo test -p flock-core\ncargo test -p flock-agent\ncargo test -p flock-tools\ncargo test -p flock-skills\n\n# Run a specific test\ncargo test -p flock-core test_name\n\n# Lint\ncargo clippy --workspace\n```\n\n### Tauri Desktop UI\n```bash\ncd flock-ui\n\n# Install dependencies\nnpm install\n\n# Development server\nnpm run dev\n# or\nnpm run tauri dev\n\n# Build for production\nnpm run build\n# or\nnpm run tauri build\n\n# Lint frontend\nnpm run lint\n```\n\n## Architecture\n\n### Workspace Crates\n\n| Crate | Purpose |\n|-------|---------|\n| `flock-core` | Core types, config, database, IPC interface, crypto, model factory |\n| `flock-agent` | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |\n| `flock-tools` | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |\n| `flock-skills` | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |\n| `flock-ui/src-tauri` | Tauri desktop app backend (commands, agent state, workspace management) |\n| `workspace-hack` | cargo-hakari build optimization |\n\n### Key Dependencies\n\n- **LangGraph**: Rust reimplementation ([langgraph-rust](https://github.com/Onelevenvy/langgraph-rust)) for agent graph orchestration\n- **LLM Providers**: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex\n- **Database**: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows\n- **Async Runtime**: Tokio\n- **Sandbox**: Daytona cloud container runtime for isolated code execution\n- **Browser Automation**: Playwright (Python, runs inside sandbox via CDP)\n\n### Core Architecture Patterns\n\n**Agent Engine** (`flock-agent/src/engine.rs`):\n- `AgentEngine` orchestrates the LLM interaction loop\n- Uses LangGraph `CompiledStateGraph` for execution flow\n- Manages conversation history via SQLite checkpointer\n- Handles tool approval, context compression, plan mode\n\n**Tool System** (`flock-tools/src/lib.rs`):\n- `Tool` trait defines the interface: `name()`, `description()`, `input_schema()`, `execute()`\n- `ToolRegistry` manages all registered tools\n- Built-in tools: Read, Write, Edit, Bash, Grep, Glob\n- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance\n- Extensible via MCP servers and custom tool providers\n\n**Workflow Engine** (`flock-agent/src/workflow_graph/`):\n- Visual workflow builder with ReactFlow canvas\n- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor\n- `build_workflow_graph()` compiles ReactFlow JSON into LangGraph `StateGraph`\n- Streaming execution with human-in-the-loop interrupts\n\n**Sandbox System** (`flock-tools/src/daytona/`):\n- Cloud-based Daytona container runtime for isolated execution\n- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)\n- Lifecycle management: create, destroy, set-public, snapshot\n- Human takeover via VNC with approval flow\n\n**Skills System** (`flock-skills/`):\n- Markdown files with YAML frontmatter in `.flock/skills/`\n- Supports `$ARGUMENTS` substitution, shell execution, conditional activation\n- Two execution contexts: `inline` (same agent) and `fork` (sub-agent)\n- Hot-reload via file watcher\n\n**Memory System** (`flock-agent/src/memory/`):\n- Four types: `user`, `feedback`, `project`, `reference`\n- Stored as Markdown files with frontmatter in `<config>/flock/projects/<project>/memory/`\n- `MEMORY.md` index file auto-loaded into system prompt\n\n**IPC Interface** (`flock-core/src/ipc_interface/`):\n- JSON-based protocol for host ↔ agent communication\n- Events (Agent → Host): `ready`, `stream_start`, `text_delta`, `tool_request`, `tool_result`, etc.\n- Commands (Host → Agent): `message`, `stop`, `tool_approve`, `tool_deny`, `set_mode`, `set_config`\n\n**Configuration** (`flock-core/src/config/settings.rs`):\n- Config priority: CLI args/env > project `flock.toml` > global config\n- Supports profiles with inheritance (`extends`)\n- Provider compatibility settings (`ProviderCompat`) for API differences\n\n### Tauri Desktop UI\n\n**Frontend Stack**:\n- React 18 + TypeScript\n- Mantine UI v8 (components, notifications)\n- Zustand (state management)\n- React Query (server state)\n- react-markdown + react-syntax-highlighter (message rendering)\n- i18next (internationalization)\n- ReactFlow (workflow visual editor)\n\n**State Stores** (`flock-ui/src/store/`):\n- `agentStore`: Agent connection status, messages, pending approvals\n- `uiStore`: Theme, sidebar state, active view, file tree\n- `workspaceStore`: Active workspace/conversation, persisted to localStorage\n- `workflowStore`: ReactFlow nodes/edges, execution state, dirty tracking\n\n**Key Views**:\n- `HomeView`: Welcome screen, assistant selection, workspace picker\n- `WorkspaceView`: Chat panel + file tree + optional preview panel (VNC, sandbox runner)\n- `WorkflowEditor`: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel\n- `AssistantPage`: CRUD for custom assistants\n- `SkillsPage`: Tools, MCP servers, and skills management\n- `SettingsModal`: Model providers, basic settings, sandbox settings, system settings\n\n**Tauri Commands** (`flock-ui/src-tauri/src/commands/`):\n- Agent control: `start_agent`, `stop_agent`, `send_message`, `approve_tool`, `deny_tool`\n- Workspace: `list_workspaces`, `create_workspace`, `delete_workspace`\n- Conversations: `list_conversations`, `create_conversation`, `load_conversation_history`\n- Database: `list_providers`, `upsert_provider`, `list_models`, `upsert_model`\n- MCP: `list_mcp_servers`, `upsert_mcp_server`, `test_mcp_server`\n- Skills: `list_skills`, `get_extra_skill_dirs`, `add_extra_skill_dir`\n- Workflow: `list_workflows`, `get_workflow`, `create_workflow`, `update_workflow`, `delete_workflow`, `run_workflow`, `stop_workflow`\n\n### Data Flow\n\n1. User sends message via UI → Tauri command `send_message`\n2. `AgentState` forwards to `AgentEngine::run()`\n3. Engine builds LangGraph, invokes LLM with tools\n4. LLM response streamed as `ProtocolEvent`s via `TauriProtocolEmitter`\n5. Frontend `useEventStream` hook listens to Tauri events, updates `agentStore`\n6. Tool calls require approval (unless auto-approved) → `ToolApprovalInline` component\n7. Approved tools execute → results fed back to LLM for next turn\n\n## Code Style\n\n- Rust edition 2024\n- Workspace lints: `unused = \"allow\"`, `unused_imports = \"allow\"`\n- Do not treat repository-wide `cargo fmt --check` diffs 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.\n- Error handling: `anyhow` for applications, `thiserror` for libraries\n- Async: Tokio runtime throughout\n- Frontend: ESLint with TypeScript rules, React hooks plugin\n\n## Global Guidelines & Core Principles\n\nWhen modifying the codebase or interacting with the user, please strictly adhere to the following rules:\n\n1. **Git Commit Format**: Upon completing a task, always output a single-line English `git commit` message beginning with standard prefixes (`feat:`, `fix:`, `chore:`, etc.). Provide the message text clearly, but **DO NOT** execute git commit commands or auto-submit.\n2. **State & Logic Abstraction**: Always separate state management and command logic from UI components. Place custom Hooks in `src/hooks` and Zustand stores in `src/store` rather than defining them inside component files.\n3. **Strict i18n Internationalization**: All newly introduced UI components must leverage `i18next` for user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX.\n4. **Component Granularity**: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested `/components` folder). Avoid keeping all view code inside single massive `index.tsx` files.\n5. **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-accent` solid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.\n","CLAUDE.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nFlock 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).\n\n## Build & Development Commands\n\n### Rust Backend\n```bash\n# Build the CLI\ncargo build --release\n\n# Run in single-shot mode\ncargo run -- \"your question\"\n\n# Run interactive REPL\ncargo run\n\n# Run with specific provider/profile\ncargo run -- --profile deepseek \"your question\"\n\n# Run tests (workspace-wide)\ncargo test\n\n# Run a single crate's tests\ncargo test -p flock-core\ncargo test -p flock-agent\ncargo test -p flock-tools\ncargo test -p flock-skills\n\n# Run a specific test\ncargo test -p flock-core test_name\n\n# Lint\ncargo clippy --workspace\n```\n\n### Tauri Desktop UI\n```bash\ncd flock-ui\n\n# Install dependencies\nnpm install\n\n# Development server\nnpm run dev\n# or\nnpm run tauri dev\n\n# Build for production\nnpm run build\n# or\nnpm run tauri build\n\n# Lint frontend\nnpm run lint\n```\n\n## Architecture\n\n### Workspace Crates\n\n| Crate | Purpose |\n|-------|---------|\n| `flock-core` | Core types, config, database, IPC interface, crypto, model factory |\n| `flock-agent` | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |\n| `flock-tools` | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |\n| `flock-skills` | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |\n| `flock-ui/src-tauri` | Tauri desktop app backend (commands, agent state, workspace management) |\n| `workspace-hack` | cargo-hakari build optimization |\n\n### Key Dependencies\n\n- **LangGraph**: Rust reimplementation ([langgraph-rust](https://github.com/Onelevenvy/langgraph-rust)) for agent graph orchestration\n- **LLM Providers**: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex\n- **Database**: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows\n- **Async Runtime**: Tokio\n- **Sandbox**: Daytona cloud container runtime for isolated code execution\n- **Browser Automation**: Playwright (Python, runs inside sandbox via CDP)\n\n### Core Architecture Patterns\n\n**Agent Engine** (`flock-agent/src/engine.rs`):\n- `AgentEngine` orchestrates the LLM interaction loop\n- Uses LangGraph `CompiledStateGraph` for execution flow\n- Manages conversation history via SQLite checkpointer\n- Handles tool approval, context compression, plan mode\n\n**Tool System** (`flock-tools/src/lib.rs`):\n- `Tool` trait defines the interface: `name()`, `description()`, `input_schema()`, `execute()`\n- `ToolRegistry` manages all registered tools\n- Built-in tools: Read, Write, Edit, Bash, Grep, Glob\n- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance\n- Extensible via MCP servers and custom tool providers\n\n**Workflow Engine** (`flock-agent/src/workflow_graph/`):\n- Visual workflow builder with ReactFlow canvas\n- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor\n- `build_workflow_graph()` compiles ReactFlow JSON into LangGraph `StateGraph`\n- Streaming execution with human-in-the-loop interrupts\n\n**Sandbox System** (`flock-tools/src/daytona/`):\n- Cloud-based Daytona container runtime for isolated execution\n- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)\n- Lifecycle management: create, destroy, set-public, snapshot\n- Human takeover via VNC with approval flow\n\n**Skills System** (`flock-skills/`):\n- Markdown files with YAML frontmatter in `.flock/skills/`\n- Supports `$ARGUMENTS` substitution, shell execution, conditional activation\n- Two execution contexts: `inline` (same agent) and `fork` (sub-agent)\n- Hot-reload via file watcher\n\n**Memory System** (`flock-agent/src/memory/`):\n- Four types: `user`, `feedback`, `project`, `reference`\n- Stored as Markdown files with frontmatter in `<config>/flock/projects/<project>/memory/`\n- `MEMORY.md` index file auto-loaded into system prompt\n\n**IPC Interface** (`flock-core/src/ipc_interface/`):\n- JSON-based protocol for host ↔ agent communication\n- Events (Agent → Host): `ready`, `stream_start`, `text_delta`, `tool_request`, `tool_result`, etc.\n- Commands (Host → Agent): `message`, `stop`, `tool_approve`, `tool_deny`, `set_mode`, `set_config`\n\n**Configuration** (`flock-core/src/config/settings.rs`):\n- Config priority: CLI args/env > project `flock.toml` > global config\n- Supports profiles with inheritance (`extends`)\n- Provider compatibility settings (`ProviderCompat`) for API differences\n\n### Tauri Desktop UI\n\n**Frontend Stack**:\n- React 18 + TypeScript\n- Mantine UI v8 (components, notifications)\n- Zustand (state management)\n- React Query (server state)\n- react-markdown + react-syntax-highlighter (message rendering)\n- i18next (internationalization)\n- ReactFlow (workflow visual editor)\n\n**State Stores** (`flock-ui/src/store/`):\n- `agentStore`: Agent connection status, messages, pending approvals\n- `uiStore`: Theme, sidebar state, active view, file tree\n- `workspaceStore`: Active workspace/conversation, persisted to localStorage\n- `workflowStore`: ReactFlow nodes/edges, execution state, dirty tracking\n\n**Key Views**:\n- `HomeView`: Welcome screen, assistant selection, workspace picker\n- `WorkspaceView`: Chat panel + file tree + optional preview panel (VNC, sandbox runner)\n- `WorkflowEditor`: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel\n- `AssistantPage`: CRUD for custom assistants\n- `SkillsPage`: Tools, MCP servers, and skills management\n- `SettingsModal`: Model providers, basic settings, sandbox settings, system settings\n\n**Tauri Commands** (`flock-ui/src-tauri/src/commands/`):\n- Agent control: `start_agent`, `stop_agent`, `send_message`, `approve_tool`, `deny_tool`\n- Workspace: `list_workspaces`, `create_workspace`, `delete_workspace`\n- Conversations: `list_conversations`, `create_conversation`, `load_conversation_history`\n- Database: `list_providers`, `upsert_provider`, `list_models`, `upsert_model`\n- MCP: `list_mcp_servers`, `upsert_mcp_server`, `test_mcp_server`\n- Skills: `list_skills`, `get_extra_skill_dirs`, `add_extra_skill_dir`\n- Workflow: `list_workflows`, `get_workflow`, `create_workflow`, `update_workflow`, `delete_workflow`, `run_workflow`, `stop_workflow`\n\n### Data Flow\n\n1. User sends message via UI → Tauri command `send_message`\n2. `AgentState` forwards to `AgentEngine::run()`\n3. Engine builds LangGraph, invokes LLM with tools\n4. LLM response streamed as `ProtocolEvent`s via `TauriProtocolEmitter`\n5. Frontend `useEventStream` hook listens to Tauri events, updates `agentStore`\n6. Tool calls require approval (unless auto-approved) → `ToolApprovalInline` component\n7. Approved tools execute → results fed back to LLM for next turn\n\n## Code Style\n\n- Rust edition 2024\n- Workspace lints: `unused = \"allow\"`, `unused_imports = \"allow\"`\n- Do not treat repository-wide `cargo fmt --check` diffs 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.\n- Error handling: `anyhow` for applications, `thiserror` for libraries\n- Async: Tokio runtime throughout\n- Frontend: ESLint with TypeScript rules, React hooks plugin\n\n\n## Global Guidelines & Core Principles\n\nWhen modifying the codebase or interacting with the user, please strictly adhere to the following rules:\n\n1. **Git Commit Format**: Upon completing a task, always output a single-line English `git commit` message beginning with standard prefixes (`feat:`, `fix:`, `chore:`, etc.). Provide the message text clearly, but **DO NOT** execute git commit commands or auto-submit.\n2. **State & Logic Abstraction**: Always separate state management and command logic from UI components. Place custom Hooks in `src/hooks` and Zustand stores in `src/store` rather than defining them inside component files.\n3. **Strict i18n Internationalization**: All newly introduced UI components must leverage `i18next` for user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX.\n4. **Component Granularity**: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested `/components` folder). Avoid keeping all view code inside single massive `index.tsx` files.\n5. **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-accent` solid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","title":"AGENTS.md","content":"# AGENTS.md\n\nThis file provides guidance to CodeX when working with code in this repository.\n\n## Project Overview\n\nFlock 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).\n\n## Build & Development Commands\n\n### Rust Backend\n```bash\n# Build the CLI\ncargo build --release\n\n# Run in single-shot mode\ncargo run -- \"your question\"\n\n# Run interactive REPL\ncargo run\n\n# Run with specific provider/profile\ncargo run -- --profile deepseek \"your question\"\n\n# Run tests (workspace-wide)\ncargo test\n\n# Run a single crate's tests\ncargo test -p flock-core\ncargo test -p flock-agent\ncargo test -p flock-tools\ncargo test -p flock-skills\n\n# Run a specific test\ncargo test -p flock-core test_name\n\n# Lint\ncargo clippy --workspace\n```\n\n### Tauri Desktop UI\n```bash\ncd flock-ui\n\n# Install dependencies\nnpm install\n\n# Development server\nnpm run dev\n# or\nnpm run tauri dev\n\n# Build for production\nnpm run build\n# or\nnpm run tauri build\n\n# Lint frontend\nnpm run lint\n```\n\n## Architecture\n\n### Workspace Crates\n\n| Crate | Purpose |\n|-------|---------|\n| `flock-core` | Core types, config, database, IPC interface, crypto, model factory |\n| `flock-agent` | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |\n| `flock-tools` | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |\n| `flock-skills` | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |\n| `flock-ui/src-tauri` | Tauri desktop app backend (commands, agent state, workspace management) |\n| `workspace-hack` | cargo-hakari build optimization |\n\n### Key Dependencies\n\n- **LangGraph**: Rust reimplementation ([langgraph-rust](https://github.com/Onelevenvy/langgraph-rust)) for agent graph orchestration\n- **LLM Providers**: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex\n- **Database**: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows\n- **Async Runtime**: Tokio\n- **Sandbox**: Daytona cloud container runtime for isolated code execution\n- **Browser Automation**: Playwright (Python, runs inside sandbox via CDP)\n\n### Core Architecture Patterns\n\n**Agent Engine** (`flock-agent/src/engine.rs`):\n- `AgentEngine` orchestrates the LLM interaction loop\n- Uses LangGraph `CompiledStateGraph` for execution flow\n- Manages conversation history via SQLite checkpointer\n- Handles tool approval, context compression, plan mode\n\n**Tool System** (`flock-tools/src/lib.rs`):\n- `Tool` trait defines the interface: `name()`, `description()`, `input_schema()`, `execute()`\n- `ToolRegistry` manages all registered tools\n- Built-in tools: Read, Write, Edit, Bash, Grep, Glob\n- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance\n- Extensible via MCP servers and custom tool providers\n\n**Workflow Engine** (`flock-agent/src/workflow_graph/`):\n- Visual workflow builder with ReactFlow canvas\n- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor\n- `build_workflow_graph()` compiles ReactFlow JSON into LangGraph `StateGraph`\n- Streaming execution with human-in-the-loop interrupts\n\n**Sandbox System** (`flock-tools/src/daytona/`):\n- Cloud-based Daytona container runtime for isolated execution\n- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)\n- Lifecycle management: create, destroy, set-public, snapshot\n- Human takeover via VNC with approval flow\n\n**Skills System** (`flock-skills/`):\n- Markdown files with YAML frontmatter in `.flock/skills/`\n- Supports `$ARGUMENTS` substitution, shell execution, conditional activation\n- Two execution contexts: `inline` (same agent) and `fork` (sub-agent)\n- Hot-reload via file watcher\n\n**Memory System** (`flock-agent/src/memory/`):\n- Four types: `user`, `feedback`, `project`, `reference`\n- Stored as Markdown files with frontmatter in `<config>/flock/projects/<project>/memory/`\n- `MEMORY.md` index file auto-loaded into system prompt\n\n**IPC Interface** (`flock-core/src/ipc_interface/`):\n- JSON-based protocol for host ↔ agent communication\n- Events (Agent → Host): `ready`, `stream_start`, `text_delta`, `tool_request`, `tool_result`, etc.\n- Commands (Host → Agent): `message`, `stop`, `tool_approve`, `tool_deny`, `set_mode`, `set_config`\n\n**Configuration** (`flock-core/src/config/settings.rs`):\n- Config priority: CLI args/env > project `flock.toml` > global config\n- Supports profiles with inheritance (`extends`)\n- Provider compatibility settings (`ProviderCompat`) for API differences\n\n### Tauri Desktop UI\n\n**Frontend Stack**:\n- React 18 + TypeScript\n- Mantine UI v8 (components, notifications)\n- Zustand (state management)\n- React Query (server state)\n- react-markdown + react-syntax-highlighter (message rendering)\n- i18next (internationalization)\n- ReactFlow (workflow visual editor)\n\n**State Stores** (`flock-ui/src/store/`):\n- `agentStore`: Agent connection status, messages, pending approvals\n- `uiStore`: Theme, sidebar state, active view, file tree\n- `workspaceStore`: Active workspace/conversation, persisted to localStorage\n- `workflowStore`: ReactFlow nodes/edges, execution state, dirty tracking\n\n**Key Views**:\n- `HomeView`: Welcome screen, assistant selection, workspace picker\n- `WorkspaceView`: Chat panel + file tree + optional preview panel (VNC, sandbox runner)\n- `WorkflowEditor`: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel\n- `AssistantPage`: CRUD for custom assistants\n- `SkillsPage`: Tools, MCP servers, and skills management\n- `SettingsModal`: Model providers, basic settings, sandbox settings, system settings\n\n**Tauri Commands** (`flock-ui/src-tauri/src/commands/`):\n- Agent control: `start_agent`, `stop_agent`, `send_message`, `approve_tool`, `deny_tool`\n- Workspace: `list_workspaces`, `create_workspace`, `delete_workspace`\n- Conversations: `list_conversations`, `create_conversation`, `load_conversation_history`\n- Database: `list_providers`, `upsert_provider`, `list_models`, `upsert_model`\n- MCP: `list_mcp_servers`, `upsert_mcp_server`, `test_mcp_server`\n- Skills: `list_skills`, `get_extra_skill_dirs`, `add_extra_skill_dir`\n- Workflow: `list_workflows`, `get_workflow`, `create_workflow`, `update_workflow`, `delete_workflow`, `run_workflow`, `stop_workflow`\n\n### Data Flow\n\n1. User sends message via UI → Tauri command `send_message`\n2. `AgentState` forwards to `AgentEngine::run()`\n3. Engine builds LangGraph, invokes LLM with tools\n4. LLM response streamed as `ProtocolEvent`s via `TauriProtocolEmitter`\n5. Frontend `useEventStream` hook listens to Tauri events, updates `agentStore`\n6. Tool calls require approval (unless auto-approved) → `ToolApprovalInline` component\n7. Approved tools execute → results fed back to LLM for next turn\n\n## Code Style\n\n- Rust edition 2024\n- Workspace lints: `unused = \"allow\"`, `unused_imports = \"allow\"`\n- Do not treat repository-wide `cargo fmt --check` diffs 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.\n- Error handling: `anyhow` for applications, `thiserror` for libraries\n- Async: Tokio runtime throughout\n- Frontend: ESLint with TypeScript rules, React hooks plugin\n\n## Global Guidelines & Core Principles\n\nWhen modifying the codebase or interacting with the user, please strictly adhere to the following rules:\n\n1. **Git Commit Format**: Upon completing a task, always output a single-line English `git commit` message beginning with standard prefixes (`feat:`, `fix:`, `chore:`, etc.). Provide the message text clearly, but **DO NOT** execute git commit commands or auto-submit.\n2. **State & Logic Abstraction**: Always separate state management and command logic from UI components. Place custom Hooks in `src/hooks` and Zustand stores in `src/store` rather than defining them inside component files.\n3. **Strict i18n Internationalization**: All newly introduced UI components must leverage `i18next` for user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX.\n4. **Component Granularity**: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested `/components` folder). Avoid keeping all view code inside single massive `index.tsx` files.\n5. **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-accent` solid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.\n","category":"root","tokens":2234},{"name":"CLAUDE.md","path":"CLAUDE.md","title":"CLAUDE.md","content":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nFlock 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).\n\n## Build & Development Commands\n\n### Rust Backend\n```bash\n# Build the CLI\ncargo build --release\n\n# Run in single-shot mode\ncargo run -- \"your question\"\n\n# Run interactive REPL\ncargo run\n\n# Run with specific provider/profile\ncargo run -- --profile deepseek \"your question\"\n\n# Run tests (workspace-wide)\ncargo test\n\n# Run a single crate's tests\ncargo test -p flock-core\ncargo test -p flock-agent\ncargo test -p flock-tools\ncargo test -p flock-skills\n\n# Run a specific test\ncargo test -p flock-core test_name\n\n# Lint\ncargo clippy --workspace\n```\n\n### Tauri Desktop UI\n```bash\ncd flock-ui\n\n# Install dependencies\nnpm install\n\n# Development server\nnpm run dev\n# or\nnpm run tauri dev\n\n# Build for production\nnpm run build\n# or\nnpm run tauri build\n\n# Lint frontend\nnpm run lint\n```\n\n## Architecture\n\n### Workspace Crates\n\n| Crate | Purpose |\n|-------|---------|\n| `flock-core` | Core types, config, database, IPC interface, crypto, model factory |\n| `flock-agent` | Agent engine, session management, tool execution, memory, graph orchestration, workflow engine |\n| `flock-tools` | Tool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse) |\n| `flock-skills` | Skill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills |\n| `flock-ui/src-tauri` | Tauri desktop app backend (commands, agent state, workspace management) |\n| `workspace-hack` | cargo-hakari build optimization |\n\n### Key Dependencies\n\n- **LangGraph**: Rust reimplementation ([langgraph-rust](https://github.com/Onelevenvy/langgraph-rust)) for agent graph orchestration\n- **LLM Providers**: OpenAI-compatible (default), Anthropic, AWS Bedrock, Google Vertex\n- **Database**: SQLite via sqlx for sessions, conversations, providers, tools, MCP servers, workflows\n- **Async Runtime**: Tokio\n- **Sandbox**: Daytona cloud container runtime for isolated code execution\n- **Browser Automation**: Playwright (Python, runs inside sandbox via CDP)\n\n### Core Architecture Patterns\n\n**Agent Engine** (`flock-agent/src/engine.rs`):\n- `AgentEngine` orchestrates the LLM interaction loop\n- Uses LangGraph `CompiledStateGraph` for execution flow\n- Manages conversation history via SQLite checkpointer\n- Handles tool approval, context compression, plan mode\n\n**Tool System** (`flock-tools/src/lib.rs`):\n- `Tool` trait defines the interface: `name()`, `description()`, `input_schema()`, `execute()`\n- `ToolRegistry` manages all registered tools\n- Built-in tools: Read, Write, Edit, Bash, Grep, Glob\n- Sandbox tools: CodeExecution, SandboxExec, Browser, ComputerUse, RequestHumanAssistance\n- Extensible via MCP servers and custom tool providers\n\n**Workflow Engine** (`flock-agent/src/workflow_graph/`):\n- Visual workflow builder with ReactFlow canvas\n- 10 node types: start, llm, agent, classifier, ifelse, answer, code, human, plugin, parameter_extractor\n- `build_workflow_graph()` compiles ReactFlow JSON into LangGraph `StateGraph`\n- Streaming execution with human-in-the-loop interrupts\n\n**Sandbox System** (`flock-tools/src/daytona/`):\n- Cloud-based Daytona container runtime for isolated execution\n- VNC desktop provisioning (Xvfb, fluxbox, x11vnc, websockify)\n- Lifecycle management: create, destroy, set-public, snapshot\n- Human takeover via VNC with approval flow\n\n**Skills System** (`flock-skills/`):\n- Markdown files with YAML frontmatter in `.flock/skills/`\n- Supports `$ARGUMENTS` substitution, shell execution, conditional activation\n- Two execution contexts: `inline` (same agent) and `fork` (sub-agent)\n- Hot-reload via file watcher\n\n**Memory System** (`flock-agent/src/memory/`):\n- Four types: `user`, `feedback`, `project`, `reference`\n- Stored as Markdown files with frontmatter in `<config>/flock/projects/<project>/memory/`\n- `MEMORY.md` index file auto-loaded into system prompt\n\n**IPC Interface** (`flock-core/src/ipc_interface/`):\n- JSON-based protocol for host ↔ agent communication\n- Events (Agent → Host): `ready`, `stream_start`, `text_delta`, `tool_request`, `tool_result`, etc.\n- Commands (Host → Agent): `message`, `stop`, `tool_approve`, `tool_deny`, `set_mode`, `set_config`\n\n**Configuration** (`flock-core/src/config/settings.rs`):\n- Config priority: CLI args/env > project `flock.toml` > global config\n- Supports profiles with inheritance (`extends`)\n- Provider compatibility settings (`ProviderCompat`) for API differences\n\n### Tauri Desktop UI\n\n**Frontend Stack**:\n- React 18 + TypeScript\n- Mantine UI v8 (components, notifications)\n- Zustand (state management)\n- React Query (server state)\n- react-markdown + react-syntax-highlighter (message rendering)\n- i18next (internationalization)\n- ReactFlow (workflow visual editor)\n\n**State Stores** (`flock-ui/src/store/`):\n- `agentStore`: Agent connection status, messages, pending approvals\n- `uiStore`: Theme, sidebar state, active view, file tree\n- `workspaceStore`: Active workspace/conversation, persisted to localStorage\n- `workflowStore`: ReactFlow nodes/edges, execution state, dirty tracking\n\n**Key Views**:\n- `HomeView`: Welcome screen, assistant selection, workspace picker\n- `WorkspaceView`: Chat panel + file tree + optional preview panel (VNC, sandbox runner)\n- `WorkflowEditor`: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel\n- `AssistantPage`: CRUD for custom assistants\n- `SkillsPage`: Tools, MCP servers, and skills management\n- `SettingsModal`: Model providers, basic settings, sandbox settings, system settings\n\n**Tauri Commands** (`flock-ui/src-tauri/src/commands/`):\n- Agent control: `start_agent`, `stop_agent`, `send_message`, `approve_tool`, `deny_tool`\n- Workspace: `list_workspaces`, `create_workspace`, `delete_workspace`\n- Conversations: `list_conversations`, `create_conversation`, `load_conversation_history`\n- Database: `list_providers`, `upsert_provider`, `list_models`, `upsert_model`\n- MCP: `list_mcp_servers`, `upsert_mcp_server`, `test_mcp_server`\n- Skills: `list_skills`, `get_extra_skill_dirs`, `add_extra_skill_dir`\n- Workflow: `list_workflows`, `get_workflow`, `create_workflow`, `update_workflow`, `delete_workflow`, `run_workflow`, `stop_workflow`\n\n### Data Flow\n\n1. User sends message via UI → Tauri command `send_message`\n2. `AgentState` forwards to `AgentEngine::run()`\n3. Engine builds LangGraph, invokes LLM with tools\n4. LLM response streamed as `ProtocolEvent`s via `TauriProtocolEmitter`\n5. Frontend `useEventStream` hook listens to Tauri events, updates `agentStore`\n6. Tool calls require approval (unless auto-approved) → `ToolApprovalInline` component\n7. Approved tools execute → results fed back to LLM for next turn\n\n## Code Style\n\n- Rust edition 2024\n- Workspace lints: `unused = \"allow\"`, `unused_imports = \"allow\"`\n- Do not treat repository-wide `cargo fmt --check` diffs 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.\n- Error handling: `anyhow` for applications, `thiserror` for libraries\n- Async: Tokio runtime throughout\n- Frontend: ESLint with TypeScript rules, React hooks plugin\n\n\n## Global Guidelines & Core Principles\n\nWhen modifying the codebase or interacting with the user, please strictly adhere to the following rules:\n\n1. **Git Commit Format**: Upon completing a task, always output a single-line English `git commit` message beginning with standard prefixes (`feat:`, `fix:`, `chore:`, etc.). Provide the message text clearly, but **DO NOT** execute git commit commands or auto-submit.\n2. **State & Logic Abstraction**: Always separate state management and command logic from UI components. Place custom Hooks in `src/hooks` and Zustand stores in `src/store` rather than defining them inside component files.\n3. **Strict i18n Internationalization**: All newly introduced UI components must leverage `i18next` for user-facing texts (e.g. tooltips, titles, toast notifications, confirm boxes). Do not hardcode Chinese or English strings inside JSX.\n4. **Component Granularity**: Strive for modularity. Always split large layout or page files into focused, localized sub-components (placed in a nested `/components` folder). Avoid keeping all view code inside single massive `index.tsx` files.\n5. **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-accent` solid blue branding, standard monospace typographies, and hover-card transitions) in both dark and light modes.\n","category":"root","tokens":2240}]}