AI News HubLIVE
In-site rewrite5 min read

An AI Chief of Staff

AICoS is an open-source AI operating system for CEOs that transforms department data into board-ready decisions. It integrates CSV uploads, Slack, HubSpot, Linear, Notion, and more via Supabase and OpenAI to generate executive dashboards, recommendations, and PDF reports with enterprise-grade guardrails.

SourceHacker News AIAuthor: bsuhas

Notifications You must be signed in to change notification settings

Fork 0

Star 1

BranchesTags

Open more actions menu

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

18 Commits

18 Commits

backend

backend

frontend

frontend

slack

slack

supabase

supabase

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

screenshot.png

screenshot.png

Repository files navigation

The open-source AI operating system for CEOs

Turn every department's metrics into board-ready decisions, Slack-aware action tracking, executive scorecards, Supabase vector memory, CEO chat, PDF reports, board memos, and guarded AI recommendations.

Created by Suhas Bhairav

Independent personal project. Completely open source under the MIT License.

Why This Exists

AICoS - AI Chief of Staff is an operating intelligence workspace for CEOs, founders, operators, and functional leaders. It turns department-level CSV uploads into live dashboards, current Supabase JSONB snapshots, Slack-derived action items, historical trend imports, board memos, and OpenAI-generated recommendations.

The product is designed around a simple idea: every important department should report the metrics a serious CEO would actually inspect, and the Executive dashboard should synthesize those signals into company-level operating judgment.

Product Cards

Executive Command Center

CEO-level rollups across value creation, cash, GTM efficiency, customer/product health, risk, and execution posture.

Output: board-ready operating insight.

Department Dashboards

Finance, Sales, Marketing, Product, HR, Legal, IT, Operations, Support, Risk, Strategy, R&D, and Executive views.

Output: KPI cards and 3-5 charts per function.

AI Suggestions On Demand

OpenAI calls happen only when a user clicks Fetch Suggestions or Fetch Org Suggestions.

Output: concise action recommendations.

Supabase JSONB Store

Flexible department snapshots are stored as JSONB, so changing columns does not require schema churn.

Output: scalable operating data.

Live Slack Workspace

Real Slack OAuth, Web API, Events API, signed request verification, task harvesting, and message snapshots.

Output: Robust company action tracking.

Enterprise Guardrails

All OpenAI calls are protected against prompt injection, jailbreaks, secret leakage, and unsafe task mutations.

Output: safer AI operations.

HubSpot Deal Pipeline

Sync the full CRM deal pipeline for open pipeline, weighted forecast, stage mix, stale deals, top opportunities, and owner accountability.

Output: CEO revenue pipeline command center.

CEO Chat Assistant

Chat about any department, retrieve Supabase vector evidence, and escalate to guarded OpenAI synthesis only when the CEO asks.

Output: grounded operating answers.

Linear Ticket Overview

Sync Linear issues for open load, urgent work, overdue tickets, stale execution, team pressure, project risk, and completion throughput.

Output: engineering execution command center.

Notion Product OKRs

Sync a real Notion OKR database into Product to track objectives, key results, owners, progress, status, risk, and due dates.

Output: live product execution scorecard.

Historical Trend Imports

Every CSV upload is appended to an immutable Supabase import ledger for multi-period analysis.

Output: historical data trail.

PDF Reports

Beautiful reports include cover pages, AI synthesis, KPI snapshots, chart tables, department tables, and methodology.

Output: polished management reports.

Board Memo Export

Generates board-facing PDFs and stores memo metadata/content in Supabase.

Output: investor-ready narrative.

Core Capabilities

Area What It Does Storage / Engine

Executive dashboard Summarizes all departments into CEO scorecards Supabase JSONB

Department dashboards Calculates KPI cards and charts from uploaded CSVs Browser CSV parser + Supabase

AI synthesis Generates CEO and department recommendations OpenAI Responses API

CEO Chat Retrieves department evidence and answers CEO questions Supabase pgvector + OpenAI

Product OKRs Syncs live Notion OKRs into the Product dashboard Notion API + Supabase

Deal Pipeline Tracks HubSpot pipeline health for the CEO HubSpot CRM API + Supabase

Ticket Overview Tracks Linear execution health for the CEO Linear npm SDK + Supabase

Slack integration Reads channels/DMs, replies, harvests commitments Slack OAuth + Events API

Master To-Do Tracks tasks, waiting-on items, delegated work Supabase summary JSON

Historical imports Preserves every upload for trend analysis department_snapshot_history

PDF reports Exports dashboard state and OpenAI explanation jspdf + jspdf-autotable

Board memos Saves and exports board-facing memo narratives board_memos

Guardrails Blocks jailbreaks and wraps untrusted data Shared OpenAI guardrail layer

CEO Metrics Philosophy

This is not a generic BI dashboard. It focuses on the metrics CEOs, CFOs, operators, and investors actually care about:

Growth Quality ARR, revenue growth, NRR, Rule of 40 Cash Discipline burn multiple, runway, FCF margin, operating expenses

GTM Efficiency pipeline, bookings, CAC, LTV:CAC, CAC payback, win rate Product Health activation, retention, adoption, NPS, P1 bugs, velocity

Customer Health CSAT, NPS, backlog, escalation rate, response/resolution time Operational Execution throughput, yield, defect rate, on-time delivery, inventory turns

Risk Posture enterprise risk, audit score, control coverage, unmitigated risks Strategic Leverage TAM coverage, market share, partnerships, M&A pipeline

The Executive dashboard intentionally avoids naive technical metrics like row count or column count as core charts. Those are relegated to the data-store table. Executive charts focus on operating outcomes.

Architecture

