How aryanketkar-15/trc-engine works
TRC Engine Phase 1 accepts a system model, retrieves relevant knowledge-base patterns, analyzes attack chains, generates and validates threat scenarios, then exposes them for human review and writes approved results to SCRS. The API also tracks run status and supports rejection-driven retries. The README documents this workflow and KB ingestion; source excerpts show orchestration and selected module dependencies. Some unsampled component details are represented only where the README or source index supports them.
Main entry points: orchestrator.py Pipeline Orchestrator · router.py Threat API · retrieval.py KB Retrieval · generator.py Scenario Generator
Components 20
API and Runs
- Threat API
agents/threat_agent/router.py - FastAPI App
main.py - Runtime Settings
config/settings.py
Threat Reasoning
- Pipeline Orchestrator
agents/threat_agent/orchestrator.py - Attack Chain Analysis
agents/threat_agent/attack_chain.py - Scenario Generator
agents/threat_agent/generator.py - Invariant Validator
agents/threat_agent/validator.py - Evidence Grounding
agents/threat_agent/grounding.py - LLM Client
common/llm_client.py - Threat Contracts
agents/threat_agent/schemas.py - Confidence Scorer
agents/threat_agent/scorer.py
Knowledge Base
- KB Retrieval
agents/threat_agent/retrieval.py - Candidate Reranking
agents/threat_agent/rerank.py - Knowledge Loaders
kb/loaders/base_loader.py - KB Index Builder
kb/scripts/build_index.py
Persistence and State
- PostgreSQL and pgvector
common/db.py - Run Registry
agents/threat_agent/run_store.py - SCRS State Manager
scrp/state_manager.py
Other components
- Analyst
- Human Reviewer
Connections 20
- Analyst → Threat API: submits model
- FastAPI App → Threat API: mounts router
main.py - Threat API → Pipeline Orchestrator: starts analysis
agents/threat_agent/router.py - Pipeline Orchestrator → KB Retrieval: fetches candidates
agents/threat_agent/orchestrator.py - KB Retrieval → PostgreSQL and pgvector: queries vectors
agents/threat_agent/retrieval.py - KB Retrieval → Candidate Reranking: reranks candidates
agents/threat_agent/retrieval.py - Pipeline Orchestrator → Attack Chain Analysis: builds paths
agents/threat_agent/orchestrator.py - Pipeline Orchestrator → Scenario Generator: generates scenarios
agents/threat_agent/orchestrator.py - Scenario Generator → LLM Client: requests completion
agents/threat_agent/generator.py - Pipeline Orchestrator → Invariant Validator: validates scenarios
agents/threat_agent/orchestrator.py - Pipeline Orchestrator → Evidence Grounding: uses grounding
agents/threat_agent/orchestrator.py - Scenario Generator → Confidence Scorer: scores confidence
agents/threat_agent/generator.py - Threat API → Run Registry: tracks runs
agents/threat_agent/router.py - Run Registry → PostgreSQL and pgvector: persists runs
agents/threat_agent/run_store.py - Human Reviewer → Threat API: reviews scenarios
- Threat API → SCRS State Manager: records approval
agents/threat_agent/router.py - KB Index Builder → Knowledge Loaders: loads entries
kb/scripts/build_index.py - KB Index Builder → PostgreSQL and pgvector: builds vector index
kb/scripts/build_index.py - LLM Client → Runtime Settings: reads credentials
common/llm_client.py - KB Retrieval → Runtime Settings: reads options
agents/threat_agent/retrieval.py