# A.R.K.A. Architecture (EN)

> Technical overview of the TCP: A.R.K.A. node and its link to The Cyber Prepper
> (TCP) methodology. Lithuanian version: [`architektura.md`](architektura.md).

## 1. Concept: from "Zero Trust" to "Zero Connectivity"

TCP teaches everyday cyber resilience via **15 controls** across **three layers**:

| Layer | Everyday (TCP) | Crisis (A.R.K.A.) |
|---|---|---|
| **Perimeter** | External internet, segmentation | Collapses → replaced by *mesh* comms |
| **System** | Servers, cloud, backups | Unreachable → replaced by the local node |
| **Human** | Identity, habits | **Remains — the A.R.K.A. core** |

A.R.K.A. is **TCP step 6 – "Survive"**, following *Identify → Isolate → Harden → Monitor → Recover*.

## 2. Components

```
arka/
├── app/      Backend (Node + Express + TypeScript)
│   └── src/  server.ts, config.ts, types.ts, data/, services/, routes/
└── web/      UI (Vite + React 19 + Tailwind v4 + TanStack Query)
    └── src/  i18n/, lib/api.ts, components/, pages/
```

The service layer (`services_service`, `knowledge_service`, `ai_service`) is kept
deliberately light, so the node runs on modest hardware.

## 3. Data flow (AI assistant)

1. User asks a question in the UI (`Assistant.tsx`).
2. `POST /api/ai/chat` → `ai_service`.
3. `knowledge_service.search()` retrieves the 3 most relevant entries (RAG context).
4. Context + system prompt go to a local **OpenAI-compatible** LLM (Ollama / LM Studio / llama.cpp).
5. If the LLM is **unreachable**, a fallback answer is returned straight from the
   knowledge base — first digital aid works even without a model.

Answers are tagged with their sources and mode (`llm` / `fallback`), reflecting the
TCP principle of "evidence over assumptions".

The Command Center reports live host telemetry: memory, filesystem usage, host
uptime and A.R.K.A. process uptime.

## 4. Privacy & security

- **Zero telemetry.** Runs air-gapped; no internet required.
- The only outbound link is back to the TCP portal (informational).
- Per TCP philosophy, no authentication in the MVP; control LAN access at the
  network layer.
- Docker Compose binds port 8080 to `127.0.0.1` by default.

## 5. License and concept origin

A.R.K.A. is distributed under Apache License 2.0 and does not use QGPL. Project
N.O.M.A.D. was used as a workflow and concept reference; attribution is retained
in the `NOTICE` file.

## 6. Roadmap

- Vector search (Qdrant) instead of keyword matching.
- ZIM/PDF archive import into the knowledge base.
- Real mesh (LoRa) comms module.
- Encrypted vault backend.
- Live module status from Docker containers.
