From e1e11ec464de07504e58b93650613c4bf5598b88 Mon Sep 17 00:00:00 2001 From: Autismo Date: Thu, 10 Sep 2026 20:36:32 +0200 Subject: [PATCH] Launch C++ Alexandria from Start/Heal, keep Go as rollback Start and Heal prefer build/cpp_memory_store/Release rag-service and rag-rebuild. Kernel and Librarian resolve memory-store.exe the same way. Live desk now serves C++ rag-service on :8084. --- AGENTS.md | 25 ++++++++++++------------ ARCHITECTURE.md | 2 +- Heal-GodBrain.ps1 | 13 +++++++++++- README.md | 2 +- Start-GodBrain.ps1 | 14 ++++++++++++- godbrain_core/cpp_kernel/memory.cpp | 2 ++ godbrain_core/cpp_memory_store/README.md | 9 +++++---- godbrain_core/cpp_tools/librarian.cpp | 19 +++++++++++++++++- scripts/Verify-SkillLab.ps1 | 5 ++++- scripts/build_pipeline.ps1 | 9 ++++++++- 10 files changed, 77 insertions(+), 23 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0785c6ec..52a77eea 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -582,18 +582,19 @@ the operator `message`, never the quote. Loopback ask without Galaxy: `scripts\Ask-GodBrain.ps1` POSTs `/api/chat`. Chat generate stays loopback-only. `/idea` and `/ideas` are the idea category. -`godbrain_core/memory_store/` is the active Alexandria write boundary. It -validates provenance and ingestion state, then stores immutable sources -and knowledge nodes plus append-only run-to-node links in MongoDB. - -`godbrain_core/memory_store/cmd/rag-service/` is the canonical committed -Golden Record retrieval boundary on `127.0.0.1:8084`. It searches the -generation-addressed `rag_documents` projection, optionally fuses bounded -generation-addressed local embeddings, resolves citations through -append-only `rag_provenance`, and exposes a bounded graph/document read -for Galaxy. The C++ and Go routers fail closed when this service is -unavailable, unready, or invalid. The experimental Rust router still uses -search-only and returns `410` for `/api/graph` and `/api/node`. +`godbrain_core/cpp_memory_store/` is the desk Alexandria write/retrieval +boundary (Start/Heal prefer `build/cpp_memory_store/Release`). Go +`godbrain_core/memory_store/` stays as rollback. Both validate provenance +and ingestion state, then store immutable sources and knowledge nodes plus +append-only run-to-node links in MongoDB. + +`rag-service.exe` on `127.0.0.1:8084` searches the generation-addressed +`rag_documents` projection, optionally fuses bounded generation-addressed +local embeddings, resolves citations through append-only `rag_provenance`, +and exposes a bounded graph/document read for Galaxy. The C++ and Go +routers fail closed when this service is unavailable, unready, or invalid. +The experimental Rust router still uses search-only and returns `410` for +`/api/graph` and `/api/node`. `LLM/colibri_LLM/` is a substantial nested Colibri engine project. Treat it as an interchangeable inference implementation, not as a protocol diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 3d79d65e..fbdabc8c 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -16,7 +16,7 @@ verify, then repeat or stop. The bottleneck is the verifier, not the model. | Listener | Process | Job | |---|---|---| | `:27017` | Windows service `MongoDB` | Vault. Immutable sources + Golden Records. | -| `:8084` | `rag-service.exe` | Committed Golden Record search / graph / document. Start/Heal still launch the Go binary. C++ sibling is `godbrain_core/cpp_memory_store/`. | +| `:8084` | `rag-service.exe` | Committed Golden Record search / graph / document. Start/Heal prefer `build/cpp_memory_store/Release`, then Go `memory_store`. | | `:8000` | `llama-server` or `coli serve` | One GPU mouth. Chat and Librarian share it. | | `:8083` | `godbrain-kernel.exe` | Galaxy, HTTP API, privileged `command_type`. Loopback chat. | diff --git a/Heal-GodBrain.ps1 b/Heal-GodBrain.ps1 index 1dfd6d93..6acc6627 100644 --- a/Heal-GodBrain.ps1 +++ b/Heal-GodBrain.ps1 @@ -209,8 +209,19 @@ function Get-DiagnoseLayer($probe) { return "ok" } +function Resolve-AlexandriaExe([string]$Name) { + foreach ($p in @( + (Join-Path $RepoRoot "build\cpp_memory_store\Release\$Name"), + (Join-Path $RepoRoot "godbrain_core\cpp_memory_store\$Name"), + (Join-Path $RepoRoot "godbrain_core\memory_store\$Name") + )) { + if (Test-Path -LiteralPath $p) { return $p } + } + return Join-Path $RepoRoot "godbrain_core\memory_store\$Name" +} + function Invoke-AllowlistedRagRebuild { - $exe = Join-Path $RepoRoot "godbrain_core\memory_store\rag-rebuild.exe" + $exe = Resolve-AlexandriaExe "rag-rebuild.exe" if (-not (Test-Path -LiteralPath $exe)) { return "skip:missing-exe" } $stamp = Join-Path $logDir "heal-rag-rebuild.stamp" if (Test-Path -LiteralPath $stamp) { diff --git a/README.md b/README.md index 00281bc4..46ede788 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ This tree is a desk runtime plus a released kit plus research. Maturity is |---|---|---| | C++ kernel + Galaxy (`godbrain_core/cpp_kernel`, `godbrain_core/frontend`) | daily-driver on this host | `:8083`, `/edit`, privileged `command_type` | | [Memory Store / rag-service](godbrain_core/memory_store/README.md) | daily-driver | `:8084` Golden Records; lexical default | -| [C++ Memory Store](godbrain_core/cpp_memory_store/README.md) | source + throwaway-db smoke | Same stdin/HTTP exe names as Go; Start/Heal still launch Go | +| [C++ Memory Store](godbrain_core/cpp_memory_store/README.md) | desk launch (prefer Release) | Same stdin/HTTP exe names as Go; Go tree stays as rollback | | Heal / Watch / `Start-GodBrain.ps1` | daily-driver | one loop; WMI children get Mongo DB name + embedding identity, not `GODBRAIN_RAG_PORT` | | [Reclaim11](godbrain_core/reclaim11/README.md) | released kit (v12) | Windows repair ISO/zip; not the Jarvis loop | | [Skill Lab](godbrain_core/skill_lab/README.md) | source + one fixture gate | promotion needs a second independent fixture before it is usable policy | diff --git a/Start-GodBrain.ps1 b/Start-GodBrain.ps1 index 3615550e..f67d90e6 100644 --- a/Start-GodBrain.ps1 +++ b/Start-GodBrain.ps1 @@ -37,6 +37,17 @@ function Write-Log([string]$Message) { Write-Host $line } +function Resolve-AlexandriaExe([string]$Name) { + foreach ($p in @( + (Join-Path $RepoRoot "build\cpp_memory_store\Release\$Name"), + (Join-Path $RepoRoot "godbrain_core\cpp_memory_store\$Name"), + (Join-Path $RepoRoot "godbrain_core\memory_store\$Name") + )) { + if (Test-Path -LiteralPath $p) { return $p } + } + return Join-Path $RepoRoot "godbrain_core\memory_store\$Name" +} + function Test-Port([string]$HostName, [int]$Port) { try { $client = New-Object System.Net.Sockets.TcpClient @@ -235,10 +246,11 @@ if (-not $env:MONGODB_URI) { $env:MONGODB_URI = "mongodb://127.0.0.1:27017" } -$rag = Join-Path $RepoRoot "godbrain_core\memory_store\rag-service.exe" +$rag = Resolve-AlexandriaExe "rag-service.exe" if (Test-Port "127.0.0.1" 8084) { Write-Log "skip rag-service (:8084 already listening)" } else { + Write-Log "rag-service $rag" Start-LoggedProcess -Name "rag-service" -FilePath $rag ` -WorkingDirectory (Split-Path $rag -Parent) } diff --git a/godbrain_core/cpp_kernel/memory.cpp b/godbrain_core/cpp_kernel/memory.cpp index 82bd3218..ec5838d7 100644 --- a/godbrain_core/cpp_kernel/memory.cpp +++ b/godbrain_core/cpp_kernel/memory.cpp @@ -504,6 +504,8 @@ std::string resolve_memory_store() { if (!override_path.empty()) return override_path; const std::string dir = exe_dir(); const std::string candidates[] = { + dir + "\\..\\..\\build\\cpp_memory_store\\Release\\memory-store.exe", + dir + "\\..\\cpp_memory_store\\memory-store.exe", dir + "\\memory-store.exe", dir + "\\..\\memory_store\\memory-store.exe", dir + "\\..\\..\\godbrain_core\\memory_store\\memory-store.exe", diff --git a/godbrain_core/cpp_memory_store/README.md b/godbrain_core/cpp_memory_store/README.md index 7805524f..d5645783 100644 --- a/godbrain_core/cpp_memory_store/README.md +++ b/godbrain_core/cpp_memory_store/README.md @@ -1,9 +1,10 @@ # C++ Alexandria Memory Store (cut 11) Same stdin JSON door as Go `memory-store.exe`. Go under `godbrain_core/memory_store/` -stays. This tree is the C++ replacement; Start/Heal still launch Go until this -exe is tested against a disposable Mongo db (never the live `godbrain` db from -ctest). +stays as rollback. Start/Heal prefer `build/cpp_memory_store/Release` +(`rag-service`, `rag-rebuild`) then the Go folder. Kernel and Librarian +resolve `memory-store.exe` the same way. Never write live `godbrain` from +ctest (use `godbrain_cpp_store_test`). Cut 1 (offline, no Mongo): 15 MiB cap, unknown-field/trailing fail, ingest validate (`trust_tier=candidate`, Keccak-256 `source_hash`), `set_status` DAG, @@ -53,7 +54,7 @@ Cut 11: ingest `document` + `chunks` (Local-Document-Adapter). Same gates as Go: metadata and chunks together, `content_sha256` of `raw_transcript`, contiguous UTF-8 byte ranges, forbidden-secret scan, immutable `chunks` collection. -Start/Heal still launch Go. +Start/Heal prefer this tree's Release exes, then Go. ```powershell .\scripts\Fetch-MongoCDriver.ps1 diff --git a/godbrain_core/cpp_tools/librarian.cpp b/godbrain_core/cpp_tools/librarian.cpp index 6e3bf6f7..4813ed27 100644 --- a/godbrain_core/cpp_tools/librarian.cpp +++ b/godbrain_core/cpp_tools/librarian.cpp @@ -35,6 +35,23 @@ static std::string get_exe_dir() { return pos == std::string::npos ? "" : full.substr(0, pos); } +static bool file_exists_path(const std::string& path) { + DWORD attr = GetFileAttributesA(path.c_str()); + return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) == 0; +} + +static std::string resolve_memory_store_exe(const std::string& exe_dir) { + const std::string candidates[] = { + exe_dir + "\\..\\..\\build\\cpp_memory_store\\Release\\memory-store.exe", + exe_dir + "\\..\\cpp_memory_store\\memory-store.exe", + exe_dir + "\\..\\memory_store\\memory-store.exe", + }; + for (const auto& candidate : candidates) { + if (file_exists_path(candidate)) return candidate; + } + return exe_dir + "\\..\\memory_store\\memory-store.exe"; +} + static std::vector child_environment_with(const std::string& name, const std::string& value) { LPCH raw_environment = GetEnvironmentStringsA(); if (!raw_environment) { @@ -1117,7 +1134,7 @@ int main(int argc, char* argv[]) { LibrarianConfig config{ env_llm ? std::string(env_llm) : exe_dir + "\\..\\..\\LLM\\colibri_LLM\\c\\colibri.exe", env_prompt ? std::string(env_prompt) : exe_dir + "\\prompts\\hermes_v1.json", - env_mongo ? std::string(env_mongo) : exe_dir + "\\..\\memory_store\\memory-store.exe", + env_mongo ? std::string(env_mongo) : resolve_memory_store_exe(exe_dir), load_mouth_model_id(), "N/A", env_or("GODBRAIN_MOUTH_HOST", "127.0.0.1"), diff --git a/scripts/Verify-SkillLab.ps1 b/scripts/Verify-SkillLab.ps1 index eaac32aa..5b86e456 100644 --- a/scripts/Verify-SkillLab.ps1 +++ b/scripts/Verify-SkillLab.ps1 @@ -105,7 +105,10 @@ if ($Record) { if ([string]::IsNullOrWhiteSpace($OriginNodeID)) { throw "Verify-SkillLab -Record needs -OriginNodeID (the candidate skill node)" } - $store = Join-Path $RepoRoot "godbrain_core\memory_store\memory-store.exe" + $store = Join-Path $RepoRoot "build\cpp_memory_store\Release\memory-store.exe" + if (-not (Test-Path -LiteralPath $store)) { + $store = Join-Path $RepoRoot "godbrain_core\memory_store\memory-store.exe" + } if (-not (Test-Path -LiteralPath $store)) { throw "Verify-SkillLab: missing $store" } diff --git a/scripts/build_pipeline.ps1 b/scripts/build_pipeline.ps1 index 36e40350..bbe7f261 100644 --- a/scripts/build_pipeline.ps1 +++ b/scripts/build_pipeline.ps1 @@ -6,8 +6,15 @@ $ErrorActionPreference = "Stop" Write-Host "Building Alexandria Pipeline..." +# 0. C++ store (desk default). Go build below remains rollback. +Write-Host "Building C++ memory-store / rag-service / rag-rebuild..." +cmake -S "$RepoRoot\godbrain_core\cpp_memory_store" -B "$RepoRoot\build\cpp_memory_store" -DBUILD_TESTING=ON +if ($LASTEXITCODE -ne 0) { throw "C++ memory-store cmake failed" } +cmake --build "$RepoRoot\build\cpp_memory_store" --config Release +if ($LASTEXITCODE -ne 0) { throw "C++ memory-store build failed" } + # 1. Build Memory Store and canonical retrieval tools -Write-Host "Building Memory Store and RAG tools (Go)..." +Write-Host "Building Memory Store and RAG tools (Go, rollback)..." Push-Location "$RepoRoot\godbrain_core\memory_store" try { go build -o memory-store.exe ./cmd/memory-store