Skip to content

Commit bd6c758

Browse files
hyperpolymathclaude
andcommitted
fix(integration): Wire VQL-UT to VeriSimDB search + Julia embeddings
Closes all integration gaps in the ECHIDNA Prover Wars stack: - vql_ut.rs: executor methods now call VeriSimDB REST endpoints (/api/v1/search/text, /api/v1/search/vector, /api/v1/search/related) instead of returning empty stubs. Includes URL encoding, search result parsing, and Julia embedding fetch for vector similarity. - agent/memory.rs: VeriSimDBProofStore.store_success() now fetches a 512-dim goal embedding from the Julia inference service (port 8090) and passes it to ProofOctadBuilder.with_embedding() before storing the octad. Graceful fallback if Julia is unreachable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fd9da3a commit bd6c758

2 files changed

Lines changed: 303 additions & 32 deletions

File tree

src/rust/agent/memory.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,49 @@ impl VeriSimDBProofStore {
246246
}
247247
}
248248

249+
/// Fetch a goal embedding from the Julia inference service (port 8090).
250+
/// Returns a 512-dim f32 vector, or empty vec on failure.
251+
async fn fetch_goal_embedding(&self, goal: &crate::core::Goal) -> Result<Vec<f32>> {
252+
let julia_url = std::env::var("ECHIDNA_JULIA_URL")
253+
.unwrap_or_else(|_| "http://localhost:8090".to_string());
254+
255+
let goal_display = format!("{}", goal.target);
256+
let body = serde_json::json!({
257+
"goal": goal_display,
258+
"model": "default"
259+
});
260+
261+
let http = reqwest::Client::builder()
262+
.timeout(std::time::Duration::from_secs(5))
263+
.build()?;
264+
265+
match http.post(format!("{}/api/encode", julia_url))
266+
.json(&body)
267+
.send()
268+
.await
269+
{
270+
Ok(response) if response.status().is_success() => {
271+
let result: serde_json::Value = response.json().await?;
272+
if let Some(embedding) = result.get("embedding").and_then(|e| e.as_array()) {
273+
let vec: Vec<f32> = embedding.iter()
274+
.filter_map(|v| v.as_f64().map(|f| f as f32))
275+
.collect();
276+
debug!("Got {}-dim embedding from Julia for goal {}", vec.len(), goal.id);
277+
return Ok(vec);
278+
}
279+
Ok(vec![])
280+
}
281+
Ok(_) => {
282+
debug!("Julia inference returned non-200 for goal {}", goal.id);
283+
Ok(vec![])
284+
}
285+
Err(e) => {
286+
debug!("Julia inference unreachable for goal {}: {}", goal.id, e);
287+
Ok(vec![])
288+
}
289+
}
290+
}
291+
249292
/// Initialise the store and check VeriSimDB connectivity.
250293
pub async fn init(&self) -> Result<()> {
251294
let reachable = self.client.health_check().await;
@@ -287,6 +330,10 @@ impl ProofMemory for VeriSimDBProofStore {
287330
if *self.connected.read().await {
288331
use crate::verisimdb_bridge::{ProofOctadBuilder, ProofStatus};
289332

333+
// Fetch goal embedding from Julia inference service (best-effort)
334+
let embedding = self.fetch_goal_embedding(&goal.goal).await
335+
.unwrap_or_default();
336+
290337
let octad = ProofOctadBuilder::new(&goal.goal.id, &goal.goal, prover)
291338
.with_proof_state(proof)
292339
.with_status(if proof.is_complete() {
@@ -296,6 +343,7 @@ impl ProofMemory for VeriSimDBProofStore {
296343
})
297344
.with_aspects(goal.aspects.clone())
298345
.with_time_ms(time_ms)
346+
.with_embedding(embedding)
299347
.build()?;
300348

301349
if let Err(e) = self.client.create_octad(&octad).await {

0 commit comments

Comments
 (0)