惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
MyScale Blog
MyScale Blog
H
Help Net Security
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Proofpoint News Feed
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - feers77/iasql: A new implementation of SQL for I...
feers77 · 2026-05-25 · via Hacker News: Show HN

Turn PostgreSQL into a self-compiling knowledge base. An in-database implementation of Andrej Karpathy's "LLM Wiki" pattern: you INSERT raw documents, and a background worker uses an external LLM to compile them into a maintained, cross-referenced Markdown wiki — then keeps auditing that wiki against the sources for hallucinations.

Status: 0.1 — working proof of concept. Built and tested on PostgreSQL 17. Español aquí →

🌐 Landing: https://feers77.github.io/iasql · Live wiki demo: https://iasql.dev.feres.cl 📖 New here? Start with the tutorial by user profile.


The idea

Most "chat with your documents" systems use RAG: at query time they retrieve a few text chunks and ask the model to improvise an answer. The model re-discovers your domain from scratch on every question and never accumulates understanding.

Karpathy's LLM Wiki pattern flips this around, borrowing a metaphor from software:

Software Knowledge base
Source code Raw documents (immutable ground truth)
Compiler The LLM
Compiled binary A maintained Markdown wiki (synthesised, linked)

The expensive work happens at ingest time, not query time. When a new document arrives, the LLM reads it once, decides which entities/pages it affects, and rewrites those pages — consolidating, resolving contradictions, and adding cross-references. Knowledge compounds: each document makes the whole wiki better.

IA-SQL puts this loop inside PostgreSQL. The database is no longer a passive store; it metabolises new information asynchronously and audits its own consistency, while normal queries keep running.

How it works

INSERT INTO ia_wiki.raw_documents (content)         -- Layer 1: append-only ground truth
        │  AFTER INSERT trigger (O(1): enqueue + NOTIFY, never blocks)
        ▼
   ia_wiki.jobs  (pending)
        │  ia_sql dispatcher (background worker)
        │   claim FOR UPDATE SKIP LOCKED  →  call external LLM  →  write result
        ▼
   ia_wiki.compiled_pages + entity_graph             -- Layer 2: the wiki (LLM-owned)
        ▲
        │  pg_cron nightly  →  ia_wiki.enqueue_lint()
        ▼
   ia_wiki.hallucination_flags                       -- self-audit against Layer 1

The three layers of the pattern map to:

  • Layer 1 — Ground truth: ia_wiki.raw_documents, append-only (UPDATE/DELETE are blocked by a trigger) so the wiki can always be recompiled from scratch.
  • Layer 2 — The wiki: ia_wiki.compiled_pages (Markdown) and ia_wiki.entity_graph (typed relations), fully owned and rewritten by the LLM.
  • Layer 3 — Directives: the compiler/auditor system prompts, exposed as PostgreSQL GUCs (ia_sql.wiki_system_prompt, ia_sql.lint_system_prompt) — tunable live with ALTER SYSTEM SET … ; SELECT pg_reload_conf();.

Why PostgreSQL (and why the LLM stays external)

PostgreSQL's process model, background workers, SPI, GUCs and triggers make it an ideal host for an asynchronous compile loop. The heavy model inference, however, runs in a separate, configurable OpenAI-compatible service (local Ollama / llama.cpp, or a SaaS API). This keeps the database stable — a crash or OOM in a model never takes Postgres down — and lets you pick any model. IA-SQL is the orchestrator in the engine; the LLM is a swappable backend.

Requirements

  • PostgreSQL 17 (with postgresql-server-dev-17)
  • A C toolchain (gcc/make) and libcurl (libcurl4-openssl-dev)
  • pg_cron (optional, for scheduled audits)
  • An OpenAI-compatible chat-completions endpoint (Ollama, llama.cpp server, vLLM, OpenAI, etc.) serving an instruction-following model

Install

git clone https://github.com/feers77/iasql.git
cd iasql
make
sudo make install

Enable the background worker and (optionally) pg_cron, then create the extension:

