Hacker News new | past | comments | ask | show | jobs | submit login
Kb: A minimalist hacker-oriented knowledge base manager (github.com/gnebbia)
199 points by nebbiolo on Sept 17, 2020 | hide | past | favorite | 53 comments

Thank you! Any particular recommendations from your experience? (I may end up spending my whole weekend on this :-D)

Nope, total analysis paralysis.

Also, I'd like an external knowledge with a spaced repetition system used as an API for the internal knowledge management system in my brain.

That's not minimalist, this is minimalist

    sn() {
        rg -S -C 2 $1 /some/folder/with/snippets/as/files

    $ sn git #searches for snippets containing `git`

I can do one better: Just learn to use the standard unix tools directly. If you keep stacking wrappers upon wrappers and grow to depend on them you will be totally lost once you have to work on another machine. It also makes it easier to e.g. replace grep by fzf.

For reference:

    kb list -> find
    kb list foo -> find | grep foo
    kb edit --title "git" --category "cheatsheet" -> vim cheatsheet/git
    kb delete --id 1 -> rm path/to/file
    kb grep foo -> grep -r foo

Exactly! I started from there, then these commands evolved into functions and the functions evolved into bash scripts which then evolved into a python program in order to have something more readable/structured and cross platform.

But of course no software is an excuse to not learn the good old UNIX core tools. kb is not better than these tools, it just packs them up in order to have a slightly nicer output and be able to associate metadata to the notes in a clean way.

You are right, but what about having a nicer output list? What about having metadata associated to files such as author, status and especially tags?

Also, what about being cross-platform and able to run on Windows?

What about instead having custom templates to apply to the files I desire?

alias rg="rg" might be more flexible as it allows you to specifify a root folder to search in as well as other options.

edit: The previous sentence is a joke. This should not take away the usefulness and polish of kb.

Try "$@" instead of $1, for multi-word queries.

What a fantastic name for a command-line knowledge base! Extremely heartening for anyone who's gone through the briar-patch of browsing through a self-disorganizing hierarchy of sub-kilobyte text files. The animated screenshots on GitHub are very welcome. Interesting.

I would like to see more import/export options.

Ditto on the import/export functionality. The .tar.gz file format is an odd choice. A plain json dump would be the obvious choice here, as it would be easier to manipulate.

Since it's sqlite...not sure how many tables or joins. You may just be able to dump to csv (and json) using sqlite3's built-in (and add-on) exporter

I'm lazy. I've found a gitlab wiki sufficient for my basic needs. 1. Version control 2. Easily editable from terminal (markdown) 3. Easily viewed via browser (either on gitlab or self hosted gollum instance) 4. Supports some HTML, such as `details` and `summary` for drop down visibility. 5. Supports `[[_TOC_]]` to add a table of contents (works well with in `details` at the top of every page) 6. Supports nested directories for the sidebar navigation on gitlab (github forces a single layer)

For me this kind of tool needs to provide a way to sync between devices to be useful, and ideally be available on mobile. As it's using sqlite3 to store documents, it's probably not trivial to sync with something like Dropbox.

Why would a sqlite3 DB file not be trivial to sync with Dropbox or Syncthing? Are there platform-specific nuances to decoding or something?

Syncing at db-file level would create false sync conflicts when making edits while offline. You may even lose data, depending on how Dropbox/Syncthing resolve file-level conflicts. For fully automatic sync, you need to operate at the level of records.

> You may even lose data, depending on how Dropbox/Syncthing resolve file-level conflicts.

It's even worse - Dropbox can corrupt the database file even without conflicts - it's not safe to copy database file which is currently open in some process since it can change within the reading operation. I mean, the original file stays OK, but the copy will be likely corrupt (and in this corrupt state synced into another instance).

For safe copy, Dropbox would have to force some FS-level snapshotting, but that would halt all database operations. I have received few bug reports for my app which were eventually traced into attempts to sync it with Dropbox and similar services.

I missed it was in a database when I checked it out. That'd be a hard no for me.

I much prefer separate text files for any minimal notes solution, since that plays well with nvAlt, Obsidian, 1Writer, etc, and is the safest sync in every file syncing service (they pretty much all know how to deal with text conflicts). It also lets me write side tooling to crawl and process notes much more easily than if I had to hit a database.

At this point, a proprietary database had better be justified by something epic like Roam's bullet transclusion or Evernote's back-end handwriting OCR, or some other killer feature that's hard to replicate locally in decoupled files. Otherwise, it's just not worth even considering.

A ubiquitous public domain library is a proprietary database now?

No, but it is non-transparent and can’t be edited with a text editor, without being unpacked and repacked like Fossil. Yet another layer of indirection is the last thing I want when I’m in a hurry to write down a thought before I forget it. Of course that can be overcome with practicing the tooling, but that’s also a non-negligible transition cost.

Yes, because the database is the custom schema + the data being managed by the library, not the library itself.

The library is properly an example of a DBMS: database management system, it's only "a database" informally to lay users.

> At this point, a proprietary database had better be justified by something epic like Roam's bullet transclusion or Evernote's back-end handwriting OCR, or some other killer feature that's hard to replicate locally in decoupled files. Otherwise, it's just not worth even considering.

Even basic things like backlinks are not possible (to do well) without some sort of indexes and overall control over data.

(assuming we're talking about large amount of data, 100 notes does not constitute "knowledge base" IMHO).

Obsidian.md is doing them pretty well in plaintext. It has scaling issues, but think they come in a couple orders of magnitude above the "toy" threshold you mention. It might suffer a bit for a well-populated Zettelkasten until they optimize more, but for most users it'd be fine. I think a lot of the scaling issue was in the link graph analysis, and they've been steadily working on that.

To your point, I'm sure it caches a fair amount of that analysis in its .obsidian directory, but to mine, it can still calculate them from scratch on a new (or newly synced) note set. It does so invisibly the first time it sees the Vault (or the new file in the Vault directory, if you add it from elsewhere), so it's still portable, just with an indexing phase if you want to show a backlink or graph pane.

The important thing for me is that most other plaintext notes editors support the forward [[links]] that are the only real "source" data. The implied backlink analysis is just that, results of an analysis. It'd be nice for the cache to be portable, but not necessary.

Transclusion is where I'd agree with you, since that actually appears in the notes themselves rather than as part of an active sidebar. You're more or less stuck with proprietary software that knows how to look for anchors and render their targets inline, at least until/unless we get a generic format for it. But so far that's been more a reason I can't have transclusion yet than a reason why I'd move off plaintext notes in a directory.

I build https://nostashapp.com pretty much for the same reason.

I needed it on very different devices and on mobile.

It is a web app, but it is coming with export functionality.

Why not just use a separate program? I personally use Syncthing to sync my notes, among other things. It's peer to peer, doesn't even need an internet connection if your devices are on the same LAN.

Could you throw the .sqlite file into your Dropbox folder?

Wouldn't fossil be perfect for this?

What advantage does it have over text files, an editor and grep?

I think it basically is text files, and editor and grep. Just conveniently packaged under one command.

folders / files / editor / search has worked well for me for years.

It supports tags I guess?

So much better than man pages. I get that you need a huge manual to cover everything. But 99.99999999% of the time someone needs to just decompress a tar.gz or create a tar.gz file, they really don't need the man page.

Edit: although, correct me if I'm wrong, but it looks like this doesn't come pre-loaded with anything :(

Edit 2: Oh man, thank you guys!

You might like tldr.sh, bro pages, or cheat.sh (Edit: My pleasure!)

You might like https://tldr.sh then.

I use https://tldr.sh/ for this most of the time

Don't want to be negative but for me nothing beats markdown files with visual studio code.

What's your setup?

I would say it is markdown files, and Visual Studio Code. :D

Tiddlywiki plus OneDrive has been my go-to for a personal knowledgebase for a couple of years.

Thanks for this. I'll give it a try for sure.

I'm struggling with a good tool that does help me manage my documents and content. There was "Google Desktop" more than a decade back that Google discontinued.

Basically, it used to create a Google like experience locally on my desktop. It used to index my pdfs, email (outlook then!), excels, basically everything I used back then.

Would be grateful to get any recommendations on alternatives for those old enough to know what Google Desktop was! :) (un-minimalistic but neat is also ok)

I would love to have something like google for my local notes! I usually go into these threads with the hopes of finding a tool like that. Something that would go over my plaintext notes (PDF support can be a nice to have too), index them, and allow me to search through them google style.

Not that this isn't useful, but I think I get all these features with an org-mode file and a ripgrep search using counsel. I think I get all the same features.

Looks like everyone has the same ideas at different but slightly overlapping spans.

I’ve been managing my “work log” notes in such way from a few years already.


I wanted something similar but that worked online.

I didn't really like any of the alternatives so I ended up coding my own.

It is open if anybody would like to use it as well.


I work better with it.

My standard workflow is to keep notes about what I want to do at my day job in a TODO note, and about what I did in a Journal - $date note (each day a new journal note).

Then anytime I do something new or I complete some weird or complex procedure, I write a note about it. And if possible I make it public.

I end up being on top of all my responsibilities quite more easily.

Very slick and well done. An optional way to hook it up to a tag suggestion service might be nice.

What happened to man pages?

Folks started distributing applications as binaries instead of OS packages and distributed documentation fell by the way-side. Nowadays most apps self-document. I'm looking at you golang!

I always found them to be too detailed.

It's easier for me to just write down most commonly used syntaxes of commands, or use something like https://tldr.sh/.

Don't get me started on "man find". I usually end up googling it (I don't use the terminal frequently).

Why can't I type "find toto.txt" and it looks for the file everywhere? If I need a more complex search I'm fine providing more arguments but give me something by default so that I don't spend 10 minutes trying to find how to use find ;)

Yes I could make an alias, but it won't be available everywhere.

You might find,


to your liking. It is simple, intuitive, and very fast.

locate (mlocate) does that, but it's not find's job to do it. I understand why the naming might be unfortunate though.

Thanks for posting!

Is there a way to tag sub-kb's. I have a tech group I'd like to share documentation with, but maintain a personal database as well. I suppose I can use 2 different files.

This really does look like the better version of `um`, `tldr`, and local manpage and use examples. Thanks for making, pushing, and sharing

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact