### Run the NocturnusAI setup wizard Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Downloads and runs the official installation script from the repository. ```bash curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash ``` -------------------------------- ### Quickstart: Install dependencies, start NocturnusAI, set API keys, launch Jupyter Source: https://github.com/auctalis/nocturnusai/blob/main/nocturnusai-bench/README.md Setup steps for the live benchmark. Requires Docker or Gradle to run NocturnusAI locally, and Anthropic and Google API keys for live API calls. ```bash # 1. Install dependencies pip install -r requirements.txt # 2. Start NocturnusAI locally (for the live benchmark) docker run -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest # or: ./gradlew :nocturnusai-server:run (from repo root) # 3. Set API keys export ANTHROPIC_API_KEY=sk-ant-... export GOOGLE_API_KEY=AIza... # 4. Launch Jupyter jupyter notebook notebooks/ ``` -------------------------------- ### Repo-local manual install Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Manual path for starting from the repo instead of the hosted installer. `make up-ollama` is the repo-local/manual path; the primary install path is the one-line installer. ```bash make up-ollama make smoke ``` -------------------------------- ### CLI usage example Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Start the NocturnusAI CLI and use the REPL commands `context`, `compress`, and `cleanup`. `compress` maps to `POST /memory/compress`, and `cleanup` maps to `POST /memory/cleanup`. ```bash nocturnusai # then inside the REPL: # context 10 # compress # cleanup 0.05 ``` -------------------------------- ### Start the NocturnusAI server Source: https://github.com/auctalis/nocturnusai/blob/main/sdks/python/README.md Recommended setup installs CLI, configures LLM provider, and starts server. Bare Docker runs logic engine but context extraction requires LLM config. ```bash # Recommended — installs CLI, configures LLM provider, starts server curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash nocturnusai setup # Or bare Docker (logic engine works; context extraction requires LLM config — see below) docker run -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest ``` -------------------------------- ### Install Python SDK via pip Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Install the Python SDK package using pip. ```bash pip install nocturnusai ``` -------------------------------- ### Install options Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Alternative install commands with flags: `--host-ollama` for local Ollama, `--ollama` for Docker, `--key` for provider key, `--port` for custom port. ```bash # Local Ollama on your machine curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --host-ollama ``` ```bash # Ollama in Docker curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --ollama ``` ```bash # With your own provider key curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --key sk-ant-your-key ``` ```bash # Custom port curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --port 8080 ``` -------------------------------- ### Setup: Install dependencies Source: https://github.com/auctalis/nocturnusai/blob/main/demos/advanced/typescript/README.md Navigate to the TypeScript demos directory and install npm dependencies. Ensure the server is running at http://localhost:9300 before proceeding. ```bash cd demos/advanced/typescript npm install ``` -------------------------------- ### Install NocturnusAI with Docker Compose Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Manual installation using Docker Compose. Clone the repository and start the services with docker compose up --build. ```bash git clone https://github.com/Auctalis/nocturnusai.git cd nocturnusai docker compose up --build ``` -------------------------------- ### Working Loop example (fails silently without LLM) Source: https://github.com/auctalis/nocturnusai/blob/main/docs/fresh-eyes-audit-2026-04-12.md README's headline example for the Working Loop. Returns zero facts and a warning when no LLM provider is configured, as the Quick Start Docker command does not include LLM configuration. ```bash curl -X POST http://localhost:9300/context -d '{"turns":["user: Customer says..."]}' ``` -------------------------------- ### Install TypeScript SDK via npm Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Install the TypeScript SDK package using npm. ```bash npm install nocturnusai-sdk ``` -------------------------------- ### Start the server with Docker or installer Source: https://github.com/auctalis/nocturnusai/blob/main/sdks/typescript/README.md Two ways to start the NocturnusAI server: via Docker or via the installer script. ```bash # Docker docker run -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest ``` ```bash # or installer curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash ``` -------------------------------- ### Build and Run NocturnusAI from Repository Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Starts the full stack with Ollama and runs smoke tests from the repository. ```bash make up-ollama && make smoke ``` -------------------------------- ### Create example directory with mkdir Source: https://github.com/auctalis/nocturnusai/blob/main/docs/plans/2026-03-11-framework-integration-blitz.md Creates the directory for the example scripts. ```bash mkdir -p sdks/python/examples ``` -------------------------------- ### Run value proof with bash value_proof.sh Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Executes the value proof example script. Requires the same prerequisites as the other examples. ```bash bash value_proof.sh ``` -------------------------------- ### Install NocturnusAI with one-liner options Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Install with specific options: --host-ollama, --ollama, --key, or --port. Each option configures the installation accordingly. ```bash curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --host-ollama ``` ```bash curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --ollama ``` ```bash curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --key sk-ant-... ``` ```bash curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash -s -- --port 8080 ``` -------------------------------- ### GET /userguide Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md User guide content. This endpoint returns user guide content. ```APIDOC ## [GET] /userguide ### Description User guide content. ### Method GET ### Endpoint /userguide ``` -------------------------------- ### Run all examples with bash examples.sh Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Executes every example script in the repository. Requires curl, jq, and a running NocturnusAI server at http://localhost:9300. ```bash bash examples.sh ``` -------------------------------- ### TypeScript SDK demo setup and run commands Source: https://github.com/auctalis/nocturnusai/blob/main/demos/advanced/README.md Navigate to the TypeScript demos directory, install dependencies, and run the selected demo scripts with ts-node covering basics, memory management, SSE events, and agent workflow. ```bash cd demos/advanced/typescript npm install npx ts-node 01_basics.ts npx ts-node 03_memory_management.ts npx ts-node 06_events_sse.ts npx ts-node 07_agent_workflow.ts ``` -------------------------------- ### Python SDK demo setup and run commands Source: https://github.com/auctalis/nocturnusai/blob/main/demos/advanced/README.md Navigate to the Python demos directory, install the nocturnusai package, and run the numbered demo scripts covering basics, rules, memory, transactions, auth, DSL, LangChain tools, and agent workflow. ```bash cd demos/advanced/python pip install nocturnusai python 01_basics.py python 02_rules_and_inference.py python 03_memory_management.py python 04_transactions.py python 05_auth_and_keys.py python 06_dsl_execute.py python 07_langchain_tools.py python 08_agent_workflow.py ``` -------------------------------- ### Install NocturnusAI via pip, npm, and Docker Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Install the NocturnusAI SDK for Python, TypeScript, or run the Docker container. The Docker command maps port 9300. ```bash pip install nocturnusai # Python ``` ```bash npm install nocturnusai-sdk # TypeScript ``` ```bash docker run -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest # Docker ``` -------------------------------- ### Build from source with Gradle Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Requires JDK 17+. Run the HTTP server on port 9300, start the interactive REPL, build a native binary, or run the full test suite. ```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 ``` -------------------------------- ### Install dependencies Source: https://github.com/auctalis/nocturnusai/blob/main/nocturnusai-bench/notebooks/02_live_benchmark.ipynb Install required Python packages from requirements.txt. ```bash pip install -r ../requirements.txt ``` -------------------------------- ### Install nocturnusai and run Docker container Source: https://github.com/auctalis/nocturnusai/blob/main/examples/langchain/README.md Install the required Python packages and start the NocturnusAI server on port 9300. ```bash pip install nocturnusai langchain langchain-openai docker run -d -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest ``` -------------------------------- ### GET /admin/databases Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Lists admin databases. ```APIDOC ## GET /admin/databases ### Description Lists admin databases. ### Method GET ### Endpoint /admin/databases ### Headers - **X-Database** (string) - Required - Database name - **X-Tenant-ID** (string) - Required - Tenant identifier ### Response #### Success Response (200) - No response body details provided. #### Response Example ```json {} ``` ``` -------------------------------- ### Start server and bootstrap admin key Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Starts the Docker Compose stack with monitoring profile, then bootstraps the admin key via POST /auth/bootstrap. Save the returned key for subsequent API calls. ```bash # 3. Start docker compose --profile monitoring up -d # 4. Bootstrap admin key curl -sX POST http://localhost:9300/auth/bootstrap \ -H 'Content-Type: application/json' \ -d '{"name":"admin"}' # Save the returned key! ``` -------------------------------- ### OpenAI Agents knowledge example script Source: https://github.com/auctalis/nocturnusai/blob/main/docs/plans/2026-03-11-framework-integration-blitz.md Self-contained example showing OpenAI Agents SDK integration with NocturnusAI. Requires `pip install nocturnusai[openai-agents]` and a running server. Prints available tools and agent usage. ```python """OpenAI Agents SDK + NocturnusAI example: Agent with knowledge tools. Prerequisites: pip install nocturnusai[openai-agents] # Start NocturnusAI: ./gradlew :nocturnusai-server:run """ from nocturnusai import SyncNocturnusAIClient from nocturnusai.openai_agents import get_nocturnusai_tools client = SyncNocturnusAIClient("http://localhost:9300") tools = get_nocturnusai_tools(client) print("NocturnusAI OpenAI Agents tools ready:") for i, tool in enumerate(tools): name = getattr(tool, "name", getattr(tool, "__name__", f"tool_{i}")) print(f" - {name}") print("\nUsage: Agent(name='reasoner', tools=tools)") ``` -------------------------------- ### Run the knowledge agent example Source: https://github.com/auctalis/nocturnusai/blob/main/examples/openai-agents/README.md Executes the example script that demonstrates context compression and an OpenAI Agent using NocturnusAI tools. ```bash python knowledge_agent.py ``` -------------------------------- ### Python SDK usage example Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Use the SyncNocturnusAIClient to process turns, diff context, and clear a session. The client is used as a context manager. ```python from nocturnusai import SyncNocturnusAIClient with SyncNocturnusAIClient("http://localhost:9300") as client: ctx = client.process_turns( turns=["user: Customer is enterprise, blocked on SLA credits."], scope="ticket-42", session_id="ticket-42", ) diff = client.diff_context(session_id="ticket-42", max_facts=10) client.clear_context_session("ticket-42") ``` -------------------------------- ### Software Engineering Examples for PRACTICAL_ARGUMENT Source: https://github.com/auctalis/nocturnusai/blob/main/USERGUIDE.md Example predicate configurations for deployment gates, access control, auto-scaling, and PR merge scenarios. Each uses the PRACTICAL_ARGUMENT template with CONCLUSION, EVIDENCE, and EXCEPTION predicates. ```json {"CONCLUSION": "Deploy_To_Prod", "EVIDENCE": "All_Tests_Pass", "EXCEPTION": "Deploy_Freeze"} ``` ```json {"CONCLUSION": "Grant_Access", "EVIDENCE": "Valid_Credentials", "EXCEPTION": "Account_Locked"} ``` ```json {"CONCLUSION": "Scale_Up", "EVIDENCE": "High_CPU", "EXCEPTION": "Budget_Exceeded"} ``` ```json {"CONCLUSION": "Auto_Merge", "EVIDENCE": "Approved_Review", "EXCEPTION": "Merge_Conflict"} ``` -------------------------------- ### Manage server with Docker Compose and Make Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Commands for viewing logs, stopping, restarting, and updating the NocturnusAI server. Use 'docker compose logs -f nocturnusai' to follow logs, 'make down' to stop, 'make up-ollama' to restart, and the curl command to update via the install script. ```bash # Logs docker compose logs -f nocturnusai # Stop make down # Restart make up-ollama # Update curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash ``` -------------------------------- ### Install dependencies and run NocturnusAI server Source: https://github.com/auctalis/nocturnusai/blob/main/examples/openai-agents/README.md Install the required Python packages, start the NocturnusAI Docker container on port 9300, and set the OpenAI API key. ```bash pip install nocturnusai openai-agents docker run -d -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest export OPENAI_API_KEY=sk-... ``` -------------------------------- ### TypeScript SDK usage example Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Use the NocturnusAIClient to process turns, diff context, and clear a session asynchronously. ```typescript import { NocturnusAIClient } from 'nocturnusai-sdk'; const client = new NocturnusAIClient({ baseUrl: 'http://localhost:9300' }); const ctx = await client.processTurns({ turns: ['user: Customer is enterprise, blocked on SLA credits.'], scope: 'ticket-42', sessionId: 'ticket-42', }); const diff = await client.diffContext({ sessionId: 'ticket-42', maxFacts: 10 }); await client.clearContextSession('ticket-42'); ``` -------------------------------- ### Quick start commands for Python and TypeScript demos Source: https://github.com/auctalis/nocturnusai/blob/main/demos/llm/README.md Run the Python demo from the demos/llm/python directory, then the TypeScript demo from the typescript directory. Requires installing the nocturnusai package and npm dependencies. ```bash # Python cd demos/llm/python pip install nocturnusai python 01_langchain_agent.py # TypeScript cd ../typescript npm install npx ts-node 01_mcp_client.ts ``` -------------------------------- ### Commit example scripts Source: https://github.com/auctalis/nocturnusai/blob/main/docs/plans/2026-03-11-framework-integration-blitz.md Commits the newly created example scripts to the repository. ```bash git add sdks/python/examples/ git commit -m "feat(sdk): add framework integration example scripts" ``` -------------------------------- ### Anthropic tool use example script Source: https://github.com/auctalis/nocturnusai/blob/main/docs/plans/2026-03-11-framework-integration-blitz.md Self-contained example showing Anthropic SDK integration with NocturnusAI. Requires `pip install nocturnusai anthropic` and a running server. Prints tool definitions and usage for message creation and tool call handling. ```python """Anthropic SDK + NocturnusAI example: Claude with knowledge tools. Prerequisites: pip install nocturnusai anthropic # Start NocturnusAI: ./gradlew :nocturnusai-server:run """ from nocturnusai import SyncNocturnusAIClient from nocturnusai.anthropic_tools import get_nocturnusai_tool_definitions, handle_tool_call client = SyncNocturnusAIClient("http://localhost:9300") tools = get_nocturnusai_tool_definitions() print("NocturnusAI Anthropic tool definitions:") for tool_def in tools: print(f" - {tool_def['name']}: {tool_def['description'][:60]}...") print("\nUsage:") print(" response = anthropic.messages.create(tools=tools, ...)") print(" result = handle_tool_call(client, tool_use.name, tool_use.input)") ``` -------------------------------- ### Quickstart commands for Python and TypeScript demos Source: https://github.com/auctalis/nocturnusai/blob/main/demos/README.md Run the Python MCP demo, the Python memory lifecycle demo, and the TypeScript MCP demo. Commands assume you are in the demos/llm directory; the TypeScript demo requires npm install and npx ts-node. ```bash # Python MCP demo cd demos/llm/python pip install nocturnusai python 02_mcp_client.py # Python memory lifecycle demo python 04_agent_memory.py # TypeScript MCP demo cd ../typescript npm install npx ts-node 01_mcp_client.ts ``` -------------------------------- ### Install nocturnusai with LangChain extras Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Install the Python SDK with LangChain support using pip. ```bash pip install nocturnusai[langchain] ``` -------------------------------- ### Install nocturnusai with pip Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Install the Python SDK. The second command includes the optional LangChain integration. ```bash pip install nocturnusai # With LangChain integration pip install nocturnusai[langchain] ``` -------------------------------- ### Run NocturnusAI with Ollama for Natural-Language Extraction Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Starts NocturnusAI with Ollama as the LLM provider, enabling natural-language extraction. Sets the model to granite3.3:8b and points to the local Ollama service. ```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 ``` -------------------------------- ### Run NocturnusAI with Docker Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Starts the NocturnusAI server in a Docker container, mapping port 9300 and persisting data in a volume. The container restarts unless stopped. ```bash docker run -d --name nocturnusai -p 9300:9300 \ --restart unless-stopped \ -v nocturnusai-data:/data \ ghcr.io/auctalis/nocturnusai:latest ``` -------------------------------- ### LogiQL Family Relationships Example Source: https://github.com/auctalis/nocturnusai/blob/main/USERGUIDE.md Complete example demonstrating facts, rules (including recursive), queries, constraints, explanations, and a test case. Shows expected results and test output. ```logiq -- Family relationships ASSERT Parent(alice, bob); ASSERT Parent(bob, dave); ASSERT Parent(bob, eve); -- Grandparent rule ASSERT FORALL ?x, ?y, ?z { Grandparent(?x, ?z) <- Parent(?x, ?y) AND Parent(?y, ?z) }; -- Ancestor rule (recursive) ASSERT FORALL ?x, ?y { Ancestor(?x, ?y) <- Parent(?x, ?y) }; ASSERT FORALL ?x, ?y, ?z { Ancestor(?x, ?z) <- Parent(?x, ?y) AND Ancestor(?y, ?z) }; -- Query INFER Grandparent(?who, dave); -- Result: Grandparent(alice, dave) INFER Ancestor(alice, ?descendant); -- Results: Ancestor(alice, bob), Ancestor(alice, dave), Ancestor(alice, eve) -- Constraint: nobody can be their own parent RESTRICT ?x { Parent(?x, ?x) } -> CONTRADICTION; -- Explanation EXPLAIN Grandparent(alice, dave); -- Shows: Derived via rule [Grandparent(?x, ?z) :- Parent(?x, ?y), Parent(?y, ?z)] -- with premises [Parent(alice, bob), Parent(bob, dave)] -- Test: verify grandparent inference TEST "grandparent rule" { GIVEN { ASSERT Parent(alice, bob); ASSERT Parent(bob, dave); ASSERT FORALL ?x, ?y, ?z { Grandparent(?x, ?z) <- Parent(?x, ?y) AND Parent(?y, ?z) }; } EXPECT { PROVABLE Grandparent(alice, dave); NOT_PROVABLE Grandparent(dave, alice); COUNT Grandparent(alice, ?z) 1; } }; -- Output: TEST "grandparent rule": PASSED (3/3 expectations) ``` -------------------------------- ### Run NocturnusAI and install MCP config Source: https://github.com/auctalis/nocturnusai/blob/main/examples/mcp/example-session.md Commands to start the NocturnusAI Docker container and copy the config.json to the Claude Desktop MCP servers directory. Requires Docker and a valid ANTHROPIC_API_KEY. ```bash docker run -d -p 9300:9300 -e EXTRACTION_ENABLED=true \ -e ANTHROPIC_API_KEY=sk-ant-... ghcr.io/auctalis/nocturnusai:latest ``` ```bash cp config.json ~/Library/Application\ Support/Claude/mcp_servers/nocturnus.json ``` -------------------------------- ### Run NocturnusAI Docker container Source: https://github.com/auctalis/nocturnusai/blob/main/examples/README.md Starts the NocturnusAI server on port 9300. Required before running any example. ```bash docker run -d -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest ``` -------------------------------- ### GET /replication/wal Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Gets the write-ahead log. This endpoint is part of the ReplicationRoutes and is used to retrieve the write-ahead log for replication. ```APIDOC ## [GET] /replication/wal ### Description Gets the write-ahead log. This endpoint is part of the ReplicationRoutes and is used to retrieve the write-ahead log for replication. ### Method GET ### Endpoint /replication/wal ### Parameters No parameters. ### Response #### Success Response (200) - **wal** (array) - The write-ahead log entries. #### Response Example { "wal": [] } ``` -------------------------------- ### GET /auth/status Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Gets authentication status. This endpoint is part of the AuthRoutes and is used to check the current authentication status. ```APIDOC ## [GET] /auth/status ### Description Gets authentication status. This endpoint is part of the AuthRoutes and is used to check the current authentication status. ### Method GET ### Endpoint /auth/status ### Parameters No parameters. ### Response #### Success Response (200) - **status** (string) - The authentication status. #### Response Example { "status": "enabled" } ``` -------------------------------- ### GET /auth/whoami Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Gets current user information. This endpoint is part of the AuthRoutes and is used to retrieve information about the current authenticated user. ```APIDOC ## [GET] /auth/whoami ### Description Gets current user information. This endpoint is part of the AuthRoutes and is used to retrieve information about the current authenticated user. ### Method GET ### Endpoint /auth/whoami ### Parameters No parameters. ### Response #### Success Response (200) - **user** (object) - The current user information. #### Response Example { "user": { "id": "user_123", "role": "admin" } } ``` -------------------------------- ### GET /.well-known/agent.json Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Retrieves the agent card. ```APIDOC ## GET /.well-known/agent.json ### Description Retrieves the agent card. ### Method GET ### Endpoint /.well-known/agent.json ### Headers - **X-Database** (string) - Required - Database name - **X-Tenant-ID** (string) - Required - Tenant identifier ### Response #### Success Response (200) - No response body details provided. #### Response Example ```json {} ``` ``` -------------------------------- ### GET /auth/status Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Retrieves authentication status. ```APIDOC ## GET /auth/status ### Description Retrieves authentication status. ### Method GET ### Endpoint /auth/status ### Headers - **X-Database** (string) - Required - Database name - **X-Tenant-ID** (string) - Required - Tenant identifier ### Response #### Success Response (200) - No response body details provided. #### Response Example ```json {} ``` ``` -------------------------------- ### GET /predicates Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Retrieves the schema of predicates. ```APIDOC ## GET /predicates ### Description Retrieves the schema of predicates. ### Method GET ### Endpoint /predicates ### Headers - **X-Database** (string) - Required - Database name - **X-Tenant-ID** (string) - Required - Tenant identifier ### Response #### Success Response (200) - No response body details provided. #### Response Example ```json {} ``` ``` -------------------------------- ### GET /auth/keys/{id} Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Gets a specific API key. This endpoint is part of the AuthRoutes and is used to retrieve a single API key by ID. ```APIDOC ## [GET] /auth/keys/{id} ### Description Gets a specific API key. This endpoint is part of the AuthRoutes and is used to retrieve a single API key by ID. ### Method GET ### Endpoint /auth/keys/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the API key. ### Response #### Success Response (200) - **key** (object) - The API key details. #### Response Example { "key": { "id": "key_123", "name": "my-key", "role": "admin" } } ``` -------------------------------- ### Quick start: get_nocturnusai_tools Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Create a SyncNocturnusAIClient and obtain LangChain tools for the knowledge base. The returned tools include nocturnusai_assert, nocturnusai_query, nocturnusai_infer, and nocturnusai_context. ```python from nocturnusai import SyncNocturnusAIClient from nocturnusai.langchain import get_nocturnusai_tools client = SyncNocturnusAIClient("http://localhost:9300") tools = get_nocturnusai_tools(client) # tools = [ # NocturnusAIAssertTool — nocturnusai_assert # NocturnusAIQueryTool — nocturnusai_query # NocturnusAIInferTool — nocturnusai_infer # NocturnusAIContextTool — nocturnusai_context # ] ``` -------------------------------- ### Start the NocturnusAI CLI (Makefile, Gradle, options, single command) Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Commands to launch the interactive REPL. Use `make cli` or `./gradlew :nocturnusai-cli:run --console=plain` for a plain console. Pass server, database, and API key via `--args='--server ... --db ... --api-key ...'`. Execute a single command with `-e`. ```bash # Via Makefile make cli # Via Gradle ./gradlew :nocturnusai-cli:run --console=plain # With options ./gradlew :nocturnusai-cli:run --args='--server http://host:9300 --db mydb --api-key secret' # Execute a single command ./gradlew :nocturnusai-cli:run --args='-e "tell human(socrates)"' ``` -------------------------------- ### GET /health Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Health check endpoint to verify the server is running. ```APIDOC ## GET /health ### Description Health check endpoint to verify the server is running. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - No response body details provided. #### Response Example ```json {} ``` ``` -------------------------------- ### Initialize client and use core API methods Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Create a NocturnusAIClient with baseUrl, optional apiKey, database, and tenantId. Demonstrates assertFact, assertRule, infer, contextWindow, temporalQuery, setPriority, consolidate, decay, retract, predicates, health, and execute DSL. ```typescript import { NocturnusAIClient } from 'nocturnusai-sdk'; const client = new NocturnusAIClient({ baseUrl: 'http://localhost:9300', apiKey: 'your-key', // optional database: 'default', tenantId: 'default', }); // Assert facts await client.assertFact('parent', ['alice', 'bob']); await client.assertFact('parent', ['bob', 'charlie']); // Assert rules await client.assertRule( { predicate: 'grandparent', args: ['?x', '?z'] }, [ { predicate: 'parent', args: ['?x', '?y'] }, { predicate: 'parent', args: ['?y', '?z'] }, ] ); // Infer const results = await client.infer('grandparent', ['?who', 'charlie']); console.log(results); // With proofs const proofs = await client.infer('grandparent', ['?who', 'charlie'], { withProof: true, }); // Context window const ctx = await client.contextWindow({ maxFacts: 50, minSalience: 0.1, }); console.log(`${ctx.windowSize} of ${ctx.totalAvailable} facts`); // Temporal query const pastFacts = await client.temporalQuery( 'location', ['?user', '?place'], Date.now() - 86400000 // 24 hours ago ); // Set priority await client.setPriority('user_preference', ['alice', 'dark_mode'], 0.9); // Consolidate and decay const consolidation = await client.consolidate(); const decay = await client.decay(0.05); // Retract await client.retract('parent', ['bob', 'charlie']); // Schema discovery const schema = await client.predicates(); // Health const health = await client.health(); // Execute DSL const dslResult = await client.execute('ASSERT human(socrates).'); ``` -------------------------------- ### Docker Compose advanced commands Source: https://github.com/auctalis/nocturnusai/blob/main/README.md Clone the repository and run the server with optional components. `make up` uses `.env.example` defaults, `make up-ollama` adds Ollama, `make up-monitoring` adds Prometheus and Grafana, and `make smoke` verifies health and context endpoint. ```bash git clone https://github.com/Auctalis/nocturnusai.git && cd nocturnusai make up # Server using .env.example defaults make up-ollama # + Ollama (reuses host or starts bundled) make up-monitoring # + Prometheus + Grafana make smoke # Verify health + context endpoint ``` -------------------------------- ### GET /admin/databases Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Lists all databases. This endpoint is part of the AdminRoutes and is used to retrieve a list of all databases. ```APIDOC ## [GET] /admin/databases ### Description Lists all databases. This endpoint is part of the AdminRoutes and is used to retrieve a list of all databases. ### Method GET ### Endpoint /admin/databases ### Parameters No parameters. ### Response #### Success Response (200) - **databases** (array) - List of database names. #### Response Example { "databases": ["default", "db1"] } ``` -------------------------------- ### CLI - context, compress, cleanup Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md CLI commands for interacting with the system. `compress` maps to `POST /memory/compress`, and `cleanup` maps to `POST /memory/cleanup`. ```APIDOC ## CLI commands ### Description CLI commands for interacting with the system. `compress` maps to `POST /memory/compress`, and `cleanup` maps to `POST /memory/cleanup`. ### Commands - **context** - Display context (usage: `context 10`) - **compress** - Compress memory (maps to `POST /memory/compress`) - **cleanup** - Cleanup memory (maps to `POST /memory/cleanup`) ### Usage ```bash nocturnusai # then inside the REPL: # context 10 # compress # cleanup 0.05 ``` ``` -------------------------------- ### GET /scopes Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Lists all scopes. This endpoint is part of the ScopeRoutes and is used to retrieve a list of all scopes. ```APIDOC ## [GET] /scopes ### Description Lists all scopes. This endpoint is part of the ScopeRoutes and is used to retrieve a list of all scopes. ### Method GET ### Endpoint /scopes ### Parameters No parameters. ### Response #### Success Response (200) - **scopes** (array) - List of scope names. #### Response Example { "scopes": ["scope1", "scope2"] } ``` -------------------------------- ### POST /tx/begin Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Begins a transaction. This endpoint is part of the TransactionRoutes and is used to start a new transaction. ```APIDOC ## [POST] /tx/begin ### Description Begins a transaction. This endpoint is part of the TransactionRoutes and is used to start a new transaction. ### Method POST ### Endpoint /tx/begin ### Parameters No parameters. ### Response #### Success Response (200) - **transaction_id** (string) - The ID of the new transaction. #### Response Example { "transaction_id": "tx_123" } ``` -------------------------------- ### Narrow the window for the next question Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Optimizes the context window for a specific goal using `/context/optimize` with goals, maxFacts, and sessionId. ```bash curl -sX POST http://localhost:9300/context/optimize \ -H 'Content-Type: application/json' \ -H "X-Tenant-ID: ${NOCTURNUS_TENANT}" \ -d '{ "goals": [ {"predicate":"eligible_for_sla","args":["acme_corp"]} ], "maxFacts": 10, "sessionId": "ticket-42" }' | jq . ``` -------------------------------- ### Development Setup Commands Source: https://github.com/auctalis/nocturnusai/blob/main/CONTRIBUTING.md Commands to clone the repository, build and test the server, run the server and CLI, build with Docker, and set up Python, TypeScript, and docs environments. Requires JDK 17+, Docker (optional), Python 3.10+, and Node 20+. ```bash git clone https://github.com/Auctalis/nocturnusai.git cd nocturnusai # Build and test the server ./gradlew build test # Run the server locally ./gradlew :nocturnusai-server:run # Run the CLI (requires a running server) ./gradlew :nocturnusai-cli:run # Build with Docker docker compose up --build # Python SDK cd sdks/python pip install -e ".[langchain,dev]" pytest # TypeScript SDK cd sdks/typescript npm install && npm run build # Docs site cd site npm install && npm run dev # http://localhost:4321 ``` -------------------------------- ### Run server from source with Gradle Source: https://github.com/auctalis/nocturnusai/blob/main/docs/fresh-eyes-audit-2026-04-11.md Starts the NocturnusAI server using the Gradle wrapper. Build takes about 16 seconds with zero warnings, server initializes in 0.316s and loads 12 databases. Note: port 9300 may already be in use, causing a BindException; an existing instance can be used. ```bash ./gradlew :nocturnusai-server:run ``` -------------------------------- ### GET /.well-known/agent.json Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md A2A Agent Card. This endpoint is part of the ObservabilityRoutes and provides the A2A Agent Card. ```APIDOC ## [GET] /.well-known/agent.json ### Description A2A Agent Card. This endpoint is part of the ObservabilityRoutes and provides the A2A Agent Card. ### Method GET ### Endpoint /.well-known/agent.json ### Parameters No parameters. ### Response #### Success Response (200) - **agent** (object) - The agent card. #### Response Example { "agent": {} } ``` -------------------------------- ### Setup environment and plotting Source: https://github.com/auctalis/nocturnusai/blob/main/nocturnusai-bench/notebooks/02_live_benchmark.ipynb Check environment variables, set NocturnusAI URL, and configure matplotlib. ```python import os import json import time import datetime import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mticker import pandas as pd # ── Check environment ────────────────────────────────────────────────────────── ANTHROPIC_KEY = os.environ.get("ANTHROPIC_API_KEY") GOOGLE_KEY = os.environ.get("GOOGLE_API_KEY") NOCTURNUS_URL = os.environ.get("NOCTURNUS_URL", "http://localhost:9300") print("Environment check:") print(f" ANTHROPIC_API_KEY : {'✅ set' if ANTHROPIC_KEY else '❌ missing'}") print(f" GOOGLE_API_KEY : {'✅ set' if GOOGLE_KEY else '❌ missing'}") print(f" NOCTURNUS_URL : {NOCTURNUS_URL}") plt.rcParams.update({'figure.dpi': 130, 'axes.spines.top': False, 'axes.spines.right': False}) ``` -------------------------------- ### GET /metrics Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Prometheus metrics endpoint. This endpoint is part of the ObservabilityRoutes and exposes metrics in Prometheus format. ```APIDOC ## [GET] /metrics ### Description Prometheus metrics endpoint. This endpoint is part of the ObservabilityRoutes and exposes metrics in Prometheus format. ### Method GET ### Endpoint /metrics ### Parameters No parameters. ### Response #### Success Response (200) - **metrics** (string) - The Prometheus metrics. #### Response Example { "metrics": "# HELP ..." } ``` -------------------------------- ### POST /context/optimize Source: https://github.com/auctalis/nocturnusai/blob/main/demos/curl/README.md Builds a goal-driven context window based on specified goals. ```APIDOC ## POST /context/optimize ### Description Builds a goal-driven context window based on specified goals. ### Method POST ### Endpoint /context/optimize ### Headers - **X-Database** (string) - Required - Database name - **X-Tenant-ID** (string) - Required - Tenant identifier ### Request Body - **goals** (array of objects) - Required - List of goals, each with predicate and args - **maxFacts** (integer) - Optional - Maximum number of facts to return - **sessionId** (string) - Optional - Session identifier ### Request Example ```json { "goals": [{"predicate": "eligible_for_sla", "args": ["acme_corp"]}], "maxFacts": 10, "sessionId": "ticket-42" } ``` ### Response #### Success Response (200) - No response body details provided. #### Response Example ```json {} ``` ``` -------------------------------- ### GET /health Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Health check endpoint. This endpoint is part of the ObservabilityRoutes and is used to check the health of the server. ```APIDOC ## [GET] /health ### Description Health check endpoint. This endpoint is part of the ObservabilityRoutes and is used to check the health of the server. ### Method GET ### Endpoint /health ### Parameters No parameters. ### Response #### Success Response (200) - **status** (string) - The health status. #### Response Example { "status": "ok" } ``` -------------------------------- ### Backend reasoning: tell, teach, ask Source: https://github.com/auctalis/nocturnusai/blob/main/QUICKSTART.md Use the low-level HTTP endpoints to model facts and rules directly. The `tell` endpoint adds a fact, `teach` adds a rule, and `ask` queries with a variable. Requires the `NOCTURNUS_TENANT` environment variable. ```bash curl -sX POST http://localhost:9300/tell \ -H 'Content-Type: application/json' \ -H "X-Tenant-ID: ${NOCTURNUS_TENANT}" \ -d '{"predicate":"parent","args":["alice","bob"]}' curl -sX POST http://localhost:9300/teach \ -H 'Content-Type: application/json' \ -H "X-Tenant-ID: ${NOCTURNUS_TENANT}" \ -d '{ "head": {"predicate":"grandparent","args":["?x","?z"]}, "body": [ {"predicate":"parent","args":["?x","?y"]}, {"predicate":"parent","args":["?y","?z"]} ] }' curl -sX POST http://localhost:9300/ask \ -H 'Content-Type: application/json' \ -H "X-Tenant-ID: ${NOCTURNUS_TENANT}" \ -d '{"predicate":"grandparent","args":["?who","bob"]}' | jq . ``` -------------------------------- ### GET /auth/keys Source: https://github.com/auctalis/nocturnusai/blob/main/CLAUDE.md Lists all API keys. This endpoint is part of the AuthRoutes and is used to retrieve a list of all API keys. ```APIDOC ## [GET] /auth/keys ### Description Lists all API keys. This endpoint is part of the AuthRoutes and is used to retrieve a list of all API keys. ### Method GET ### Endpoint /auth/keys ### Parameters No parameters. ### Response #### Success Response (200) - **keys** (array) - List of API keys. #### Response Example { "keys": [] } ``` -------------------------------- ### LangGraph stateful workflow example script Source: https://github.com/auctalis/nocturnusai/blob/main/docs/plans/2026-03-11-framework-integration-blitz.md Self-contained example showing LangGraph integration with NocturnusAI. Requires `pip install nocturnusai[langgraph]` and a running server. Prints checkpoint saver usage and thread-to-scope mapping. ```python """LangGraph + NocturnusAI example: Stateful workflow with checkpointing. Prerequisites: pip install nocturnusai[langgraph] # Start NocturnusAI: ./gradlew :nocturnusai-server:run """ from nocturnusai import SyncNocturnusAIClient from nocturnusai.langgraph import NocturnusAICheckpointSaver client = SyncNocturnusAIClient("http://localhost:9300") saver = NocturnusAICheckpointSaver(client=client) print("NocturnusAI LangGraph checkpoint saver ready") print("Usage: app = graph.compile(checkpointer=saver)") print("\nLangGraph threads map to NocturnusAI scopes for isolation.") ``` -------------------------------- ### Production Environment Setup and Server Launch Source: https://github.com/auctalis/nocturnusai/blob/main/USERGUIDE.md Sets environment variables for a production deployment, including ports, API and encryption keys from secrets, storage directory, TLS settings, and then runs the server via Gradle. Enables authentication, TLS 1.2+ on port 9443, AES-256-GCM encryption at rest, and isolated storage. ```bash export PORT=9300 export HOST=0.0.0.0 export API_KEY=$(cat /run/secrets/nocturnusai-api-key) export ENCRYPTION_KEY=$(cat /run/secrets/nocturnusai-encryption-key) export STORAGE_DIR=/data/nocturnusai export TLS_ENABLED=true export TLS_PORT=9443 export TLS_KEYSTORE_PATH=/etc/nocturnusai/keystore.p12 export TLS_KEYSTORE_PASSWORD=$(cat /run/secrets/keystore-password) export TLS_KEY_ALIAS=nocturnusai ./gradlew :nocturnusai-server:run ``` -------------------------------- ### Auth management with bootstrap and key creation Source: https://github.com/auctalis/nocturnusai/blob/main/DEVELOPER_GUIDE.md Shows how to check auth status, bootstrap the first admin key, create scoped keys, and list/revoke keys. Requires an admin key for creating keys. ```python async with NocturnusAIClient("http://localhost:9300") as client: # Check auth status status = await client.auth_status() # Bootstrap first admin key (only when no keys exist) admin = await client.bootstrap(name="my-admin") print(f"Admin key: {admin['key']}") # save this! # Create scoped keys (requires admin key) client._api_key = admin['key'] writer = await client.create_key( name="agent-writer", role="writer", databases=["prod"], expires_in_days=90, ) # List and revoke keys keys = await client.list_keys() await client.revoke_key(keys[0]["id"]) ```