Reconcile (add / add_extracted): when the reconcile model call fails, returns an empty 200 reply or an unparseable reply, or reconcile raises before anything is stored, the write no longer falls back to adding every extracted memory as-is with success=true. The ADD-all fallback and its degraded flags are removed. The write returns success=false, agent_error_code=RECONCILE_FAILED and the cause in reconcile_error_code (LLM_UNAVAILABLE / EMPTY_RESPONSE / JSON_PARSE_FAILED / RECONCILE_EXCEPTION). Nothing new is stored, the episode counter does not advance, and add rolls back its L1 raw (retry_safe=true), so a re-run with a new request_id is clean. Only a literal [] still means "no changes". RECONCILE_ENABLED=false keeps writing directly. Working / coding path: an extraction model failure (LLM_ERROR, EMPTY_RESPONSE, JSON_PARSE_FAILED) and an experience or fact embedding failure (EMBEDDING_FAILED) now return success=false instead of success with 0 ops or a node without a vector. Embeddings are computed before the SQLite row is written and before an older fact is superseded. A failed write does not append its trace or record chain rounds. A model that answers with nothing to remember is still a success. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
42 lines
1019 B
Python
42 lines
1019 B
Python
# -*- coding: utf-8 -*-
|
||
"""
|
||
HY Memory - Coding Memory 模块
|
||
|
||
为生产力 / 编码场景设计的独立记忆链路,双层结构:
|
||
- 经验层 CodingMemory(procedural):可复用的方法,怎么做
|
||
- 事实层 WorkingFact(episodic):一段 trace 的任务、做法与结果
|
||
- 独立物理存储(SQLite meta + 两个独立 VDB collection)
|
||
- 独立 extractor / 两个 reconciler / store
|
||
- 与现有 chat 链路彻底分轨,chat 路径零回归
|
||
"""
|
||
|
||
from .types import (
|
||
CodingMemory,
|
||
CodingWriteError,
|
||
CodingMemoryDraft,
|
||
ReconcileOp,
|
||
WorkingFact,
|
||
WorkingFactDraft,
|
||
FactReconcileOp,
|
||
FactReconcileAction,
|
||
FactStatus,
|
||
FACT_STATUSES,
|
||
MAX_FACT_CHAIN_ENTRIES,
|
||
short_date,
|
||
)
|
||
|
||
__all__ = [
|
||
"CodingMemory",
|
||
"CodingWriteError",
|
||
"CodingMemoryDraft",
|
||
"ReconcileOp",
|
||
"WorkingFact",
|
||
"WorkingFactDraft",
|
||
"FactReconcileOp",
|
||
"FactReconcileAction",
|
||
"FactStatus",
|
||
"FACT_STATUSES",
|
||
"MAX_FACT_CHAIN_ENTRIES",
|
||
"short_date",
|
||
]
|