Agent memory and context

haaaarsh4/

Recur

A chat workspace that detects repeated questions, compiles them into deterministic local programs, and runs those programs instead of calling a model again.

What’s new here

Recur watches for repeated requests, clusters them into a task family after three occurrences, and compiles a typed dataflow program by searching over 13 readers, 41 transforms and 5 emitters. The winner is the cheapest candidate that reproduces every observed answer exactly. Computation is verified by search; model output is used only for surface phrasing, never as an authority on arithmetic or logic.

What it does

Recur runs as an Express server with a React chat client. Every message is profiled into an intent, domain, operation and a 256-dimension hashed vector. Three matching messages trigger an offer to compile.

Compilation is a best-first search over a typed dataflow IR. Candidates are scored by a simplicity prior and verified against all demonstrations before a winner is chosen. A separate acceptance head, 256 inputs and 12 hidden units, decides whether a new request is close enough to the compiled family to be worth offering.

Once compiled, matching requests are answered locally with a function call instead of a model call. The registry shows each program’s artifact, its verification metrics (consistency, leave-one-out, 64 stress-test inputs), and the acceptance head’s confidence. Programs that cannot read a request decline rather than guess.

Who it’s for

Developers or researchers who want to study what happens when you treat an LLM as a noisy label source rather than an oracle. Also useful for anyone running a local model who wants repeated computations to stop costing full inference. The project is candid about what it cannot do: the operator library is fixed at 41 transforms, storage is a single JSON file, and the acceptance head is weak with few examples.

Try it

Requires Node 20 or newer. Ollama is needed for the general-answer path; compiled programs run without it.

npm run install:all
ollama pull qwen2.5:0.5b
cp server/.env.example server/.env
npm --prefix server run dev   # API on http://localhost:8787
npm --prefix client run dev   # app on http://localhost:5173

Ask the same type of question three times. Recur will offer to compile the pattern. Accept it, and the fourth request runs the compiled program. The backend test suite (36 tests) runs with npm test.

How mature is it

2 stars, 0 forks, 1 contributor, no releases, no license. Created 2026-09-21, last pushed 2026-09-27. 14 commits in the last 90 days. This is a research prototype and the README describes it as an experiment with real limitations.