How theopensi/cosmic-core works
OpenSI-CoSMIC is a configurable cognitive assistant that routes queries to general reasoning, chess analysis, document knowledge updates, or code generation. Its primary workflow is a user query entering the application, being classified by an LLM-based analyser, and then handled by the selected service to produce an answer. Document retrieval and LLM backends support these paths. The README documents the major services; some implementation links are based on the SOURCE INDEX rather than complete excerpts, so uncertain internal relationships are omitted.
Main entry points: opensi_cosmic.py CoSMIC orchestrator · qa.py General QA · llm.py LLM service · chess.py Chess services
Components 20
Application entry
- Chat API
api.py - CoSMIC orchestrator
src/opensi_cosmic.py
Query routing
- Query analyser
src/query_analyser/query_analyser.py
Knowledge services
- Vector database
src/services/vector_database.py - Context retrieval
src/services/rag.py
Reasoning and chess
- General QA
src/services/qa.py - Code generation
modules/code_generation/code_generation.py - Chess services
src/services/chess.py - Puzzle analysis
modules/chess/chess_qa_puzzle.py - Chess quality
modules/chess/chess_qa_quality.py - FEN generation
modules/chess/chess_genfen.py - Move reasoning
modules/chess/chess_gencot.py
Model infrastructure
- LLM service
src/services/llms/llm.py - LLM base
src/services/llms/LLMBase.py - Ollama backend
src/services/llms/Ollama.py - Model registry
src/maps.py - Prompt templates
src/services/llms/prompts/user_prompt.py - Tokenizer
src/services/llms/tokenizer.py
Other components
- Chat user
- Stockfish engine
Connections 30
- Chat user → Chat API: submits query
README.md - Chat API → CoSMIC orchestrator: invokes
api.py - CoSMIC orchestrator → Query analyser: classifies query
src/opensi_cosmic.py - CoSMIC orchestrator → Vector database: configures
src/opensi_cosmic.py - CoSMIC orchestrator → General QA: configures
src/opensi_cosmic.py - CoSMIC orchestrator → Context retrieval: configures
src/opensi_cosmic.py - CoSMIC orchestrator → Puzzle analysis: configures
src/opensi_cosmic.py - CoSMIC orchestrator → Chess quality: configures
src/opensi_cosmic.py - CoSMIC orchestrator → FEN generation: configures
src/opensi_cosmic.py - CoSMIC orchestrator → Move reasoning: configures
src/opensi_cosmic.py - CoSMIC orchestrator → Code generation: configures
src/opensi_cosmic.py - General QA → Query analyser: classifies with
src/services/qa.py - General QA → Context retrieval: retrieves context
src/services/qa.py - General QA → Code generation: delegates code
src/services/qa.py - Context retrieval → Vector database: searches
src/services/rag.py - Puzzle analysis → Chess services: predicts moves
modules/chess/chess_qa_puzzle.py - Chess services → Stockfish engine: queries engine
- General QA → Chess services: predicts moves
src/services/qa.py - CoSMIC orchestrator → LLM service: creates model
src/opensi_cosmic.py - LLM service → LLM base: extends
src/services/llms/llm.py - LLM service → Ollama backend: loads backend
src/services/llms/llm.py - LLM service → Model registry: reads registry
src/services/llms/llm.py - LLM base → Prompt templates: uses templates
src/services/llms/LLMBase.py - LLM base → Tokenizer: uses tokenizer
src/services/llms/LLMBase.py - Query analyser → LLM service: classifies with
src/query_analyser/query_analyser.py - Query analyser → Prompt templates: uses prompts
src/query_analyser/query_analyser.py - Puzzle analysis → General QA: delegates answers
modules/chess/chess_qa_puzzle.py - Move reasoning → Chess services: uses chess logic
modules/chess/chess_gencot.py - FEN generation → Chess services: uses chess logic
modules/chess/chess_genfen.py - Chess quality → General QA: uses QA
modules/chess/chess_qa_quality.py