| name | explain-diff-html |
|---|---|
| description | Use when the user asks for a rich explanation of a code change, diff, branch, or PR. Produces HTML output. |
Please make me a rich, interactive explanation of the specified code change.
It should have these sections:
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.
PI is a TypeScript toolkit for building AI agents. It's a monorepo of packages that layer on top of each other: pi-ai handles LLM communication across providers, pi-agent-core adds the agent loop with tool calling, pi-coding-agent gives you a full coding agent with built-in tools, session persistence, and extensibility, and pi-tui provides a terminal UI for building CLI interfaces.
These are the same packages that power OpenClaw. This guide walks through each layer, progressively building up to a fully featured coding assistant with a terminal UI, session persistence, and custom tools.
By understanding how to compose these layers, you can build production-grade agentic software on your own terms, without being locked into a specific abstraction.
Pi was created by @badlogicgames. This is a great writeup from him that explains some of the design decisions made when creating it.
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "github.com/bytecodealliance/wasmtime-go/v31" | |
| ) | |
| // Default memory configuration (matching JavaScript defaults) |
See the new site: https://postgresisenough.dev
| import openai | |
| import streamlit as st | |
| from streamlit_chat import message | |
| from dotenv import load_dotenv | |
| import os | |
| from langchain.embeddings.openai import OpenAIEmbeddings | |
| from langchain.vectorstores import Chroma | |
| import openai | |
| from langchain.document_loaders import UnstructuredMarkdownLoader | |
| from langchain.chains.question_answering import load_qa_chain |
| import openai | |
| import streamlit as st | |
| from streamlit_chat import message | |
| from dotenv import load_dotenv | |
| import os | |
| from langchain.embeddings.openai import OpenAIEmbeddings | |
| from langchain.vectorstores import Chroma | |
| import openai | |
| from langchain.document_loaders import UnstructuredMarkdownLoader | |
| from langchain.chains.question_answering import load_qa_chain |
| import { useCalendar } from '@h6s/calendar'; | |
| import { useMachine } from '@xstate/react'; | |
| import { Button as AriaButton } from 'ariakit/button'; | |
| import clsx from 'clsx'; | |
| import { isSunday, isSameDay, addMonths, isFuture, isPast, setDate } from 'date-fns'; | |
| import format from 'date-fns/format'; | |
| import isWithinInterval from 'date-fns/isWithinInterval'; | |
| import { FC, useCallback, useMemo } from 'react'; | |
| import Select from '@components/forms/components/Select'; |
| import * as d3 from "d3"; | |
| import { | |
| eachMonthOfInterval, | |
| endOfMonth, | |
| format, | |
| isSameMonth, | |
| parseISO, | |
| startOfMonth, | |
| } from "date-fns"; | |
| import useMeasure from "react-use-measure"; |
| import { isTest } from "@/lib/constants"; | |
| import { Dialog } from "@headlessui/react"; | |
| import { motion } from "framer-motion"; | |
| const TRANSITIONS = { | |
| DURATION: !isTest ? 0.5 : 0, | |
| EASE: [0.32, 0.72, 0, 1], | |
| }; | |
| function Modal({ onClose = () => {}, initialFocusRef, children }) { |