← Back to Docs

Perception System

The Ghost's senses - understanding documents, analyzing emails, detecting anomalies, and monitoring external signals.

Document Processing

Intelligent extraction from invoices, contracts, reports. No templates needed.

  • • Entity extraction (people, companies, amounts)
  • • Key phrase identification
  • • Sentiment and urgency detection
  • • Action item extraction

Email Analysis

Understands intent, extracts actions, suggests replies.

  • • Intent classification (request, question, complaint)
  • • Priority scoring
  • • Action item extraction
  • • Smart reply drafts

Anomaly Detection

Spots unusual patterns in metrics before they become problems.

  • • Statistical outlier detection
  • • Trend change alerts
  • • Threshold monitoring
  • • Root cause suggestions

Signal Intelligence

Monitors market, competitor, and industry signals.

  • • Relevance scoring
  • • Opportunity/threat classification
  • • Intelligence briefing generation
  • • Action recommendations

Usage Examples

Process an Invoice

const result = await perception.processInvoice(invoiceText);

// Returns:
// - Invoice number, vendor, amounts
// - Due date, line items
// - Extracted entities
// - Auto-stored in memory

Analyze Email

const email = await perception.analyzeEmail({
  from: '[email protected]',
  to: ['[email protected]'],
  subject: 'Urgent: Contract Review',
  body: emailBody
});

// Returns: intent, priority, action items, reply draft

Record Metric & Detect Anomalies

// Record metric (auto-detects anomalies)
const anomaly = await perception.recordMetric(
  'daily_revenue',
  15000
);

if (anomaly) {
  console.log('Anomaly detected:', anomaly.description);
  console.log('Suggested actions:', anomaly.analysis.suggestedActions);
}

API Reference

POST /api/gfs/perception

Process various perception types

Types: document, invoice, contract, email, emails, metric, signal, signals
GET /api/gfs/perception?action=anomalies

Get recent anomalies

GET /api/gfs/perception?action=metric_history&metric=revenue

Get metric history for analysis

System Integration

All perceptions automatically integrate with other GFS systems:

🧠
Memory
All perceptions stored as memories
Event Bus
Significant events published
🔄
Workflows
Can trigger automated workflows