Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |

Expand Down
13 changes: 12 additions & 1 deletion Heal-GodBrain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Comment on lines +212 to +221

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) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
14 changes: 13 additions & 1 deletion Start-GodBrain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Comment on lines +40 to +49

function Test-Port([string]$HostName, [int]$Port) {
try {
$client = New-Object System.Net.Sockets.TcpClient
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions godbrain_core/cpp_kernel/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment on lines 505 to 510
dir + "\\..\\..\\godbrain_core\\memory_store\\memory-store.exe",
Expand Down
9 changes: 5 additions & 4 deletions godbrain_core/cpp_memory_store/README.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
Expand Down
19 changes: 18 additions & 1 deletion godbrain_core/cpp_tools/librarian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Comment on lines +43 to +53

static std::vector<char> child_environment_with(const std::string& name, const std::string& value) {
LPCH raw_environment = GetEnvironmentStringsA();
if (!raw_environment) {
Expand Down Expand Up @@ -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"),
Expand Down
5 changes: 4 additions & 1 deletion scripts/Verify-SkillLab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Comment on lines +108 to +111
if (-not (Test-Path -LiteralPath $store)) {
throw "Verify-SkillLab: missing $store"
}
Expand Down
9 changes: 8 additions & 1 deletion scripts/build_pipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Comment on lines +9 to +14

# 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
Expand Down