# What is Software Heritage, and can it show when code existed?

Source: https://codelifter.com/forum/posts/what-is-software-heritage-and-can-it-show-when-code-existed/
Site: CodeLifter Forum, category Code provenance
Published: 2026-11-16. Updated: 2026-11-16. Replies: 1.

## Question by CodeLifter editors (staff), 2026-11-16

Software Heritage is a non-profit archive, started by Inria in 2016, that collects publicly available source code with its full history. It can show that code existed by a given date: each archive visit to a repository is recorded. The commit dates inside the code are copied as written, so they prove nothing on their own.

## What is Software Heritage?

The project's [mission page](https://www.softwareheritage.org/mission/) states its aim plainly: "to collect, preserve, and share all software that is publicly available in source code form." Its [FAQ](https://www.softwareheritage.org/faq/) adds that it is "an open, non-profit initiative unveiled in 2016 by Inria", run "in collaboration with UNESCO", and that it crawls git repositories from GitHub, GitLab, Bitbucket and other forges, plus Subversion and Mercurial repositories and packages from Debian, PyPI, CRAN and npm.

Three properties matter for provenance:

- **It keeps code after the original is gone.** The FAQ answers "If I delete the repository that contains my code, will the data stay in SWH?" with "Yes, all software source code artifacts are preserved for the long-term."
- **It does not filter.** The archive takes "anything that we can get hold of", without checking licences first.
- **It keeps history.** The mission page says it stores each project's "full development history", not only the latest files.

## What is a SWHID?

A SWHID (SoftWare Hash IDentifier) is the archive's permanent name for a piece of code. [SWHID.org](https://www.swhid.org/) says the scheme was adopted as the international standard ISO/IEC 18670:2025 on 23 April 2025, and describes SWHIDs as "persistent, intrinsic identifiers". Intrinsic means the identifier is computed from the code itself, not assigned by a registry, so anyone with the same bytes gets the same identifier.

The [specification's clause on core identifiers](https://www.swhid.org/swhid-specification/v1.2/5.Core_identifiers/) defines five object types:

| Prefix | Identifies | Includes |
| --- | --- | --- |
| `swh:1:cnt:` | A file's contents | The bytes only, "no file *name*" |
| `swh:1:dir:` | A directory | Entry names, permissions and the identifiers of what it contains |
| `swh:1:rev:` | A commit (revision) | Root directory, parents, author, committer, timestamps, message |
| `swh:1:rel:` | A release (annotated tag) | Name, target, optional author and message |
| `swh:1:snp:` | A snapshot | Every branch and where it pointed when the archive visited |

The same clause notes that content, directory, revision and release identifiers are computed the way Git computes its own object IDs, so for a file today `git hash-object path/to/file` gives the hash that follows `swh:1:cnt:`. The spec warns that this Git compatibility is "incidental" and not guaranteed in future versions.

## Can it show when code existed?

Partly, and it is important to separate two kinds of date.

**Visit dates are recorded by the archive.** The FAQ describes an API that "allows you to list the times Software Heritage visited the repository, and get the snapshot associated with each visit." If a snapshot from a visit on a given day contains a file, that file existed in that public repository by that day, recorded by a third party rather than by you. The snapshot section of the spec confirms what a snapshot is: a record of all branches "and where each of them was pointing at the time".

**Commit dates are copied from the repository.** A revision's author and committer timestamps are part of the commit itself, which the spec lists as data supplied with the commit. The FAQ says Save Code Now preserves "the development history and commit dates and messages". The archive keeps those dates faithfully, but it did not witness them. A commit claiming 2015 that first appears in an archive visit in 2026 shows only that the code existed by 2026. The spec describes timestamps as metadata that is "automatically synthesized" when the commit is made, which means by the committer's own software and clock.

So the useful evidence is the earliest visit whose snapshot contains the code. If you need that date to be early, archive early.

## How do you get your code archived?

The FAQ gives two routes: wait for the regular crawl of popular forges, or trigger it yourself with **Save Code Now** from the archive's web interface (or the "Save again" button on an archived repository). It says ingestion "is usually completed in a few minutes, depending on the size of the repository." Larger projects and research software can also go through a deposit API.

Some practical steps:

1. Push the code to a public repository first; the archive only collects public code.
2. Use annotated tags (`git tag -a v1.0`) for releases. The FAQ notes that lightweight tags do not appear in the archive's Releases tab, though they are still saved as branches.
3. Add a licence file and, if you like, a `codemeta.json` description, which the FAQ says is indexed.
4. After archival, copy the SWHID from the "Permalinks" tab and put it in your [provenance record](https://codelifter.com/provenance/provenance-record/).

## What can it not tell you?

It cannot tell you who wrote the code or whether a person or a model produced it. The author field is whatever the committer typed. It also cannot see private repositories or code that was never pushed anywhere public. And a file appearing in two archived projects shows only that the same bytes exist in both; the visit dates suggest which came first, not who copied whom. The [seed thread on proving you wrote code](/forum/posts/can-you-prove-you-wrote-a-piece-of-code-yourself/) covers the other records you can combine with an archive date.

Checked on 12 November 2026.

## Short version

- Software Heritage is a non-profit archive of public source code and its history, started by Inria in 2016.
- SWHIDs are content-based identifiers, now ISO/IEC 18670; the same bytes always give the same ID.
- Archive visit dates are independent evidence that code existed by that date.
- Commit dates inside the archive are copied from the repository and can be set to anything.
- Use Save Code Now early if you may need to show when your code existed.

## Reply 1 by CodeLifter editors (staff), 2026-11-16

**Can Software Heritage help when a detector flags old code as AI-written?** It can help with the date, which is often the real question. If the code sat in a public repository that the archive visited before AI coding assistants were widely available, a snapshot from that visit shows the code existed then, and that record was made by the archive, not by you. The [Software Heritage FAQ](https://www.softwareheritage.org/faq/) describes how to list an origin's visits and the snapshot taken at each one, and how to get a SWHID with context from the "Permalinks" tab, which you can hand to whoever raised the flag.

Check what the snapshot actually contains. A repository's later commits can carry earlier dates, so look for the earliest visit whose snapshot includes the file, and quote that visit date rather than the commit date. The core content identifier (`swh:1:cnt:`) is computed from the file's bytes alone, so if you changed even a character since then, the IDs will differ; compare the directory or file at the archived revision, not your current copy.

The [seed thread on 2019 code flagged as AI](/forum/posts/a-detector-flagged-code-written-in-2019-as-ai-what-now/) covers the rest of the response. An archive date does not show who typed the code, but it does rule out a model that did not exist yet.

---
Cite as: CodeLifter Forum, "What is Software Heritage, and can it show when code existed?", https://codelifter.com/forum/posts/what-is-software-heritage-and-can-it-show-when-code-existed/, accessed 2026-11-17.
