Your Company Brain: Automated local knowledge extraction pipeline converting docs & threads into AI agent skills
Your Company Brain is an automated, offline-first knowledge extraction pipeline and multi-provider AI Q&A system. It connects to 38 connectors across your company's communication, engineering, HR, productivity, customer support, and analytics stack, pulls all scattered information, runs it through local or cloud LLMs, and outputs structured "Skills" — machine-readable procedure cards that AI agents can directly execute, or lets you query your company data directly in your terminal using natural-language search (ycb --ask) or via the secure local web UI (ycb ui).
Instead of manually writing instruction manuals for your AI tools or searching across 10 different dashboards, Your Company Brain generates them automatically and answers questions across any model you choose.
Want to see how Your Company Brain extracts and synthesizes knowledge before configuring your real workspace?
# Run the instant interactive demo ycb demo # Or run non-interactively ycb demo --no-interactive The demo runs completely in-memory with prepackaged sample data (Slack threads, GitHub PRs, Notion docs) from a mock company ("Acme Widgets Inc"). It bypasses authentication, creates no disk files, and requires no API keys or model downloads. It provides instant answers with exact source citations and pure in-memory BM25 retrieval.
🚀 What's New in v5.0.2 — Seamless Onboarding, Glowing Quick-Start Guidance & Unified Multi-App Sign-in:
🚀 What's New in v5.0.0 — Instant Demo Mode, Browser OAuth Sign-in & Live Credential Verification:
🚀 What's New in v4.8.0 — Top-Level ycb Namespace, Local Web UI (ycb ui) & Non-Destructive Storage Migration:
🚀 What's New in v4.7.1 — Context-Aware Batched LLM Pipeline & High-Throughput Resilience:
🚀 What's New in v4.6.0 — Task-Oriented Quick-Start Guide, First-Login Tour & Clean UI:
🚀 What's New in v4.5.0 — Fixed Google OAuth Port (eliminates redirect_uri_mismatch):
🚀 What's New in v4.4.0 — Google OAuth Reliability & Credential Validation:
🚀 What's New in v4.3.0 — Interactive Sync Default, Auto-Export & Log Routing:
🚀 What's New in v4.2.0 — Centralized Global Configuration (~/.ycb/config.json):
🚀 What's New in v4.1.0 — NVIDIA NIM Direct Provider:
🚀 What's New in v4.0.0 — Hybrid General/Company Q&A & Dynamic Context Auto-Shifting:
For technical deep-dives, here is exactly how the pipeline operates under the hood:
graph TD; A[38 Data Sources via REST/GraphQL APIs] -->|BaseConnector.ingest| B(ConnectorRegistry) B -->|RawDataItem objects| C(SQLite: raw_data_items) C -->|Sliding Window Chunker| D{Local LLM: gemma4:e4b} D -->|Single combined prompt| E(SQLite: processed_chunks) E -->|Confidence filtering + concept clustering| F[LLM Synthesizer] F -->|Pydantic Skill schema| G((skills_file.json)) 🚀 Setup Guide Prerequisites Python 3.11+ Ollama — Download from ollama.ai API keys for the connectors you want to enable (see .env.example) Option A — Install via pip (Recommended for users) # 1. Create and activate a virtual environment python -m venv venv # On Windows: .\venv\Scripts\Activate.ps1 # On macOS/Linux: source venv/bin/activate # 2. Install the package pip install ycb # 3. Pull the required AI model and start Ollama ollama pull gemma4:e4b ollama serve # Keep running in background # 4. Initialize — creates global config ~/.ycb/config.json, verifies Ollama & license key ycb # Displays the 4-line quick-start guidance box ycb init # 5. Connect your platforms # Connect any of the 38 supported platforms, or connect Google Suite in one sign-in: ycb connect google # Single sign-in connects Gmail, Google Docs, Drive, and Sheets ycb connect slack # 6. Sync your data ycb sync # Sync all connected apps (or single app: ycb sync slack) # 7. Launch the local web chat interface or query from terminal ycb ui # Opens private browser dashboard at http://127.0.0.1:8766 ycb --ask "What is our refund policy?" # Or query directly from your terminal Note: If ycb is not recognized, make sure your virtual environment is activated, reference the full path to the executable (e.g. .\venv\Scripts\ycb.exe), or ensure your Python Scripts folder is on PATH. Tip: ycb init creates your global configuration at ~/.ycb/config.json (or %USERPROFILE%\.ycb\config.json on Windows). If an existing .env is present in your current folder, ycb will automatically migrate all settings to the global config on first run without modifying your .env.
# Clone and enter the repo git clone https://github.com/AmrutiyaKirtan/Company_Brain.git cd Company_Brain # Create virtual environment python -m venv venv .\venv\Scripts\activate # Windows # source venv/bin/activate # macOS/Linux # Install in editable mode pip install -e . # Pull the required AI model ollama pull gemma4:e4b ollama serve # Initialize global configuration (and configure ycb on user PATH, then launch web chat UI) ycb init # To skip opening the browser and UI during init: ycb init --no-ui # If 'ycb' is not recognized yet in your current terminal, run: python -m ycb init PATH Setup: ycb init automatically adds the launcher directory to your user PATH (Windows User Registry or macOS/Linux shell profiles) so ycb works across all terminal windows. Use ycb path status to check configuration, ycb path remove to revert, or pass --no-path to ycb init to skip.
All credentials and selections are stored centrally in ~/.ycb/config.json and OAuth tokens in ~/.ycb/oauth_tokens.json (protected with owner-only access controls: chmod 600 / Windows icacls). You can easily connect and disconnect platforms using the CLI:
ycb connect # Browser sign-in by default (falls back to token entry) ycb connect google # One sign-in connects all Google apps (Gmail, Docs, Drive, Sheets) ycb connect --method browser # Explicitly launch browser sign-in flow ycb connect --method token # Explicitly enter personal access token / API key ycb connect --skip-verify # Connect without running live verification check ycb disconnect # Remove credentials and stored OAuth tokens ycb disconnect google # Disconnect all Google Suite apps at once Authentication Method by Service Connector Supported Mode Description Google Docs Browser sign-in Local browser OAuth (port 8765) using credentials.json Google Drive Browser sign-in Local browser OAuth (port 8765) using credentials.json Google Sheets Browser sign-in Local browser OAuth (port 8765) using credentials.json Gmail Browser sign-in Local browser OAuth (port 8765) using credentials.json Outlook / Teams Browser sign-in Microsoft Entra ID public client (PKCE) GitHub Browser sign-in GitHub Device Authorization Flow (RFC 8628) Notion Needs relay or own app OAuth 2.0 confidential client (or token fallback) Slack Needs relay or own app Slack App OAuth 2.0 (or SLACK_USER_TOKEN fallback) Salesforce Browser sign-in Salesforce Connected App (PKCE) HubSpot Needs relay or own app HubSpot App OAuth 2.0 (or Private App token fallback) Dropbox Browser sign-in Dropbox Scoped App (PKCE) Jira Needs relay or own app Atlassian 3LO OAuth 2.0 (or API token fallback) Asana Browser sign-in Asana OAuth 2.0 (PKCE) Linear Needs relay or own app Linear OAuth 2.0 (or API key fallback) GitLab Browser sign-in GitLab OAuth 2.0 (PKCE) Zoom Needs relay or own app Zoom Server-to-Server / OAuth (or JWT/token fallback) Airtable Browser sign-in Airtable OAuth 2.0 (PKCE) ClickUp Needs relay or own app ClickUp OAuth 2.0 (or API token fallback) Monday.com Needs relay or own app Monday OAuth 2.0 (or API token fallback) Basecamp Needs relay or own app Basecamp 3 OAuth 2.0 (or launchpad token fallback) BambooHR Token only API Key Deel Token only Personal Access Token Rippling Needs relay or own app Rippling Partner App OAuth 2.0 (or token fallback) Ashby Token only API Key Discord Token only Bot Token Mixpanel Token only Service Account Secret Amplitude Token only API Key & Secret Key Algolia Token only Application ID & API Key Datadog Token only API Key & Application Key Segment Token only Workspace API Token Front Token only API Key Calendly Needs relay or own app Calendly OAuth 2.0 (or Personal Access Token) Twitter / X Browser sign-in Twitter OAuth 2.0 (PKCE) Facebook Needs relay or own app Facebook Login (or User Access Token) Todoist Needs relay or own app Todoist OAuth 2.0 (or API token fallback) Web Crawler Token only No authentication required Exa Search Token only API Key Perplexity Token only API Key Run ycb status to see all active, available, and unlocked connectors for your tier.
All four Google connectors (google_docs, gmail, google_drive, google_sheets) use a fixed OAuth callback port 8765. The redirect URI sent to Google on every run is always:
Why this step? Google Cloud Console only allows OAuth callbacks to URIs that are explicitly pre-registered. ycb previously used a random port on every run (port=0), which made it impossible to pre-register. As of v4.5.0, the port is fixed at 8765 so this one-time setup is all that's needed.
Port already in use? If something is running on port 8765, ycb connect will print:
[Google OAuth] Port 8765 is already in use on this machine. Find what's using it: Windows: netstat -ano | findstr :8765 macOS/Linux: lsof -i :8765 Close that process and re-run.
If installed via pip, use the ycb command from anywhere (or python main.py in developer mode):
# Initialize workspace — configures database, Ollama runtime, and prompts for license ycb init # Sign in with an existing license key and registered email ycb login ycb login --license-key CB-XXXX-XXXX-XXXX --email you@company.com # Sign out and clear local session state and cached credentials ycb logout 🎟️ Plan Tiers & Access Tier Connectors Unlocked Description Solo google_docs, slack (2) Free tier for individual exploration and core communication knowledge. Max All 38 Connectors Monthly subscription unlocking your entire SaaS & engineering stack with automated renewal checks and background self-healing. Enterprise All 38 Connectors Organization-wide multi-seat licensing with priority support. Connect a Data Source Interactively prompt for and configure credentials for a single connector on demand.
ycb connect slack Disconnect a Data Source Remove stored credentials for a specific connector.
ycb disconnect slack Run an Interactive Sync (Default) Processes sources in small batches with real-time progress and pauses after each batch for review. Newly generated skills are automatically exported to output/skills_file.json.
# Interactive mode is now the default! ycb sync # The explicit flag is also supported for backward compatibility: ycb sync --interactive Run a Full Continuous Sync Processes all enabled connectors in one continuous pass without stopping or prompting.
ycb sync --full # (Legacy alias --once is also supported) ycb sync --once Run a Single-Connector Sync Sync only a specific configured connector.
# Interactive batch mode for a single connector (positional shorthand or --connector flag): ycb sync slack ycb sync --connector slack # Continuous full mode for a single connector: ycb sync slack --full ycb sync --connector slack --full Stream Verbose Debug Logs By default, console logs stay clean while detailed execution logs are written to %USERPROFILE%\.ycb\logs\ycb.log (Windows) or ~/.ycb/logs/ycb.log (macOS/Linux). Pass --verbose to view full debug logs in your terminal.
ycb sync --verbose Check Current Status View license tier, active connectors, tier-locked connectors, and skills stats. Re-test all connected credentials with --check.
ycb status # Display summary overview ycb status --check # Live re-test all connected services and print verification table Export Your Skills Export structured data for use by AI agents.
# Export as JSON (Best for AI Agents) ycb export --output output/skills.json # Export as Markdown (Best for Humans) ycb export --output output/skills.md --format markdown Ask Questions About Your Company Knowledge & Beyond (--ask) Run natural-language Q&A directly in your terminal. The Q&A engine operates as a hybrid assistant: it uses company knowledge when relevant (clearly citing it), and seamlessly draws on general AI knowledge for questions outside or partially outside your synced data:
# Ask a company-data question (cites company data when found) ycb --ask "how do we handle customer refund requests" # Ask a general knowledge question (answers normally using LLM intelligence) ycb --ask "what is machine learning and how does gradient descent work" # Scope question to a specific connector ycb --ask "what PRs were merged this week" --connector github # Run with verbose retrieval debugging audit and model attribution ycb --ask "tell me about our onboarding workflow" --verbose ⚡ Dynamic Context Auto-Shifting When a broad question retrieves a large volume of company data (>90k characters), ycb automatically shifts that single query to a high-capacity model (e.g. nvidia/nemotron-3-ultra-550b-a55b:free with a 1,000,000-token / 3.15M-character context window) so no information is lost:
Model: nvidia/nemotron-3-ultra-550b-a55b:free (auto-shifted from 'openrouter/free') Switch AI Models & Providers (switch model) Select which model answers your questions and synthesizes skills:
# Open the interactive categorized model selection menu ycb switch model # List all supported categorized models without prompting ycb switch model --list # Switch directly by model name or slug ycb switch model gemma4:e4b # Local (Ollama) ycb switch model gpt-5.6-terra # OpenAI ycb switch model claude-sonnet-5 # Claude ycb switch model nvidia/nemotron-3-ultra-550b-a55b # NVIDIA NIM Direct (your quota) ycb switch model openrouter/free # OpenRouter Auto-Router ycb switch model nvidia/nemotron-3-ultra-550b-a55b:free # OpenRouter 1M-token free model ycb switch model mistralai/mistral-large-2407 # Custom OpenRouter slug NVIDIA NIM Direct vs OpenRouter free: Both use the same Nemotron 3 Ultra 550B model, but nvidia_nim hits NVIDIA's inference endpoint with your personal NVIDIA_NIM_API_KEY (no shared quota), while the OpenRouter :free variant shares a free-tier pool with all OpenRouter users.
Launch the secure, offline-first web chat interface in your browser:
# Launch on default port (8766) and automatically open your browser ycb ui # Run in mock mode for instant UI testing without GPU or LLM models ycb ui --mock # Specify a custom port or disable auto-opening the browser ycb ui --port 9000 --no-browser Local & Private: Bound strictly to 127.0.0.1. Security Hardening: One-time launch token exchange, HttpOnly Strict session cookies, per-session CSRF validation, strict Content Security Policy. Interactive Multi-Source Chat: Natural language Q&A with real-time Server-Sent Events (SSE) streaming answers and source citations. Document Ingestion: Upload documents (PDF, TXT, MD, DOCX, CSV, JSON, PNG, JPG) directly into your company brain knowledge base via drag-and-drop or file picker. Connector Filtering: Filter retrieval to specific sources (e.g. GitHub, Slack, local uploads, or All). Company Brain — Complete Technical Reference This document covers every aspect of the Company Brain project: what it does, how it works under the hood, every API used, every technology used, the full data pipeline, CLI commands, and the engineering decisions made. Written for YC interviews and technical deep-dives.
Company Brain is an offline-first knowledge extraction pipeline. It connects to 38 of your company's existing communication, engineering, HR, customer support, and analytics tools, pulls all the scattered information, runs it through a local AI model, and outputs structured "Skills" — machine-readable procedure cards that AI agents can directly execute.
In plain English: Your team's knowledge lives in thousands of Slack messages, GitHub issues, Notion pages, and Jira tickets. Right now, no AI agent can act on that knowledge because it's buried in unstructured text across 38 different platforms. Company Brain reads all of it and converts it into clean, structured instructions.
┌───────────────────────────────────────────────────────────────────────────┐ │ Data Sources (38) │ │ Slack GitHub Notion Discord Linear Google Docs Google Sheets │ │ Outlook/Teams GitLab Dropbox Mixpanel Amplitude Algolia Exa │ │ Perplexity Facebook Todoist Web Crawler Jira Asana Calendly │ │ ClickUp Airtable Datadog Segment Front Zoom Twitter HubSpot │ │ Salesforce Monday Basecamp Ashby BambooHR Deel Rippling Gmail │ │ Google Drive │ └────────────────────────────────┬──────────────────────────────────────────┘ │ REST / GraphQL APIs ▼ ┌───────────────────────────────────────────────────────────────────────────┐ │ Connector Layer (BaseConnector) │ │ │ │ • Every connector inherits BaseConnector (get_source_name, ingest) │ │ • registry.py: get_enabled_connectors() loops all 38, skips unconfigured │ │ • retry_with_backoff() handles 429/5xx with exponential backoff │ │ • Error isolation: one failing connector never blocks the others │ │ • CONNECTORS_ENABLED env var toggles connectors without code changes │ └────────────────────────────────┬──────────────────────────────────────────┘ │ │ • Every connector inherits BaseConnector (get_source_name, ingest) │ │ • registry.py: get_enabled_connectors() loops all 16, skips unconfigured │ │ • retry_with_backoff() handles 429/5xx with exponential backoff │ │ • Error isolation: one failing connector never blocks the others │ │ • CONNECTORS_ENABLED env var toggles connectors without code changes │ └────────────────────────────────┬──────────────────────────────────────────┘ │ List[RawDataItem] (Pydantic model) ▼ ┌───────────────────────────────────────────────────────────────────────────┐ │ SQLite Database │ │ (via SQLAlchemy ORM) │ │ Table: raw_data_items Table: processed_chunks Table: skills │ └────────────────────────────────┬──────────────────────────────────────────┘ │ ▼ ┌───────────────────────────────────────────────────────────────────────────┐ │ Processing Pipeline │ │ │ │ 1. DocumentChunker → sentence-based sliding window (5 sentences, │ │ 2-sentence overlap), URL/email masking, noise filtering │ │ │ │ 2. KnowledgeExtractor → single optimised prompt to gemma4:e4b via Ollama │ │ - Classifies chunk type (procedure/policy/decision/incident/general) │ │ - Extracts key concepts as JSON array │ │ - Computes heuristic confidence score (0.0 – 1.0) │ │ │ │ 3. SkillsSynthesizer → filters high-confidence chunks, clusters by │ │ primary concept, asks Gemma to write a complete Skill card │ │ (steps, decisions, prerequisites, edge cases) │ └────────────────────────────────┬──────────────────────────────────────────┘ │ ▼ ┌───────────────────────────────────────────────────────────────────────────┐ │ Export Layer │ │ skills_file.json / skills_file.md │ │ (ready to plug into LangChain, AutoGen, or custom bots) │ └───────────────────────────────────────────────────────────────────────────┘ 4. Technology Stack Category Library / Tool Why We Used It Language Python 3.11 Mature ecosystem for AI/NLP pipelines Data Validation pydantic v2 Enforces strict schema for every data model Database ORM sqlalchemy v2 Maps Python classes to SQLite tables cleanly Database SQLite Zero-config local persistence, no server needed HTTP Client requests Used by all new connectors for REST/GraphQL API calls Slack Integration slack-sdk v3 Official Slack client; handles pagination & auth Google Integration google-api-python-client, google-auth-oauthlib Shared OAuth 2.0 flow for both Google Docs and Google Sheets Local AI ollama (Python client) Runs Gemma 4 locally; zero data sent externally CLI Framework click Clean, composable command-line interface Terminal UI rich Beautiful dashboard with live animations, progress bars Background Scheduler apscheduler Runs sync jobs on a 30-minute interval Env Management python-dotenv Loads .env credentials without hardcoding secrets 5. Connectors — All 38 Data Sources Company Brain uses a pluggable connector architecture. All 38 connectors inherit from BaseConnector and are registered in registry.py. The sync loop dynamically loads only the ones with valid credentials configured in .env.
Edit the CONNECTORS_ENABLED variable in your .env:
# Enable only what you use — unconfigured connectors are silently skipped CONNECTORS_ENABLED=slack,google_docs,github,notion,linear,jira,hubspot Leave it empty to attempt all 38 connectors (only those with valid credentials will run).
The SyncScheduler calls get_enabled_connectors() from registry.py. This returns a list of instantiated connectors whose credentials are present. For each connector, ingest(days_back=30) is called and the returned RawDataItem objects are collected.
# Every piece of data becomes this shape regardless of source class RawDataItem(BaseModel): id: str # e.g., "github:owner/repo:42" or "notion:abc123" source: DataSourceType # enum: "slack", "github", "notion", etc. source_id: str # platform-native ID (channel ID, doc ID, issue ID) title: str # human-readable display name content: str # full normalized text author: str # username or display name created_at: datetime updated_at: datetime raw_metadata: dict # source-specific extras (labels, state, channel, etc.) Idempotency check: Before processing, the system calls get_processed_source_item_ids() on the database. This returns the set of all item IDs already processed into chunks. The pipeline filters out any item whose ID is already in this set. This means:
Long documents are split into smaller, manageable pieces before being sent to the LLM.
- Collapses multiple whitespace characters into single spaces - Strips control characters (ASCII 0-31, 127-159) - Replaces URLs with the token [URL] - Replaces email addresses with the token [EMAIL] Sliding-Window Sentence Chunking:
Why overlap? Without overlap, if a procedure starts at the end of one chunk and continues at the start of the next, the LLM would only see half the context. The overlap ensures key context is preserved across boundaries.
For every chunk, the extractor makes a single combined LLM call (optimised from two separate calls):
Prompt: "Classify this text as ONE of: procedure, decision, incident, policy, or general. Then extract 3-5 key concepts. Return as JSON: { type: ..., concepts: [...] }" Output: { "type": "procedure", "concepts": ["Handle Refunds", "Verify order status", "Payment processor"] } Confidence Scoring (no LLM call, pure heuristic):
+0.3 if chunk is longer than 100 words +0.2 if chunk is 50–100 words +0.3 if classified as "procedure", "policy", or "decision" +0.2 if 4+ key concepts were extracted +0.1 if 2–3 key concepts were extracted Max score: 1.0 Every processed chunk becomes a ProcessedChunk object and is saved to the database.
Phase A — Filtering: Only chunks with confidence_score >= 0.2 move forward.
Phase B — Clustering: Chunks are grouped by their first (primary) key concept. For example, all chunks where the first concept is "Handle Refunds" end up in the same cluster. Clusters with fewer than 2 chunks get merged into a miscellaneous cluster.
Phase C — Skill Generation: For each cluster, the LLM is given all the chunk texts combined and asked to synthesize a complete Skill card:
{ "name": "clear skill name", "description": "what this skill does", "category": "refunds / pricing / incidents / ...", "procedure_steps": ["Step 1", "Step 2", "..."], "decision_points": {"if customer > 30 days": "deny refund"}, "prerequisites": ["who can perform this", "required access"], "success_criteria": ["how to verify completion"], "exceptions": ["edge cases to watch for"] } The final Skill object is upserted (insert or update) into the SQLite skills table.
Running python main.py export serializes all skills from the database into a single SkillsFile object and writes it to disk.
{ "version": "1.0.0", "generated_at": "2026-07-25T00:00:00", "company_name": "Your Company", "skills": [ { "id": "skill-uuid-...", "name": "Handle Customer Refunds", "description": "...", "category": "refunds", "procedure_steps": ["Check eligibility", "Verify order", "Issue refund"], "decision_points": {"if_disputed": "escalate to manager"}, "examples": [], "prerequisites": ["Customer support access"], "success_criteria": ["Refund confirmation sent"], "exceptions_and_edge_cases": ["Active subscriptions need billing cancel"], "source_items": ["github:myorg/repo:42", "slack-C01-123...", "notion:abc123"], "confidence_score": 0.75 } ], "metadata": { "total_skills": 1, "by_category": {"refunds": 1} } } 7. Database Design The system uses SQLite with SQLAlchemy ORM. The database lives at data/company_brain.db (path configurable via DATABASE_URL in .env).
raw_data_items ├── id (PK) — unique ID e.g. "github:myorg/repo:42", "notion:abc123" ├── source — enum: "slack", "github", "notion", "linear", etc. ├── source_id — platform-native ID (channel ID, doc ID, issue ID) ├── title — display name ├── content — full raw text ├── author — username or display name ├── created_at ├── updated_at └── raw_metadata — JSON blob with source-specific fields (labels, state, etc.) processed_chunks ├── id (PK) — "chunk-{uuid}" ├── source_item_id — FK to raw_data_items.id ├── chunk_text — the actual text block ├── chunk_index — position within source document ├── key_concepts — JSON list e.g. ["Refunds", "Policy"] ├── chunk_type — "procedure", "policy", "decision", "incident", "general" ├── confidence_score — float 0.0 to 1.0 └── created_at skills ├── id (PK) — "skill-{uuid}" ├── name — e.g. "Handle Customer Refunds" ├── description ├── category — e.g. "refunds" ├── procedure_steps — JSON list ├── decision_points — JSON dict ├── examples — JSON list ├── prerequisites — JSON list ├── success_criteria — JSON list ├── exceptions_and_edge_cases — JSON list ├── source_items — JSON list of contributing raw_data_items IDs ├── last_updated └── confidence_score 8. The LLM Integration (Multi-Provider Engine) Your Company Brain features a pluggable, multi-provider LLM abstraction layer (ycb/qa/providers/) that decouples knowledge extraction, skill synthesis, and Q&A retrieval from any single model back-end.
All providers implement the LLMProvider abstract base class (ycb/qa/providers/base.py):
class LLMProvider(ABC): display_name: str max_context_chars: int @abstractmethod def check_available(self) -> bool: """Health check and API authentication verification.""" ... @abstractmethod def generate(self, question: str, context: str, history: List[Dict[str, str]]) -> str: """Multi-turn Q&A answer generation.""" ... @abstractmethod def generate_text(self, prompt: str, max_tokens: int = 512, temperature: float = 0.0) -> str: """Raw prompt completion for concept extraction and skill synthesis.""" ... JSON Parsing Robustness Because LLMs sometimes wrap structured JSON in markdown code fences, we extract payloads with regex fallbacks:
json_match = re.search(r'\[.*?\]', result_text, re.DOTALL) # for arrays json_match = re.search(r'\{.*\}', result_text, re.DOTALL) # for objects if json_match: data = json.loads(json_match.group()) 9. CLI Commands Reference All commands are run from inside the project root directory using the venv Python interpreter.
# Workspace setup & authentication ycb init ycb login --license-key CB-XXXX-XXXX-XXXX --email you@company.com ycb logout # Model and provider switching ycb switch model # Interactive categorized menu ycb switch model --list # Print all models ycb switch model gemma4:e4b # Switch to local Ollama ycb switch model gpt-5.6-terra # Switch to OpenAI ycb switch model claude-sonnet-5 # Switch to Anthropic ycb switch model openrouter/free # Switch to OpenRouter # Connector credential configuration ycb connect slack ycb disconnect slack # Start interactive batch sync (DEFAULT) # Processes 2 items at a time, shows checkpoints, and auto-exports to output/skills_file.json ycb sync # Run continuous full sync (processes everything without pausing) ycb sync --full # Stream full debug logs to console (logs are always stored in ~/.ycb/logs/ycb.log) ycb sync --verbose # Sync a single connector only ycb sync --connector slack # Check current license tier, unlocked connectors, and extracted skills stats ycb status # Ask natural-language questions about your company data ycb --ask "what processes or procedures does our company have documented" # Scope question to a specific connector only ycb --ask "what updates or commits were made recently" --connector github # Export skills as JSON (for AI agents) ycb export --output output/skills.json # Export skills as readable Markdown (for humans) ycb export --output output/skills.md --format markdown # Launch local web chat interface ycb ui # Starts local web server on port 8766 ycb ui --mock # Offline mock mode for rapid UI testing # Disable the Rich dashboard UI (useful for piping output to logs) ycb sync --full --plain Interactive Batch Menu (appears after each batch of 2 documents):
[Batch 1 complete. 5 total chunks processed so far.] Do you want to: (1) Process next batch (2) Synthesize skills now and STOP (3) Quit immediately? 1 → Continue to next 2 items 2 → Stop ingesting new data, run synthesis on what you have right now, and export 3 → Exit immediately without synthesizing 10. Terminal Dashboard (UI) The terminal UI is built with the rich library and runs inside a rich.live.Live context. This means the dashboard panel stays fixed at the top of the terminal while log messages scroll underneath it.
With 16 connectors, hardcoding each one into SyncScheduler would create a monolithic, hard-to-maintain sync loop. Instead, BaseConnector enforces a uniform ingest() interface, and registry.py acts as a plugin system. Adding a new connector is three steps: write the class, register it in registry.py, add credentials to .env.example. The scheduler code never changes.
Privacy-first design. Company data stays on-premise. SQLite also requires zero configuration, which makes setup trivial. The path is configurable via DATABASE_URL if you want to swap in PostgreSQL for production.
Companies have confidential Slack data, GitHub issues, emails. Sending it to a third-party API is a major legal and trust risk. Ollama + Gemma 4 gives equivalent results while keeping everything local. This is a core value proposition: "your data, your machine, your AI."
The original design made two LLM calls per chunk: one for classification, one for concept extraction. This was optimised to a single JSON-returning prompt that does both simultaneously, cutting per-chunk latency roughly in half without sacrificing output quality.
We also implemented chunk_by_structure() (splits by # headers). But most Slack messages and informal docs don't have formal headers. The sentence-based sliding window handles messy, unstructured text far better across all 16 source types.
For an MVP, cosine similarity over embeddings requires storing large float arrays and running nearest-neighbor search. Instead, we cluster purely by the primary concept extracted by the LLM. It's O(N) instead of O(N²) and produces very interpretable clusters. Embedding-based clustering is a listed future improvement (embedding field already exists on ProcessedChunk, it's just null for now).
Running a full sync across 16 connectors through a local 4B model can take a long time. Users need to be able to stop, inspect partial results, and decide whether to continue. The batch system also lets users validate quality early without committing to the full pipeline run.
Every raw item has a globally unique ID (e.g., github:myorg/repo:42, notion:abc123, slack-C05-1234). Before any processing, we query processed IDs from the DB and filter them out. Running sync 10 times on the same data produces the same result as running it once.
company_brain_mvp/ │ ├── main.py ← CLI entry point (self-relative sys.path setup) ├── requirements.txt ← All Python dependencies ├── .env ← Your API keys (gitignored) ├── .env.example ← Template for .env with all 38 connectors ├── credentials.json ← Google OAuth credentials (gitignored) ├── token.pickle ← Saved Google OAuth token (gitignored) │ ├── ycb/ │ ├── connectors/ │ │ ├── base_connector.py ← Abstract BaseConnector: ingest(), retry_with_backoff() │ │ ├── registry.py ← Central connector registry: get_enabled_connectors() │ │ │ │ │ │ ── Tier 1 Connectors ── │ │ ├── slack_connector.py ← Slack: messages, thread replies │ │ ├── google_docs_connector.py ← Google Docs: paragraph text, tables │ │ ├── google_sheets_connector.py ← Google Sheets: tabs as key-value row text │ │ ├── google_drive_connector.py ← Google Drive: file metadata & content text │ │ ├── gmail_connector.py ← Gmail: emails, threads, message text │ │ ├── github_connector.py ← GitHub: issues, PRs, comments (REST API v3) │ │ ├── notion_connector.py ← Notion: page blocks, recursive children │ │ ├── discord_connector.py ← Discord: server channels, messages │ │ ├── linear_connector.py ← Linear: issues, comments (GraphQL API) │ │ ├── outlook_teams_connector.py ← Outlook emails + Teams messages (MS Graph) │ │ │ │ │ │ ── Tier 2 Connectors ── │ │ ├── gitlab_connector.py ← GitLab: issues, merge requests, notes │ │ ├── dropbox_connector.py ← Dropbox: text file downloads │ │ ├── analytics_connector.py ← Mixpanel + Amplitude: event schemas │ │ ├── search_connector.py ← Algolia + Exa + Perplexity: search results │ │ ├── facebook_connector.py ← Facebook: page posts, comments │ │ ├── todoist_connector.py ← Todoist: tasks, project details, comments │ │ ├── web_crawler_connector.py ← Web Crawler: scraped web page text │ │ │ │ │ │ ── Tier 3 Connectors ── │ │ ├── jira_connector.py ← Jira: issues, comments, work logs │ │ ├── asana_connector.py ← Asana: tasks, projects, subtasks │ │ ├── clickup_connector.py ← ClickUp: tasks, docs, custom fields │ │ ├── airtable_connector.py ← Airtable: base records & fields │ │ ├── monday_connector.py ← Monday.com: boards, updates, items │ │ ├── basecamp_connector.py ← Basecamp: message boards, to-dos │ │ ├── datadog_connector.py ← Datadog: monitors, alert logs │ │ ├── segment_connector.py ← Segment: tracking plans & event schema │ │ │ │ │ │ ── Tier 4 Connectors ── │ │ ├── front_connector.py ← Front: shared inbox conversations │ │ ├── zoom_connector.py ← Zoom: meeting transcripts & logs │ │ ├── twitter_connector.py ← Twitter / X: tweets, replies, threads │ │ ├── hubspot_connector.py ← HubSpot: contacts, deals, ticket notes │ │ ├── salesforce_connector.py ← Salesforce: objects, opportunities, cases │ │ ├── calendly_connector.py ← Calendly: scheduled events & notes │ │ ├── ashby_connector.py ← Ashby: candidate notes, jobs │ │ ├── bamboohr_connector.py ← BambooHR: HR policies & announcements │ │ ├── deel_connector.py ← Deel: contracts & compliance docs │ │ └── rippling_connector.py ← Rippling: policy handbooks & HR docs │ │ │ ├── processors/ │ │ ├── chunker.py ← Sentence-based sliding window chunker │ │ ├── knowledge_extractor.py ← gemma4:e4b: single combined classify+extract call │ │ └── skills_synthesizer.py ← Cluster chunks → generate Skill cards │ │ │ ├── models/ │ │ └── domain.py ← Pydantic models: RawDataItem, ProcessedChunk, Skill │ │ │ ├── storage/ │ │ ├── database.py ← SQLite table definitions & non-destructive migration │ │ └── storage_manager.py ← CRUD: save_raw_items, save_chunks, get_processed_ids │ │ │ ├── licensing/ │ │ ├── validator.py ← Online REST verification, machine ID binding & offline grace checks │ │ └── tier_mapping.py ← Plan tiers (solo, max, enterprise), self-healing cache & connector gating │ │ │ ├── qa/ │ │ ├── ask_engine.py ← Multi-turn Q&A retrieval, history management │ │ └── providers/ ← Pluggable LLM engines │ │ ├── base.py ← LLMProvider ABC + ProviderError + create_openai_client │ │ ├── ollama_provider.py ← Local Ollama (gemma4:e4b, fully offline) │ │ ├── openai_provider.py ← OpenAI GPT models │ │ ├── anthropic_provider.py ← Anthropic Claude models │ │ ├── openrouter_provider.py ← OpenRouter: free fallback chain + auto-shifting │ │ ├── nvidia_nim_provider.py ← NVIDIA NIM Direct: integrate.api.nvidia.com (personal quota) │ │ └── __init__.py ← Provider registry, MODEL_CONTEXT_CHARS, load_active_provider │ │ │ ├── ui/ │ │ ├── server.py ← Secure local Flask web server (127.0.0.1) & SSE API │ │ └── file_parser.py ← Subprocess file parser (PDF/DOCX/TXT/CSV/JSON/images) │ │ │ ├── sync/ │ │ └── sync_scheduler.py ← Orchestrates full & interactive sync via registry │ │ │ └── cli/ │ ├── main.py ← Click commands: init, login, logout, sync, status, export, switch, connect, disconnect, ui │ └── ui/ │ ├── animation.py ← ASCII procedural neural network animation │ ├── branding.py ← Solid filled-block ASCII branding & first-login overview │ ├── dashboard.py ← Rich Live ASCII dashboard (SyncDashboard, SyncState) │ ├── help_guide.py ← Task-oriented step-by-step help guide & command reference │ ├── logger.py ← Custom logging.Handler → UI state bridge │ └── components.py ← Rich tables/panels for status & export │ ├── tests/ ← Unit test suite for all 38 connectors, UI server, and migration │ ├── ~/.ycb/ ← Global user directory (persisted across sessions) │ ├── config.json ← Centralized global configuration │ ├── company_brain.db ← Local SQLite knowledge database (auto-migrated) │ └── logs/ycb.log ← Detailed system & sync logs │ └── output/ ├── skills_file.json ← Final structured output for AI agents └── skills_file.md ← Human-readable version 🔒 Privacy, Security & Data Sovereignty Your Company Brain is engineered from the ground up for complete data privacy:
Distributed under the Apache-2.0 License. See LICENSE for more information.
ai-agents automation knowledge-base llm rag skills
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




