TL;DR β€” I built an AI-powered Client Relationship Management (CRM) workflow for a small legal team, integrating Outlook, a self-hosted CRM, and LLMs to automate client opportunity tracking, task creation, and internal coordination.

The project main design principles are:

βœ… Simplicity: for adoption by non-technical users
βœ… Data ownership: self-hosted infrastructure on client premises
βœ… Vendor independence: open API stack with no SaaS lock-in

Code and documentation available:
Github β€” CRM Workflow

Context and Motivation

The legal office manages hundreds of ongoing client matters, including:

β–ͺ️ Intellectual property (IP) filings (logos, patents)
β–ͺ️ Company registrations
β–ͺ️ Tax reporting and compliance

Each request type follows a multi-step workflow, for example:

initial consultation β†’ contract sent β†’ ... β†’ invoice paid

Keeping track of all these pipelines manually created overhead and risk of human error. Commercial CRMs were too bulky, expensive, or unfit for the office’s custom legal workflows.

This solution was built to evolve step by step, from Excel to CRM to agentic CRM.

Design Philosophy

πŸ” Human-in-the-loop: AI augments but doesn’t replace staff. Humans validate and refine updates.

πŸ”§ Built for AI: From day one, the system was architected for AI integrationβ€”well-documented, API-first, and fully observable.

🧩 Hackable CRM: Lightweight, REST-based, with a clean UI and open source deployment.

Features

βœ… Already Implemented
β–ͺ️Extract client and opportunity information from incoming emails
β–ͺ️Automatically generate notes and tasks linked to each case based on internal workflow rules

πŸ”œ In Progress
β–ͺ️Summarize case files – for internal collaboration and client updates
β–ͺ️CRM AI chatbot – conversational access to CRM records (e.g. β€œWhat’s the status of Client A’s trademark?”)
β–ͺ️User Role Management – integrate MS & CRM user permissions for secure multi-user collaboration

Architecture & Stack

🧠 LLM Engine
Connects to the CRM, parses emails, makes decisions using tools like read_email(), create_task() (e.g. β€œCreate note for client X about signed contract”)

πŸ“© MS Graph API
Fetches emails, calendars, and SharePoint data

πŸ“‚ Twenty CRM API
Writes updates to CRM about clients, opportunities, and creates notes, and tasks

πŸ–₯️ Self-hosted frontend
Twenty CRM self-hosted app, a lightweight CRM frontend supporting multi-user authentication

AI CRM system architecture

Data flow

The client updates are sourced from the business email inboxes and interpretated by the LLM into actionable updates to the CRM.

AI workflow

From the agent perspective, each email triggers a new request with the following inputs and expected output / actions

Inputs
  - Outlook emails  
  - CRM records  
  - Legal process metadata  

Outputs:
  - New or updated CRM opportunities
  - Auto-generated tasks and notes
  - Audit-friendly logs of every AI action

The agent uses tools and APIs to respond to changes in email context:

  1. Parse email content
  2. Check if client exists β†’ update or create
  3. Match or create opportunity
  4. Create note or task if required

Visualizing the agent prompt as a workflow diagram

Why This Matters

A CRM designed for AI is a solid foundation for scaling legal operations.

Rather than retrofit AI into an existing system, we built an open, modular CRM from the startβ€”fully ready for future LLM integration.
The AI assistant does not replace humans, it does the repetitive work for them and enable them to focus on the key decisions.