From CLI knowledge loops to a browser workflow — LLM grounding, Clingo WASM, and Popper induction
In Part 1, I described the LiveKnowledge architecture: an LLM proposes facts, Clingo verifies merged coherence (kb ⊕ candidate), and a human closes the hermeneutic loop when predicates drift or gaps are wrong.
That system lives on the command line. This post is about what happens when you move the same shape of loop into the browser — and add inductive rule learning on top.
The result is WebILP (source): a single-page app that runs Popper’s Alan encoding via Clingo WASM, tests candidates with Trealla Prolog, and uses an OpenAI-compatible LLM API for the LiveKnowledge-style grounding steps.
LiveKnowledge v2.1 is powerful, but it asks you to think like an engineer: edit kb.lp, run learn, inspect gap JSON, re-ask. That is the right trade-off for automation and reproducibility.
For exploration — especially when pairing an LLM with symbolic checks — a browser UI wins on three counts:
npm start serves static files; Clingo and Trealla load from CDN. No Python venv, no local Clingo binary.WebILP is not a replacement for the full LiveKnowledge CLI. It is a browser port of the ideas plus a Popper induction path the CLI does not cover.
The UI is a five-step flow graph. Each step has a job; arrows show where to go next and where you can loop back.
Two buttons, two purposes — do not confuse them:
| Action | When to use it | What it does |
|---|---|---|
| Draft layer | Starting from prose only | LLM writes all three Popper files: bk.pl (facts), bias.pl (search space), exs.pl (pos/neg supervision) |
| Extract facts → bk | You already have bias/exs and need more background | LLM proposes ASP facts; Clingo WASM checks bk ⊕ candidate is satisfiable — same merged-coherence invariant as LiveKnowledge’s verify_candidate_knowledge |
Between steps 2 and 3, a grounding connector shows live status: spinner while the LLM runs, green check on success, red X on failure. Click it to expand a timestamped log (waiting for model, parsing JSON, Clingo verify, errors with raw snippets).
Part 1 introduced target_review.drop as the CLI hook for human judgement. WebILP surfaces the same idea as a feedback textarea plus Refine from feedback: the LLM revises bk, bias, and exs from your comment. Suggest more examples appends pos/neg lines when coverage is thin.
The machine handles syntax and consistency checks; you supply meaning.
Induce is where WebILP goes beyond LiveKnowledge:
bias.pl → build Popper’s Alan ASP encodingAdd learned rule to bk pins the induced clause into background knowledge so the next round can extract more facts or induce again — a lightweight version of immutable KB snapshots, without leaving the page.
WebILP’s verify-knowledge.js implements the v2.1 semantic fix from Part 1: verification is on the merged program, not the candidate in isolation. A locally consistent fragment that contradicts existing facts is rejected.
The LLM assist path mirrors two CLI primitives:
generate_knowledge → Extract facts → bkWhat is not in the browser yet (and remains CLI territory):
ask / answer verification loopslearn --fill-gap orchestrationThose are the “Part 3+” features if we wire the full LiveKnowledge orchestrator behind the same UI.
Clingo WASM is reliable with Popper’s single-clause alan.pl encoding. The browser build does not run full Popper CLI features:
| Feature | WebILP (browser) | Popper CLI |
|---|---|---|
| Single-clause rules | yes | yes |
max_clauses > 1, PI, recursion (alan-old.pl) |
no | yes |
| Nogood learning / CEGIS loop inside Popper | no (enumerate + test) | yes |
For game-rule layers with predicate invention or multiple clauses, export the layer and run helpers/induce.sh in your Popper project. WebILP is the fast path for single-clause discovery and LiveKnowledge-style fact grounding.
Open the live app
No install — runs in your browser. Add an LLM key in Setup, then follow the flow.
app.livelogic.dev →Or run locally:
git clone https://github.com/adamrybinski/webilp.git cd webilp npm install npm start
Open the URL serve prints (usually http://localhost:3000). Collapse Setup to add an OpenRouter or OpenAI-compatible API key (stored in localStorage only).
Suggested first run:
Or skip the LLM: Setup → Load Popper example → grandparent-maternal → Induce to see pure symbolic induction with no API key.
WebILP on GitHub
Browser ILP + LiveKnowledge-style grounding. Issues and PRs welcome.
Open app → GitHub →Part 1 deferred semantic gap-completeness, non-monotonic retractions, and multi-shot Clingo. WebILP defers them too — but it adds something the CLI never had: interactive induction in the same session as knowledge extraction.
The natural merge path: gap reports from ask pre-fill step 2’s extract targets; failed induces feed back into suggest-examples; pinning rules updates the same KB snapshot LiveKnowledge persists on disk.
Until then, use the CLI for full orchestration and WebILP for exploration, demos, and the bk → bias → exs → rule loop in one tab.