# Installation
ASR is built from this Rust workspace.
## Required Tools
```txt
rustup
cargo
git
sqlite3 system library
```
macOS:
```bash
xcode-select --install
```
Debian/Ubuntu:
```bash
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libsqlite3-dev git curl
```
## ASR-first Installer
For operator installs, use the ASR installer:
```bash
scripts/install-asr.sh
```
The installer first looks for an `asr-<tag>-<target>.tar.gz` release asset and
falls back to `cargo install --path` when it is running from a local ASR
checkout. If no local checkout is available, it falls back to the crates.io
package:
```bash
cargo install agent-source-repository
```
It runs an ASR smoke test against a temporary Git repository after installation.
To force local checkout installation:
```bash
ASR_INSTALL_METHOD=path ASR_SOURCE_PATH=/path/to/ASR scripts/install-asr.sh
```
To require a release asset and fail if it is missing:
```bash
ASR_INSTALL_METHOD=binary scripts/install-asr.sh
```
## ASR_HOME
Default:
```txt
~/.asr
```
For isolated runs:
```bash
export ASR_HOME=$(mktemp -d)
```
ASR writes only under `ASR_HOME`:
```txt
ASR_HOME/
asr.sqlite
index/exact/<repo>/manifest.json
index/exact/<repo>/chunks.jsonl
index/exact/<repo>/postings.tsv
repos/
cache/
```
The exact shard files are a rebuildable cache. The SQLite chunk snapshot is the
source of truth.
Boundary rules:
```txt
ASR_HOME must not be inside any Git worktree.
Registered source repositories must not be inside ASR_HOME.
ASR must not write generated state into source repositories.
```
## Local Smoke
```bash
ASR_HOME=$(mktemp -d)
cargo run --bin asr -- init --json
cargo run --bin asr -- repo add app /path/to/checkout --json
cargo run --bin asr -- repo index app --json
cargo run --bin asr -- read app src/example.rs --lines 1:20 --json
cargo run --bin asr -- verify app --json
```
`read`, `deps`, and `impact` require a fresh indexed snapshot by default. Use
`--live` only when intentionally inspecting the current registered source without
snapshot binding.