Toto Tvalavadze11 downloadsRecord, view, and edit metrics in Obsidian in plain text / json files

File-first metrics for Obsidian that keep *.metrics.ndjson as the source of truth.
Metrics is an Obsidian plugin for viewing and editing canonical *.metrics.ndjson files inside your vault. It gives you a compact timeline, inline validation, cross-file search, filtering, grouping, summaries, and charts without introducing a hidden database or cache layer.
The goal is to make metrics feel like normal vault data instead of app-owned state:
metric:<id>Metrics currently targets Obsidian 1.6.0+.
For a local install:
npm install
npm run build
Then copy these files into your vault plugin folder:
.obsidian/plugins/metrics-lens/
├── manifest.json
├── main.js
└── styles.css
After that, enable Metrics in Obsidian's community plugins screen.
Each line in a metrics file is one JSON object.
Required fields:
idtskeyvaluesourceOptional fields:
dateunitorigin_idnotecontexttagsExample:
{"id":"01JV7RK8Q4X60M0E2N0A6QK61V","ts":"2026-04-14T08:30:00+04:00","key":"body.weight","value":105.6,"unit":"kg","source":"withings"}
{"id":"01JV7RM60M9X1Y9G7TWJ3CF8ES","ts":"2026-04-14T09:10:00+04:00","key":"nutrition.energy_intake","value":720,"unit":"kcal","source":"manual","note":"breakfast"}
Default conventions:
Metrics/*.metrics.ndjsonMetrics/All.metrics.ndjsonmetric:Validation behavior:
id values are treated as errors and block safe record mutationsCurrent command set:
Open current file
Open view
Search
Add record to current file
New file
Rename current file
Delete current file
Assign missing ids in current file
Record-level copy, edit, and delete actions are available from the timeline row menu.
The plugin includes a small settings pane for vault-level conventions:
The first-party catalog lives in src/metric-catalog.json.
It drives:
Unknown keys remain allowed by the file contract so the plugin stays file-first and user-extensible.
Custom catalog entries are stored in this plugin's per-vault settings as a versioned JSON object. The plugin merges custom entries over the built-in catalog and uses the merged catalog for validation warnings, labels, unit formatting, icons, and record modal suggestions.
The settings tab includes structured editors for custom metrics and custom units. Rows with catalog-related validation warnings also include catalog actions in the row menu, so an unknown metric can be added directly from the flagged record.
The advanced JSON editor stores only the custom delta:
{
"schemaVersion": 1,
"categories": {
"training": {
"label": "Training",
"iconCandidates": ["activity"]
}
},
"metrics": {
"training.run_distance": {
"label": "Run distance",
"category": "training",
"allowedUnits": ["km"],
"defaultUnit": "km",
"fractionDigits": 2,
"iconCandidates": ["activity"]
}
},
"units": {
"serving": {
"label": "Serving",
"display": "serving",
"aliases": ["servings"],
"fractionDigits": 1
}
}
}
New metrics require label, category, and at least one allowedUnits entry. New units and categories require label. Existing built-in entries can be partially overridden by key.
Install dependencies and start watch mode:
npm install
npm run dev
Build once:
npm run build
Run type-checking:
npm run check
For local vault development, place the built plugin in:
.obsidian/plugins/metrics-lens
Releases are published by GitHub Actions when you push a bare semantic version tag that matches manifest.json.
npm run check
npm run build
git tag 0.6.1 # replace with the manifest version
git push origin 0.6.1
Do not use a v prefix. Obsidian requires the GitHub Release tag to exactly match the version in manifest.json.
The release workflow validates the tag, manifest.json, and package.json, builds the production bundle, generates artifact attestations, writes categorized release notes from conventional commit messages, and uploads the Obsidian release assets:
manifest.jsonmain.jsstyles.css