Skip to main content

Intelligence Layer

The Intelligence Layer consists of Python 3 scripts that power core processing, entity resolution, role detection, and system orchestration.

Architecture

Requirements:
  • Python 3.9+
  • Standard library only (pathlib, json, re, datetime)
  • Optional: PyYAML for config files

Core Modules

role_detector.py

3-level role detection system with weighted scoring. Version: 2.0.0 Function: detect_roles_in_text()
str
required
Content to analyze for role mentions
str
Source identifier for tracking
dict
ENTITY-REGISTRY dict (loaded if None)
Returns:
Detection Levels: Registry Update:
Trigger Thresholds:
object
Criteria: weighted_score >= 10 AND sources >= 2Action: Trigger agent creation
object
Criteria: weighted_score >= 5 AND sources >= 1Action: Track for promotionPromotion: Becomes “established” when criteria met
CLI Usage:
Source: core/intelligence/role_detector.py:1-856

entity_normalizer.py

Canonical entity resolution with fuzzy matching and domain awareness. Version: 1.0.0 Function: normalize_entity()
str
required
Raw entity name to normalize
str
required
Type: "person", "theme", "role", "concept"
dict
ENTITY-REGISTRY dict (loaded if None)
str
Source that mentioned this entity
bool
Save registry after modification (default: False)
str
Domain ID for context-aware matching (e.g., “SALES”)
Returns:
Resolution Algorithm:
1

Exact Match on Canonical

Check if name matches any canonical entity (case-insensitive).Score: 1.0
2

Exact Match on Aliases

Check if name matches any registered alias.Score: 1.0
3

Fuzzy Match

Use difflib.SequenceMatcher for similarity scoring.Threshold: 0.85 (configurable)Example: “alex hormozi” → “Alex Hormozi” (score: 0.92)
4

Domain Boost

If domain_hint provided and entity shares domain, add +0.10 bonus.Example: “sales lead” in SALES domain gets boost when matching SALES-LEAD
5

Taxonomy Check

Look up in DOMAINS-TAXONOMY.yaml for known entities.Score: 1.0 if found
6

Create New Entity

If no match found, create new canonical entity.Score: 0.0 (no match)
Auto-Merge Rules: Canonical Name Formats:
Batch Normalization:
CLI Usage:
Source: core/intelligence/entity_normalizer.py:1-566

theme_analyzer.py

Automatic theme classification and domain assignment. Version: 1.0.0 Function: analyze_themes()
str
required
Content to analyze for themes
str
Source identifier
dict
ENTITY-REGISTRY dict
Returns:
Theme Categories: Source: core/intelligence/theme_analyzer.py:1-xxx

bootstrap_registry.py

Initialize ENTITY-REGISTRY from taxonomy and existing data. Function: bootstrap_registry()
bool
Overwrite existing registry (default: False)
Behavior:
  1. Load DOMAINS-TAXONOMY.yaml
  2. Scan existing agents, dossiers, and knowledge base
  3. Create registry entries for all entities
  4. Set initial mention_count based on artifacts
  5. Save to processing/canonical/ENTITY-REGISTRY.json
CLI Usage:
Source: core/intelligence/bootstrap_registry.py:1-xxx

agent_trigger.py

Automatic agent creation trigger detection. Function: check_agent_triggers()
dict
ENTITY-REGISTRY dict
Returns:
Trigger Logic:
Logging:
  • Triggers written to logs/triggers.jsonl
  • One JSON object per line
Source: core/intelligence/agent_trigger.py:1-xxx

task_orchestrator.py

Task execution engine with dependency resolution. Function: execute_task()
str
required
Task identifier (e.g., “TSK-020”)
dict
required
Input parameters for task
dict
Execution context (previous task outputs)
Returns:
Task Resolution:
  1. Load task definition from core/tasks/{task-id}.md
  2. Validate inputs against task schema
  3. Execute based on execution_type:
    • Agent: Delegate to JARVIS
    • Script: Run Python script
    • Manual: Prompt human
    • Hook: Trigger hook
  4. Validate outputs against acceptance criteria
  5. Return result
Source: core/intelligence/task_orchestrator.py:1-xxx

Utility Modules

audit_layers.py

Validate Layer 1/2/3 security boundaries. Function: audit_layers() Checks:
  • L1 files don’t contain L3 data
  • .env and sensitive files are gitignored
  • No API keys in tracked files

validate_layers.py

Check layer integrity and cross-references. Function: validate_integrity() Validates:
  • Foreign key references
  • File existence
  • Schema compliance
  • Canonical entity usage

autonomous_processor.py

Autonomous decision-making for routine operations. Function: autonomous_process() Capabilities:
  • Auto-resolve entity aliases above 0.95 similarity
  • Auto-create agent when threshold met
  • Auto-organize inbox files
  • Auto-update cross-references
Safety:
  • All decisions logged to DECISIONS-LOG.md
  • Rollback support via checkpoints
  • Human override available

Configuration

All intelligence modules use: Config File: scripts/trigger_config.yaml

Error Handling

All modules follow standard error protocol:
Error Logging:
  • Written to logs/intelligence.log
  • Structured JSON format
  • Includes stack trace

See Also