Skip to content

About

Evaluating Employees AI usage smartly

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

EfficientAI

Evaluating employees AI usage smartly

EfficientAI is a B2B usage tracker for AI coding assistants (Claude Code first, Cursor and OpenAI Codex on the roadmap). It attributes usage to tickets, reports accurate per-user and per-team cost, and surfaces efficiency signals like cache-hit ratio and cost-per-ticket — with a hard privacy constraint (ADR-1): prompt/code content never leaves the developer's machine; only usage metadata and aggregates reach the server. ADR-10 scopes one deliberate exception — admin-authorized work-tool content (Slack messages that mention an employee) is ingested, because attributing work to usage is the product. Personal devices and prompt/code content stay out. See docs/PLAN.md for the full architecture and extraction plan, and docs/THREAT-MODEL.md for the trust boundaries.

Repo layout

Path Description
crates/schema Shared contract types (normalized event schema, work_item, ingest API)
crates/agent-core OTLP parsing + Claude Code transcript watcher, shared by the agent binary and the future desktop app
crates/agent Device agent binary — headless, listens on localhost:4318 (OTLP HTTP/JSON)
crates/server Ingest API + Postgres — listens on :8080; serves /v1/auth/*, /v1/admin/*, budgets. Optionally serves the built dashboard/dist SPA at the same URL only when DASHBOARD_DIST_DIR is set (09c1293 — the deploy image no longer bundles or serves it). Connector sync bins in src/bin/ (linear/jira/github/gitlab/asana/notion/cursor-sync)
crates/control-plane §11 billing control plane (efficientai-control-plane, :8091) — signed license-heartbeat receiver + seat meter, Postgres-backed license store, Stripe checkout + webhook; ADR-8: never sees usage events. See docs/CONTROL-PLANE.md
crates/seed Deterministic demo-data generator
dashboard/ React + TypeScript + Vite web dashboard — react-router pages + sidebar shell (+ operator console at /admin.html)
landing/ Marketing site — Next.js 15 (App Router)
infra/ AWS deploy — Terraform (network, database, ECS service, observability) + bootstrap
docs/MASTER-PLAN.md Living engineering playbook: status, phases, ownership, checklists
docs/PLAN.md Architecture, extraction mechanisms, sprint plan, team ownership
docs/contracts/ Frozen schemas shared across crates and the dashboard

Install

The device agent (efficientai-agent) is the only piece meant to be installed on a developer's machine — the server and dashboard deploy to AWS (see docs/PLAN.md §11) and aren't part of this section. Packaging is handled by cargo-dist (config: Cargo.toml's [workspace.metadata.dist], workflow: .github/workflows/release.yml).

a) End-user install (once a release exists)

Not live yet. These one-liners only start working after the first v* tag is pushed and the release.yml workflow finishes publishing a GitHub Release — until then they will 404. Once that's happened:

macOS / Linux:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/SameerRKamble/EfficientAI/releases/latest/download/efficientai-agent-installer.sh | sh

Windows (PowerShell):

powershell -ExecutionPolicy Bypass -c "irm https://github.com/SameerRKamble/EfficientAI/releases/latest/download/efficientai-agent-installer.ps1 | iex"

Both are generated by cargo-dist and fetch a prebuilt efficientai-agent binary for your platform — no Rust toolchain required. Untested until the first tag ships.

b) Build from source (works today)

This is the sprint's real install path — no release has been cut yet. From the repo root:

macOS / Linux:

./scripts/install-dev.sh

Windows (PowerShell):

.\scripts\install-dev.ps1

Both build efficientai-agent in release mode and copy it to a local bin directory on your PATH (see the scripts for exact locations and next steps).

c) Running the agent as a background service

The agent is meant to run continuously in the background (see docs/PLAN.md §1). Templates for the three platforms live in packaging/ — each has a header comment with the install path and the exact load/enable command:

  • packaging/com.efficientai.agent.plist — macOS launchd LaunchAgent
  • packaging/efficientai-agent.service — Linux systemd user unit
  • packaging/windows-service.md — Windows: Task Scheduler or NSSM, with exact commands

Quickstart

  1. Start Postgres:
    docker compose up -d
    
    or via Homebrew:
    brew services start postgresql@16
    createuser -s efficientai && createdb -O efficientai efficientai
    
    (password efficientai, or set DATABASE_URL to point elsewhere)
  2. Copy the env template:
    cp .env.example .env
    
    It ships with EFFICIENTAI_ALLOW_DEV_TOKENS=1, which is what lets the dev-default tokens work on localhost — without it the server exits at startup (audit C2). Delete that line and set real tokens for any deployment real traffic can reach.
  3. Run the server:
    cargo run -p efficientai-server
    
  4. Run the device agent:
    cargo run -p efficientai-agent
    
  5. Run the dashboard:
    cd dashboard && npm install && npm run dev
    
    then open http://localhost:5173
  6. Pipe a real Claude Code session in:
    CLAUDE_CODE_ENABLE_TELEMETRY=1 OTEL_METRICS_EXPORTER=otlp OTEL_LOGS_EXPORTER=otlp OTEL_EXPORTER_OTLP_PROTOCOL=http/json OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 claude
    
    Note: this uses http/json on port 4318, not the gRPC/4317 default shown in docs/PLAN.md §2.1's general env block — the sprint agent only implements the HTTP/JSON receiver (see docs/PLAN.md §0).

Seed demo data

With the server running, generate a realistic 4-person, 2-week usage history instead of (or alongside) a live session:

cargo run -p efficientai-seed -- --days 14 --seed 42

Add --dry-run to print the generated events and a per-user cost summary instead of uploading them. Seeding is deterministic — the same --seed value always regenerates the same event stream, so wiping the database and reseeding reproduces identical numbers.

Server endpoints

Every analytics/PII endpoint below requires either a signed-in session (the HttpOnly cookie, or an X-Session-Token header carrying the same token — 29bc1ac, for non-browser clients like the Tauri webview) or the x-efficientai-token admin token — there are no unauthenticated read surfaces left (audit C1). Machine paths (ingest, work-item upsert) take the ingest token instead; /health is the only open route.

Endpoint Auth Description
GET /health none Liveness check — no auth, no DB touch
POST /v1/ingest/events ingest token Uploads a batch of normalized usage events. A user-bound token overrides the payload's user_email (THREAT-MODEL gap #1)
POST /v1/slack/events Slack signature Slack Events API receiver — verifies X-Slack-Signature constant-time; 503 unless SLACK_SIGNING_SECRET is set (ADR-10)
GET /v1/work-items session Reads the local work-item cache
POST /v1/work-items ingest token Connector upsert path (the sync bins)
GET /v1/summary/org session Org-wide cost/usage rollup over a trailing window
GET /v1/summary/users manager/owner Per-user cost/usage totals and cache-hit ratio
GET /v1/summary/user session (self-scoped) Per-user drill-down. Non-privileged callers can only read their own row; the email query param is honored only for manager/owner/admin
GET /v1/summary/models session Per-model cost/usage over a trailing window
GET /v1/summary/tickets session Per-ticket cost/usage over a trailing window
GET /v1/summary/slack-mentions session Slack mention ↔ usage join (ADR-10 payoff)
GET /v1/events/recent session Newest-first slim event rows for the live feed
GET /v1/alerts, GET /v1/budgets session Budget alerts and configured budgets
/v1/auth/*, /v1/org/* mixed Login/SSO/session, org setup, user roster, connector config, mintable ingest tokens
/v1/admin/* admin token only Operator console — no session fallback (see docs/THREAT-MODEL.md)

Fail-closed on default tokens (audit C2): the server exits at startup if EFFICIENTAI_INGEST_TOKEN or EFFICIENTAI_ADMIN_TOKEN is unset or still equals its insecure dev default. Set EFFICIENTAI_ALLOW_DEV_TOKENS=1 to opt back in for localhost work.

Who works where

  • Saatvik — dashboard/ + analytics queries
  • Sounak — crates/agent + crates/agent-core
  • Sameer — crates/server + infra/deploy
  • Kush — integrations (Linear/Jira/GitHub/GitLab/Asana/Notion connectors + pagination + in-product config), Slack Events ingestion (ADR-10), attribution ladder, crates/control-plane (licensing + Stripe billing), landing commerce

Assignments other than Saatvik's are provisional — pick your track and update docs/PLAN.md §0/§12 accordingly. YC prototype due 2026-07-29; contracts freeze Day 2.

About

Evaluating Employees AI usage smartly

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages