Add User Model Service and Temporal Recall for MeMind V0.1.
Introduce UMS ingest/snapshot pipeline, Context Planner with multi-source recall, runtime context injection, canonical user mapping, and session snapshot loading on auth/me. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://memind.local/schemas/context-plan.v1.schema.json",
|
||||
"title": "ContextPlan",
|
||||
"description": "Context Planner 输出 — 决定需要哪些上下文及多源检索计划",
|
||||
"type": "object",
|
||||
"required": ["query_type", "time", "temporal_mode", "targets", "sources", "retrievals", "context_needs"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"query_type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"personal_temporal_recall",
|
||||
"memory_lookup",
|
||||
"profile_only",
|
||||
"general_chat",
|
||||
"task_execution"
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"type": "object",
|
||||
"required": ["mention_range"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"mention_range": {
|
||||
"$ref": "#/$defs/timeRange",
|
||||
"description": "按 observed_time / 提及时间过滤"
|
||||
},
|
||||
"event_range": {
|
||||
"oneOf": [{ "$ref": "#/$defs/timeRange" }, { "type": "null" }],
|
||||
"description": "按 event_time / 计划发生时间过滤"
|
||||
},
|
||||
"relative_label": {
|
||||
"type": ["string", "null"],
|
||||
"enum": [
|
||||
"today",
|
||||
"yesterday",
|
||||
"day_before_yesterday",
|
||||
"this_week",
|
||||
"last_week",
|
||||
"this_month",
|
||||
"last_month",
|
||||
"recent_days",
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"temporal_mode": {
|
||||
"type": "string",
|
||||
"enum": ["OCCURRED_IN", "MENTIONED_IN", "PLANNED_IN", "CREATED_IN", "DUE_IN", "AMBIGUOUS"]
|
||||
},
|
||||
"targets": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["type", "weight"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"calendar_event",
|
||||
"event",
|
||||
"schedule",
|
||||
"todo",
|
||||
"commitment",
|
||||
"decision",
|
||||
"mention",
|
||||
"important_event"
|
||||
]
|
||||
},
|
||||
"weight": { "type": "number", "minimum": 0, "maximum": 1 }
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"type": "object",
|
||||
"additionalProperties": { "type": "number", "minimum": 0, "maximum": 1 },
|
||||
"propertyNames": {
|
||||
"enum": ["calendar", "chat", "meinput", "memory_v2", "email", "browser", "tasks", "git"]
|
||||
}
|
||||
},
|
||||
"retrievals": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["source", "query_type", "weight"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"source": {
|
||||
"type": "string",
|
||||
"enum": ["calendar", "chat", "meinput", "memory_v2"]
|
||||
},
|
||||
"query_type": {
|
||||
"type": "string",
|
||||
"description": "源内检索策略,如 important_mentions | commitments_and_decisions | events"
|
||||
},
|
||||
"expanded_queries": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "maxLength": 128 }
|
||||
},
|
||||
"weight": { "type": "number", "minimum": 0, "maximum": 1 },
|
||||
"skip_below": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1,
|
||||
"default": 0.3,
|
||||
"description": "低于此权重的 source 跳过检索"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"importance_min": { "type": "number", "minimum": 0, "maximum": 1 },
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": ["any", "unresolved", "planned", "completed"]
|
||||
},
|
||||
"participants": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"group_by": {
|
||||
"type": "string",
|
||||
"enum": ["importance", "time", "source", "type"]
|
||||
},
|
||||
"dedupe": { "type": "boolean", "default": true },
|
||||
"timeline": { "type": "boolean", "default": true },
|
||||
"wide_recall": { "type": "boolean", "default": true },
|
||||
"max_items": { "type": "integer", "minimum": 1, "maximum": 200, "default": 50 }
|
||||
}
|
||||
},
|
||||
"context_needs": {
|
||||
"type": "object",
|
||||
"required": ["user_snapshot", "temporal_recall", "memory_retrieval"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"user_snapshot": { "type": "string", "enum": ["REQUIRED", "OPTIONAL", "SKIP"] },
|
||||
"temporal_recall": { "type": "string", "enum": ["REQUIRED", "OPTIONAL", "SKIP"] },
|
||||
"memory_retrieval": { "type": "string", "enum": ["REQUIRED", "OPTIONAL", "SKIP"] }
|
||||
}
|
||||
},
|
||||
"planner_meta": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"level": { "type": "string", "enum": ["cheap_router", "semantic_planner"] },
|
||||
"rule_hits": { "type": "array", "items": { "type": "string" } },
|
||||
"confidence": { "type": "number", "minimum": 0, "maximum": 1 }
|
||||
}
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"timeRange": {
|
||||
"type": "object",
|
||||
"required": ["start", "end"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"start": { "type": "string", "format": "date-time" },
|
||||
"end": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user