# Data model

> The tables the registry keeps in Postgres, and what lives in storage.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://skills.docs.sypnia.com/architecture/data-model/

For agents: Postgres schema sypnia_skills: publishers (handle, kind person|org, account/org id, verified_domain), publisher_members (publisher, account, role publisher|admin), skills (id, publisher, name, description, visibility listed|unlisted|private, kind, homepage, repository, created_at), versions (skill, version semver, state checking|refused|in-review|listed|yanked|removed, sha256, size, manifest jsonb, touches jsonb, signature, key_id, provenance jsonb, yank_reason, published_by, created_at), findings (version, check, file, line, message, severity), reviews (version, reviewer, decision, notes, at), tokens (publisher, name, scopes, hash, expires_at, last_used_at), trusted_publishers (skill, host, repo, branch, workflow), reports (skill, version, reporter, reason, state), install_counts (skill, version, day, count), keys (id, public_key, from, until). Storage: packages/<publisher>/<name>/<version>-<sha256>.tar.gz (immutable), uploads/ (temporary, 24 h). No personal data in install counts.

The registry keeps its records in a Postgres schema, `sypnia_skills`, and the packages in storage.

| Table                | Holds                                                                                                                |
| -------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `publishers`         | handle, whether a person or an organization, its account or organization, verified domain                            |
| `publisher_members`  | who holds the publisher or admin role of an organization's publisher                                                 |
| `skills`             | publisher, name, description, visibility, kind, homepage, repository                                                 |
| `versions`           | version, state, SHA-256, size, the manifest, `touches`, signature and key, provenance, yank reason, who published it |
| `findings`           | the result of each check: check, file, line, message                                                                 |
| `reviews`            | the reviewer, the decision and its notes                                                                             |
| `tokens`             | name, scopes, a hash of the token (never the token), expiry, last use                                                |
| `trusted_publishers` | the repositories, branches and workflows allowed to publish a skill                                                  |
| `reports`            | reports from people, and what was done                                                                               |
| `install_counts`     | installs per skill, version and day; no people, no addresses                                                         |
| `keys`               | the public signing keys and the dates each is valid                                                                  |

## Storage

| Path                                                    | What it is                                           |
| ------------------------------------------------------- | ---------------------------------------------------- |
| `packages/<publisher>/<name>/<version>-<sha256>.tar.gz` | a version's package; written once, never overwritten |
| `uploads/`                                              | packages being published; deleted after 24 hours     |
