Intelligence Layer
The Intelligence Layer consists of Python 3 scripts that power core processing, entity resolution, role detection, and system orchestration.Architecture
- Python 3.9+
- Standard library only (pathlib, json, re, datetime)
- Optional:
PyYAMLfor 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)
object
Criteria:
weighted_score >= 10 AND sources >= 2Action: Trigger agent creationobject
Criteria:
weighted_score >= 5 AND sources >= 1Action: Track for promotionPromotion: Becomes “established” when criteria metcore/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”)
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-LEAD5
Taxonomy Check
Look up in
DOMAINS-TAXONOMY.yaml for known entities.Score: 1.0 if found6
Create New Entity
If no match found, create new canonical entity.Score: 0.0 (no match)
Canonical Name Formats:
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
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)
- Load
DOMAINS-TAXONOMY.yaml - Scan existing agents, dossiers, and knowledge base
- Create registry entries for all entities
- Set initial
mention_countbased on artifacts - Save to
processing/canonical/ENTITY-REGISTRY.json
core/intelligence/bootstrap_registry.py:1-xxx
agent_trigger.py
Automatic agent creation trigger detection. Function:check_agent_triggers()
dict
ENTITY-REGISTRY dict
- Triggers written to
logs/triggers.jsonl - One JSON object per line
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)
- Load task definition from
core/tasks/{task-id}.md - Validate inputs against task schema
- Execute based on
execution_type:Agent: Delegate to JARVISScript: Run Python scriptManual: Prompt humanHook: Trigger hook
- Validate outputs against acceptance criteria
- Return result
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
- 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:- Written to
logs/intelligence.log - Structured JSON format
- Includes stack trace
