How akramiot/dcats works
Project type and purpose
• This is a Python library implementing the “Dual-Layer Cognitive Architecture for Trustworthy and Secure AI Systems.”
• It is effectively a middleware/SDK that wraps an AI reasoning engine (the Core layer) with a cognitive firewall (the Oversight layer).
• Users import DualLayerAI from src/dcats.py to feed queries, get “filtered” outputs, and automatically enforce trust/security policies.
File structure
• Top-level directories:
– src/core: Core Reasoning Layer
– src/oversight: Four oversight modules
– src/policies: Policy store and management
– src/utils: Cross-cutting utilities (e.g., audit logging)
– examples: Starter scripts demonstrating usage
– tests: Unit tests
• Configuration: requirements.txt for dependencies, .gitignore, LICENSE, README.md.
• No external microservices or databases—policy store is in-memory or file-based and audit logs are written via utils.
Extract architectural insights from the README
• Two main logical layers:
1. Core Reasoning Layer (“C”)
2. Oversight Layer (“O”) with subcomponents: Attention Filter, Trust Scorer, Memory Partitioner, Output Veto
• A Policy Store feeds the oversight rules.
• An Audit Logger records events (via utils).
• The client calls DualLayerAI.process(input), which orchestrates the layers.
a. Main components
1. Client Application (could be example scripts or any user code)
2. DualLayerAI Facade (entrypoint in src/dcats.py)
4. Oversight Layer container, subdivided into four modules:
– Attention Filter
– Trust Scorer
– Memory Partitioner
– Output Veto
5. Policy Store (in policies)
6. Audit Logger (in utils)
7. Optional: External AI service (if Core uses an external LLM)
b. Relationships & data flow
2. DualLayerAI → (1) Core Reasoning → core response
3. Core response → Oversight Layer (chain through the four modules)
4. Oversight modules consult Policy Store for rules
5. Oversight modules call Audit Logger on key events
6. Final approved response → DualLayerAI → Client
c. Architectural patterns & principles
– Layered architecture (clear separation of concerns)
– Single-responsibility for each oversight subcomponent
– Policy-driven control (Policy Store is the single source of truth)
– Pluggable/extensible: users can extend or swap out oversight modules or policies
d. Key technologies & frameworks
– Python 3.x
– Logging (via utils/audit_logger.py)
– Policy store (in-memory or file-based, in src/policies/policy_store.py)
– Unit tests (pytest style, in tests/)
Diagramming conventions
– Use rectangles for modules/layers.
• Core layer = blue
• Oversight subcomponents = orange
• Policy Store = green
• Audit Logger = gray
• Client/Examples = light yellow
Putting it all together
– DualLayerAI Facade at the left
• Optional annotation: “Examples/basic_usage.py” calls this flow.