Logic Server

ai.nocturnus由 nocturnus.ai 發布v0.3.11更新於 Oct 24, 2026

Agent reasoning, memory, and token-optimized context for AI applications.

已驗證STDIO僅桌面知識與記憶AI 與機器學習

概覽

AI 產生的概覽

一個本機 MCP 伺服器,為助理提供確定性的推理與記憶引擎,每輪只回傳發生變化的事實脈絡。

可以做什麼
依對話輪次與工具輸出建立依重要性排序的工作事實集,README 建議每輪使用 context 工具。依目標驅動組裝脈絡,只回傳從目前目標可達的事實。取得快照之間的差異,僅顯示新增與移除的項目。在執行緒結束時清除工作階段中儲存的脈絡。儲存事實與規則,支援反向鏈推理、證明鏈、真值維護與時間有效性。
適用情境
當助理反覆重播很長的對話歷史、你希望降低 token 用量同時維持業務事實一致時適合使用,例如多輪客服或需要撤回、更新事實的代理流程。適合希望採用確定性推理而非向量檢索或摘要的情境。
執行需求
以桌面本機程序執行,透過 stdio 從 npm 套件 nocturnusai-mcp 啟動。環境變數:NOCTURNUSAI_API_KEY 用於驗證存取,NOCTURNUSAI_DATABASE 指定資料庫名稱,NOCTURNUSAI_TENANT 用於多租戶隔離,NOCTURNUSAI_URL 指定 NocturnusAI 伺服器的基礎位址。自然語言擷取需要 LLM 供應商;未設定時自然語言輪次會回傳零筆事實,但述詞語法不需 LLM 即可使用。
安裝前請注意
需要 NOCTURNUSAI_API_KEY 密鑰以及可連線的 NocturnusAI 伺服器。對話輪次與工具輸出會送到該伺服器進行擷取,若設定了 LLM 供應商也會傳給該模型,因此不要傳送敏感資料。伺服器會儲存事實與工作階段脈絡,並可清除工作階段,因而改變已存狀態。README 的安裝腳本會把遠端腳本直接交給 shell 執行,建議改用套件或容器方式安裝。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Logic Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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

python
# ❌ Without NocturnusAI — replay everything, every turnmessages = system_prompt + full_history + tool_outputs   # ~1,259 tokens/turnresponse = llm(messages)                                 # $13,600/mo at scale
# ✅ With NocturnusAI — send only what changedctx = nocturnus.process_turns(raw_turns)                 # extract → infer → deltamessages = system_prompt + ctx.briefing_delta             # ~221 tokens/turnresponse = llm(messages)                                 # $2,400/mo. Same accuracy.

The Numbers

Measured on live APIs. 15-turn product support conversation. Real usage.input_tokens counts. Run it yourself.

Naive replayRAG-optimizedNocturnusAI
Tokens per turn~1,259~800~221
Cost per month (1K req/hr, Opus 4, $15/1M)$13,600$12,000$2,400
Latencyhighmediumlow
Truth-preservingnonoyes

Claude Opus 4: 5.7× reduction. Gemini 2.0 Flash: 10.0×. Full calculations.


Install

bash
pip install nocturnusai          # Pythonnpm install nocturnusai-sdk      # TypeScriptdocker run -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest  # Docker

Or use the setup wizard:

bash
curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash

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

FrameworkIntegrationLink
LangChain / LangGraphDrop-in NocturnusContextProvider, LangSmith trace pass-throughDocs
CrewAITask-scoped context per agent roleDocs
AutoGenContext server callable by any agentDocs
MCPSpec-compliant server for Claude Desktop, Cursor, ContinueConfig
OpenAI Agents SDKContext middleware, no tool modificationsDocs
Vercel AI SDKEdge-compatible adapter for Next.js, Nuxt, SvelteKitDocs
Python SDKpip install nocturnusaiDocs
TypeScript SDKnpm install nocturnusai-sdkDocs

How It Works

Three steps. Every turn.

  1. Extract — raw conversation turns → structured facts via LLM extraction
  2. Infer — backward-chaining logical inference finds only the facts reachable from the agent's current goal
  3. Return the delta — a briefingDelta containing 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

bash
curl -X POST http://localhost:9300/context \  -H 'Content-Type: application/json' \  -H 'X-Tenant-ID: default' \  -d '{    "turns": [      "user: Customer says they are enterprise and blocked on SLA credits.",      "tool: CRM says account is Acme Corp with a 2M ARR contract.",      "agent: Last week support promised to review SLA eligibility.",      "tool: Billing note says renewal is due next month."    ],    "maxFacts": 12  }'

2. Goal-driven pass: POST /memory/context

