Initial standalone memabra release
This commit is contained in:
86
docs/schemas/candidate_object.schema.json
Normal file
86
docs/schemas/candidate_object.schema.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://memabra.local/schemas/candidate_object.schema.json",
|
||||
"title": "CandidateObject",
|
||||
"description": "Unified retrieval/routing candidate for memory, skill, or tool objects in memabra.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"id",
|
||||
"type",
|
||||
"title",
|
||||
"summary",
|
||||
"triggers",
|
||||
"cost",
|
||||
"confidence",
|
||||
"success_rate",
|
||||
"freshness",
|
||||
"risk",
|
||||
"tags",
|
||||
"source"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": ["memory", "skill", "tool"]
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"triggers": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"default": []
|
||||
},
|
||||
"cost": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"success_rate": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"freshness": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"risk": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"embedding_ref": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"default": []
|
||||
},
|
||||
"source": {
|
||||
"type": "string",
|
||||
"enum": ["user", "system", "generated", "external"]
|
||||
},
|
||||
"type_payload": {
|
||||
"type": "object",
|
||||
"description": "Type-specific metadata retained without collapsing semantic boundaries.",
|
||||
"default": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
docs/schemas/event.schema.json
Normal file
57
docs/schemas/event.schema.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://memabra.local/schemas/event.schema.json",
|
||||
"title": "Event",
|
||||
"description": "Atomic event emitted during retrieval, routing, execution, and evaluation in memabra.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"event_id",
|
||||
"trajectory_id",
|
||||
"timestamp",
|
||||
"stage",
|
||||
"event_type",
|
||||
"payload"
|
||||
],
|
||||
"properties": {
|
||||
"event_id": {"type": "string", "minLength": 1},
|
||||
"trajectory_id": {"type": "string", "minLength": 1},
|
||||
"timestamp": {"type": "string", "format": "date-time"},
|
||||
"stage": {
|
||||
"type": "string",
|
||||
"enum": ["retrieval", "policy", "execution", "evaluation", "memory_writeback"]
|
||||
},
|
||||
"event_type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"task_received",
|
||||
"context_summarized",
|
||||
"candidates_recalled",
|
||||
"candidate_scored",
|
||||
"action_selected",
|
||||
"tool_called",
|
||||
"tool_result",
|
||||
"skill_loaded",
|
||||
"memory_injected",
|
||||
"user_clarified",
|
||||
"user_corrected",
|
||||
"reward_computed",
|
||||
"memory_written",
|
||||
"memory_revoked",
|
||||
"task_completed",
|
||||
"task_failed"
|
||||
]
|
||||
},
|
||||
"payload": {
|
||||
"type": "object",
|
||||
"description": "Event-specific structured body"
|
||||
},
|
||||
"metrics": {
|
||||
"type": "object",
|
||||
"default": {}
|
||||
},
|
||||
"parent_event_id": {
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
75
docs/schemas/memory_record.schema.json
Normal file
75
docs/schemas/memory_record.schema.json
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://memabra.local/schemas/memory_record.schema.json",
|
||||
"title": "MemoryRecord",
|
||||
"description": "Long-term memory record stored by memabra with explicit layer typing and verification metadata.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"id",
|
||||
"memory_type",
|
||||
"fact_status",
|
||||
"content",
|
||||
"summary",
|
||||
"source",
|
||||
"confidence",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"verification"
|
||||
],
|
||||
"properties": {
|
||||
"id": {"type": "string", "minLength": 1},
|
||||
"memory_type": {
|
||||
"type": "string",
|
||||
"enum": ["semantic", "procedural", "episodic", "working"]
|
||||
},
|
||||
"fact_status": {
|
||||
"type": "string",
|
||||
"enum": ["draft", "assumed", "verified", "deprecated", "revoked"]
|
||||
},
|
||||
"content": {"type": "string", "minLength": 1},
|
||||
"summary": {"type": "string", "minLength": 1},
|
||||
"source": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["kind", "ref"],
|
||||
"properties": {
|
||||
"kind": {"type": "string", "enum": ["user", "session", "tool", "import", "system"]},
|
||||
"ref": {"type": "string", "minLength": 1}
|
||||
}
|
||||
},
|
||||
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"default": []
|
||||
},
|
||||
"related_entities": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"default": []
|
||||
},
|
||||
"created_at": {"type": "string", "format": "date-time"},
|
||||
"updated_at": {"type": "string", "format": "date-time"},
|
||||
"last_used_at": {"type": ["string", "null"], "format": "date-time"},
|
||||
"expires_at": {"type": ["string", "null"], "format": "date-time"},
|
||||
"verification": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["status", "last_checked_at", "check_method"],
|
||||
"properties": {
|
||||
"status": {"type": "string", "enum": ["unknown", "pending", "confirmed", "disputed", "failed"]},
|
||||
"last_checked_at": {"type": ["string", "null"], "format": "date-time"},
|
||||
"check_method": {"type": ["string", "null"]}
|
||||
}
|
||||
},
|
||||
"revocation": {
|
||||
"type": ["object", "null"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"reason": {"type": "string"},
|
||||
"revoked_at": {"type": "string", "format": "date-time"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
121
docs/schemas/trajectory.schema.json
Normal file
121
docs/schemas/trajectory.schema.json
Normal file
@@ -0,0 +1,121 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://memabra.local/schemas/trajectory.schema.json",
|
||||
"title": "Trajectory",
|
||||
"description": "Replayable task-level trace for routing and learning in memabra.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"trajectory_id",
|
||||
"task",
|
||||
"context_snapshot",
|
||||
"candidate_sets",
|
||||
"decisions",
|
||||
"events",
|
||||
"outcome",
|
||||
"reward"
|
||||
],
|
||||
"properties": {
|
||||
"trajectory_id": {"type": "string", "minLength": 1},
|
||||
"task": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["task_id", "input", "channel", "created_at"],
|
||||
"properties": {
|
||||
"task_id": {"type": "string", "minLength": 1},
|
||||
"input": {"type": "string", "minLength": 1},
|
||||
"channel": {"type": "string", "minLength": 1},
|
||||
"created_at": {"type": "string", "format": "date-time"},
|
||||
"user_id": {"type": ["string", "null"]}
|
||||
}
|
||||
},
|
||||
"context_snapshot": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["conversation_summary", "environment_summary"],
|
||||
"properties": {
|
||||
"conversation_summary": {"type": "string"},
|
||||
"environment_summary": {"type": "string"},
|
||||
"recent_failures": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"default": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"candidate_sets": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["memory", "skill", "tool"],
|
||||
"properties": {
|
||||
"memory": {"type": "array", "items": {"$ref": "candidate_object.schema.json"}},
|
||||
"skill": {"type": "array", "items": {"$ref": "candidate_object.schema.json"}},
|
||||
"tool": {"type": "array", "items": {"$ref": "candidate_object.schema.json"}}
|
||||
}
|
||||
},
|
||||
"decisions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["step", "decision_type", "selected_ids", "rationale"],
|
||||
"properties": {
|
||||
"step": {"type": "integer", "minimum": 1},
|
||||
"decision_type": {
|
||||
"type": "string",
|
||||
"enum": ["direct_answer", "inject_memory", "load_skill", "call_tool", "clarify", "composite_action"]
|
||||
},
|
||||
"selected_ids": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"}
|
||||
},
|
||||
"rejected_ids": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"default": []
|
||||
},
|
||||
"rationale": {"type": "string"},
|
||||
"estimated_cost": {"type": ["number", "null" ]}
|
||||
}
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "event.schema.json"}
|
||||
},
|
||||
"outcome": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["status", "steps", "latency_ms", "user_corrections"],
|
||||
"properties": {
|
||||
"status": {"type": "string", "enum": ["success", "partial_success", "failure"]},
|
||||
"steps": {"type": "integer", "minimum": 0},
|
||||
"latency_ms": {"type": "integer", "minimum": 0},
|
||||
"user_corrections": {"type": "integer", "minimum": 0},
|
||||
"tool_errors": {"type": "integer", "minimum": 0},
|
||||
"notes": {"type": ["string", "null"]}
|
||||
}
|
||||
},
|
||||
"reward": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["total", "components"],
|
||||
"properties": {
|
||||
"total": {"type": "number"},
|
||||
"components": {
|
||||
"type": "object",
|
||||
"required": ["task_success", "retrieval_hit", "tool_error", "user_correction", "latency", "context_cost", "useful_reuse"],
|
||||
"properties": {
|
||||
"task_success": {"type": "number"},
|
||||
"retrieval_hit": {"type": "number"},
|
||||
"tool_error": {"type": "number"},
|
||||
"user_correction": {"type": "number"},
|
||||
"latency": {"type": "number"},
|
||||
"context_cost": {"type": "number"},
|
||||
"useful_reuse": {"type": "number"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user