agentleFS
OnelevenvyOnelevenvy/flock/AGENTS.md

flock

AGENTS.md1.1k starsChanged 5 months agoApache-2.0View on GitHub

This file provides guidance to CodeX when working with code in this repository. 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):…

  • Installs packages

We split this AGENTS.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
  1. Very specific:

    Do not treat repository-wide cargo fmt --check diffs or warnings such as unused imports/variables as blockers unless they are introduced by …

    line 180
  2. Distinctive:

    When modifying the codebase or interacting with the user, please strictly adhere to the following rules:

    line 187
  3. Very specific:

    State & Logic Abstraction: Always separate state management and command logic from UI components.

    line 190
  4. Very specific:

    Strict i18n Internationalization: All newly introduced UI components must leverage i18next for user-facing texts (e.g.

    line 191
  5. Very specific:

    UI Specification Compliance: Ensure any new styling aligns with the design tokens defined in docs/resources/ui_specification.md (e.g.

    line 193

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides guidance to CodeX 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 --workspace

Tauri 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 lint

Architecture

Workspace Crates

CratePurpose
flock-coreCore types, config, database, IPC interface, crypto, model factory
flock-agentAgent engine, session management, tool execution, memory, graph orchestration, workflow engine
flock-toolsTool registry, built-in tools (Read/Write/Edit/Bash/Grep/Glob), MCP integration, sandbox tools (CodeExecution, SandboxExec, Browser, ComputerUse)
flock-skillsSkill discovery, loading, frontmatter parsing, hooks, permissions, bundled skills
flock-ui/src-tauriTauri desktop app backend (commands, agent state, workspace management)
workspace-hackcargo-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):

  • 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 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 LangGraph StateGraph
  • 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 $ARGUMENTS substitution, shell execution, conditional activation
  • Two execution contexts: inline (same agent) and fork (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.md index 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 approvals
  • uiStore: Theme, sidebar state, active view, file tree
  • workspaceStore: Active workspace/conversation, persisted to localStorage
  • workflowStore: ReactFlow nodes/edges, execution state, dirty tracking

Key Views:

  • HomeView: Welcome screen, assistant selection, workspace picker
  • WorkspaceView: Chat panel + file tree + optional preview panel (VNC, sandbox runner)
  • WorkflowEditor: Visual workflow builder with ReactFlow canvas, node palette, properties panel, execution panel
  • AssistantPage: CRUD for custom assistants
  • SkillsPage: Tools, MCP servers, and skills management
  • SettingsModal: 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

  1. User sends message via UI → Tauri command send_message
  2. AgentState forwards to AgentEngine::run()
  3. Engine builds LangGraph, invokes LLM with tools
  4. LLM response streamed as ProtocolEvents via TauriProtocolEmitter
  5. Frontend useEventStream hook listens to Tauri events, updates agentStore
  6. Tool calls require approval (unless auto-approved) → ToolApprovalInline component
  7. 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 --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.
  • Error handling: anyhow for applications, thiserror for 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Download now (ZIP)

  • 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 28,693 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 repositoryOne other file it gives its agents.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.