1pub fn schema_queries(embedding_dim: usize) -> String {
11 format!(
12 r#"
13 DEFINE TABLE memory_block SCHEMAFULL;
14 DEFINE FIELD project_id ON memory_block TYPE string;
15 DEFINE FIELD textual_content ON memory_block TYPE string;
16 DEFINE FIELD semantic_embedding ON memory_block TYPE array<float>;
17 DEFINE FIELD timestamp ON memory_block TYPE datetime;
18
19 -- HNSW index optimized for the embedding model's dimension.
20 -- DIST COSINE measures angular similarity (closest to semantic similarity).
21 DEFINE INDEX memory_embed_idx ON memory_block
22 FIELDS semantic_embedding
23 HNSW DIMENSION {embedding_dim} DIST COSINE;
24
25 -- Project metadata table.
26 DEFINE TABLE project SCHEMAFULL;
27 DEFINE FIELD name ON project TYPE string;
28 DEFINE FIELD description ON project TYPE string;
29 DEFINE FIELD created_at ON project TYPE datetime;
30 DEFINE FIELD skills ON project TYPE array<string>;
31
32 -- Execution log table for trajectory extraction.
33 DEFINE TABLE execution_log SCHEMAFULL;
34 DEFINE FIELD session_id ON execution_log TYPE string;
35 DEFINE FIELD phase ON execution_log TYPE string;
36 DEFINE FIELD action ON execution_log TYPE string;
37 DEFINE FIELD result ON execution_log TYPE string;
38 DEFINE FIELD timestamp ON execution_log TYPE datetime;
39 "#
40 )
41}