> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sonaragent.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

> Read-only, non-custodial by design

Sonar's pipeline is strictly **read-only** and **non-custodial** — no wallet connection, no private keys, no transaction signing of any kind.

```
Stacks Mainnet
└── Zest Protocol v2 (pool-borrow-v2-3, stx-btc-oracle-v1-4)
    └── Hiro API (read-only, no auth)
        └── Sonar backend
            ├── 1. Read on-chain state (collateral, debt, oracle price)
            ├── 2. Compute health factor off-chain
            └── 3. Alert via Telegram (plain-English risk summary)
                └── User notification
```

<Note>
  The system only ever reads public on-chain state. It cannot move funds, sign transactions, or interact with any wallet. Sonar requires only a Stacks address to monitor.
</Note>

## Components

<CardGroup cols={3}>
  <Card title="Read layer" icon="book-open">
    Clarity contract read-only calls via the Hiro public API. `@stacks/transactions` handles Clarity encode/decode.
  </Card>

  <Card title="Compute layer" icon="calculator">
    Off-chain health-factor computation, wired live into the dashboard via `/api/positions`.
  </Card>

  <Card title="Alert layer" icon="paper-plane">
    A Node service (Telegram bot + monitor) that watches positions and notifies on threshold breach.
  </Card>
</CardGroup>
