# pyjamasamm/logrena architecture

> Architecture diagram of the GitHub repository pyjamasamm/logrena, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pyjamasamm/logrena
- Repository: https://github.com/pyjamasamm/logrena

## Overview

LogReNa is a local-first log and code analysis CLI. Its main workflow parses and templates logs, checks events against configured feature-readiness signals and registered anti-pattern detectors, then correlates violations with retrieved code; its ask command combines logs, code, graph, and violations into grounded model answers. A separate indexing workflow prepares code chunks for hybrid retrieval. README describes the detector and Q&A capabilities; some implementation details for feature loading, correlation, and answering were not sampled, so those links follow the documented and CLI-visible orchestration.

Main entry points: [`src/cli.py`](https://github.com/pyjamasamm/logrena/blob/main/src/cli.py) (CLI commands), [`src/detectors/__init__.py`](https://github.com/pyjamasamm/logrena/blob/main/src/detectors/__init__.py) (Detector registry), [`src/reranker.py`](https://github.com/pyjamasamm/logrena/blob/main/src/reranker.py) (Result reranker), [`src/llm_client.py`](https://github.com/pyjamasamm/logrena/blob/main/src/llm_client.py) (Model clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Inputs and Indexing"]
  node_log_parser["Log parser<br/>[log_parser.py]"]
  node_feature_graph["Feature graph<br/>[feature_graph.py]"]
end

subgraph group_analysis["Log Analysis"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_detectors["Detector registry<br/>[__init__.py]"]
  node_dependency["Dependency check"]
  node_silent["Silent failure check<br/>[silent_failure.py]"]
  node_retry["Retry storm check<br/>[retry_storm.py]"]
  node_correlate["Violation correlation<br/>[correlate.py]"]
end

subgraph group_retrieval["Code Retrieval"]
  node_repo_indexer["Repository indexer<br/>[repo_indexer.py]"]
  node_repo_index[("Code index<br/>[repo_indexer.py]")]
  node_reranker["Result reranker<br/>[reranker.py]"]
end

subgraph group_answers["Q&amp;A and Privacy"]
  node_qna["Grounded Q&amp;A<br/>[qna.py]"]
  node_llm_client["Model clients<br/>[llm_client.py]"]
  node_privacy["Privacy guard<br/>[privacy_guard.py]"]
end

node_user(("Engineer"))
node_ollama(("Ollama"))
node_anthropic(("Anthropic API"))
node_terminal(("CLI output"))

node_user -->|"runs commands"| node_cli
node_cli -->|"parses logs"| node_log_parser
node_cli -->|"loads signals"| node_feature_graph
node_cli -->|"runs checks"| node_detectors
node_detectors -->|"dispatches"| node_dependency
node_detectors -->|"dispatches"| node_silent
node_detectors -->|"dispatches"| node_retry
node_cli -->|"builds index"| node_repo_indexer
node_repo_indexer -->|"stores chunks"| node_repo_index
node_cli -->|"loads index"| node_repo_index
node_cli -->|"correlates violations"| node_correlate
node_correlate -->|"retrieves code"| node_reranker
node_reranker -->|"queries"| node_repo_index
node_cli -->|"asks question"| node_qna
node_qna -->|"retrieves evidence"| node_reranker
node_qna -->|"requests answer"| node_llm_client
node_reranker -.->|"judges candidates"| node_llm_client
node_repo_indexer -.->|"embeds chunks"| node_llm_client
node_llm_client -->|"guards requests"| node_privacy
node_privacy -->|"permits local calls"| node_ollama
node_privacy -.->|"permits opt-in calls"| node_anthropic
node_cli -->|"prints results"| node_terminal

click node_cli "https://github.com/pyjamasamm/logrena/blob/main/src/cli.py"
click node_log_parser "https://github.com/pyjamasamm/logrena/blob/main/src/log_parser.py"
click node_feature_graph "https://github.com/pyjamasamm/logrena/blob/main/src/feature_graph.py"
click node_detectors "https://github.com/pyjamasamm/logrena/blob/main/src/detectors/__init__.py"
click node_dependency "https://github.com/pyjamasamm/logrena/blob/main/src/detectors/dependency_violation.py"
click node_silent "https://github.com/pyjamasamm/logrena/blob/main/src/detectors/silent_failure.py"
click node_retry "https://github.com/pyjamasamm/logrena/blob/main/src/detectors/retry_storm.py"
click node_correlate "https://github.com/pyjamasamm/logrena/blob/main/src/correlate.py"
click node_repo_indexer "https://github.com/pyjamasamm/logrena/blob/main/src/repo_indexer.py"
click node_repo_index "https://github.com/pyjamasamm/logrena/blob/main/src/repo_indexer.py"
click node_reranker "https://github.com/pyjamasamm/logrena/blob/main/src/reranker.py"
click node_qna "https://github.com/pyjamasamm/logrena/blob/main/src/qna.py"
click node_llm_client "https://github.com/pyjamasamm/logrena/blob/main/src/llm_client.py"
click node_privacy "https://github.com/pyjamasamm/logrena/blob/main/src/privacy_guard.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_log_parser,node_feature_graph toneBlue
class node_cli,node_detectors,node_dependency,node_silent,node_retry,node_correlate toneAmber
class node_repo_indexer,node_repo_index,node_reranker,node_anthropic toneMint
class node_qna,node_llm_client,node_privacy toneRose
class node_user,node_ollama,node_terminal toneIndigo
```

## Components

### Inputs and Indexing

- [Log parser](https://github.com/pyjamasamm/logrena/blob/main/src/log_parser.py): `src/log_parser.py`
- [Feature graph](https://github.com/pyjamasamm/logrena/blob/main/src/feature_graph.py): `src/feature_graph.py`

### Log Analysis

- [CLI commands](https://github.com/pyjamasamm/logrena/blob/main/src/cli.py): `src/cli.py`
- [Detector registry](https://github.com/pyjamasamm/logrena/blob/main/src/detectors/__init__.py): `src/detectors/__init__.py`
- [Dependency check](https://github.com/pyjamasamm/logrena/blob/main/src/detectors/dependency_violation.py): `src/detectors/dependency_violation.py`
- [Silent failure check](https://github.com/pyjamasamm/logrena/blob/main/src/detectors/silent_failure.py): `src/detectors/silent_failure.py`
- [Retry storm check](https://github.com/pyjamasamm/logrena/blob/main/src/detectors/retry_storm.py): `src/detectors/retry_storm.py`
- [Violation correlation](https://github.com/pyjamasamm/logrena/blob/main/src/correlate.py): `src/correlate.py`

### Code Retrieval

- [Repository indexer](https://github.com/pyjamasamm/logrena/blob/main/src/repo_indexer.py): `src/repo_indexer.py`
- [Code index](https://github.com/pyjamasamm/logrena/blob/main/src/repo_indexer.py): `src/repo_indexer.py`
- [Result reranker](https://github.com/pyjamasamm/logrena/blob/main/src/reranker.py): `src/reranker.py`

### Q&A and Privacy

- [Grounded Q&A](https://github.com/pyjamasamm/logrena/blob/main/src/qna.py): `src/qna.py`
- [Model clients](https://github.com/pyjamasamm/logrena/blob/main/src/llm_client.py): `src/llm_client.py`
- [Privacy guard](https://github.com/pyjamasamm/logrena/blob/main/src/privacy_guard.py): `src/privacy_guard.py`

### Other components

- **Engineer**
- **Ollama**
- **Anthropic API**
- **CLI output**

## Connections

- Engineer → CLI commands: runs commands
- CLI commands → Log parser: parses logs
- CLI commands → Feature graph: loads signals
- CLI commands → Detector registry: runs checks
- Detector registry → Dependency check: dispatches
- Detector registry → Silent failure check: dispatches
- Detector registry → Retry storm check: dispatches
- CLI commands → Repository indexer: builds index
- Repository indexer → Code index: stores chunks
- CLI commands → Code index: loads index
- CLI commands → Violation correlation: correlates violations
- Violation correlation → Result reranker: retrieves code
- Result reranker → Code index: queries
- CLI commands → Grounded Q&A: asks question
- Grounded Q&A → Result reranker: retrieves evidence
- Grounded Q&A → Model clients: requests answer
- Result reranker → Model clients: judges candidates
- Repository indexer → Model clients: embeds chunks
- Model clients → Privacy guard: guards requests
- Privacy guard → Ollama: permits local calls
- Privacy guard → Anthropic API: permits opt-in calls
- CLI commands → CLI output: prints results
