Home / use case

Keeping a WordPress AI assistant usable on small local context windows

At a glance
Models & engines
LM Studio or Ollama on localhost
Key gotcha
LM Studio's default "truncate middle" strategy can make the model re-request the same tool call, because the first response arrives malformed

What they built

Alex Kirk maintains AI Assistant, a WordPress plugin for working with your WordPress site using local LLMs. Because it runs in JavaScript, it uses browser-side HTTP requests to localhost to talk to LM Studio or Ollama, so it works even when the WordPress site is hosted elsewhere.

The main challenge he hit is the small context window: local models often run on hardware with much less memory than cloud servers, so even a model that supports a large window may only get a fraction of it. Instead of appending messages until the window fills, the plugin actively manages what the model sees, retrieves information when needed, and keeps intermediate work outside the main context.

Setup

  • AI Assistant WordPress plugin running in the browser
  • LM Studio or Ollama on localhost

How it works

  1. The system prompt is kept short and is not changed between requests; other plugins can add short topic hints through a WordPress filter
  2. When a tool returns something unexpectedly long, such as a long blog post, the model gets a short preview while the full result stays in memory for the model to query with further tool calls
  3. If the model asks for the same tool call again because its context overflowed, the plugin pretends the second call didn't happen and replaces the first result with a compact one
  4. If the model gets stuck in a loop, the plugin stops

Gotchas

  • LM Studio's default "truncate middle" strategy can make the model re-request the same tool call, because the first response arrives malformed
  • Sometimes no tooling helps when the model's constraints make the task impossible
“Actively manage what the model sees, retrieve information when needed, and keep intermediate work outside the main context.”— Alex Kirk

Do it yourself

  1. Run LM Studio or Ollama on your computer
  2. Install the AI Assistant plugin in WordPress and point it at the local server
  3. Keep your system prompt short and fixed
  4. Read the plugin repository's "Working with Local LLMs" guide for the full set of strategies
Source: Alex Kirk (blog) · Published 2026-11-30 · Added 2026-12-01. This write-up summarizes the original source; see it for full details.

Similar setups

Haris: a security-first Windows desktop assistant that asks before acting and can run fully on local Ollama

Mahmoud Farouk built Haris after auditing a popular assistant that opened firewall ports and ran model-written code. It talks, listens, and uses fixed tools only after your click, with Ollama or LM Studio as the local brain.

Mahmoud Farouk (Haris) · 2026-11-05

A copy-paste path to a local OpenAI-compatible LLM endpoint with LM Studio, Ollama, or llama.cpp

Mikalai Karytka’s Nov 2026 guide walks through installing LM Studio’s lms CLI (plus Ollama and llama.cpp equivalents), sizing RAM for a quantized model, serving an OpenAI-compatible API, and checking tool-calling before you build agents on top.

Mikalai Karytka (DEV.to) · 2026-11-05

LM Studio vs Ollama on an RTX 5080: memory settings mattered more than the app

LK Wood IV ran LM Studio and Ollama on the same RTX 5080 with identical GGUF files and found the apps within 14% of each other, while one wrong offload or context setting cost up to 3.4x.

LK Wood IV (DEV Community) · 2026-11-01

How much RAM a local LLM needs on a Mac: measurements on a 16 GB MacBook M5

Kirill Lukyanov measured three models in Ollama on a 16 GB MacBook M5 with short prompts and 10- and 45-page documents, then built a sizing table for what fits on Macs from 16 to 128 GB.

Kirill Lukyanov (DEV Community) · 2026-10-28