Skip to content

Instantly share code, notes, and snippets.

LLM Wiki

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.

The core idea

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.

@Kyle-Ye
Kyle-Ye / CAHostingLayer.md
Last active April 3, 2026 15:26
Using CAHostingLayer in SwiftUI — access SwiftUI's SPI CALayer without Apple internal SDK

Using CAHostingLayer in SwiftUI

Background

SwiftUI provides more than just UIHostingController / _UIHostingView (iOS) and NSHostingController / NSHostingView (macOS) for embedding SwiftUI views into UIKit/AppKit.

Starting from iOS 18.0 / macOS 15.0, SwiftUI also offers CAHostingLayer<Content: View> — a CALayer subclass that can host SwiftUI content directly at the layer level. This API is currently marked as SPI (@_spi(ForUIKitOnly) / @_spi(ForAppKitOnly)) and is used internally by UIKit, AppKit, and WebKit.

Accessing CAHostingLayer without Apple Internal SDK

#include <metal_stdlib>
#include <SwiftUI/SwiftUI.h>
using namespace metal;
[[ stitchable ]] half4 simpledistort(float2 pos, SwiftUI::Layer l, float4 boundingRect, float progress, float distortion) {
float2 size = boundingRect.zw;
float2 uv = pos / size;
float2 center = float2(0.5, 0.5);
float2 delta = uv - center;
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@antirez
antirez / codex_skill.md
Last active April 2, 2026 06:52
CLAUDE_CODEX_SKILL.md
name codex
description Use OpenAI Codex CLI for complex debugging, code analysis, or when stuck on difficult problems. Invokes Codex with a file-based question/answer pattern.
disable-model-invocation true

Using Codex for Complex Debugging

When you encounter a difficult problem that would benefit from a second perspective or deep analysis, use Codex via the file-based pattern.

Claude Agent SDK Technical Specification

Version: 1.0.0 Protocol Version: 2024-11-05 Last Updated: 2026-01-10

Table of Contents

  1. Overview
  2. Architecture
@tkersey
tkersey / 201X-2023.md
Created January 5, 2026 20:49
Previous bookmarks

2023

December

Boost your Metal app’s performance by upscaling lower-resolution content to save GPU time.

The MetalFX framework integrates with Metal to upscale a relatively low-resolution image to a higher output resolution in less time than it takes to render directly to the output resolution. >

@banteg
banteg / readme.md
Last active March 27, 2026 18:57
uninstall beads

Beads Uninstall Script

A comprehensive uninstall/cleanup script for Beads (bd) that removes all traces of the tool from a system.

Usage

./scripts/uninstall.sh            # dry-run (scan $HOME)
./scripts/uninstall.sh --apply    # perform cleanup
./scripts/uninstall.sh --root DIR --apply
@dimitribouniol
dimitribouniol / main.swift
Created December 22, 2025 11:58
ISO8601 Date Formatter Benchmarks
import AppKit
@main
struct DateFormatters {
static func main() {
let iterations = 100_000
let startInterval: TimeInterval = 780_000_000
time("Create Date Baseline") {
var results: [Date] = []
@kylehowells
kylehowells / open_clip_embedding_test.py
Created October 27, 2025 06:15
Demo of using the OpenAI CLIP and SigLIP 2 models to do text and image embedding search.
"""
Simple demo showing how to generate and compare text and image embeddings.
Uses CLIP (openai/clip-vit-base-patch16) model for both text and image embeddings.
"""
import torch
from PIL import Image
from transformers import CLIPProcessor, CLIPModel
import numpy as np
import torch.nn.functional as F