Skip to content

Latest commit

 

History

History
162 lines (133 loc) · 5.7 KB

File metadata and controls

162 lines (133 loc) · 5.7 KB

Metric Updating Feature

Overview

This feature allows users to add new information to specific metrics for companies, which triggers an AI agent to analyze the changes and update the score accordingly. Each metric has its own specialized AI agent that understands the scoring criteria.

How It Works

1. User Interface (frontend/src/pages/CompanyDetail.tsx)

  • Each metric section now has an "Add Information" button
  • Clicking the button reveals a Notion-like text area where users can enter additional context
  • The text area accepts any information about the metric (achievements, updates, new data, etc.)
  • Users click "Save & Rescore" to trigger the AI analysis
  • The UI shows a loading state: "Analyzing & Updating..."
  • After completion, displays the new score and updated overall score

2. Backend API Endpoint

Endpoint: POST /api/companies/:id/metrics/update

Request Body:

{
  "metricName": "Team Quality",
  "additionalInfo": "The founder just closed a $2M seed round and hired 3 senior engineers from Google."
}

Response:

{
  "success": true,
  "data": {
    "company": { /* full company object with updated evaluation */ },
    "updatedMetric": {
      "metric_name": "domain_expertise",
      "score": 4,
      "explanation": "Updated explanation based on new information...",
      "confidence": "high"
    },
    "newOverallScore": 3.5
  }
}

3. AI Scoring Agents (backend/ai/metricScoring.js)

Each metric has a specialized AI agent with specific scoring criteria:

Domain Expertise (Team Quality)

  • Score 4: Founder/market fit, complementary team, coachable
  • Score 3: Some domain knowledge, well researched
  • Score 2: Limited background but strong learning skills
  • Score 1: No relevant background, not coachable

Product

  • Score 4: Usable product with regular users, high retention, monetizable
  • Score 3: Product built with initial users, promising data
  • Score 2: Prototype/MVP built, interesting ideas
  • Score 1: Nothing built, pre-product

Fundraisability

  • Score 4: Well spoken, strong clarity, hot space, oversubscribed round
  • Score 3: Decent storyteller, majority of round filled
  • Score 2: Struggles off-script, minority of round filled
  • Score 1: Poor communicator, little fundraising progress

Market

  • Score 4: $100M+ TAM
  • Score 3: $50M+ TAM
  • Score 2: $25M+ TAM
  • Score 1: $10M+ TAM

Execution

  • Score 4: Takes initiative, high velocity, constantly hits milestones
  • Score 3: Consistent velocity but needs guidance
  • Score 2: Slowly executing
  • Score 1: Poor execution, doesn't know what to measure

Traction

  • Score 4: $500k+ ARR pre-seed
  • Score 3: $200k+ ARR pre-seed or strong partnerships
  • Score 2: $50k+ ARR pre-seed or waitlist
  • Score 1: Minimal traction

4. Scoring Process

When a user adds information to a metric:

  1. Retrieve Context: Get company details and current metric score/explanation
  2. AI Analysis: Call Claude API with:
    • Company information (name, description, website, etc.)
    • Previous score and explanation (for context)
    • New additional information from user
    • Specific scoring criteria for the metric
  3. Score Calculation: AI returns:
    • New score (1-4)
    • Updated explanation
    • Key factors considered
    • Confidence level (high/medium/low)
  4. Database Update:
    • Update EvaluationDetail table with new score and explanation
    • Update Evaluation table with new metric score
    • Recalculate overall score (average of all 6 metrics)
  5. Return Results: Send updated company data back to frontend

5. Database Schema

EvaluationDetail Table:

  • evaluation_id: FK to evaluations table
  • metric_name: One of the 6 core metrics
  • score: DECIMAL(3,2) between 1-4
  • explanation: TEXT with detailed reasoning
  • references: JSONB array of reference sources

Evaluation Table:

  • overall_score: Average of all metric scores
  • domain_expertise: Score for team quality
  • product: Score for product
  • fundraisability: Score for fundraising ability
  • market: Score for market size
  • execution: Score for execution ability
  • traction: Score for traction/revenue

Key Files

Backend

  • backend/ai/metricScoring.js - AI scoring agents with criteria
  • backend/controllers/companyController.js - updateMetricInfo() endpoint
  • backend/routes/companies.js - Route definition
  • backend/models/EvaluationDetail.js - Database model

Frontend

  • frontend/src/pages/CompanyDetail.tsx - UI with editable sections
  • frontend/src/utils/api.ts - API client method updateMetricInfo()

Usage Example

  1. Navigate to a company detail page
  2. Expand any metric section (e.g., "Product")
  3. Click "Add Information"
  4. Enter text: "Just launched v2 with 500 active users, 40% retention"
  5. Click "Save & Rescore"
  6. AI analyzes the information against Product criteria
  7. Returns new score (e.g., 3 → 4) with updated explanation
  8. Overall company score recalculates automatically

Technical Details

  • AI Model: Uses Claude API via existing callClaudeJSON() helper
  • Temperature: 0.5 (balanced between consistency and creativity)
  • Max Tokens: 1024 per metric scoring request
  • Transaction Safety: All database updates wrapped in transactions
  • Error Handling: Graceful failures with rollback on errors
  • Validation: Input validation on both frontend and backend

Future Enhancements

  1. History Tracking: Store all previous scores and reasoning
  2. Batch Updates: Update multiple metrics at once
  3. Information Storage: Save the additional info as a separate record
  4. Confidence Indicators: Show AI confidence level in UI
  5. Comparison View: Show before/after scores side by side
  6. Audit Trail: Track who made changes and when