ReMe/reme2/memory/schema/__init__.py
huangsen dd2de16481 ```
feat(file_watcher): add directory deletion support with descendant indexing

Add support for deleting entire directories and their indexed descendants
in the file watcher. Previously only individual file deletions were
handled properly. Now when a directory is deleted, the system finds all
indexed files beneath that directory path and removes them along with
their metadata and chunks.

The implementation includes:
- New `_descendant_indexed_paths` method to find all indexed files
  under a given directory path
- Updated `_on_deleted` method to process both the target path and
  all its indexed descendants
- Proper handling of symlinks and path resolution differences
- Enhanced logging to show directory deletion with child count

Also adds necessary os import for path operations.

refactor(config): restructure configuration profiles for clarity

Rename curated.yaml to remove outdated configuration file and
rename full.yaml to expert.yaml with updated documentation.
Add new service.yaml configuration profile that provides a
service-aligned MCP surface with three main tools:
- retrieve: graph-aware hybrid retrieval
- remember: single write entry point with log/distill modes
- maintain: vault hygiene sweep

The expert configuration now excludes the ingest tool since
cold-path operations are handled by external agents, and adds
memory_lint tool for structural issue detection.

Updated documentation to clarify the different configuration
profiles and their intended usage patterns.
```
2026-05-11 10:52:25 +08:00

79 lines
2.1 KiB
Python

"""Memory Schema — vault domain "constitution".
Per `structure.md` §"全局架构蓝图", the Schema layer sits between the
domain-agnostic Core Engine and the three Memory 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:
Memory — 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) → (Memory | 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 Memory'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,
Memory,
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
"Memory",
"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",
]