# The Anky Protocol

_Last updated: 2026-05-12_

Anky is a local-first protocol for private daily writing.

The protocol is not the token. The protocol is not a market. The protocol is the file.

The small version is:

```text
write on the phone
  -> save exact .anky bytes locally
  -> hash those exact bytes
  -> keep the writing yours
```

Everything else is downstream.

Source anchors:

- Mobile `.anky` parser and hash code: <https://github.com/jpfraneto/anky-monorepo/blob/main/apps/anky-mobile/src/lib/ankyProtocol.ts>
- Mobile local storage: <https://github.com/jpfraneto/anky-monorepo/blob/main/apps/anky-mobile/src/lib/ankyStorage.ts>
- Optional reflection endpoint handler: <https://github.com/jpfraneto/anky-monorepo/blob/main/src/routes/mobile_sojourn.rs>
- Anky coins memetic layer: <https://www.anky.app/ankycoin>
- Privacy policy: <https://www.anky.app/privacy-policy.md>

---

## 1. The Protocol Claim

Anky's claim is simple:

```text
A local .anky writing rite happened and produced exact bytes B.
sha256(B) = H.
```

That is the root of the system.

The file is the private artifact. The hash is the integrity handle. The user decides whether anything else happens after that.

This protocol does not need a token to be valid. It does not need a public market to be valid. It does not need a server to read the writing. It does not claim that a hash encrypts the writing. It does not establish personhood, authorship, originality, literary quality, or human exclusivity.

The modesty is the point. Privacy depends on narrow public claims and strong private ownership.

---

## 2. The `.anky` File

A writing session is a UTF-8 text file. It records accepted forward keystrokes and their timing.

The first line stores the Unix epoch millisecond timestamp of the first accepted character. Later character lines store elapsed milliseconds since the previous accepted character. Typed spaces are encoded as the exact ASCII token `SPACE`. The file closes with the exact terminal line `8000`.

```text
{epoch_ms} {character_or_SPACE}
{delta_ms_0000_to_7999} {character_or_SPACE}
{delta_ms_0000_to_7999} {character_or_SPACE}
8000
```

Canonical rules:

- The file is UTF-8.
- Line endings are LF only: `\n`.
- There is no byte order mark.
- The terminal line is exactly `8000`.
- Nothing follows the terminal line.
- The first line uses an epoch millisecond integer.
- Subsequent deltas are zero-padded 4-digit integers from `0000` to `7999`.
- Backspace, delete, enter, paste, arrow-key editing, and post-hoc editing are outside the canonical writing stream.

Example:

```text
1712345678000 h
0204 e
0187 l
0143 l
0198 o
0301 SPACE
0089 w
8000
```

This reconstructs to:

```text
hello w
```

The prose is in the file. The timing is in the file. The start time is in the file. That is why the exact bytes matter.

---

## 3. The Hash

The session hash is:

```text
session_hash = sha256(exact_raw_utf8_bytes_of_the_.anky_file)
```

Do not normalize line endings before hashing. Do not trim whitespace. Do not hash reconstructed prose. Do not hash parsed JSON. Do not hash a transformed representation.

The canonical filename may be:

```text
{session_hash}.anky
```

Local integrity verification is:

```python
sha256(open(filepath, "rb").read()).hexdigest() == basename_without_dot_anky
```

If that holds, the file still matches the committed bytes. If it fails, either the file changed or the filename is not the hash.

---

## 4. Local-First Storage

The current mobile app stores `.anky` files and sidecars in the app document directory. The `.anky` file is upstream. Sidecars are downstream.

Local sidecars can include:

```text
{hash}.reflection.md
{hash}.processing.json
{hash}.conversation.json
{hash}.image.png|jpg|webp
```

Sidecars may be deleted or regenerated. The `.anky` bytes are the canonical practice artifact.

Writing is free and local. Credits pay for optional processing that asks a server or model to produce something from the writing, such as a reflection or a keep-writing conversation. Credits do not buy the right to write, save, hash, or keep the file.

---

## 5. Local Identity

The current mobile app uses a seedphrase-first identity model.

The app creates or loads a local seed phrase, stores it through device secure storage, derives a cryptographic keypair locally, and uses that keypair for local signatures and app actions. The backend does not need the seed phrase.

The seed phrase itself must never be sent to Anky.

Identity is not the writing. It is an account layer around the writing. The `.anky` file remains the canonical artifact even when account systems change.

---

## 6. The Memetic Layer

`$ANKY` is the memetic layer.

It points at the practice, but it does not define the practice. It does not unlock writing. It does not make an `.anky` valid. It does not give Anky ownership of the user's words. It does not turn private writing into public content.

The token page says this directly:

```text
$ANKY is the memetic layer.
it does not unlock the practice.
```

A memecoin is a public symbol for an idea. The `.anky` protocol is the private practice that the symbol points toward.

Those layers should not be confused.

---

## 7. Optional Processing

Reflection and keep-writing are optional app features. They are not required by the protocol.

When the user explicitly asks for reflection, the app sends the `.anky` bytes to:

```text
POST /api/mobile/reflections
```

The backend validates that the supplied bytes hash to the supplied `sessionHash`, reconstructs readable text for processing, charges the relevant credits, and stores derived artifacts and job metadata. The raw `.anky` bytes are processing input, not the canonical server record.

When the user asks to keep writing with Anky, the app sends the current `.anky` context and conversation message to the thread endpoint used by the mobile client. That is also optional processing.

These processing paths are the privacy boundary where plaintext can leave the phone. They should be explicit, paid for with credits when applicable, and understandable to the user. They are not needed to save, hash, or keep a session.

---

## 8. What Anky Does Not Claim

Anky does not claim:

- The hash encrypts the writing.
- A token unlocks the practice.
- A market validates the practice.
- A server needs plaintext for the protocol to work.
- Optional processing is required.
- Old repository experiments describe the current app.

Anky does claim:

- The `.anky` file is the canonical private artifact.
- The hash commits to exact bytes.
- The phone can keep the writing local by default.
- Writing is free.
- Plaintext processing should be opt-in and bounded.
- `$ANKY` is a public meme for the practice, not the practice itself.

---

## 9. Direction

The old internet made private human expression easy to capture and hard to keep sovereign.

Anky is trying to invert that.

The writing should belong first to the person who wrote it. Public symbols can point at the practice, but they should not swallow it. The protocol is valuable only if it preserves the boundary: private interior life on the device, optional processing only when the user asks, and a memetic layer that remains honest about what it is.

Privacy here is not a marketing feature. It is the shape of the protocol.