-- postgresql.conf
shared_preload_libraries = 'pg_cron,ia_sql'   -- restart required
CREATE EXTENSION ia_sql;     -- creates schema ia_wiki + tables + functions

Point IA-SQL at your LLM:

ALTER SYSTEM SET ia_sql.llm_base_url = 'http://localhost:11434/v1';  -- e.g. Ollama
ALTER SYSTEM SET ia_sql.llm_model    = 'qwen2.5';
SELECT pg_reload_conf();

Usage

-- 1. Feed it documents (Layer 1). The wiki compiles asynchronously.
INSERT INTO ia_wiki.raw_documents (source, content)
VALUES ('notes', 'PostgreSQL is an extensible, process-based RDBMS …');

-- 2. Read the compiled wiki (Layer 2).
SELECT * FROM ia_wiki.pages;                       -- listing
SELECT markdown_body FROM ia_wiki.compiled_pages WHERE page_entity = 'postgresql';
SELECT * FROM ia_wiki.entity_graph;                -- the knowledge graph

-- 3. Audit for hallucinations (on demand or via pg_cron).
SELECT ia_wiki.enqueue_lint(20);
SELECT * FROM ia_wiki.hallucination_flags WHERE NOT resolved;

-- Observability
SELECT * FROM ia_wiki.jobs ORDER BY job_id DESC;          -- queue
SELECT * FROM ia_wiki.processing_log ORDER BY id DESC;    -- tokens / latency

Configuration (GUCs)

GUC Default Purpose
ia_sql.enabled on Master on/off switch for the worker
ia_sql.database iasql Database the worker connects to (postmaster-level)
ia_sql.poll_interval_ms 1000 Worker poll cadence
ia_sql.llm_base_url http://localhost:11434/v1 OpenAI-compatible base URL
ia_sql.llm_api_key '' Bearer key (superuser-only, hidden)
ia_sql.llm_model qwen2.5 Model name
ia_sql.llm_timeout_ms 120000 HTTP timeout
ia_sql.llm_temperature 0.2 Sampling temperature
ia_sql.llm_max_tokens 4096 Max completion tokens
ia_sql.llm_extra_json {} Extra JSON merged into each request (see below)
ia_sql.wiki_system_prompt (built-in) Layer-3 compiler directive
ia_sql.lint_system_prompt (built-in) Layer-3 auditor directive
ia_sql.max_attempts 3 Retries before a job is marked error

Provider compatibility

IA-SQL speaks the standard /chat/completions API, so it works with Ollama, llama.cpp's server, vLLM, OpenAI, and compatible gateways. Provider-specific options go through ia_sql.llm_extra_json, which is merged into every request body. Examples:

-- Qwen3 "thinking" models: disable reasoning so the answer is plain JSON
ALTER SYSTEM SET ia_sql.llm_extra_json = '{"chat_template_kwargs":{"enable_thinking":false}}';

-- Force JSON output where supported
ALTER SYSTEM SET ia_sql.llm_extra_json = '{"response_format":{"type":"json_object"}}';

For a hosted API, set ia_sql.llm_api_key and the corresponding ia_sql.llm_base_url.

Security notes

  • The worker runs as a PostgreSQL background worker; only install extensions you trust.
  • ia_sql.llm_api_key is SUPERUSER_ONLY and not shown to regular users.
  • Documents and compiled pages are sent to your configured LLM endpoint — point it at an endpoint you trust with your data.

Roadmap

  • Parallel workers (RegisterDynamicBackgroundWorker) for higher ingest throughput
  • Smarter context retrieval (graph- or embedding-guided page selection)
  • Optional token-streaming for interactive use (shm_mq)
  • Full re-bootstrap (recompile the whole wiki from Layer 1)
  • A read-only web viewer for the wiki

Credits & license

  • Concept: Andrej Karpathy's LLM Wiki pattern.
  • Bundles cJSON (MIT).
  • Licensed under the MIT License — see LICENSE.