GEMINI.md — FIM One Instructional Context
Documents the architecture, build commands, and development conventions for an AI-powered enterprise connector hub.
What this file does
Documents the architecture, build commands, and development conventions for an AI-powered enterprise connector hub.
When to use it
- Onboarding new developers to the FIM One project
- Setting up a local development environment for the first time
- Contributing code that must follow the project's Git and i18n rules
- Reviewing the project's tech stack and tooling decisions
Assumes this stack
GEMINI.md — FIM One Instructional Context
Project Overview
FIM One is an AI-powered Connector Hub that serves as a bridge between disjointed enterprise systems (ERP, CRM, OA, Databases) through autonomous AI agents.
Core Architecture
- Backend: FastAPI (Python 3.11+) asynchronous framework.
- Agent Core: ReAct reasoning loops and dynamic DAG planning with concurrent execution.
- Provider Agnostic: Protocol-first architecture using LiteLLM to support OpenAI, Anthropic, DeepSeek, Ollama, etc.
- RAG Pipeline: LanceDB vector store with hybrid retrieval (FTS + RRF) and reranking.
- Frontend: Next.js 15+ (App Router) with shadcn/ui and Tailwind CSS 4.
- Database: Dual-track support for SQLite (development) and PostgreSQL (production) via SQLAlchemy and Alembic.
Building and Running
Prerequisites
- Python 3.11+ with
uvpackage manager. - Node.js 18+ with
pnpm. - Docker (optional, for sandboxed code execution).
Key Commands
- Full Stack:
./start.sh portal(Production) or./start.sh dev(Development with hot-reload). - Backend Only:
./start.sh apioruv run uvicorn fim_one.web:create_app --factory --host 0.0.0.0 --port 8000. - Frontend Only:
cd frontend && pnpm dev. - Database Migrations:
uv run alembic upgrade head. - Testing:
uv run pytest. - Linting/Formatting:
ruff check src/ tests/andmypy src/.
Development Conventions
Git & Workflow
- Atomic Commits: Unrelated changes must be split into separate commits.
- i18n Automation: Only edit English source files (
messages/en/*.json,README.md,docs/*.mdx). Other languages are auto-translated on commit viascripts/translate.py. - Worktrees: Agents must commit on their branch; merge via
git merge, never file copying. - Migrations: Worktree agents must NOT run
alembic upgrade head; only write migration files. Migrations are applied after merging to main.
Backend (Python)
- Async First: Use
async deffor all I/O-bound operations. - Type Safety: Mandatory type hints on all public functions.
- Migrations: All migrations must be idempotent and compatible with both SQLite and PostgreSQL (use helpers in
fim_one.migrations.helpers). - Boolean Defaults: Use
server_default=sa.text("FALSE")orsa.text("TRUE")for PG compatibility.
Frontend (Next.js)
- i18n: Never hardcode English strings; use
next-intl(useTranslations). - UI Safety: Never
rm -rf frontend/.nextwhile dev server is running. - Admin Tables: Follow the
admin-users.tsxpattern: actions in a "..." DropdownMenu, Lucide icons for all menu items, destructive actions last. - Dialogs: Use
AlertDialogsiblings for dirty state protection; avoid nativeconfirm/alert. - Styling: Prefer
focus-visible:outline-*overring-*to avoid clipping.
Project Structure
src/fim_one/
├── core/ # Agent logic (ReAct, Planner, Tools, RAG)
│ ├── agent/ # ReActAgent & Hook System
│ ├── workflow/ # DAG Engine & Node types
│ ├── model/ # LLM Providers & LiteLLM integration
│ └── tools/ # Base tools & Connector adapters
├── web/ # FastAPI App, API routes, and SSE endpoints
└── db/ # SQLAlchemy models & session management
frontend/ # Next.js Application
├── src/components/ # UI components (shadcn)
├── messages/ # i18n JSON files (en/ is source)
└── public/ # Static assets
docs/ # Documentation (Mintlify format)
tests/ # Comprehensive pytest suite
What's inside
6 sections covering overview, build commands, dev conventions, and project structure with directory tree.
Change this for your project
- Replace
fim_onewith your own package name throughout - Replace
FIM Onewith your own project name - Replace
fim-ai/fim-onewith your own repository URL
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Atomic commits with separate branches and worktrees for agents
- i18n automation via auto-translation on commit from English source files
- Dual-track database support with idempotent migrations for SQLite and PostgreSQL
Related Documents
Totem — Development Rules
Defines team-wide conventions for a pnpm monorepo: branch strategy, commit rules, tooling, and a mandatory knowledge-search workflow before coding.
MechCAD-MLLM
Proposes a MLLM + dual-decoder architecture for mechanical CAD generation, combining Drawing2CAD and CAD-GPT ideas.
Prompt Generator
Generates Stable Diffusion and Flux prompts via Qwen3-8B on Ollama, with a Gradio UI and CLI.
Agent Instructions
Defines a three-layer architecture (directive, orchestration, execution) for AI agents that self-anneal errors and update living SOPs.