Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Georgia Grant Opportunities</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@calebdre
calebdre / AGENTS_SEED.md
Created December 20, 2025 23:00
Instructions for llms on how to create directory-level AGENTS.md/CLAUDE.md files

What are AGENTS.md files?

AGENTS.md files are short, directory-scoped “orientation docs” intended for an LLM (or a new human contributor) to quickly understand:

  • What’s in this directory
  • How this directory fits into the codebase (data flow, feature flow, boundaries)

The goal is to reduce repeated repo-wide exploration by making architecture and responsibilities discoverable from the filesystem.

Guidelines for creating and updating AGENTS.md

type QueryResult = {
score: number,
func: FunctionInfo
}
export async function runQuery(
query: string,
files: FileInfo[]
): Promise<QueryResult[]> {
// convert input query to embedding
const queryEmbedding = await createEmbedding(query);
// math -> https://mathjs.org/index.html
export function cosineSimilarity(embedding1: number[], embedding2: number[]): number {
const dotProduct = math.dot(embedding1, embedding2)
const magnitude1 = math.norm(embedding1)
const magnitude2 = math.norm(embedding2)
return dotProduct / (magnitude1 * magnitude2)
}
export const createEmbedding = async (
model: string,
text: string
) => {
const resp = await ollama.embeddings({
model: model,
prompt: text
})
return resp.embedding
const collectFileData = async (dir: string) => {
// collect all the files in the directory
const files = findTsFiles(dir)
for (const file of files) {
// extract functions from each file
file.functions = extractFunctions(file.content)
for (const func of file.functions) {
// get the description for each function
const description = await getFunctionDescription(file, func.functionName)
if (description) {
export const getFunctionDescription = async (file: FileInfo, functionName: string, model: string = "llama3"): Promise<string | null> => {
const prompt = `given the following file ${file!.path}/${file!.filename}:
\`\`\`typescript
${file!.content}
\`\`\`
Provide a concise description for the function \`${functionName}\`. focusing on its specific role within the larger codebase.
The description should briefly explain:
- The purpose of the function
- The function's inputs, outputs, and any notable side effects or dependencies
export function extractFunctions(fileContents: string): ExtractFunctionResponse[] {
const functions: ExtractFunctionResponse[] = [];
try {
const ast = parser.parse(fileContents, {
sourceType: 'module',
plugins: ['typescript', 'jsx'],
allowImportExportEverywhere: true,
allowAwaitOutsideFunction: true,
allowReturnOutsideFunction: true,
type FileInfo {
content: string
path: string
filename: string
}
function findTsFiles(directory: string, exclude_dirs: string[]): void {
const fileList: FileInfo[] = []
function traverseDirectory(currentDir: string) {
const evaluateCodeSearch = async (
files: FileInfo[],
numSamples: number = 15,
k: number = 5
) => {
// create validation set
const validationSet: ValidationQuery[] = await generateValidationQueries(files, numSamples)
const resultSet: QueryResult[][] = []
// run each validation query against the code search system