ReMe/reme2/memory/schema/__init__.py
huangsen 8465f6d06e ```
docs(protocol): add typed edge link protocol documentation

Add comprehensive documentation for the link protocol supporting
typed edges in body text. This includes specification for three
legal inline forms (bare wikilink, line-level Dataview,
inline-bracketed Dataview), predicate syntax rules, and the
machine-managed Relations section convention for organizing
discovered edges.

fix(memory): update path reference from vault_root to working_dir

Change the memory_create operation's path anchoring from
vault_root to working_dir to maintain consistency with the
current working directory configuration.

refactor(components): remove edge_extractor module and simplify parsing

Remove the edge_extractor component module entirely and
inline edge extraction logic directly into LinkedFileParser
using parse_wikilinks utility. This simplifies the architecture
by eliminating the separate edge extraction component and
delegating edge discovery to the maintainer's enrichment operations.

feat(parser): update parse method signature and simplify edge extraction

Modify LinkedFileParser to return (FileNode, list[FileChunk])
tuple instead of ParsedFile, remove dependency on BaseEdgeExtractor,
and implement direct wikilink parsing from body text only.
```
2026-05-11 19:45:53 +08:00

79 lines
2.1 KiB
Python

"""MemoryFileNode Schema — vault domain "constitution".
Per `structure.md` §"全局架构蓝图", the Schema layer sits between the
domain-agnostic Core Engine and the three MemoryFileNode Services. Engines store
arbitrary markdown + open frontmatter dicts; Services read this Schema
to know what a "well-formed memory" is and shape the vault accordingly.
Public API:
MemoryFileNode — single typed class for every vault frontmatter
Lifecycle / Scope / Source / Role — the four behavioral axes (StrEnum)
Status — streaming-only state (active / distilled / archived)
Confidence — claim-only confidence (PENDING / VERIFIED / REJECTED)
parse_frontmatter(raw) → (MemoryFileNode | None, errors) tolerant parser
*_PRESET dicts — common axis combos for hot-write paths
preset_for_category(name) — legacy category → preset lookup
LEGACY_AXES_FROM_CATEGORY — back-fill table; auto-applied by MemoryFileNode's
pre-validator so legacy vaults parse free.
Lives in `reme2/memory/` (not `reme2/schema/` and not `reme2/component/`)
because the Schema is owned by the memory services that consume it. The
engine never imports from here.
"""
from .memory import (
LEGACY_AXES_FROM_CATEGORY,
Confidence,
Lifecycle,
MemoryFileNode,
Role,
Scope,
Source,
Status,
)
from .parser import parse_frontmatter
from .presets import (
CONCEPT_PRESET,
EVENT_PRESET,
FUNDAMENTALS_PRESET,
MATERIAL_PRESET,
METHOD_PRESET,
MODEL_PRESET,
PRESETS_BY_CATEGORY,
PROFILE_PRESET,
QUESTIONS_PRESET,
THESIS_PRESET,
TOOL_PRESET,
preset_for_category,
)
__all__ = [
# core
"MemoryFileNode",
"Lifecycle",
"Scope",
"Source",
"Role",
"Status",
"Confidence",
"LEGACY_AXES_FROM_CATEGORY",
# parser
"parse_frontmatter",
# presets
"EVENT_PRESET",
"PROFILE_PRESET",
"CONCEPT_PRESET",
"THESIS_PRESET",
"MODEL_PRESET",
"QUESTIONS_PRESET",
"METHOD_PRESET",
"TOOL_PRESET",
"FUNDAMENTALS_PRESET",
"MATERIAL_PRESET",
"PRESETS_BY_CATEGORY",
"preset_for_category",
]