Skip to content

Instantly share code, notes, and snippets.

@tranhieutt
tranhieutt / llm-wiki.md
Created April 7, 2026 05:50 — forked from karpathy/llm-wiki.md
llm-wiki

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.

@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:04
waitForExistence
let textField = app.textFields[""input user name textField.tap()
textField.typeText("abc")
app.buttons["start"].tap()
let querry = app.otherElements["identifier_any_uicontroll"]
if querry.waitForExistence(timeout: timeOut)
{
//do something else
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:02
pickerWheels
app.pickerWheels.element(boundBy: 0).adjust(toPickerWheelValue: "17")
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:01
testMoveToOtherScreen
func testMoveToOtherScreen() {
_ = tapOnButtonInCell(atPosition: 0)
XCTAssert(app.navigationBars["Other Screen:"].exists)
}
func tapOnButtonInCell(atPosition: Int) -> XCUIElement {
let cellQuerry = app.tables.cells.element(boundBy: atPosition)
cellQuerry.buttons["buttonOther"].tap()
return cellQuerry
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:00
testMoveToFlowerSrceen
func testMoveToFlowerSrceen() {
app.tables.cells.staticTexts["Flower"].tap()
XCTAssert(app.navigationBars["Flower Screen"].exists)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:59
testMoveHomeScreen
func testMoveHomeScreen() {
app.buttons[startTest].tap()
XCTAssert(app.navigationBars["HomeScreen"].exists)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:57
testLoginWithPasswordAndUserName
func testLoginWithPasswordAndUserName() {
let textField = app.textFields["input user name"]
textField.tap()
textField.typeText("user name")
let secureTextFields = app.secureTextFields[inputPassword]
secureTextFields.tap() secureTextFields.typeText("pass123")
app.buttons["login"].tap()
XCTAssert(app.buttons["startTest"].isEnabled)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:56
testLoginWithEmptyUserNameAndPassword
func testLoginWithEmptyUserNameAndPassword() {
let secureTextFields = app.secureTextFields["input password"]
secureTextFields.tap() secureTextFields.typeText("pass123")
app.buttons["login"].tap()
XCTAssert(app.alerts.element.staticTexts["pass is correct"].exists)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:54
testRegisterWithUserName
func testRegisterWithUserName() {
let textField = app.textFields["input user name"]
textField.tap()
textField.typeText("user name")
app.buttons[register].tap()
XCTAssert(app.alerts.element.staticTexts["user is correct"].exists)
}
@tranhieutt
tranhieutt / Swift_CG_UIBezierPath.swift
Created July 22, 2017 11:38
Swift_CG_UIBezierPath
override func draw(_ rect: CGRect) {
// Add ARCs
self.addCirle(innerCircleRadius, capRadius: 20, color: self.firstColor)
self.addCirle(middleCircleRadius, capRadius: 20, color: self.secondColor)
self.addCirle(outerCircleRadius, capRadius: 20, color: self.thirdColor)
}
func addCirle(_ arcRadius: CGFloat, capRadius: CGFloat, color: UIColor) {
let X = self.bounds.midX
let Y = self.bounds.midY