<div align="center">

# NIDHI

**A private record vault.** Records, folders, tags and links between them — offline, in one HTML file, on your disk.

[![licence](https://img.shields.io/badge/licence-PolyForm%20Noncommercial%201.0.0-7a2e2e?style=flat-square)](LICENSE)
[![offline](https://img.shields.io/badge/network-none%20of%20its%20own-2e7d32?style=flat-square)](#what-it-will-not-claim)
[![telemetry](https://img.shields.io/badge/telemetry-none-2e7d32?style=flat-square)](#what-it-will-not-claim)
[![single file](https://img.shields.io/badge/single%20file-171%20KB-b8862b?style=flat-square)](dist/index.html)
[![languages](https://img.shields.io/badge/languages-EN%20%2F%20HI%20%2F%20GU-6e6e6e?style=flat-square)](#the-app)
<!-- checks-badge -->
[![checks](https://img.shields.io/endpoint?url=https%3A%2F%2Fdrsamonline.github.io%2FNIDHI%2Fdocs%2Fbadge.json)](AUDIT_REPORT.md)
<!-- /checks-badge -->

**[Open the vault](https://drsamonline.github.io/NIDHI/play/)** · [Live site](https://drsamonline.github.io/NIDHI/) · [One file](dist/index.html) · [Docs](docs/ARCHITECTURE.md) · [Claims](CLAIMS.md) · [Roadmap](ROADMAP.md)

</div>

![The records view](docs/shot-records.png)

---

## What it is

Nidhi is a place to keep the things you would otherwise scatter across notes apps,
spreadsheets and a folder of text files. A record has a title, some text, a folder
and tags, and it can link to another record by name. That is the whole data model,
and it is deliberately the whole data model — a vault you have to design is a
vault you stop using.

Four views sit on top of the same records:

| View | What it does | Built on |
|---|---|---|
| **Records** | The list, folder chips, ranked search as you type, the editor with live backlinks | search-kit |
| **Review** | Every learning record is a flashcard; SM-2 decides what is due | srs-kit |
| **Health** | Health records as a dated timeline with a severity trend | case-kit |
| **Money** | Double-entry bookkeeping in integer paise; an unbalanced entry cannot be posted | app-ledger's rule |

And two things that cut across them:

- **Filing suggestions** — press *Suggest* in the editor and the vault proposes a
  folder and tags from records you already have, naming what it compared you
  against (ml-kit, tf-idf + cosine). It never files anything itself.
- **Sync, optionally** — two devices on your own Wi-Fi exchange records through a
  small host you start yourself. No internet, no account, and the host stores
  nothing (lan-kit).

## Quick start

**Nothing at all.** Open <https://drsamonline.github.io/NIDHI/play/> — the hosted
app, served over https, where sealing works and the browser will offer to install
it. Records stay in that browser's storage on your device.

**One file.** Download [`dist/index.html`](dist/index.html) and open it. Everything
is inlined, it works with the network off, and it needs no install.

**From a checkout.** This gives you sealing, because `localhost` is a secure
context and `file://` is not:

```bash
git clone https://github.com/drsamonline/NIDHI.git
cd NIDHI
python3 -m http.server 8080
# → http://localhost:8080/play/
```

**Two devices.** On one machine:

```bash
node tools/sync-host.js --pin 4821
```

Then **Sync** in the app on both, pointing at the address it prints.

## The optional model

Nidhi works completely without one, and ships with it off. If you turn one on in
**✦ Model**, the editor grows a **Draft from text** button that reads the record
and proposes a title, tags and a folder. The proposal is checked against the same
rules the editor enforces — a folder outside the list is refused, tags are cleaned
by the model's own rules — so a bad answer changes nothing.

| Provider | Key | Network | What leaves the device |
|---|---|---|---|
| Off | — | — | nothing |
| Ollama on this machine | none | localhost | nothing leaves the machine |
| Your own key (OpenAI-compatible) | yes | yes | the text of the record you are drafting |
| lm-kit, in this tab | none | none | nothing |

The fourth is the fleet's own [lm-kit](https://github.com/drsamonline/lm-kit):
44 KB of WebAssembly and a 1.1 MB checkpoint, run from this repository. It is the
1.08 M **demo** model — its JSON is well formed and its values are mostly wrong,
which is what its own README says — so it is offered as a demonstration that the
pipeline runs, and it is deliberately *not* wired to the draft button.

## What it will not claim

Every one of these is in the product's own words, not a disclaimer bolted on:

- **It is not conflict-free.** Two devices merge newest-wins per field, tags
  unioned. Simultaneous edits to the same record resolve to the newer text and a
  line in the log. There is no CRDT here.
- **It does not read receipts, and cannot hold one yet.** No OCR, and no attachments at
  all — you type the figure. Attachments are on the [roadmap](ROADMAP.md).
- **It is not quantum-resistant.** AES-256-GCM with a passphrase. A post-quantum
  KEM solves key exchange over a channel; there is no channel here.
- **The sync PIN gates writing, not reading.** The event stream is open to anyone
  who can reach the host. lan-kit is built that way and the app says so.
- **It publishes no test total.** Each suite is counted separately, with the date
  it ran, in [`AUDIT_REPORT.md`](AUDIT_REPORT.md). Numbers from different suites
  are never added together.

[`CLAIMS.md`](CLAIMS.md) pairs every public claim with the check that supports it,
and the test runner fails if a claim names a check that does not exist.

## Documentation

| Document | What is in it |
|---|---|
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | The five layers, the data flow, why the domain is pure, what is deliberately absent |
| [docs/DATA.md](docs/DATA.md) | The record schema, sealed records, tombstones, the export format, the three merge paths, money in paise |
| [docs/SYNC.md](docs/SYNC.md) | The room, the protocol, what the PIN does and does not protect, what sync is not |
| [docs/DEVELOPING.md](docs/DEVELOPING.md) | Requirements, the loop, building the single file, adding a view, the claims gate, house rules |
| [SETUP.md](SETUP.md) | Installing and running it on Windows, macOS, Linux, Android and iOS, with troubleshooting |
| [CLAIMS.md](CLAIMS.md) | Every claim, and the check behind it |
| [AUDIT_REPORT.md](AUDIT_REPORT.md) | Generated by `tools/run-tests.sh` — never edited by hand |
| [ROADMAP.md](ROADMAP.md) | Everything that is missing, wrong or merely unbuilt — with an id, a reason and a done-when |
| [SPEC.docx](SPEC.docx) | The build specification this was built from |

## Built from the fleet

Nidhi is the 188th repository in [drsamonline](https://github.com/drsamonline) and
reuses it rather than reinventing it. Every kit below is vendored in `kits/`,
unmodified, with its licence.

| Kit | What it supplies |
|---|---|
| [web-kit](https://github.com/drsamonline/web-kit) | Storage, theme, and English / Hindi / Gujarati |
| [search-kit](https://github.com/drsamonline/search-kit) | The inverted index and tf-idf ranking behind search |
| [ml-kit](https://github.com/drsamonline/ml-kit) | tf-idf and cosine for the filing suggestions |
| [srs-kit](https://github.com/drsamonline/srs-kit) | SM-2 scheduling for review |
| [case-kit](https://github.com/drsamonline/case-kit) | The timeline and summary behind the health view |
| [crypto-kit](https://github.com/drsamonline/crypto-kit) | AES-256-GCM and PBKDF2 for sealing a record |
| [lan-kit](https://github.com/drsamonline/lan-kit) | The room behind optional two-device sync, and its host |

## Checks

```bash
./tools/run-tests.sh          # everything, and rewrites AUDIT_REPORT.md
node tests/test-nidhi.js      # the record model
node tests/test-suggest.js    # filing suggestions
node tests/test-modules.js    # cards, health timeline, ledger
node tests/test-sync.js       # merge rules + a real host round trip over HTTP
python3 tools/build.py        # dist/index.html
python3 tools/verify.py write && python3 tools/verify.py check
python3 tools/snapshot.py
```

The browser checks — layout, the editor, suggestions, the conflict review,
grading, the money form, and two devices syncing — live in `tools/e2e.js` and
`tools/e2e-sync.js`. They need `puppeteer-core` and are not part of the runner,
which must stay dependency-free. See [docs/DEVELOPING.md](docs/DEVELOPING.md).

## Layout

```
index.html            the landing page
play/index.html       the app (loads kits/ and src/ separately)
dist/index.html       the same app, everything inlined — one file, no requests
src/
  nidhi.js            the record model: records, links, export, merge
  suggest.js          filing suggestions over ml-kit
  cards.js            learning cards over srs-kit
  timeline.js         the health timeline over case-kit
  ledger.js           double-entry bookkeeping, integer paise
  sync.js             merge rules, the wire format, the lan-kit wrapper
  app.js              the views and the wiring — the only file that touches the DOM
  app.css             layout, on web-kit's design tokens
kits/                 vendored kits, unmodified, with their licences
tests/                node tests for everything in src/
tools/                build, integrity, snapshot, sync host, test runner, e2e
docs/                 architecture, data, sync, developing, screenshots
```

## Support

Free, offline, accountless — and staying that way.

| | |
|---|---|
| UPI (India) | `drsohilboi@ybl` — payee Dr Sohil Momin, open amount |
| GitHub Sponsors | [github.com/sponsors/drsamonline](https://github.com/sponsors/drsamonline) |
| Ko-fi | [ko-fi.com/matneo](https://ko-fi.com/matneo) |
| My books | [Amazon author store](https://www.amazon.com/stores/author/B08ZT331LY/allbooks) |
| More apps | [drsamonline.github.io](https://drsamonline.github.io/) |
| Email | [sohilmomin2000@gmail.com](mailto:sohilmomin2000@gmail.com) |

## Licence

PolyForm Noncommercial 1.0.0 — free for personal and noncommercial use.
© 2026 Dr Sohil Momin. The vendored kits carry the same licence in `kits/`.
