DEV Community

Cover image for I Replaced My Entire Note-Taking System With 30 Lines of Python - Here's What Happened
Shashi Kiran
Shashi Kiran

Posted on

I Replaced My Entire Note-Taking System With 30 Lines of Python - Here's What Happened

I'm a developer. I take notes constantly — ideas, bugs, snippets.

I tried Notion. Too bloated.
I tried Obsidian. Too much setup.
I tried Apple Notes. Lost everything twice.

So I did what any developer would do when a tool doesn't exist:

I built it on a Saturday afternoon with 30 lines of Python.


The Problem (That You Probably Have Too)

Every note app either:

  • Does too much (and you spend more time organizing than thinking)
  • Does too little (and you lose things anyway)

What I actually wanted was dead simple:

"Hey, save this thought. Hey, find that thing I wrote about Docker last week."

That's it. No folders. No tags. No kanban boards for my grocery list.


The Solution: A CLI Note Tool + AI Search

Here's the entire thing:

import sys
import json
import datetime
from pathlib import Path
from openai import OpenAI

NOTES_FILE = Path.home() / ".notes.json"
client = OpenAI()

def load_notes():
    if not NOTES_FILE.exists():
        return []
    return json.loads(NOTES_FILE.read_text())

def save_note(text):
    notes = load_notes()
    notes.append({"text": text, "date": str(datetime.date.today())})
    NOTES_FILE.write_text(json.dumps(notes, indent=2))
    print("✅ Note saved!")

def search_notes(query):
    notes = load_notes()
    if not notes:
        print("No notes yet.")
        return

    context = "\n".join([f"[{n['date']}] {n['text']}" for n in notes])
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a helpful note search assistant. Given a list of notes, find and summarize the most relevant ones for the user's query."},
            {"role": "user", "content": f"Notes:\n{context}\n\nQuery: {query}"}
        ]
    )
    print(response.choices[0].message.content)

if __name__ == "__main__":
    if sys.argv[1] == "add":
        save_note(" ".join(sys.argv[2:]))
    elif sys.argv[1] == "search":
        search_notes(" ".join(sys.argv[2:]))
Enter fullscreen mode Exit fullscreen mode

Usage:

python notes.py add "Use --no-cache flag when Docker build acts weird."
python notes.py search "docker build issue."
Enter fullscreen mode Exit fullscreen mode

Output:

📝 Found a relevant note from 2026-02-14:
You noted that using --no-cache fixes weird Docker build behavior.
Enter fullscreen mode Exit fullscreen mode

Why This Is Better Than Every Note App I've Tried

Feature Notion Obsidian This script
Setup time 2 hours 45 mins 2 mins
Search quality Keyword only Keyword only Semantic AI
Sync Cloud Manual Just a JSON file
Cost $10/mo Free + plugins ~$0.001/search
Distracts me Constantly Sometimes Never

What I'd Add Next

  • [ ] A list command to dump all notes
  • [ ] Auto-tagging with AI
  • [ ] A tiny web UI (maybe with Streamlit)
  • [ ] Voice input via Whisper API

The Real Lesson Here

The best tool isn't always the most powerful one.

Sometimes it's the one you built yourself that does exactly what you need, nothing more.

30 lines. One weekend. Zero regrets.


If you build on top of this, drop your version in the comments — I'd love to see what you add. 🚀


Top comments (0)