.ai/docs/architecture.md
Flow is a CLI tool and task runner written in Rust. It provides project automation, AI-assisted development workflows, and deployment capabilities.
src/
├── main.rs # CLI entry point, command routing
├── lib.rs # Module exports
├── cli.rs # Clap command definitions
├── config.rs # Configuration loading (flow.toml, global config)
├── tasks.rs # Task execution and discovery
├── parallel.rs # Parallel task runner with TUI
├── commit.rs # AI-powered git commits and code review
├── ai.rs # AI session management (Claude, Codex)
├── deploy.rs # Deployment to hosts/platforms
├── deploy_setup.rs # Interactive deployment setup
├── docs.rs # Auto-generated documentation management
├── daemon.rs # Background daemon management
├── start.rs # Project bootstrap (.ai/ folder)
├── env.rs # Environment variable management
├── skills.rs # Codex skill management
├── tools.rs # AI tool management
├── agent.rs # Kode subagent invocation
├── upstream.rs # Upstream fork workflow
├── hub.rs # Hub daemon management
├── processes.rs # Process tracking and management
├── projects.rs # Project registry
├── history.rs # Task history
├── palette.rs # Fuzzy finder UI
├── notify.rs # Lin notification integration
├── commits.rs # Git commit browser
├── fixup.rs # TOML auto-fix
├── doctor.rs # System diagnostics
├── init.rs # Project scaffolding
├── discover.rs # Config discovery
├── flox.rs # Flox integration
├── task_match.rs # NL task matching via LM Studio
├── lmstudio.rs # LM Studio API client
├── log_server.rs # HTTP log server
├── log_store.rs # Log storage
├── watchers.rs # File watchers
├── running.rs # Running state tracking
├── sync.rs # Sync utilities
└── db.rs # Database utilities
flow.toml)name = "project-name"
[tasks.dev]
run = "cargo run"
description = "Run development server"
[tasks.build]
run = "cargo build --release"
[daemons.api]
run = "cargo run --bin api"
port = 8080
[host]
connection = "user@host"
domain = "example.com"
[cloudflare]
name = "worker-name"
[commit]
review_instructions = "Focus on security"
~/.config/flow/flow.toml)Global tasks and settings that apply across all projects.
Commands defined in flow.toml that can be run via f <task>. Support descriptions, dependencies, and arguments.
Long-running background processes managed by flow. Can be started, stopped, and monitored.
Integration with Claude Code and Codex. Sessions are tracked in .ai/internal/sessions/ with checkpoints for context management.
Support for:
Central daemon for managing servers and aggregating logs across projects.
git add)flow.toml (project or global).ai/ - AI configuration and data
actions/ - Fixer scriptsskills/ - Codex skillstools/ - TypeScript toolsflox/ - Flox manifestdocs/ - Auto-generated docsagents.md - Agent instructionsinternal/ - Private data (gitignored)
sessions/ - AI sessionscheckpoints/ - Checkpointsdb/ - SQLite database.claude/ - Symlinks to .ai/ (gitignored).codex/ - Symlinks to .ai/ (gitignored).flox/ - Symlinks to .ai/flox/ (gitignored)flow.toml - Project configuration~/.config/flow/flow.toml - Global config~/.config/flow/config.toml - Flow settings~/.local/share/flow/ - Data storage
history.sqlite - Task historyprojects.json - Project registryKey crates:
clap - CLI parsingtokio - Async runtimeaxum - HTTP serverratatui - TUI componentscrossterm - Terminal manipulationreqwest - HTTP clientrusqlite - SQLiteserde - Serializationtoml - Config parsing