Visit history File

Storage file for visit events

Visit history File: contains the data to power Visit history Feature (in short this file contains the timestamps of when you visited particular note).

Visit history file path contains the note id in the file name. Therefore, we do NOT need to duplicate the note id in the events that we store.

The contents of the visit history file are in compact text format with the following structure per line:

Line Structure (VisitPair format)

<FOCUS_TIMESTAMP_MILLIS>:<DURATION_MILLIS>
  • FOCUS_TIMESTAMP_MILLIS: When the FOCUS - Visit Event event occurred (milliseconds since epoch).
  • DURATION_MILLIS: How long the visit lasted (milliseconds).

Each line represents a complete visit (a FOCUS followed by UNFOCUS).

Example content

1753911954503:4597
1753912000000:60000

This translates to:

  • 1753911954503:4597: Visit started at timestamp [1753911954503], lasted [4597] ms (~4.6 seconds)
  • 1753912000000:60000: Visit started at timestamp [1753912000000], lasted [60000] ms (1 minute)

Stored transparently

Per Transparent Data Model, we use a human-readable format to store data in a transparent (non-proprietary) way. We opted away from JSONL to keep files compact while retaining human readability and ease of parsing, so you can see what is being recorded and parse it if you desire.

Future-proof parsing guidance

Future-proof parsing guidance

If you're parsing this data, you can future-proof your implementation by expecting additional fields to be added after the current ones, separated by the : delimiter.

In future versions, we may extend the data recorded per visit:

1753911954503:4597:<some-new-data>:<additional-field>

Simple future-proofing strategy:

  1. Take one line
  2. Split on : delimiter to get tokens
  3. Read tokens[0] (focus timestamp) and tokens[1] (duration)
  4. Ignore any additional tokens beyond index 1

This ensures your parser continues working even as new fields are added.

Location

$HOME/
  .thorg/
    usr/
      {user_name}/
        qc/
         h/
            vh2/
              vaultid_{vault_id}/
                {machine_name}/
                  {note-id}.note_visit_log
  • $HOME/ - Your user directory.
  • .thorg/ - Thorg directory under your home folder ($HOME/.thorg (Directory)).
  • usr/ - Stands for split by thorg username.
  • {user_name}/ - Thorg Username (Concept)
  • qc/ - Stands for quick changing.
  • h/ - Folder stands for history.
  • vh2/ - Folder stands for visit history v2.
  • vaultid_{vault_id}/ - vault Id
  • {machine_name}/ - Machine Name
    • Machine name exists to prevent merge conflicts when you share your visit history for the same user across multiple machines.
  • {note-id}.note_visit_log - Visit log for the Note, indexed by note_id.

Recommendation

Per Back up $HOME/.thorg, this directory is a descendant of $HOME/.thorg and is recommended to be under source control.

If you're already backing up (e.g., source controlling) $HOME/.thorg, then this directory is already backed up as well as a descendant of $HOME/.thorg. If not, it's highly recommended to backup/source control $HOME/.thorg per Back up $HOME/.thorg.


Children
  1. Visit History file Location - (Where visit history data is written to)
  2. Visit history file Content Format

Backlinks