# How it works

> From a push to a reviewed, deployed change, and where each part runs.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://git.docs.sypnia.com/start/how-it-works/

For agents: Flow: git push (SSH ssh.git.sypnia.com or HTTPS git.app.sypnia.com) → the git engine (Forgejo) stores the objects and runs hooks → Sypnia's layer checks protection rules, reads Case: trailers, emits events → Run builds a preview, webhooks fire, Cases links commits to cases → a pull request is reviewed and merged → Run deploys (production needs approval) → mirrors are updated.

**Figure**: Sypnia Git. Plain git in and out; Sypnia's layer adds your account, the links to use cases, Run and the mirrors.

1. You push with any git client, over SSH or HTTPS, or work in the browser.
2. Sypnia's layer checks who you are and the branch's rules.
3. The git engine stores the commits; repositories live on disk, backed up to S3.
4. Events go to Run (a preview), Cases (commits per case) and your webhooks.
5. Mirrors to GitHub are updated.

### 1. You push

`git push` over SSH or HTTPS, with an SSH key, a token, or your Sypnia session through the CLI.

### 2. The rules are checked

A protected branch refuses force-pushes and direct pushes; a pull request needs its reviews and checks.

### 3. Each commit says its case

A `Case: place-order` trailer links the commit to its use case in Cases, so the case shows the code that built it.

### 4. A preview is built

Sypnia Run builds the branch and posts a status check with the preview's address.

### 5. Review and merge

Comments on lines, approvals, required checks; then merge, squash or rebase.

### 6. Deploy and mirror

A merge to `main` can deploy with Run (production asks first), and the GitHub mirror is updated.
