
Logic Server
ai.nocturnusPublished by nocturnus.aiv0.3.11Updated Oct 24, 2026
Agent reasoning, memory, and token-optimized context for AI applications.
Overview
A local MCP server that gives an assistant a deterministic reasoning and memory engine, returning only the context facts that changed between turns.
- What you can do
- Build a salience-ranked working set of facts from conversation turns and tool output, using the context tool each turn as the README describes. Run goal-driven context assembly so only facts reachable from the current goal are returned. Fetch diffs between snapshots, showing only added and removed entries. Clear a session's stored context when a thread ends. Store facts and rules with backward-chaining inference, proof chains, truth maintenance and temporal validity.
- When to use it
- Worth adding when an assistant replays long conversation histories and you want to cut token use while keeping operational facts consistent, for example multi-turn support or agent workflows where facts get retracted or updated. It suits setups that want deterministic inference rather than vector search or summarization.
- Requirements
- Runs as a local process on the desktop, started from the npm package nocturnusai-mcp over stdio. Environment variables: NOCTURNUSAI_API_KEY for authenticated access, NOCTURNUSAI_DATABASE for the database name, NOCTURNUSAI_TENANT for tenant isolation, and NOCTURNUSAI_URL for the base URL of the NocturnusAI server. Natural-language extraction needs an LLM provider; without one, natural-language turns return zero facts, though predicate syntax works without an LLM.
Installation
In SourceWeft
- Open Logic Server in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
NocturnusAI
[CI] [PyPI] [npm] [Docker] [License: BUSL-1.1] [MCP]
The context engineering engine for AI agents: send only what changed.
[NocturnusAI — Context Engineering Engine for AI Agents]
Before / After
The Numbers
Measured on live APIs. 15-turn product support conversation. Real usage.input_tokens counts. Run it yourself.
Claude Opus 4: 5.7× reduction. Gemini 2.0 Flash: 10.0×. Full calculations.
Install
Or use the setup wizard:
Why Developers Star This Repo
- Reproducible token reduction — benchmark in the repo, methodology published, run it against your own workload
- Deterministic inference — same query, same result, every time. No embedding drift, no cosine similarity lottery
- Truth maintenance — retract a fact, all derived conclusions auto-retract. No stale context, no hallucination on operational state
- Plugs into existing stacks — LangChain, LlamaIndex, CrewAI, AutoGen, MCP, Vercel AI SDK, OpenAI Agents SDK, Mastra
- Benchmarkable against naive replay — numbers derived, not invented. Every claim traces to a notebook cell
Framework Quickstarts
How It Works
Three steps. Every turn.
- Extract — raw conversation turns → structured facts via LLM extraction
- Infer — backward-chaining logical inference finds only the facts reachable from the agent's current goal
- Return the delta — a
briefingDeltacontaining only what changed since the last turn
This is not vector search. It is not summarization. It is deterministic inference on a logic engine — Hexastore indexing, backward chaining, and truth maintenance.
The Working Loop
LLM required for natural-language turns. The examples below send raw text turns through an LLM to extract structured facts. If you start the server without an LLM provider, natural-language turns will return zero facts. See Quick Start for setup options, or use predicate syntax (e.g.,
"customer_tier(acme_corp, enterprise)") which works without any LLM.
1. First reduction: POST /context
2. Goal-driven pass: POST /memory/context
3. Later turns: POST /context/diff
Returns only added and removed entries between snapshots.
4. End of thread: POST /context/session/clear
Choose Your Surface
Python SDK
TypeScript SDK
MCP
Use the context tool each turn for a salience-ranked working set. Pair MCP with the HTTP context endpoints when you need goal-driven assembly and diffs.
What Lives Behind The Workflow
When you do need backend mechanics, NocturnusAI provides them:
- Deterministic fact and rule storage
- Backward-chaining inference with proof chains
- Truth maintenance and contradiction handling
- Temporal facts with
ttl,validFrom, andvalidUntil - Multi-tenancy via
X-DatabaseandX-Tenant-ID - MCP, REST, Python SDK, TypeScript SDK, and CLI surfaces over the same engine
Quick Start
Docker (fastest)
Docker with Ollama (enables natural-language extraction)
From this repo
CLI
Documentation
Full docs: nocturnus.ai
Docker Compose (advanced)
Build from Source
Requires JDK 17+.
Contributing
See CONTRIBUTING.md. Issues labelled good first issue are good entry points.
Security
Report vulnerabilities privately via GitHub Security Advisories. See SECURITY.md.
License
Business Source License 1.1 (SPDX: BUSL-1.1). Free for internal use — including internal production — inside your own organization. Offering NocturnusAI or substantial functionality as a product/hosted service to third parties requires a commercial license ([email protected]). Converts to Apache 2.0 on 2030-02-19. See LICENSE and DISCLAIMER.md.
LEGAL & SAFETY NOTICE
NocturnusAI is a deterministic reasoning engine, but its output is only as reliable as the facts provided to it.
- No Warranty of Truth. "Verified" refers to logical consistency of inference, not accuracy of real-world claims.
- Not for Autonomous High-Stakes Decisions. Do not use this engine for unsupervised medical, financial, legal, or physical-safety decisions without an independent human verification step.
- Logic Layer Only. NocturnusAI provides information and inference; it does not execute actions.
- No Liability. See DISCLAIMER.md and LICENSE.
Source: README.md at commit 0dd449a
Tools
0Version history
1- v0.3.11LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.