How kaifhoda1/cipherai works
1. Repository shape
- This is a very small, single-service Python project.
- The only application code in the tree is src/app.py, with requirements.txt and a Dockerfile supporting execution and packaging.
- There is no separate backend/frontend split in the repo; the app is likely a single Python process with a local UI and local AI calls.
2. Primary purpose
- CipherAI is designed as a local-only AI security assistant.
- The architectural constraint is important: the README explicitly says no data leaves the machine.
- That means the main boundary is between the user session and locally hosted AI/data components, not between the app and cloud services.
3. User-facing interface
- The README says the UI is built with Streamlit.
- So the top of the system is a browser-based chat interface served by the Python app.
- This layer is responsible for capturing questions, presenting answers, and likely managing chat state.
4. Application orchestrator
- src/app.py is the central entrypoint and probably coordinates the whole flow.
- In architecture terms, it likely acts as the orchestrator that connects:
- UI input
- prompt construction
- local model invocation
- eventual retrieval pipeline
- response rendering
- Because there is only one source file in the tree, the current implementation is probably monolithic rather than heavily layered.
5. Local model runtime
- The stack explicitly includes Ollama + Mistral 7B.
- This is the core inference boundary: the Python app sends prompts to a local Ollama runtime, which hosts the model.
- For a diagram, treat Ollama as an external local service/process that the app calls over a local interface, not as part of the Python app itself.
6. Knowledge sources and future RAG layer
- The README identifies a planned/targeted RAG pipeline over:
- MITRE ATT&CK
- NVD CVE data
- These datasets are the domain knowledge boundary for security answers and mitigation suggestions.
- In the future architecture, queries should flow through retrieval before generation, so the model can answer from curated security context rather than only from parametric memory.
7. Data flow: current state
- Current runtime flow is likely:
- User asks a security question in Streamlit
- app.py builds a prompt
- Prompt is sent to local Ollama/Mistral
- Model response is returned to the Streamlit UI
- In the current repo state, there is no visible dedicated retrieval/indexing subsystem in the file tree.
8. Data flow: planned state with RAG
- The intended future flow is:
- User question
- Query preprocessing
- Retrieval from local MITRE/NVD corpus
- Context injection into the prompt
- Ollama/Mistral generation
- Response displayed in Streamlit
- The retrieval layer becomes the key architectural middle tier between the UI and the model.
9. Storage and local assets
- The README mentions data/, models/, and docs/, but those folders are not present in the current tree.
- Architecturally, those directories represent expected local artifacts:
- datasets for security knowledge
- downloaded model assets
- supporting documentation
- This reinforces that the system is meant to run offline with local assets rather than remote APIs.
10. Deployment boundary
- The Dockerfile indicates the app is intended to be containerized for repeatable local deployment.
- For architecture, this is a single deployable unit: the Python app plus its dependencies, with Ollama and local model/data dependencies likely running alongside or on the host.
- requirements.txt defines the Python runtime surface area; no other runtime services are evident from the tree.
11. Project maturity
- The README roadmap shows phases already completed for local model runtime and Streamlit UI, while the RAG and fine-tuning phases are still pending.
- So the current architecture is best drawn as a minimal local chat assistant with planned expansion into a security-focused retrieval-augmented system.
12. What to emphasize in a diagram
- Draw the main trust boundary as fully local.
- Show Streamlit/UI, Python orchestration, Ollama/Mistral inference, and future MITRE/NVD retrieval as the key subsystems.
- Avoid introducing cloud services, databases, or microservices; none are evidenced by the repo tree or README.
Main entry points: app.py App Core · Dockerfile Docker Image · requirements.txt Python Deps
Components 13
Interface
User-facing local chat experience
- Streamlit UI · Browser-based chat interface for asking questions and viewing answers
Python App
Single-process application and prompt orchestration
- App Core · Central Python entrypoint that coordinates the end-to-end request flow
src/app.py - Prompt Builder · Constructs the instruction and context sent to the model
- Chat State · Maintains conversation context for the interactive session
- Response Renderer · Formats model output back into the Streamlit interface
Local Runtime
On-machine model inference boundary
- Ollama · Local inference service used to execute the model offline
- Mistral 7B · Primary local language model for security assistance
Security Knowledge
Planned local retrieval sources and corpus
- RAG Layer · Planned retrieval and context injection stage before generation
- MITRE ATT&CK · Planned local knowledge source for tactics and techniques
- NVD CVEs · Planned local vulnerability knowledge source
- Local Assets · Expected local data, model, and docs artifacts for offline operation
Packaging
Repeatable local deployment surface
- Docker Image · Containerized packaging for repeatable local deployment
Dockerfile - Python Deps · Pinned Python dependency surface for the single-service app
requirements.txt
Connections 14
- Streamlit UI → App Core: chat input · User requests are passed from the Streamlit interface into the Python app
- App Core → Chat State: track state · The app preserves conversation context during the session
- App Core → Prompt Builder: build prompt · Core logic assembles the instruction payload for inference
- Prompt Builder → Ollama: send prompt · Prompt text is forwarded to the local Ollama runtime
- Ollama → Mistral 7B: host model · Ollama serves the Mistral model locally for inference
- Mistral 7B → Response Renderer: answer text · Generated text is returned for presentation in the UI
- App Core → Response Renderer: render output · The app hands the final answer back to the interface layer
- App Core → Docker Image: package · The service is containerized for local deployment
- App Core → Python Deps: install deps · Runtime dependencies define the Python execution surface
- RAG Layer → MITRE ATT&CK: retrieve ATT&CK · Planned retrieval over MITRE ATT&CK content
- RAG Layer → NVD CVEs: retrieve CVEs · Planned retrieval over NVD vulnerability content
- RAG Layer → Local Assets: load corpus · Retrieval operates over local offline artifacts
- App Core → RAG Layer: query retrieval · Future flow inserts retrieval before generation
- RAG Layer → Prompt Builder: inject context · Retrieved evidence is appended into the prompt