A pattern for building personal knowledge bases using LLMs.
This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.
Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| bold() { printf "\033[1m%s\033[0m\n" "$*"; } | |
| info() { printf "• %s\n" "$*"; } | |
| warn() { printf "\033[33m! %s\033[0m\n" "$*"; } | |
| err() { printf "\033[31m✗ %s\033[0m\n" "$*" >&2; } | |
| ok() { printf "\033[32m✓ %s\033[0m\n" "$*"; } | |
| require_macos() { |
If you sometimes find yourself needing to share a file over HTTP, there are not many file-sharing solutions you can use.
This action works by publishing files via GitHub Pages behind an obscure prefix path. It updates the repository README with the URLs, so that you have links to the published files.
You can keep the repository secret, and the files are public but semi-secret, so you can share them without concern that other files will be discovered.
| #cloud-config | |
| # Enable automatic package updates and upgrades during cloud-init execution | |
| package_update: true | |
| package_upgrade: true | |
| packages: | |
| # Security and Hardening | |
| - ufw | |
| - fail2ban |
| javascript:(function(){try{navigator.clipboard.readText().then(function(t){if(t){var e=window.open("","_blank","width=800,height=600");e.document.open(),e.document.write(t),e.document.close()}else alert("Clipboard is empty. Please copy some text to the clipboard first.")}).catch(function(t){console.error("Failed to read clipboard contents: ",t),alert("An error occurred while trying to access the clipboard. Please ensure your browser allows clipboard access.")})}catch(t){console.error("An error occurred:",t),alert("An error occurred while trying to open the new window with the clipboard content.")}})();//bookmarklet_title: HTML Preview from Clipboard |
| import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth?v=65"; | |
| import Anthropic from "npm:@anthropic-ai/sdk@0.24.0"; | |
| const anthropic = new Anthropic(); | |
| async function suggestKeywords(question) { | |
| const message = await anthropic.messages.create({ | |
| max_tokens: 128, | |
| model: "claude-3-5-sonnet-20240620", | |
| tools: [{ |
Regular expressions are powerful search tools comprised of a sequence of defining characters. With regex, you can search, validate, replace, and extract strings of text based on these defining characters.
In this tutorial, we will break down a regex used to match an email using the following code snippet:
/^([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+)\.([a-zA-Z]{2,})$/
Going character by character, we will work through this snippet of code to understand how it is defining search parameters. Regular expressions can feel overwhelming at first, but by breaking the code down into different defining groups, we can easily understand how this expression is working.
| (function() { | |
| const OPENAI_API_KEY = 'sk-...'; | |
| let selectedText = window.getSelection().toString().trim(); | |
| if (selectedText.length > 0) { | |
| let body = JSON.stringify({ | |
| model: 'gpt-3.5-turbo', | |
| messages: [{role: 'system', content: 'explain this succinctly' },{ role: 'user', content: selectedText }] | |
| }); | |
| fetch('https://api.openai.com/v1/chat/completions', { | |
| method: 'POST', |