How ostis-apps/nika works
Project Type and Purpose
• NIKA is a full-stack, containerized, knowledge-driven assistant built on OSTIS technology.
• It comprises a semantic knowledge engine (sc-machine), a set of problem-solver modules (C++ and Python), two web UIs (a React-based chat interface and SC-web), and a large on-disk knowledge base.
File Structure
• Top-level: Docker Compose, CMake, Conan, mkdocs, GitHub CI, scripts.
• interface/: React/TypeScript chat UI, served by webpack (dev server + custom wsServer).
• problem-solver/:
• py/: Python alternative implementation for message processing + WeatherAgent.
• knowledge-base/: thousands of .scs/.gwf files defining ontologies, patterns, agents.
• scripts/: entrypoints, healthchecks, build helpers.
• docker-compose.yml: orchestrates containers (sc-machine, problem-solver, interface, sc-web, etc.).
Extract Key Insights from README
• Two web UIs exposed:
• sc-web at localhost:8000
• dialogue chat UI at localhost:3033
• Knowledge base is rebuilt on container start (controlled via REBUILD_KB env).
• Communication: frontends ←→ backends via HTTP/WebSocket; problem-solver ←→ sc-machine via sc_http; message classification uses external Wit.ai.
Main Components and Their Interactions
a. Frontend Components
• React Chat UI (“interface” container): serves SPA, connects via WebSocket to problem-solver server.
b. Backend Components
• sc-machine container: core semantic engine, loads knowledge base and C++ modules as plugins, exposes sc_http REST API.
• problem-solver container:
• C++ plugins linked into sc-machine perform semantic reasoning tasks.
• Python server (optional) for lightweight module implementations.
• A WS/HTTP server (interface/scripts/wsServer.js and server.js) relays chat messages between React UI and sc-machine modules.
• External Service: Wit.ai (via MessageClassificationModule client) used by classification agent.
c. Data Stores and Assets
• knowledge-base directory: loaded into sc-machine memory at build time.
• Persistent storage for sc-machine (if configured) or in-memory.
• config files (.ini, .env) control container behavior.
Architectural Patterns and Design Principles
• Microservices: each major subsystem runs in its own Docker container.
• Plugin modularity: C++ modules compiled separately and loaded by sc-machine.
• Frontend/backend separation: React UI and SC-web are independent UIs.
• Semantic dataflow: Messages are transformed into semantic representations (.scs/.gwf), processed by logic rules and agents, then converted back to natural language.
• CI/CD: GitHub workflows for style checks, building, testing (Conan, CMake, pytest).