From dadb0af9541cd568d1b80cfda9b03f48ff11c1fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=CE=A7=CE=B3=CF=86=CF=84=20Kompanion?=
 <chigammaphitau@chelydra.at>
Date: Sat, 18 Oct 2025 14:16:16 +0200
Subject: [PATCH] Change API naming to KI

It is just the catchy thing to do.
---
 src/CMakeLists.txt                            |  2 +-
 src/{KompanionAI => KI}/CMakeLists.txt        | 13 +++---
 src/{KompanionAI => KI}/Client/KIClient.cpp   |  4 +-
 src/{KompanionAI => KI}/Client/KIClient.h     |  4 +-
 .../Completion/KIChatOptions.h                |  4 +-
 src/{KompanionAI => KI}/Completion/KIError.h  |  4 +-
 .../Completion/KIReply.cpp                    |  4 +-
 src/{KompanionAI => KI}/Completion/KIReply.h  |  4 +-
 .../Embedding/KIEmbedding.h                   |  4 +-
 src/{KompanionAI => KI}/Message/KIMessage.h   |  4 +-
 src/{KompanionAI => KI}/Message/KIThread.h    |  4 +-
 src/{KompanionAI => KI}/Policy/KIPolicy.h     |  4 +-
 .../Provider/KICapabilities.h                 |  4 +-
 src/{KompanionAI => KI}/Provider/KIProvider.h |  4 +-
 .../Provider/OllamaProvider.cpp               |  4 +-
 .../Provider/OllamaProvider.h                 |  4 +-
 src/{KompanionAI => KI}/Tool/KITool.h         |  4 +-
 src/cli/CMakeLists.txt                        |  2 +-
 src/dal/IDatabase.hpp                         |  2 +-
 src/dal/Models.hpp                            |  2 +-
 src/dal/PgDal.cpp                             |  4 +-
 src/dal/PgDal.hpp                             |  4 +-
 src/gui/CMakeLists.txt                        |  2 +-
 src/gui/MainWindow.cpp                        | 46 +++++++++----------
 src/main.cpp                                  |  2 +-
 src/mcp/CMakeLists.txt                        |  6 ++-
 src/mcp/HandlersMemory.hpp                    | 24 +++++-----
 src/mcp/KompanionQtServer.cpp                 |  2 +-
 src/mcp/KompanionQtServer.hpp                 |  6 +--
 tests/contract_memory.cpp                     | 12 ++---
 30 files changed, 95 insertions(+), 94 deletions(-)
 rename src/{KompanionAI => KI}/CMakeLists.txt (71%)
 rename src/{KompanionAI => KI}/Client/KIClient.cpp (95%)
 rename src/{KompanionAI => KI}/Client/KIClient.h (95%)
 rename src/{KompanionAI => KI}/Completion/KIChatOptions.h (91%)
 rename src/{KompanionAI => KI}/Completion/KIError.h (90%)
 rename src/{KompanionAI => KI}/Completion/KIReply.cpp (95%)
 rename src/{KompanionAI => KI}/Completion/KIReply.h (95%)
 rename src/{KompanionAI => KI}/Embedding/KIEmbedding.h (93%)
 rename src/{KompanionAI => KI}/Message/KIMessage.h (94%)
 rename src/{KompanionAI => KI}/Message/KIThread.h (88%)
 rename src/{KompanionAI => KI}/Policy/KIPolicy.h (87%)
 rename src/{KompanionAI => KI}/Provider/KICapabilities.h (94%)
 rename src/{KompanionAI => KI}/Provider/KIProvider.h (93%)
 rename src/{KompanionAI => KI}/Provider/OllamaProvider.cpp (98%)
 rename src/{KompanionAI => KI}/Provider/OllamaProvider.h (95%)
 rename src/{KompanionAI => KI}/Tool/KITool.h (96%)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b2fba5c..d5248e7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,5 +2,5 @@ add_subdirectory(cli)
 add_subdirectory(dal)
 add_subdirectory(gui)
 
-add_subdirectory(KompanionAI)
+add_subdirectory(KI)
 add_subdirectory(mcp)
