# Comp AI CRM

Self-hosted CRM where a scheduled research agent keeps the records, tuned by four markdown skill files.

An MIT-licensed CRM whose built-in agent runs on its own schedule, reads your mail threads and signature blocks, researches contacts, and writes only strongly evidenced facts back. Three deployments (Next.js app, NestJS tRPC API, agent) share one .env; the agent's behavior lives in prompt files you can edit. There is no token-authenticated API for an outside agent yet.

Alternative to: Attio, HubSpot

- Capabilities: adaptable, operable
- Vertical: smb-ops-crm
- Shape: business-app
- Form factor: web-app
- Execution model: hybrid
- Provenance: unknown (recorded, never ranked)
- Repo: https://github.com/trycompai/crm (MIT), 9383 stars, last commit 2026-09-02
- Last activity: 2026-09-02
- Page: apps/trycompai--crm.html
- JSON: apps/trycompai--crm.json

## Use it when

- I want a CRM that fills itself in from our inboxes instead of nagging reps to log calls
- I want to change what the research agent is allowed to look at and write, without rewriting the app

## Gotchas

- No API tokens: every request needs an identity-provider session, so an outside agent has no documented way in
- Three separate deployments must agree on DATABASE_URL and BETTER_AUTH_SECRET or you get a redirect loop
- Microsoft client secrets expire (6 months default) and mail sync fails silently when they do
- Default branch is release, not main

## Editions

- Free: Free, open source
  - source: https://github.com/trycompai/crm
  - container: https://github.com/trycompai/crm/blob/release/docker-compose.yml

## Adaptable: make it yours

Effort: config-only (27 things to edit)

One .env at the repo root feeds all three processes; the README table lists which values matter. Sign-in is an allow-list (ALLOWED_SIGN_IN) plus Google or Microsoft OAuth. The agent's judgement is prose in apps/agent/agent/skills/*.md and instructions.md, versioned like code; edit those to change what counts as evidence, how identities are matched, and what a brief looks like. Optional keys open more sources.

- Env vars: DATABASE_URL, BETTER_AUTH_SECRET, ALLOWED_SIGN_IN, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, MICROSOFT_TENANT_ID, API_URL, APP_URL, AUTH_COOKIE_DOMAIN, PERPLEXITY_API_KEY, AI_GATEWAY_API_KEY, AGENT_BRIDGE_SECRET, REDIS_URL, CRON_SECRET, SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, CRM_TELEMETRY_DISABLED
- Config files: .env.example, docker-compose.yml, apps/agent/agent/schedules/dispatch.ts
- Prompt files: apps/agent/agent/instructions.md, apps/agent/agent/skills/evidence.md, apps/agent/agent/skills/identity-matching.md, apps/agent/agent/skills/data-boundaries.md, apps/agent/agent/skills/writing-a-brief.md
- Accounts you'll need: Google Cloud OAuth client or Microsoft Entra app (at least one); Perplexity (optional); Context (optional); Vercel AI Gateway (optional)

## Operable: what an agent can drive

Operability: gui. Interface: gui at https://github.com/trycompai/crm (published by the builder, local).

### Reach (partial coverage)

- Research and enrich a contact or company: not reachable. Runs on the bundled agent's schedule; no endpoint or token for an outside agent to trigger it
- Read pipeline records: not reachable. tRPC router in apps/api sits behind a Better Auth IdP session cookie; README: 'there is no way to get a session from a terminal'
- Write facts and activities to a record: not reachable. Same tRPC surface, same cookie-only auth; no API token or key flow documented
- Talk to the agent about a contact: not reachable. Agent tab in the web app, guarded by AGENT_BRIDGE_SECRET; not an external endpoint
- Sync Gmail or Microsoft mailboxes: reachable. POST /internal/sync/mailboxes guarded by the CRON_SECRET env var, documented in README Deploying; the one non-interactive endpoint
- Schedule a re-check on a person: not reachable. schedule_recheck is an internal agent tool, not exposed outside the agent
- Manage sign-in allow-list and SSO: reachable. ALLOWED_SIGN_IN env var; Settings → SSO in-app

## Code stack

- Languages: TypeScript
- Frameworks: Next.js, NestJS, nestjs-trpc, Prisma, Better Auth, eve
- Package manager: bun
- Database: PostgreSQL, Redis (optional)
- Hosting target: Vercel, Docker

## Model stack

- Providers: Vercel AI Gateway, Perplexity (optional), Context (optional)
- Models: none
- Keys you need (names only): AI_GATEWAY_API_KEY, PERPLEXITY_API_KEY, AGENT_BRIDGE_SECRET
- Prompts live in: apps/agent/agent/instructions.md, apps/agent/agent/skills/evidence.md, apps/agent/agent/skills/identity-matching.md, apps/agent/agent/skills/data-boundaries.md, apps/agent/agent/skills/writing-a-brief.md, apps/agent/agent/subagents/agent_runner/instructions.md
- Tools: read_crm_history, search_crm, identify_contact, research_person, enrich_company, record_fact, schedule_recheck, query_crm, read_crm_record, create_crm_activity, post_slack_message

## Skills

contributor: One repo tooling skill for AI UI elements used by contributors.
- Paths: .agents/skills/ai-elements/SKILL.md

## Evidence and confidence

- formFactor: README: Next.js app plus NestJS API plus agent deployment (confidence 0.95)
- executionModel: README The agent: model-driven research with a fixed dispatcher and evidence ledger; runs with no keys at all (confidence 0.9)
- operability: README (release branch): app talks to the API over tRPC; sign-in only through Google/Microsoft IdP, session cookie minted by Better Auth; no token, API key, or REST docs. Only non-interactive route is POST /internal/sync/mailboxes with CRON_SECRET. Screen control of the web app is the fallback. (confidence 0.9)
- effort: README Configuration table and .env.example; skills are markdown files in apps/agent/agent/skills (confidence 0.9)
- editions: README License: MIT; no paid edition found (confidence 0.8)
- active: GitHub pushedAt 2026-09-02
- reach:  (confidence 0.8)

## Open questions

- Is a token-authenticated API or MCP endpoint planned for outside agents?
- Which model does the agent call through AI_GATEWAY_API_KEY by default?
- Is trycrm.ai a hosted edition with pricing?

## Sources

- https://github.com/trycompai/crm (sourcing:smb-ops-crm:github)
- https://trycrm.ai (sourcing:smb-ops-crm:github)
