[Phase 3.1] Agent entity types + metadata structs (#47)
Deploy / Tag & Push Latest (push) Failing after 40s
CI / CI (push) Canceled after 3m29s

## Changes
- `crates/mem-core/src/entity.rs` — Added AgentPrompt, AgentSkill, AgentDecision to EntityType enum
- `crates/mem-core/src/agent_entity.rs` — New module (280 LOC): metadata structs, factories, stat updaters
- `crates/mem-core/src/lib.rs` — Module registration + exports

## Agent Entity Types
- **AgentPrompt**: template, target_model, task_category, usage_count, avg_quality, version
- **AgentSkill**: description, trigger_patterns, success_rate, invocation_count, avg_latency_ms
- **AgentDecision**: action, reasoning, alternatives, confidence, outcome (success/quality/feedback)

## Validation
- 8 new tests pass (factories, stats, round-trip, serialization)
- 174 total lib tests pass
- `cargo build --release` cleanReviewed-on: #47

Co-authored-by: rock <[email protected]>
This commit was merged in pull request #47.
This commit is contained in:
2026-09-09 02:48:40 +00:00
committed by rock
parent b15072e12d
commit 6b18d81421
5 changed files with 364 additions and 8 deletions
+16
View File
@@ -17,6 +17,13 @@ pub enum EntityType {
Location,
Event,
Organization,
/// Agent prompt template tracked as a first-class entity.
/// Enables the agent to learn which prompts produce good results.
AgentPrompt,
/// Agent skill — a reusable capability the agent has learned.
AgentSkill,
/// Agent decision — a recorded choice with reasoning and outcome.
AgentDecision,
Unknown,
}
@@ -29,6 +36,9 @@ impl EntityType {
Self::Location => "location",
Self::Event => "event",
Self::Organization => "organization",
Self::AgentPrompt => "agent_prompt",
Self::AgentSkill => "agent_skill",
Self::AgentDecision => "agent_decision",
Self::Unknown => "unknown",
}
}
@@ -41,6 +51,9 @@ impl EntityType {
"location" => Self::Location,
"event" => Self::Event,
"organization" => Self::Organization,
"agent_prompt" => Self::AgentPrompt,
"agent_skill" => Self::AgentSkill,
"agent_decision" => Self::AgentDecision,
_ => Self::Unknown,
}
}
@@ -175,6 +188,9 @@ mod tests {
EntityType::Person,
EntityType::Tool,
EntityType::Concept,
EntityType::AgentPrompt,
EntityType::AgentSkill,
EntityType::AgentDecision,
] {
let s = ty.as_str();
assert_eq!(EntityType::from_str(s), *ty);