bash
curl -X POST http://localhost:9300/memory/context \  -H 'Content-Type: application/json' \  -H 'X-Tenant-ID: default' \  -d '{    "goals": [{"predicate":"eligible_for_sla","args":["acme_corp"]}],    "maxFacts": 12,    "sessionId": "ticket-42"  }'

3. Later turns: POST /context/diff

bash
curl -X POST http://localhost:9300/context/diff \  -H 'Content-Type: application/json' \  -H 'X-Tenant-ID: default' \  -d '{"sessionId": "ticket-42", "maxFacts": 12}'

Returns only added and removed entries between snapshots.

4. End of thread: POST /context/session/clear

bash
curl -X POST http://localhost:9300/context/session/clear \  -H 'Content-Type: application/json' \  -H 'X-Tenant-ID: default' \  -d '{"sessionId":"ticket-42"}'

Choose Your Surface

Python SDK
python
from nocturnusai import SyncNocturnusAIClient
with SyncNocturnusAIClient("http://localhost:9300") as client:    ctx = client.process_turns(        turns=[            "user: Customer says they are enterprise and blocked on SLA credits.",            "tool: CRM says account is Acme Corp with a 2M ARR contract.",        ],        scope="ticket-42",        session_id="ticket-42",    )
    diff = client.diff_context(session_id="ticket-42", max_facts=12)    client.clear_context_session("ticket-42")
    print(ctx.briefing_delta)
TypeScript SDK
ts
import { NocturnusAIClient } from 'nocturnusai-sdk';
const client = new NocturnusAIClient({  baseUrl: 'http://localhost:9300',  tenantId: 'default',});
const ctx = await client.processTurns({  turns: [    'user: Customer says they are enterprise and blocked on SLA credits.',    'tool: CRM says account is Acme Corp with a 2M ARR contract.',  ],  scope: 'ticket-42',  sessionId: 'ticket-42',});
const diff = await client.diffContext({ sessionId: 'ticket-42', maxFacts: 12 });await client.clearContextSession('ticket-42');console.log(ctx.briefingDelta);
MCP
json
{  "mcpServers": {    "nocturnus": {      "url": "http://localhost:9300/mcp/sse",      "transport": "sse"    }  }}

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, and validUntil
  • Multi-tenancy via X-Database and X-Tenant-ID
  • MCP, REST, Python SDK, TypeScript SDK, and CLI surfaces over the same engine

Quick Start

Docker (fastest)

bash
docker run -d --name nocturnusai -p 9300:9300 \  --restart unless-stopped \  -v nocturnusai-data:/data \  ghcr.io/auctalis/nocturnusai:latest
bash
curl http://localhost:9300/health   # Verify it's running

Docker with Ollama (enables natural-language extraction)

bash
docker run -d --name nocturnusai -p 9300:9300 \  --add-host=host.docker.internal:host-gateway \  -e LLM_PROVIDER=ollama \  -e LLM_MODEL=granite3.3:8b \  -e LLM_BASE_URL=http://host.docker.internal:11434/v1 \  -e EXTRACTION_ENABLED=true \  ghcr.io/auctalis/nocturnusai:latest

From this repo

bash
make up-ollama && make smoke

CLI

bash
nocturnusai                                # Interactive REPLnocturnusai -e "context 10"               # Salience-ranked working setnocturnusai -e "compress"                 # POST /memory/compressnocturnusai -e "cleanup 0.05"             # POST /memory/cleanup

Documentation

Full docs: nocturnus.ai

Start HereThe turn-reduction workflow
Context WorkflowRaw turns → optimize → diff → clear
API ReferenceREST endpoints and response shapes
SDKsPython and TypeScript client methods
IntegrationsLangChain, CrewAI, AutoGen, MCP, and more
BenchmarkMeasured token reduction on live APIs
CalculationsEvery number, derived
How It WorksThe extraction → inference → delta pipeline

Docker Compose (advanced)

bash
git clone https://github.com/Auctalis/nocturnusai.git && cd nocturnusai
make up                                        # Server using .env.example defaultsmake up-ollama                                 # + Ollama (reuses host or starts bundled)make up-monitoring                             # + Prometheus + Grafanamake smoke                                     # Verify health + context endpoint

Build from Source

Requires JDK 17+.

bash
./gradlew :nocturnusai-server:run              # HTTP server on :9300./gradlew :nocturnusai-cli:run                 # Interactive REPL (JVM)./gradlew :nocturnusai-cli:nativeCompile       # Build native binary./gradlew test                                 # Full test suite

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.

  1. No Warranty of Truth. "Verified" refers to logical consistency of inference, not accuracy of real-world claims.
  2. 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.
  3. Logic Layer Only. NocturnusAI provides information and inference; it does not execute actions.
  4. No Liability. See DISCLAIMER.md and LICENSE.

來源:README.md,提交 0dd449a

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.11最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。