From a7d59481f2b004696acf010b778efbcefe96d32e Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Tue, 7 Apr 2026 10:04:21 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20[RESEARCH]=20MemPalace=20=E2=80=94=20Lo?= =?UTF-8?q?cal=20AI=20Memory=20System=20Assessment=20&=20Leverage=20Plan?= =?UTF-8?q?=20(#1047)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #1047 Agent: groq --- app.js | 7 +++++++ electron-main.js | 12 ++++++++++++ mempalace.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ style.css | 7 +++++++ 4 files changed, 70 insertions(+) create mode 100644 electron-main.js create mode 100644 mempalace.js 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; -- 2.43.0