-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmetadata.h
More file actions
65 lines (52 loc) · 1.73 KB
/
metadata.h
File metadata and controls
65 lines (52 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <string>
#include <vector>
#include <unordered_map>
#include <cstdint>
namespace feather {
enum class ContextType : uint8_t {
FACT = 0,
PREFERENCE = 1,
EVENT = 2,
CONVERSATION = 3
};
// Phase 5: Typed, weighted graph edge
struct Edge {
uint64_t target_id;
std::string rel_type; // "related_to", "derived_from", "caused_by", etc.
float weight; // relationship strength [0.0–1.0]
Edge() : target_id(0), rel_type("related_to"), weight(1.0f) {}
Edge(uint64_t t, const std::string& r, float w)
: target_id(t), rel_type(r), weight(w) {}
};
struct Metadata {
int64_t timestamp;
float importance;
ContextType type;
std::string source;
std::string content;
std::string tags_json;
// Phase 3: Salience
uint32_t recall_count;
uint64_t last_recalled_at;
// Phase 4: Namespace + Entity + Attributes
std::string namespace_id;
std::string entity_id;
std::unordered_map<std::string, std::string> attributes;
// Phase 5: Typed, weighted context graph edges (replaces plain `links`)
std::vector<Edge> edges;
// Phase 6: Working memory + epistemic confidence
int64_t ttl; // seconds-to-live from timestamp; 0 = never expires
float confidence; // certainty about this fact [0.0–1.0]; default 1.0
Metadata() : timestamp(0), importance(1.0f), type(ContextType::FACT),
recall_count(0), last_recalled_at(0),
ttl(0), confidence(1.0f) {}
void serialize(std::ostream& os) const;
static Metadata deserialize(std::istream& is);
};
struct ContextRecord {
uint64_t id;
Metadata metadata;
// The vector is still managed by DB class/index
};
} // namespace feather