Karpathy LLM Wiki

Read-only dashboard for the compiled world-model codebase.

wiki_manager.tsread-only
// wiki_manager.ts
// Compiled personal world-model orchestrator.
// Manages raw archive ingestion, synthesis scheduling, and page linking.

export interface WikiManagerOptions {
  archivePath: string;
  pagesPath: string;
  schemaPath: string;
}

export class WikiManager {
  private archive: Map<string, string> = new Map();
  private pages: Map<string, WikiPage> = new Map();

  constructor(private options: WikiManagerOptions) {}

  async ingest(uri: string): Promise<void> {
    // Stage raw source into the archive bucket.
    const key = this.normalizeKey(uri);
    this.archive.set(key, await this.fetchSource(uri));
    await this.scheduleSynthesis(key);
  }

  private normalizeKey(uri: string): string {
    return uri.replace(/[^a-z0-9]/gi, "_").toLowerCase();
  }

  private async fetchSource(uri: string): Promise<string> {
    // Fetch and cache the raw source material.
    return "/* fetched source */";
  }

  private async scheduleSynthesis(key: string): Promise<void> {
    // Queue atomic synthesis for the ingest trigger.
    console.log("synthesis scheduled:", key);
  }
}

export interface WikiPage {
  id: string;
  title: string;
  synthesized: boolean;
  links: string[];
}