EsotericPapers

CONCEPT

Markdown Retrieval System

A queryable prompt database using structured Markdown with dot-notation addressing. Scales to millions of permutations without hardcoding every combination. Git-controlled, AI-editable.

THE PROBLEM

Complex AI applications have factorial complexity. In Psych Assessment AI, dozens of school districts × 200+ assessment types × 100+ document types × 15-30 report sections × 15+ disability categories × dozens of demographic factors = tens of millions of possible report configurations.

You can't hardcode prompts for tens of millions of combinations. Traditional approaches (databases, templating systems) are brittle and hard to version. You need something git-controlled that AI agents can edit.

THE SOLUTION

Structured Markdown as Database

Use Markdown headers as hierarchical addressing. Each section, subsection, and nested item gets a dot-notation path (1.2.3.4). Query the structure programmatically to extract exactly what you need.

Example Structure

# 1. Districts

## 1.1 California

### 1.1.1 Los Angeles

[Prompt instructions for LA]

## 1.2 New York

### 1.2.1 NYC

[Prompt instructions for NYC]

Query: lookup("1.1.1") returns LA-specific prompt

Dynamic Composition

Build prompts by combining multiple lookups. District rules (1.1.1) + assessment type (2.5.3) + disability category (3.2.1) = composed prompt for that specific combination. No hardcoding required.

Git-Controlled, AI-Editable

Markdown files in git. Full version history. AI agents can edit prompts using standard file tools. Human-readable diffs. No database migrations. Easy to review changes.

WHERE IT'S USED

Psych Assessment AI Agent

Manages prompts for tens of millions of report permutations

Food Science AI Agent (CLI)

Powers the "af" CLI for querying massive specifications

Agent Focus

Generates filtered spec views for worker agents

WHY IT MATTERS

This pattern solves a fundamental problem: how to manage massive prompt libraries for complex AI applications. Most people hit combinatorial explosion and give up or resort to unmaintainable hardcoding.

Markdown Retrieval makes the impossible manageable. It's reusable infrastructure that shows up in multiple projects because it solves an entire class of problems, not just one specific case.