diff --git a/src/KompanionAI/CMakeLists.txt b/src/KI/CMakeLists.txt
similarity index 71%
rename from src/KompanionAI/CMakeLists.txt
rename to src/KI/CMakeLists.txt
index 99a5557..c65c80f 100644
--- a/src/KompanionAI/CMakeLists.txt
+++ b/src/KI/CMakeLists.txt
@@ -1,11 +1,10 @@
-
-set(KOMPANION_AI_SRCS
+set(KOM_KI_SRCS
     Client/KIClient.cpp
     Provider/OllamaProvider.cpp
     Completion/KIReply.cpp
 )
 
-set(KOMPANION_AI_HDRS
+set(KOM_KI_HDRS
     Client/KIClient.h
     Provider/KIProvider.h
     Provider/KICapabilities.h
@@ -20,14 +19,14 @@ set(KOMPANION_AI_HDRS
     Policy/KIPolicy.h
 )
 
-add_library(kom_ai STATIC ${KOMPANION_AI_SRCS} ${KOMPANION_AI_HDRS})
+add_library(kom_ki STATIC ${KOM_KI_SRCS} ${KOM_KI_HDRS})
 
-target_include_directories(kom_ai PUBLIC
+target_include_directories(kom_ki PUBLIC
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${Qt6Core_INCLUDE_DIRS}
 )
 
-target_link_libraries(kom_ai PUBLIC
+target_link_libraries(kom_ki PUBLIC
     Qt6::Core
     Qt6::Network
-)
+)
\ No newline at end of file
diff --git a/src/KompanionAI/Client/KIClient.cpp b/src/KI/Client/KIClient.cpp
similarity index 95%
rename from src/KompanionAI/Client/KIClient.cpp
rename to src/KI/Client/KIClient.cpp
index 1fa9f46..5a9a0b9 100644
--- a/src/KompanionAI/Client/KIClient.cpp
+++ b/src/KI/Client/KIClient.cpp
@@ -1,7 +1,7 @@
 
 #include "KIClient.h"
 
-namespace KompanionAI {
+namespace KI {
 
 KIClient::KIClient(QObject *parent) : QObject(parent)
 {
@@ -58,4 +58,4 @@ void KIClient::cancel(quint64 requestId)
     }
 }
 
-} // namespace KompanionAI
+} // namespace KI
diff --git a/src/KompanionAI/Client/KIClient.h b/src/KI/Client/KIClient.h
similarity index 95%
rename from src/KompanionAI/Client/KIClient.h
rename to src/KI/Client/KIClient.h
index 44d7a5e..011dbd5 100644
--- a/src/KompanionAI/Client/KIClient.h
+++ b/src/KI/Client/KIClient.h
@@ -9,7 +9,7 @@
 #include "../Completion/KIChatOptions.h"
 #include "../Embedding/KIEmbedding.h"
 
-namespace KompanionAI {
+namespace KI {
 
 class KIClient : public QObject
 {
@@ -39,6 +39,6 @@ private:
     QString m_defaultModel;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANICLIENT_H
diff --git a/src/KompanionAI/Completion/KIChatOptions.h b/src/KI/Completion/KIChatOptions.h
similarity index 91%
rename from src/KompanionAI/Completion/KIChatOptions.h
rename to src/KI/Completion/KIChatOptions.h
index 8575a8e..2b8f23a 100644
--- a/src/KompanionAI/Completion/KIChatOptions.h
+++ b/src/KI/Completion/KIChatOptions.h
@@ -7,7 +7,7 @@
 #include "../Tool/KITool.h"
 #include "../Policy/KIPolicy.h"
 
-namespace KompanionAI {
+namespace KI {
 
 class KIChatOptions
 {
@@ -33,6 +33,6 @@ public:
     bool operator!=(const KIChatOptions& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANICHATOPTIONS_H
\ No newline at end of file
diff --git a/src/KompanionAI/Completion/KIError.h b/src/KI/Completion/KIError.h
similarity index 90%
rename from src/KompanionAI/Completion/KIError.h
rename to src/KI/Completion/KIError.h
index de4d631..4567aff 100644
--- a/src/KompanionAI/Completion/KIError.h
+++ b/src/KI/Completion/KIError.h
@@ -4,7 +4,7 @@
 #include <QObject>
 #include <QString>
 
-namespace KompanionAI {
+namespace KI {
 
 class KIError
 {
@@ -33,6 +33,6 @@ public:
     bool operator!=(const KIError& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANIERROR_H
\ No newline at end of file
diff --git a/src/KompanionAI/Completion/KIReply.cpp b/src/KI/Completion/KIReply.cpp
similarity index 95%
rename from src/KompanionAI/Completion/KIReply.cpp
rename to src/KI/Completion/KIReply.cpp
index fb83570..b74f3db 100644
--- a/src/KompanionAI/Completion/KIReply.cpp
+++ b/src/KI/Completion/KIReply.cpp
@@ -2,7 +2,7 @@
 #include <QJsonDocument>
 #include <QJsonObject>
 
-namespace KompanionAI {
+namespace KI {
 
 QString KIReply::text() const
 {
@@ -48,4 +48,4 @@ void KIReply::processIncomingData(const QByteArray& newData)
     }
 }
 
-} // namespace KompanionAI
\ No newline at end of file
+} // namespace KI
\ No newline at end of file
diff --git a/src/KompanionAI/Completion/KIReply.h b/src/KI/Completion/KIReply.h
similarity index 95%
rename from src/KompanionAI/Completion/KIReply.h
rename to src/KI/Completion/KIReply.h
index 4980760..609ff92 100644
--- a/src/KompanionAI/Completion/KIReply.h
+++ b/src/KI/Completion/KIReply.h
@@ -8,7 +8,7 @@
 #include "../Tool/KITool.h"
 #include "KIError.h"
 
-namespace KompanionAI {
+namespace KI {
 
 class KIReply : public QObject
 {
@@ -52,6 +52,6 @@ protected:
     QString m_accumulatedText; // Added for accumulating text
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANIREPLY_H
\ No newline at end of file
diff --git a/src/KompanionAI/Embedding/KIEmbedding.h b/src/KI/Embedding/KIEmbedding.h
similarity index 93%
rename from src/KompanionAI/Embedding/KIEmbedding.h
rename to src/KI/Embedding/KIEmbedding.h
index d8c2f7a..310599a 100644
--- a/src/KompanionAI/Embedding/KIEmbedding.h
+++ b/src/KI/Embedding/KIEmbedding.h
@@ -6,7 +6,7 @@
 #include <QString>
 #include <QVector>
 
-namespace KompanionAI {
+namespace KI {
 
 class KIEmbedOptions
 {
@@ -34,6 +34,6 @@ public:
     bool operator!=(const KIEmbeddingResult& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANIEMBEDDING_H
diff --git a/src/KompanionAI/Message/KIMessage.h b/src/KI/Message/KIMessage.h
similarity index 94%
rename from src/KompanionAI/Message/KIMessage.h
rename to src/KI/Message/KIMessage.h
index ec4360a..4a39051 100644
--- a/src/KompanionAI/Message/KIMessage.h
+++ b/src/KI/Message/KIMessage.h
@@ -7,7 +7,7 @@
 #include <QList>
 #include <QVariantMap>
 
-namespace KompanionAI {
+namespace KI {
 
 class KIMessagePart
 {
@@ -37,6 +37,6 @@ class KIMessage
     bool operator!=(const KIMessage& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANIMESSAGE_H
diff --git a/src/KompanionAI/Message/KIThread.h b/src/KI/Message/KIThread.h
similarity index 88%
rename from src/KompanionAI/Message/KIThread.h
rename to src/KI/Message/KIThread.h
index c69f180..daddc95 100644
--- a/src/KompanionAI/Message/KIThread.h
+++ b/src/KI/Message/KIThread.h
@@ -6,7 +6,7 @@
 #include <QList>
 #include "KIMessage.h"
 
-namespace KompanionAI {
+namespace KI {
 
 class KIThread
 {
@@ -20,6 +20,6 @@ public:
     bool operator!=(const KIThread& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANITHREAD_H
diff --git a/src/KompanionAI/Policy/KIPolicy.h b/src/KI/Policy/KIPolicy.h
similarity index 87%
rename from src/KompanionAI/Policy/KIPolicy.h
rename to src/KI/Policy/KIPolicy.h
index f7bc4df..2a72ed5 100644
--- a/src/KompanionAI/Policy/KIPolicy.h
+++ b/src/KI/Policy/KIPolicy.h
@@ -5,7 +5,7 @@
 #include <QString>
 #include <QStringList>
 
-namespace KompanionAI {
+namespace KI {
 
 class KIPolicy
 {
@@ -23,6 +23,6 @@ public:
     bool operator!=(const KIPolicy& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANIPOLICY_H
\ No newline at end of file
diff --git a/src/KompanionAI/Provider/KICapabilities.h b/src/KI/Provider/KICapabilities.h
similarity index 94%
rename from src/KompanionAI/Provider/KICapabilities.h
rename to src/KI/Provider/KICapabilities.h
index 2be5d9a..4b38041 100644
--- a/src/KompanionAI/Provider/KICapabilities.h
+++ b/src/KI/Provider/KICapabilities.h
@@ -3,7 +3,7 @@
 
 #include <QObject>
 
-namespace KompanionAI {
+namespace KI {
 
 class KICapabilities : public QObject
 {
@@ -37,6 +37,6 @@ private:
     bool m_images = false;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANICAPABILITIES_H
\ No newline at end of file
diff --git a/src/KompanionAI/Provider/KIProvider.h b/src/KI/Provider/KIProvider.h
similarity index 93%
rename from src/KompanionAI/Provider/KIProvider.h
rename to src/KI/Provider/KIProvider.h
index 8ad5217..fbf60b5 100644
--- a/src/KompanionAI/Provider/KIProvider.h
+++ b/src/KI/Provider/KIProvider.h
@@ -9,7 +9,7 @@
 #include "../Embedding/KIEmbedding.h"
 #include "KICapabilities.h"
 
-namespace KompanionAI {
+namespace KI {
 
 class KIChatOptions; // Forward declaration
 class KIEmbedOptions; // Forward declaration
@@ -36,6 +36,6 @@ signals:
     void modelsChanged();
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANIPROVIDER_H
\ No newline at end of file
diff --git a/src/KompanionAI/Provider/OllamaProvider.cpp b/src/KI/Provider/OllamaProvider.cpp
similarity index 98%
rename from src/KompanionAI/Provider/OllamaProvider.cpp
rename to src/KI/Provider/OllamaProvider.cpp
index 90e75da..721ba0a 100644
--- a/src/KompanionAI/Provider/OllamaProvider.cpp
+++ b/src/KI/Provider/OllamaProvider.cpp
@@ -6,7 +6,7 @@
 #include "../Completion/KIChatOptions.h" // Added
 #include "../Completion/KIError.h" // Added
 
-namespace KompanionAI {
+namespace KI {
 
 OllamaProvider::OllamaProvider(QObject *parent) : KIProvider(parent)
 {
@@ -153,4 +153,4 @@ void OllamaProvider::cancel(quint64 requestId)
     // TODO: Implement cancellation logic
 }
 
-} // namespace KompanionAI
+} // namespace KI
diff --git a/src/KompanionAI/Provider/OllamaProvider.h b/src/KI/Provider/OllamaProvider.h
similarity index 95%
rename from src/KompanionAI/Provider/OllamaProvider.h
rename to src/KI/Provider/OllamaProvider.h
index 3d93dee..6ceb827 100644
--- a/src/KompanionAI/Provider/OllamaProvider.h
+++ b/src/KI/Provider/OllamaProvider.h
@@ -10,7 +10,7 @@
 #include "../Message/KIThread.h" // Included full definition for KIThread
 #include "KICapabilities.h"
 
-namespace KompanionAI {
+namespace KI {
 
 class OllamaProvider : public KIProvider
 {
@@ -36,6 +36,6 @@ private:
     KICapabilities* m_caps;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // OLLAMAPROVIDER_H
diff --git a/src/KompanionAI/Tool/KITool.h b/src/KI/Tool/KITool.h
similarity index 96%
rename from src/KompanionAI/Tool/KITool.h
rename to src/KI/Tool/KITool.h
index d740b44..03ea408 100644
--- a/src/KompanionAI/Tool/KITool.h
+++ b/src/KI/Tool/KITool.h
@@ -8,7 +8,7 @@
 #include <QVariant>
 #include <QVariantMap>
 
-namespace KompanionAI {
+namespace KI {
 
 class KIToolParam
 {
@@ -70,6 +70,6 @@ public:
     bool operator!=(const KIToolResult& other) const = default;
 };
 
-} // namespace KompanionAI
+} // namespace KI
 
 #endif // KIANITOOL_H
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 5efd624..283f2fa 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -7,6 +7,6 @@ Qt6::Core
 Qt6::Sql
 KF6::ConfigCore
 kom_dal
-kom_ai
+kom_ki
 )
 install(TARGETS kompanion RUNTIME ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/src/dal/IDatabase.hpp b/src/dal/IDatabase.hpp
index eb49ae4..89e2dc2 100644
--- a/src/dal/IDatabase.hpp
+++ b/src/dal/IDatabase.hpp
@@ -5,7 +5,7 @@
 #include <utility>
 #include <optional>
 
-namespace kom {
+namespace ki {
 class IDatabase {
 public:
   virtual ~IDatabase() = default;
diff --git a/src/dal/Models.hpp b/src/dal/Models.hpp
index 5dfcdc6..274d391 100644
--- a/src/dal/Models.hpp
+++ b/src/dal/Models.hpp
@@ -4,7 +4,7 @@
 #include <optional>
 #include <cstdint>
 
-namespace kom {
+namespace ki {
 struct MemoryItem {
   std::string id;
   std::string namespace_id;
diff --git a/src/dal/PgDal.cpp b/src/dal/PgDal.cpp
index ac7feff..ee8420f 100644
--- a/src/dal/PgDal.cpp
+++ b/src/dal/PgDal.cpp
@@ -18,7 +18,7 @@
 #include <numeric>
 #include <stdexcept>
 
-namespace kom {
+namespace ki {
 
 namespace {
 
@@ -1101,4 +1101,4 @@ std::vector<std::string> PgDal::parsePgTextArray(const QString& value) {
   return tags;
 }
 
-} // namespace kom
+} // namespace ki
diff --git a/src/dal/PgDal.hpp b/src/dal/PgDal.hpp
index 29fbf24..683350b 100644
--- a/src/dal/PgDal.hpp
+++ b/src/dal/PgDal.hpp
@@ -14,7 +14,7 @@
 #include <unordered_set>
 #include <vector>
 
-namespace kom {
+namespace ki {
 
 struct NamespaceRow {
   std::string id;
@@ -177,4 +177,4 @@ private:
   std::unordered_map<std::string, EmbeddingRow> embeddings_;
 };
 
-} // namespace kom
+} // namespace ki
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index a6db934..b450d84 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -11,7 +11,7 @@ target_link_libraries(kompanion_gui PRIVATE
     Qt6::McpServer
     Qt6::McpCommon
     kom_dal
-    kom_ai
+    kom_ki
 )
 
 install(TARGETS kompanion_gui RUNTIME DESTINATION bin)
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 713eee9..12531cb 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -10,12 +10,12 @@
 #include <QApplication>
 #include <QFutureWatcher>
 
-#include <KompanionAI/Client/KIClient.h>
-#include <KompanionAI/Provider/OllamaProvider.h>
-#include <KompanionAI/Message/KIMessage.h>
-#include <KompanionAI/Message/KIThread.h>
-#include <KompanionAI/Completion/KIReply.h>
-#include <KompanionAI/Completion/KIChatOptions.h>
+#include <Client/KIClient.h>
+#include <Provider/OllamaProvider.h>
+#include <Message/KIMessage.h>
+#include <Message/KIThread.h>
+#include <Completion/KIReply.h>
+#include <Completion/KIChatOptions.h>
 
 
 class MainWindow : public KParts::MainWindow
@@ -42,9 +42,9 @@ public:
 
         connect(sendButton, &QPushButton::clicked, this, &MainWindow::sendMessage);
 
-        // Setup KompanionAI
-        m_ollamaProvider = new KompanionAI::OllamaProvider(this);
-        m_kompanionClient = new KompanionAI::KIClient(this);
+        // Setup KI
+        m_ollamaProvider = new KI::OllamaProvider(this);
+        m_kompanionClient = new KI::KIClient(this);
         m_kompanionClient->setProvider(m_ollamaProvider);
         m_kompanionClient->setDefaultModel("llama2"); // Or some other default
     }
@@ -62,29 +62,29 @@ private slots:
         // Append user message to chat view
         insertText(QString("User: %1\n").arg(message));
 
-        // Send message to KompanionAI
-        KompanionAI::KIThread thread;
-        KompanionAI::KIMessage kimessage;
+        // Send message to KI
+        KI::KIThread thread;
+        KI::KIMessage kimessage;
         kimessage.role = "user";
-        KompanionAI::KIMessagePart part;
+        KI::KIMessagePart part;
         part.mime = "text/plain";
         part.text = message;
         kimessage.parts.append(part);
         thread.messages.append(kimessage);
 
-        KompanionAI::KIChatOptions opts;
+        KI::KIChatOptions opts;
         opts.model = m_kompanionClient->defaultModel();
 
-        QFuture<KompanionAI::KIReply*> future = m_kompanionClient->chat(thread, opts);
+        QFuture<KI::KIReply*> future = m_kompanionClient->chat(thread, opts);
         
-        QFutureWatcher<KompanionAI::KIReply*> *watcher = new QFutureWatcher<KompanionAI::KIReply*>(this);
-        connect(watcher, &QFutureWatcher<KompanionAI::KIReply*>::finished, this, [this, watcher]() {
-            KompanionAI::KIReply* reply = watcher->result();
-            connect(reply, &KompanionAI::KIReply::tokensAdded, this, [this](const QString& delta) {
+        QFutureWatcher<KI::KIReply*> *watcher = new QFutureWatcher<KI::KIReply*>(this);
+        connect(watcher, &QFutureWatcher<KI::KIReply*>::finished, this, [this, watcher]() {
+            KI::KIReply* reply = watcher->result();
+            connect(reply, &KI::KIReply::tokensAdded, this, [this](const QString& delta) {
                 insertText(delta);
             });
             
-            connect(reply, &KompanionAI::KIReply::finished, this, [this, reply]() {
+            connect(reply, &KI::KIReply::finished, this, [this, reply]() {
                 insertText("\n");
                 reply->deleteLater();
             });
@@ -105,8 +105,8 @@ private:
     KTextEditor::Document *m_document;
     QLineEdit *m_chatInput;
 
-    KompanionAI::KIClient* m_kompanionClient;
-    KompanionAI::OllamaProvider* m_ollamaProvider;
+    KI::KIClient* m_kompanionClient;
+    KI::OllamaProvider* m_ollamaProvider;
 };
 
 int main(int argc, char *argv[])
@@ -117,4 +117,4 @@ int main(int argc, char *argv[])
     window.show();
 
     return app.exec();
-}
\ No newline at end of file
+}
diff --git a/src/main.cpp b/src/main.cpp
index de4f5fc..a478cef 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
         std::cerr << "[kom_mcp] PG_DSN not set; DAL will fall back to stubbed mode. Configure Database/PgDsn to enable persistence.\n";
     }
 
-    kom::PgDal dal;
+    ki::PgDal dal;
     if (effectiveDsn) {
         if (!dal.connect(*effectiveDsn)) {
             std::cerr << "[kom_mcp] Failed to connect to database; DAL will fall back to stubbed mode.\n";
diff --git a/src/mcp/CMakeLists.txt b/src/mcp/CMakeLists.txt
index f77707e..dc6e337 100644
--- a/src/mcp/CMakeLists.txt
+++ b/src/mcp/CMakeLists.txt
@@ -1,3 +1,5 @@
+find_package(Qt6 REQUIRED COMPONENTS Core)
+
 add_library(kom_mcp STATIC
     KompanionQtServer.cpp
 )
@@ -10,7 +12,7 @@ qt_add_resources(kom_mcp kompanion_mcp_resources
 
 target_link_libraries(kom_mcp PRIVATE
     kom_dal
-    kom_ai
+    kom_ki
     KF6::ConfigCore
     Qt6::Core
     Qt6::Network
@@ -26,4 +28,4 @@ target_compile_definitions(kom_mcp PRIVATE
 )
 
 
-install(FILES ToolSchemas.json DESTINATION ${KDE_INSTALL_DATADIR}/kompanion/mcp)
+install(FILES ToolSchemas.json DESTINATION ${KDE_INSTALL_DATADIR}/kompanion/mcp)
\ No newline at end of file
diff --git a/src/mcp/HandlersMemory.hpp b/src/mcp/HandlersMemory.hpp
index 274549d..01005d2 100644
--- a/src/mcp/HandlersMemory.hpp
+++ b/src/mcp/HandlersMemory.hpp
@@ -19,8 +19,8 @@
 namespace Handlers {
 namespace detail {
 
-inline kom::PgDal& database() {
-    static kom::PgDal instance;
+inline ki::PgDal& database() {
+    static ki::PgDal instance;
     static bool connected = [] {
         const char* env = std::getenv("PG_DSN");
         const std::string dsn = (env && *env) ? std::string(env) : std::string();
@@ -385,7 +385,7 @@ inline std::string upsert_memory(const std::string& reqJson) {
         return detail::error_response("bad_request", "items array must contain at least one entry");
     }
 
-    kom::PgDal& dal = detail::database();
+    ki::PgDal& dal = detail::database();
     const bool hasTx = dal.begin();
     std::vector<std::string> ids;
     ids.reserve(items.size());
@@ -394,7 +394,7 @@ inline std::string upsert_memory(const std::string& reqJson) {
     try {
 #endif
         for (auto& parsed : items) {
-            kom::ItemRow row;
+            ki::ItemRow row;
             row.id = parsed.id;
             row.namespace_id = nsRow->id;
             row.content_json = parsed.rawJson;
@@ -406,18 +406,18 @@ inline std::string upsert_memory(const std::string& reqJson) {
             ids.push_back(itemId);
 
             if (!parsed.embedding.empty()) {
-                kom::ChunkRow chunk;
+                ki::ChunkRow chunk;
                 chunk.item_id = itemId;
                 chunk.ord = 0;
                 chunk.text = parsed.text;
-                auto chunkIds = dal.upsertChunks(std::vector<kom::ChunkRow>{chunk});
+                auto chunkIds = dal.upsertChunks(std::vector<ki::ChunkRow>{chunk});
 
-                kom::EmbeddingRow emb;
+                ki::EmbeddingRow emb;
                 emb.chunk_id = chunkIds.front();
                 emb.model = "stub-model";
                 emb.dim = static_cast<int>(parsed.embedding.size());
                 emb.vector = parsed.embedding;
-                dal.upsertEmbeddings(std::vector<kom::EmbeddingRow>{emb});
+                dal.upsertEmbeddings(std::vector<ki::EmbeddingRow>{emb});
             }
         }
 #if defined(__cpp_exceptions)
@@ -466,7 +466,7 @@ inline std::string search_memory(const std::string& reqJson) {
         }
     }
 
-    kom::PgDal& dal = detail::database();
+    ki::PgDal& dal = detail::database();
     std::unordered_set<std::string> seen;
     std::vector<detail::SearchMatch> matches;
 
@@ -520,8 +520,8 @@ inline std::string save_context(const std::string& reqJson) {
     auto tags = detail::parse_string_array(reqJson, "tags");
     auto ttlOpt = detail::extract_int_field(reqJson, "ttl_seconds");
 
-    kom::PgDal& dal = detail::database();
-    kom::ItemRow row;
+    ki::PgDal& dal = detail::database();
+    ki::ItemRow row;
     row.namespace_id = nsRow->id;
     if (!key.empty()) {
         row.key = key;
@@ -600,7 +600,7 @@ inline std::string recall_context(const std::string& reqJson) {
         sinceOpt = since;
     }
 
-    kom::PgDal& dal = detail::database();
+    ki::PgDal& dal = detail::database();
     auto rows = dal.fetchContext(nsRow->id, keyOpt, tags, sinceOpt, limit);
 
     std::ostringstream os;
diff --git a/src/mcp/KompanionQtServer.cpp b/src/mcp/KompanionQtServer.cpp
index 44eeea1..5a9caa1 100644
--- a/src/mcp/KompanionQtServer.cpp
+++ b/src/mcp/KompanionQtServer.cpp
@@ -38,7 +38,7 @@ QString normaliseToolName(const QString &defaultNamespace, const QString &rawNam
 }
 } // namespace
 
-KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic, kom::PgDal* dal, QObject *parent)
+KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic, ki::PgDal* dal, QObject *parent)
     : QMcpServer(backend, parent)
     , m_logic(logic)
     , m_dal(dal)
diff --git a/src/mcp/KompanionQtServer.hpp b/src/mcp/KompanionQtServer.hpp
index 0c44a2a..d6a54c9 100644
--- a/src/mcp/KompanionQtServer.hpp
+++ b/src/mcp/KompanionQtServer.hpp
@@ -5,7 +5,7 @@
 #include <QtCore/QObject>
 
 class KomMcpServer;
-namespace kom {
+namespace ki {
 class PgDal;
 }
 class QMcpTool;
@@ -14,12 +14,12 @@ class KompanionQtServer : public QMcpServer
 {
     Q_OBJECT
 public:
-    explicit KompanionQtServer(const QString &backend, KomMcpServer *logic, kom::PgDal* dal, QObject *parent = nullptr);
+    explicit KompanionQtServer(const QString &backend, KomMcpServer *logic, ki::PgDal* dal, QObject *parent = nullptr);
 
 private:
     QList<QMcpTool> loadToolsFromSchema() const;
 
     KomMcpServer *m_logic;
-    kom::PgDal* m_dal;
+    ki::PgDal* m_dal;
     QList<QMcpTool> m_tools;
 };
\ No newline at end of file
diff --git a/tests/contract_memory.cpp b/tests/contract_memory.cpp
index 213abb6..29a45ff 100644
--- a/tests/contract_memory.cpp
+++ b/tests/contract_memory.cpp
@@ -5,31 +5,31 @@
 #include <vector>
 
 static void contract_pgdal_basic() {
-  kom::PgDal dal;
+  ki::PgDal dal;
   dal.connect("stub://memory");
   auto ns = dal.ensureNamespace("tests");
   static_cast<void>(ns);
 
-  kom::ItemRow item;
+  ki::ItemRow item;
   item.namespace_id = "tests";
   item.text = std::string("example");
   item.tags = {"alpha", "beta"};
   item.id = dal.upsertItem(item);
 
-  kom::ChunkRow chunk;
+  ki::ChunkRow chunk;
   chunk.item_id = item.id;
   chunk.text = "chunk-text";
-  auto chunkIds = dal.upsertChunks(std::vector<kom::ChunkRow>{chunk});
+  auto chunkIds = dal.upsertChunks(std::vector<ki::ChunkRow>{chunk});
   if (!chunkIds.empty()) {
     chunk.id = chunkIds.front();
   }
 
-  kom::EmbeddingRow embedding;
+  ki::EmbeddingRow embedding;
   embedding.chunk_id = chunk.id;
   embedding.model = "stub-model";
   embedding.dim = 3;
   embedding.vector = {0.1f, 0.2f, 0.3f};
-  dal.upsertEmbeddings(std::vector<kom::EmbeddingRow>{embedding});
+  dal.upsertEmbeddings(std::vector<ki::EmbeddingRow>{embedding});
 
   static_cast<void>(dal.searchText("tests", "chunk", 5));
   static_cast<void>(dal.searchVector("tests", embedding.vector, 5));
