Files
memind/schemas/evidence-envelope.schema.json
T
john 212ff3ff80 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>
2026-09-03 23:25:18 +08:00

147 lines
4.8 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://memind.local/schemas/evidence-envelope.v1.schema.json",
"title": "EvidenceEnvelope",
"description": "通用 Evidence Contract v1。所有 SourceMeInput、Chat、Calendar、Browser、Git…)统一产出此结构;UMS 只消费 Envelope,不依赖各 Source 内部表结构。",
"type": "object",
"required": [
"evidence_id",
"user_id",
"source_type",
"source_ref",
"occurred_at",
"evidence_type",
"payload",
"content_hash",
"schema_version"
],
"properties": {
"evidence_id": {
"type": "string",
"format": "uuid",
"description": "Evidence 全局唯一 ID(由 Source 或 Export 层生成)"
},
"user_id": {
"type": "string",
"format": "uuid",
"description": "MeMind h5_users.id"
},
"source_type": {
"type": "string",
"enum": ["meinput", "chat", "calendar", "browser", "git", "mail", "filesystem", "voice", "location"],
"description": "Evidence Source 类型,与 MeMind Source 体系对齐"
},
"source_ref": {
"type": "string",
"minLength": 1,
"maxLength": 512,
"description": "Source 内稳定引用,如 segment_id / message_id / commit_sha"
},
"occurred_at": {
"type": "string",
"format": "date-time",
"description": "Evidence 发生时间(用户行为时间,非入库时间)"
},
"received_at": {
"type": "string",
"format": "date-time",
"description": "Source 侧接收/导出时间,可选"
},
"evidence_type": {
"type": "string",
"enum": [
"expression_segment",
"expression_commit",
"expression_session",
"chat_message",
"calendar_event",
"browser_visit",
"git_commit",
"aggregate_daily",
"timeline_report"
],
"description": "Evidence 语义类型,决定 payload 子 schema"
},
"payload": {
"type": "object",
"description": "类型化载荷,见 $defs"
},
"content_hash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$",
"description": "SHA-256(canonical_json(payload)+evidence_type+source_ref),用于幂等与去重"
},
"schema_version": {
"type": "integer",
"const": 1
},
"privacy_level": {
"type": "string",
"enum": ["normal", "restricted", "secure_skip"],
"default": "normal",
"description": "secure_skip 的 Evidence 不应离开 SourceExport 层必须过滤"
},
"locale": {
"type": "string",
"description": "如 zh-CN,可选"
}
},
"additionalProperties": false,
"$defs": {
"ExpressionSegmentPayload": {
"type": "object",
"required": ["text", "start_at", "end_at", "event_ids"],
"properties": {
"text": { "type": "string", "minLength": 1 },
"start_at": { "type": "string", "format": "date-time" },
"end_at": { "type": "string", "format": "date-time" },
"event_ids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "minItems": 1 },
"event_count": { "type": "integer", "minimum": 1 },
"context": {
"type": "object",
"properties": {
"app": { "type": ["string", "null"] },
"app_bundle_id": { "type": ["string", "null"] },
"device_id": { "type": "string" },
"scene": { "type": "string" },
"input_method": { "type": ["string", "null"] },
"language": { "type": ["string", "null"] }
}
}
},
"additionalProperties": false
},
"AggregateDailyPayload": {
"type": "object",
"required": ["day", "stats"],
"properties": {
"day": { "type": "string", "format": "date" },
"stats": {
"type": "object",
"properties": {
"events": { "type": "integer", "minimum": 0 },
"segments": { "type": "integer", "minimum": 0 },
"chars": { "type": "integer", "minimum": 0 },
"peak_hour": { "type": "integer", "minimum": 0, "maximum": 23 },
"top_apps": { "type": "array", "items": { "type": "string" } },
"top_terms": { "type": "array", "items": { "type": "string" } }
}
}
},
"additionalProperties": false
},
"TimelineReportPayload": {
"type": "object",
"required": ["report_type", "period_key", "edition", "status", "content"],
"properties": {
"report_type": { "type": "string", "enum": ["daily_close", "weekly_review"] },
"period_key": { "type": "string" },
"edition": { "type": "integer", "minimum": 1 },
"status": { "type": "string", "enum": ["published", "revoked"] },
"content": { "type": "object" }
},
"additionalProperties": false
}
}
}