πΊοΈ Codebase Overview¶
Welcome to the Siyarix codebase! This document serves as a quick tour of the project structure and core modules. Siyarix started as a personal passion project to explore AI-native orchestration, and it's continuously growing thanks to active development.
Tip
If you are new to the codebase, I recommend starting with the Agent Orchestrator (core/) and Interactive Chat (chat/) modules, as they form the core experience!
π Directory Structure¶
Siyarix lives under the src/siyarix/ directory. Here is the layout:
src/siyarix/
βββ __init__.py # Public API
βββ __main__.py # Entry point for `python -m siyarix`
βββ main.py # Legacy entry point
β
βββ cli/
β βββ __init__.py # Main Typer CLI app
β
βββ chat/ # π¬ Interactive REPL system
β βββ engine.py # LLMEngineMixin
β βββ repl.py # SiyarixChat: prompt_toolkit REPL
β βββ handlers.py # Slash command handlers
β βββ openai_compat.py # Adapter for AI providers
β βββ ...
β
βββ core/ # π§ Agent Orchestration Kernel
β βββ __init__.py # AgentCore
β βββ pipeline.py # CommandPipeline
β βββ swarm.py # SwarmRouter
β
βββ providers/ # βοΈ Multi-Provider LLM Abstraction Layer
β βββ manager.py # Registration and management
β βββ state.py # Cooldowns and caching
β βββ profiles/ # Provider profiles (OpenAI, Gemini, Ollama, etc.)
β
βββ parsers/ # π Tool Output Parser Subsystem
β βββ __init__.py # ParserRegistry
β βββ nmap_parser.py # Nmap XML/text parser
β βββ ...
β
βββ output/ # π¨ Output Engine
β βββ __init__.py # Renders formats (JSON, YAML, HTML, etc.)
β
βββ report/ # π Reporting
β βββ __init__.py # Generates reports in MARKDOWN, HTML, JSON
β
βββ plugins/ # π Dynamic Plugin Architecture
βββ templates/ # π UI Templates and ASCII Art
βββ data/ # ποΈ Static assets
βββ offline_registry/ # π΄ Offline heuristic planning subsystem
β
βββ Root-Level Modules:
βββ audit_log.py # Audit trails
βββ credential_store.py # Encrypted credential vault
βββ deep_scan.py # Reconnaissance engine
βββ learning_system.py # Basic learning from executions
βββ opsec.py # Basic OPSEC controls
βββ permission_gate.py # Command permission control
βββ workflow.py # Workflow engine
βββ ...
ποΈ Key Subsystems¶
π§ Agent Orchestrator (core/)¶
AgentCore is the brain of Siyarix. It dispatches tasks across four operational modes:
- REGISTRY (heuristic-based)
- AUTONOMOUS (LLM-driven)
- HYBRID (combined)
- INTERACTIVE (chat-driven)
π¬ Chat & REPL (chat/)¶
Our interactive shell is built on prompt_toolkit, featuring a split-pane layout and context-aware autocomplete. The LLMEngineMixin runs the agent loop.
βοΈ Provider Layer (providers/)¶
Siyarix abstracts various AI providers through a unified adapter (openai_compat.py). The ProviderManager handles failover and backoff, so things keep running if an API goes down.
π Parser System (parsers/)¶
The ParserRegistry discovers tool parsers at import time. Each parser implements the Parser protocol, mapping raw tool output to structured data.
π‘οΈ Security Layer (Root Modules)¶
Siyarix includes some neat security features: - PermissionGate: A review stage before running commands. - DLP Engine: Tries to mask sensitive data patterns. - CredentialStore: Secures API keys locally. - AuditLogger: Keeps a log of actions.
π¨ Output & Reporting (output/, report/)¶
The OutputEngine supports multiple formats and themes, and the ReportEngine compiles assessments into Markdown or HTML.
Implemented Features vs. Stubs
Siyarix is a growing project. While features like MultiWaveExecution and BudgetChecking are active, some features listed in chat/stubs.py are placeholders designed for future expansion as I continue building out the tool.
π Development Conventions¶
To keep the codebase manageable, I try to follow these standards:
- Type Hints: Encouraged on public APIs.
- Async First: asyncio is used extensively.
- Structured Data: Using Python dataclasses for representing findings.
- Error Handling: Use SiyarixException instead of bare except: blocks.
- Logging: Standard Python logging (logging.getLogger(__name__)).
- Testing: We rely on pytest. Let's try to keep coverage up!
- Linting: Using Ruff for formatting and linting.