Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .claude/skills/nt-distill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ Finish with a short receipt: what was merged, demoted, retired, tagged
`distinct`, and skipped — plus the block's before/after size. If anything in
`rules/`/`memory/` changed and the user compiles them into `AGENTS.md` /
`CLAUDE.md`, remind them to re-run `nt export --tag rule` — otherwise the
pruning never reaches the place it was being paid for.
pruning never reaches the place it was being paid for. (Exports written with
`--out` are tracked, so `nt doctor` also flags the stale file if this is
forgotten.)

If the `nt_*` tools are unavailable, fall back to the `nt` CLI over bash (`nt
distill`, `nt show`, `nt index --tag rule`, `nt export --tag rule`, `nt edit
Expand Down
45 changes: 30 additions & 15 deletions .claude/skills/nt/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ On large stores the index is **tiered**: pinned standing notes (rules/, memory/,
ref/, or tag `pin`) + everything changed in the last 14 days, with the older
remainder as per-folder counts. Expand a folder with `--folder <f>`, or pass
`--all` for every stub. **`--project <name>` hard-filters to that project**
(via `project:` frontmatter or `+project` tag) — unlike `recall --project`,
which is a soft ranking preference. Standing knowledge belongs in the pinned
layers — file it with `--kind rule|ref` (or tag `pin`) so every future session
sees it.
(via `project:` frontmatter or `+project` tag, case-insensitive; MCP `nt_index`
takes the same `project` argument) — unlike `recall --project`, which is a
soft ranking preference. Standing knowledge belongs in the pinned layers —
file it with `--kind rule|ref` (or tag `pin`) so every future session sees it.

`nt index` is your "what's here" catalog; `nt ready` is the task feed. **Before
creating anything, retrieve first** (`nt index` / `nt search`) so you don't
Expand Down Expand Up @@ -82,6 +82,13 @@ banner warns you. If your query was long and oddly specific, one **shorter**
retry is worth it: recall weighs distinct concepts a note shares with you, so
wordiness can dilute meaning. Retry shorter, not looser.

**Recall's synonym vocabulary is extensible.** `$NT_DIR/synonyms.txt` — one
group per line, comma-separated (`gateway, ingress, route, routing`) — merges
into the built-in table before every recall, no restart. When a recall misses
a note you later find by other means, the usual cause is vocabulary (you said
"gateway", the note says "ingress"): suggest adding that group to
`synonyms.txt` — it fixes the miss for every future session, not just this one.

When `NT_WORKSTREAM` is set, your own project's notes get a soft ranking
preference in results — cross-project results stay visible below. Override
with `--project <name>` or disable with `--project none`.
Expand Down Expand Up @@ -156,12 +163,13 @@ this for multi-line/backtick appends), `--body <text>` (replace the whole body
inline, no temp file needed), `--body-file new.md` (replace the body from a
file — for long/multi-line content), `--old-string "..." --new-string "..."`
(patch ONE exact match in place — the targeted fix for a longer note; refuses
if the match isn't unique, so make it longer to disambiguate), or `--desc "…"`
(set the one-line summary). These are mutually exclusive per call — pick one
way to change the body. MCP: `nt_note_edit` takes the same
`append`/`body`/`old_string`+`new_string`/`description` fields; it's the
in-place counterpart to `nt_note`, which only ever creates (`supersede:` mints
a *new* id rather than editing in place).
if the match isn't unique, so make it longer to disambiguate), `--desc "…"`
(set the one-line summary), or `--project <name>` (`none` clears — fix a note
mis-scoped at capture). The body edits are mutually exclusive per call — pick
one way to change the body. MCP: `nt_note_edit` takes the same
`append`/`body`/`old_string`+`new_string`/`description`/`project` fields; it's
the in-place counterpart to `nt_note`, which only ever creates (`supersede:`
mints a *new* id rather than editing in place).

Tag a note with **`--project <name>`** when it's specific to one codebase in a
shared multi-project store — `nt recall --project <name>` (default: your
Expand Down Expand Up @@ -198,17 +206,21 @@ Durable memory needs the reasoning a future session would otherwise rediscover:
nt search "race condition" # full-text over notes + tasks
nt search --tag auth --tag ref # tag-filtered (AND); --tag alone lists, no query needed
nt search "jwt" --tag auth --type note # combine text + tag, scope to note|task|all
nt search --project webhookd # hard project scope (notes' project: + tasks' +project); alone = list the project's items
nt tags # the tag vocabulary with counts — keep it controlled
nt tags --projects # the PROJECT vocabulary — check before scoping by project
nt links <handle> # forward links + backlinks for a note or task
nt links --orphans # notes nothing links to — gaps in the graph to wire up
```

**Scoping by project or tag? The store's vocabulary wins.** A directory or repo
name is not necessarily the tag past sessions used — check `nt tags` before
scoping, and if a `--project`/`--tag` filter comes back empty, fall back to a
topical `nt search` rather than concluding nothing is recorded.
name is not necessarily the name past sessions used — check `nt tags` /
`nt tags --projects` before scoping, and if a `--project`/`--tag` filter comes
back empty, fall back to a topical `nt search` rather than concluding nothing
is recorded. (Note text search matches title+body only — a note's `project:`
frontmatter is invisible to it, so scope by `--project`, don't grep for the name.)

MCP equivalents: `nt_search` (query and/or tag), `nt_links` (handle). **Read links
MCP equivalents: `nt_search` (query, tag, and/or project), `nt_links` (handle). **Read links
before starting related work, not just when writing them** — `nt links <id>`
reconstructs why a task exists and surfaces the decisions and sibling work around
it, recovering reasoning a prior session left behind.
Expand All @@ -222,6 +234,9 @@ backlinks are found automatically.
`half_life:"90d"`): the note fades in recall/index as it ages un-reconfirmed —
down-ranked and flagged `faded`, never hidden. Use for config gotchas and
version-specific facts; skip for rules/refs (pinned knowledge doesn't decay).
Config can default this per kind (`[decay] lesson = "180d"` in
`$NT_DIR/config.toml`) — new notes of that kind get the stamp automatically;
an explicit `half_life` always wins.
- **Verified a faded note still holds? `nt touch <id>`** (MCP `nt_touch`) stamps
`reviewed:` and resets its clock. Reading alone never resets decay.
- **An edit changed a conclusion? Record why: `nt decide <id> "switched X → Y
Expand All @@ -245,7 +260,7 @@ nt mv <note> ref/auth # refile/rename, rewriting every [[link]] to
nt tag <note> +reviewed -inbox # add/remove tags
nt rm <note> # delete → .trash/ (refuses if inbound [[links]] would dangle; --force overrides)
nt rm <task-id> --yes # delete a task (agents must pass --yes; journaled, nt undo restores)
nt doctor # store health: dangling [[links]], near-duplicates, oversized pinned tier
nt doctor # store health: dangling [[links]], near-duplicates, oversized pinned tier, drifted exports
nt archive <note> # retire a stale note from index/search/recall (reversible)
nt supersede <old> --by <new> # (or nt note … --supersede <old>) — replace a note; the old one retires with a pointer
nt gc # plan: superseded stubs + stranded task notes >30d old
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ That's it — you're up. `nt help` lists every command; [more install options be
- **Claude Code plugin marketplace** — this repo is a self-hosted marketplace (`.claude-plugin/`): `/plugin marketplace add navbytes/nt` then `/plugin install nt@navbytes-nt` installs the skill + registers the MCP server in one step, no separate `nt mcp install` needed.
- **Context7** — nt's docs are indexed for the [Context7 MCP](https://context7.com) (`context7.json` at repo root), so any Context7-connected agent can pull them in with `use context7` / resolving `navbytes/nt`, no extra setup here.
- **The `/nt` skill + read-back loop** — teach the agent to capture as it works and load prior context (`nt index`, then fetch on demand) when it resumes.
- **Learn from past mistakes** — record a footgun or dead-end as a **lesson** (`nt note … --lesson`), then `nt recall "<what you're about to do>"` surfaces relevant notes with lessons flagged ⚑ first — paraphrase-aware, returns nothing when nothing is relevant (a precision floor, so it's safe to run before every task), and softly boosts same-project notes (`NT_WORKSTREAM`/`--project`; `none` disables). See [docs/claude-integration.md](docs/claude-integration.md).
- **Learn from past mistakes** — record a footgun or dead-end as a **lesson** (`nt note … --lesson`), then `nt recall "<what you're about to do>"` surfaces relevant notes with lessons flagged ⚑ first — paraphrase-aware (stemming + an extensible synonym vocabulary), with a precision floor for multi-concept queries and a per-hit confidence tier (read the tier — a weak hit is a signal to doubt, and an empty result usually means nothing is recorded), plus a soft same-project boost (`NT_WORKSTREAM`/`--project`; `none` disables). See [docs/claude-integration.md](docs/claude-integration.md).
- **Parallel agents, one store** — set `NT_WORKSTREAM` per agent to isolate in-flight tasks (`list`/`ready`/`log`/`review`/`index` scope to it; `"*"` widens) while notes stay shared; `undo`/`redo` refuse another workstream's change unless `--force`.
- **Curate, don't hoard** — `nt doctor` flags near-duplicates, orphans, and an oversized pinned tier; `nt supersede`/`nt archive` retire stale notes; `nt gc` sweeps superseded stubs and stranded task-detail notes to `.trash/` (dry-run by default).
- **Memory that ages honestly** — give a volatile fact a `--half-life 90d` and it *fades* in recall and the index as it goes un-reconfirmed (down-ranked and flagged `~faded`, never hidden); `nt touch` says "still true" and resets the clock, and `nt review` lists the most-faded notes for triage. `--if-exists return` steers agents to **edit the topic's canonical note instead of creating a duplicate**, `nt decide` keeps a dated `## Decisions` history of *why* a note changed (so a superseded approach isn't re-proposed), and `nt history` reads the full per-edit story back from git. Inspired by how Kimi K3's delta-attention memory learns — design in [docs/spec-memory-dynamics.md](docs/spec-memory-dynamics.md).
Expand All @@ -94,7 +94,7 @@ nt recall "adding concurrent token refresh" # surfaces the lesson before you h

### Terminal UI — just run `nt`

A Bubble Tea TUI that adapts to your terminal width (compact strip → standard list → wide split with a live detail pane) and **live-refreshes** via fsnotify when a CLI call or an AI session writes the store. Three tabs — **tasks**, **notes**, and a **Logbook** of completed work grouped by date — with multi-select bulk ops, search-as-you-type, mouse support, undo/**redo**, and a read-only lock. A **`:` command palette** runs any action by name, **vim motions take counts** (`5j`, `12G`), notes capture inline (no `$EDITOR` bounce), and the whole UI follows your terminal's **light/dark** theme. Press `?` for the full keymap.
A Bubble Tea TUI that adapts to your terminal width (compact strip → standard list → wide split with a live detail pane) and **live-refreshes** via fsnotify when a CLI call or an AI session writes the store. Three tabs — **notes**, **tasks**, and a **Logbook** of completed work grouped by date — with multi-select bulk ops, search-as-you-type, mouse support, undo/**redo**, and a read-only lock. A **`:` command palette** runs any action by name, **vim motions take counts** (`5j`, `12G`), notes capture inline (no `$EDITOR` bounce), and the whole UI follows your terminal's **light/dark** theme. Press `?` for the full keymap.

| Notes | Logbook |
|---|---|
Expand Down
21 changes: 17 additions & 4 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ Tokens expire after 24h; refresh window is 7d. See [[oauth-flow]].
- **`description:`** is a one-line summary convention (set via `nt note --description "…"` or
the `nt_note` `description` arg); it's the stub blurb `nt index` shows so an agent can scan
the catalog without reading bodies.
- **`project:`** (optional) scopes a note to one project/codebase in a shared multi-project
store — set at capture (`nt note --project`, the `nt_note` `project` arg) or later
(`nt edit --project`, `nt_note_edit` `project`; `none` clears). Comparisons fold case and
whitespace everywhere: a **hard filter** on `nt index --project` / `nt_index` and
`nt search --project` / `nt_search`, a **soft ranking boost** in `nt recall`, and part of
the dedup guard's shared-tag set. Domain knowledge meant to be discoverable from every
project carries **no** `project:` — unscoped notes are never down-ranked. The project
vocabulary is listed by `nt tags --projects`.
- Filename is a slug of the title (or a datetime when untitled, à la `nb`).
- Notes may live in **subfolders** of `notes/`. Create into one with
`nt note "…" --folder work/auth` (or path-style `nt note "work/auth/…"`); the
Expand Down Expand Up @@ -413,18 +421,18 @@ nt add "fix auth bug" --pri high --due today --tag backend --project api [--sour
nt note "JWT expiry" --body "..." --description "..." --tag auth [--folder work] [--source claude]
nt list [--status open] [--tag bug] [--project api] [--sort urgency] [--json] # (ls)
nt ready [--json] # open, unblocked work by urgency — the actionable feed
nt index [--all] [--tag t] [--folder f] [--since 14d] [--json] # tiered stub catalog + active tasks — start here (AI loop)
nt index [--all] [--tag t] [--folder f] [--project p] [--since 14d] [--json] # tiered stub catalog + active tasks — start here (AI loop)
nt log [--since 2026-06-01] [--days 7] [--source claude] [--json] # completed tasks, newest first
nt done <id|task:N> # mark done (do)
nt update <id|task:N> --status doing --pri med --due +3d # (up)
nt search "race condition" [--type note|task] [--limit 8] [--include-archived] # ranked stubs (q); --include-archived = the deep sweep over retired notes that recall's escalate hint suggests
nt search "race condition" [--type note|task] [--project p] [--limit 8] [--include-archived] # ranked stubs (q); --project = hard scope (notes' project: + tasks' +project); --include-archived = the deep sweep over retired notes that recall's escalate hint suggests
nt recall "adding a cache layer" [--lessons-only] [--project p] # lessons ⚑ first, paraphrase-aware, precision floor (empty = nothing relevant), soft same-project boost (NT_WORKSTREAM default; 'none' disables)
nt note "gotcha" --kind lesson --description "trigger" # taxonomy: lesson|decision|ref|rule|memory → canonical tag + folder (--lesson = --kind lesson)
nt show <id|slug|title> # one note's full body, on demand
nt links <id|task:N> [--json] # forward links + backlinks for an item (§5.1)
nt archive # move done tasks → done.txt
nt gc [--older-than 30d] [--yes] # sweep superseded stubs + stranded __tasks__ notes → .trash/ (dry-run default)
nt export --tag rule # compile the standing rules layer (CLAUDE.md / AGENTS.md)
nt export --tag rule [--out FILE] # compile the standing rules layer; --out is recorded, and nt doctor flags the file when it drifts from the store
nt import backup.json | vault/ # export's inverse: round-trip a JSON backup, or bulk-load an Obsidian vault
nt distill [--json] # every near-duplicate note pair, uncapped — proposes, never merges
nt undo / redo # transactional; workstream-safe (--force overrides)
Expand Down Expand Up @@ -557,7 +565,12 @@ findings cross-pollinate. A *workstream* is that isolation axis, distinct from
| `NT_ASCII` | `1` forces ASCII glyphs instead of Unicode | off |
| `XDG_DATA_HOME` | Consulted before `~/.local/share` when `NT_DIR` is unset | unset |

Optional `$NT_DIR/config.toml` sets the same knobs from a file (§13).
Optional `$NT_DIR/config.toml` sets the same knobs from a file (§13), plus per-kind decay
defaults: a `[decay]` section (`lesson = "180d"`, `ref = "270d"`, …) stamps that `half_life:`
onto **new** notes of the kind when the caller gives none — visible frontmatter, never an
invisible read-time rule, so a config change never re-ranks existing notes. An explicit
`--half-life` always wins; `rule`/`memory` accept a value but pinned knowledge usually
shouldn't decay. `nt doctor` reports unparseable `[decay]` values.

Everything is plain text under `$NT_DIR`. Back it up or `git init` it. For multi-machine use,
prefer the git-native pattern (`nt git-init` + `nt sync`) over file-syncing the store (§6.4).
Expand Down
2 changes: 1 addition & 1 deletion desktop/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/navbytes/nt/desktop

go 1.25.12
go 1.25.13

require (
github.com/navbytes/nt v0.0.0
Expand Down
24 changes: 23 additions & 1 deletion docs/claude-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ Pass 2 matters most on Claude Code. Pi and OpenCode inject the rules block live
and nudge you when it exceeds `NT_INJECT_MAX`; here the block reaches Claude
through `CLAUDE.md` (see [Standing rules](#standing-rules-in-claudemd)), which
has no size warning at all — a prompt is the only signal you get. After pruning,
re-run `nt export --tag rule` or the change never reaches `CLAUDE.md`.
re-run `nt export --tag rule` or the change never reaches `CLAUDE.md` — file
exports are tracked, so `nt doctor` flags the drift if you forget.

---

Expand Down Expand Up @@ -268,6 +269,27 @@ Notes in `rules/` (tag `rule`) and `memory/` (tag `memory-core`, written with
your `CLAUDE.md` / `AGENTS.md` with `nt export --tag rule`. Keep them small —
they're the part of the store that's paid for on every request.

Compile them into a **dedicated file** and import it, rather than exporting
over `CLAUDE.md` itself — `nt export --out` rewrites the whole target file, so
pointing it at a `CLAUDE.md` that contains anything else would destroy the rest:

```bash
nt export --tag rule --out ~/.claude/nt-rules.md
```

then one line in `CLAUDE.md` imports it:

```markdown
@~/.claude/nt-rules.md
```

File exports are **tracked**: `nt export --out` records what was compiled
where (`$NT_DIR/export-state.json`, hand-editable), and `nt doctor` re-renders
each recorded selection against the current store, warning — with the exact
command to re-run — when the compiled file no longer matches. A rule pruned by
`/nt-distill` or added by `/nt-learn` now shows up as drift on the next
doctor instead of silently never reaching Claude.

## Hook vs. skill — when each fires

- **Hook** = passive, automatic. Mirrors Claude's *own* todo list. Best for
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/navbytes/nt

go 1.25.12
go 1.25.13

require (
github.com/alecthomas/chroma/v2 v2.27.0
Expand Down
Loading
Loading