diff --git a/app.js b/app.js
index 1f28ad2..c65c1d0 100644
--- a/app.js
+++ b/app.js
@@ -1933,6 +1933,9 @@ function setupControls() {
document.querySelector('.chat-quick-actions').innerHTML += `
+
Compression: --x
+
Docs: 0
+
AAAK: 0B
Compression: --x
Docs: 0
AAAK: 0B
@@ -1971,6 +1974,10 @@ function setupControls() {
}
function sendChatMessage(overrideText = null) {
+ // Mine chat message to MemPalace
+ if (overrideText) {
+ window.electronAPI.execPython(`mempalace add_drawer "${this.wing}" "chat" "${overrideText}"`);
+ }
const input = document.getElementById('chat-input');
const text = overrideText || input.value.trim();
if (!text) return;
diff --git a/electron-main.js b/electron-main.js
new file mode 100644
index 0000000..17674c5
--- /dev/null
+++ b/electron-main.js
@@ -0,0 +1,12 @@
+const { app, BrowserWindow, ipcMain } = require('electron')
+const { exec } = require('child_process')
+
+// MemPalace integration
+ipcMain.handle('exec-python', (event, command) => {
+ return new Promise((resolve, reject) => {
+ exec(command, (error, stdout, stderr) => {
+ if (error) return reject(error)
+ resolve({ stdout, stderr })
+ })
+ })
+})
diff --git a/mempalace.js b/mempalace.js
new file mode 100644
index 0000000..dcde44e
--- /dev/null
+++ b/mempalace.js
@@ -0,0 +1,44 @@
+// MemPalace integration
+class MemPalace {
+ constructor() {
+ this.palacePath = '~/.mempalace/palace';
+ this.wing = 'nexus_chat';
+ this.init();
+ }
+
+ async init() {
+ try {
+ await this.setupWing();
+ this.setupAutoMining();
+ } catch (error) {
+ console.error('MemPalace init failed:', error);
+ }
+ }
+
+ async setupWing() {
+ await window.electronAPI.execPython(`mempalace init ${this.palacePath}`);
+ await window.electronAPI.execPython(`mempalace mine ~/chats --mode convos --wing ${this.wing}`);
+ }
+
+ setupAutoMining() {
+ setInterval(() => {
+ window.electronAPI.execPython(`mempalace mine #chat-container --mode convos --wing ${this.wing}`);
+ }, 30000); // Mine every 30 seconds
+ }
+
+ async search(query) {
+ const result = await window.electronAPI.execPython(`mempalace search "${query}" --wing ${this.wing}`);
+ return result.stdout;
+ }
+
+ updateStats() {
+ const stats = window.electronAPI.execPython(`mempalace status --wing ${this.wing}`);
+ document.getElementById('compression-ratio').textContent =
+ `${stats.compression_ratio.toFixed(1)}x`;
+ document.getElementById('docs-mined').textContent = stats.total_docs;
+ document.getElementById('aaak-size').textContent = stats.aaak_size;
+ }
+}
+
+// Initialize MemPalace
+const mempalace = new MemPalace();
diff --git a/style.css b/style.css
index 8e70bb2..ad8da5e 100644
--- a/style.css
+++ b/style.css
@@ -516,6 +516,13 @@ canvas#nexus-canvas {
background: rgba(74, 240, 192, 0.3);
}
.mem-palace-stats {
+ color: #4af0c0;
+ font-family: var(--font-display);
+ font-size: 10px;
+ margin-top: 8px;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
margin-top: 4px;
font-size: 10px;
color: #aaa;