ai-chief-of-staff/ frontend/ app/ page.js # Home command center departments/[slug]/page.js # Department + executive dashboards slack/page.js # Live Slack workspace UI todo/page.js # Master To-Do command center integrations/page.js # Slack integration hub assistant/page.js # CEO chat over Supabase vector memory pipeline/page.js # HubSpot CEO deal pipeline tickets/page.js # Linear CEO ticket overview api/ analytics/[department]/route.js # Guarded OpenAI recommendations ceo-chat/route.js # Retrieval planner + CEO answer agent embeddings/rebuild/route.js # Backfill vector memory notion/okrs/route.js # Notion OKR sync and store hubspot/deals/route.js # HubSpot deal pipeline sync and store linear/tickets/route.js # Linear ticket sync and store current-data/route.js # Supabase JSONB current store historical-data/route.js # Historical trend import ledger board-memos/route.js # Board memo persistence slack/... # Slack OAuth, events, channels todo/route.js # Master To-Do sync and mutation lib/ current-data-store.js # Supabase read/write + org rollup openai/department-embeddings.js # OpenAI embeddings + pgvector retrieval openai/guardrails.js # Enterprise AI guardrails slack/server.js # Slack OAuth/API helpers supabase/server.js # Server-side Supabase client

supabase/ schema.sql # Table creation SQL README.md # Supabase setup notes

slack/ slack-app-manifest.example.json # Slack app manifest template

backend/ main.py # FastAPI CSV parsing scaffold

Data Flow

flowchart LR A[Department CSV Upload] --> B[Next.js API] B --> C[Supabase department_snapshots] B --> D[Supabase department_snapshot_history] B --> M[Supabase department_embeddings] C --> E[Executive Rollup] D --> F[Historical Trend Ledger] M --> N[CEO Chat Retrieval] E --> G[CEO Dashboard] G --> H[Guarded OpenAI Synthesis] N --> H H --> I[PDF Report / Board Memo] J[Slack Events API] --> K[Task Harvester] K --> L[Master To-Do]

Loading

A department user downloads a CSV template.

The user uploads operating data in that department dashboard.

The frontend parses the CSV into records.

/api/current-data upserts the current department snapshot.

The same upload is appended to the historical import ledger.

Executive rollups calculate org-level scorecards.

Uploads refresh Supabase vector embeddings for CEO chat retrieval.

OpenAI recommendations are generated only on explicit button clicks or chat sends.

PDF reports and board memos export from the live dashboard state.

Slack events and channel sync harvest commitments into the Master To-Do.

Supabase Data Model

Primary tables:

Table Purpose

department_snapshots One current JSONB snapshot per department

organization_summaries Latest executive rollup and summary content

department_snapshot_history Immutable historical import ledger

board_memos Saved board memo metadata and JSON content

department_embeddings pgvector chunks for CEO chat and department retrieval

notion_okr_snapshots Synced Notion Product OKR snapshots

hubspot_deal_snapshots Synced HubSpot deal pipeline snapshots

linear_ticket_snapshots Synced Linear issue snapshots

slack_installations Active Slack workspace installs and bot tokens

slack_events Signed Slack Events API webhook ledger

slack_message_snapshots Slack channel/DM message snapshots

Run supabase/schema.sql in the Supabase SQL Editor before starting the app. The schema enables pgvector and exposes match_department_embeddings for cosine-similarity search.

Enterprise AI Guardrails

All OpenAI API calls use frontend/lib/openai/guardrails.js.

Prompt Injection Defense Blocks direct jailbreak and secret-exfiltration prompts before model calls. Secret Redaction Redacts common API key, Slack token, JWT, password, and service-role patterns.

Untrusted Data Wrapping Slack messages, CSV-derived JSON, tasks, and dashboards are marked as evidence, not instructions. Payload Caps Normalizes and truncates oversized inputs before OpenAI calls.

Guarded Responses API All model calls go through guardedResponsesCreate. Action Validation Task resolve/delegate/add actions are validated before mutation.

If a direct request resembles a jailbreak or credential-exfiltration attempt, the API blocks it before it reaches OpenAI.

Slack Integration

This is a real Slack integration, not a simulator.

OAuth /api/integrations/slack/authorize and callback token exchange. Events API Signed request verification at /api/slack/events.

Web API conversations.list, conversations.history, chat.postMessage. Task Harvesting Slack messages are analyzed and converted into Master To-Do items.

Create a Slack app using slack/slack-app-manifest.example.json, replacing YOUR_APP_DOMAIN.com with your deployed app domain.

Required Slack URLs:

Redirect URL: https://your-app-domain.com/api/integrations/slack/callback Events URL: https://your-app-domain.com/api/slack/events

Required bot scopes:

app_mentions:read channels:history channels:join channels:read chat:write chat:write.public groups:history groups:read im:history im:read im:write mpim:history mpim:read team:read users:read

Required bot events:

app_mention message.channels message.groups message.im message.mpim

After install, open /integrations and connect Slack. Then use /slack for the live workspace view, /todo to sync harvested commitments, and Slack DMs/app mentions to talk to Aegis from inside Slack.

Notion Product OKRs

This is a real Notion integration for Product OKR tracking.

Create a Notion internal integration.

Copy the integration secret.

Share your Product OKR database with that integration.

Copy the database ID from the Notion database URL.

Add the values in Vercel env vars or connect manually from /integrations.

Open /departments/product and click Sync Notion OKRs.

Recommended database properties:

Objective Key Result Owner Status Progress Quarter Due Date Department Priority Confidence

The parser is flexible and also recognizes common variants like Name, KR, DRI, State, % Complete, Cycle, and Target Date.

HubSpot Deal Pipeline

This is a real HubSpot CRM integration for CEO-level deal pipeline tracking.

Create a HubSpot Private App.

Add CRM read s

[truncated for AI cost control]