Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/en/docs/operate/atomic-memory-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ alias when that current row is already absent. Restoring an identity to active r
forgotten and retired identities lose their outgoing aliases as well. The current projection remains active-only.

`POWERCONTEXT_SERVER_RUNTIME_ATOMIC_MEMORY_ALIAS_RECALL` (`atomic_memory_alias_recall` in `RuntimeConfig`)
defaults to `true` and controls alias recall during reconciliation. Setting it to `false` makes no alias query. Alias maintenance and
defaults to `false` and controls alias recall during reconciliation. Set it to `true` to enable alias recall;
while disabled, no alias query is made. Alias maintenance and
explicit rebuilding are independent of this switch. When enabled, aliases use the request's FTS/vector/hybrid
mode, embedding profile and distance threshold. Matching historical wording proposes a comparison with the
currently active successor; it does not force a merge or prove semantic equivalence. Public search, lifecycle
Expand Down
3 changes: 2 additions & 1 deletion docs/zh/docs/operate/atomic-memory-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ current 和 alias 列的维度。该 DDL 可能独立提交,整个过程必须
身份也删除其出向别名。current 投影仍然只包含 active 记忆。

`POWERCONTEXT_SERVER_RUNTIME_ATOMIC_MEMORY_ALIAS_RECALL`(`RuntimeConfig` 中的 `atomic_memory_alias_recall`)
默认 `true`,控制协调阶段的别名召回。设为 `false` 时完全不查询别名。别名维护和显式重建独立于此开关。开启时,别名复用请求的
默认 `false`,控制协调阶段的别名召回。设为 `true` 可开启别名召回;关闭时完全不查询别名。
别名维护和显式重建独立于此开关。开启时,别名复用请求的
FTS/vector/hybrid 模式、embedding profile 和距离阈值。匹配历史表述只提出与当前 active 后继记忆比较的候选,
不强制合并,也不证明语义等同。公开搜索、生命周期状态、内容、协调动作和提示词保持现有语义。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class AtomicMemoryProcessingConfig:
related_max_distance: float = 1.0
related_page_size: int = DEFAULT_ATOMIC_MEMORY_RELATED_PAGE_SIZE
related_fts_fallback: bool = False
alias_recall: bool = True
alias_recall: bool = False
comparison_batch_size: int = 20
input_tokens_limit: int = 64_000
processing_mode: Literal["per_candidate", "one_pass"] = "per_candidate"
Expand Down
2 changes: 1 addition & 1 deletion src/powercontext/builtin/runtime/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def recall_channel_weights(self) -> RecallChannelWeights:
atomic_memory_related_max_distance: float = Field(default=1.0, ge=0)
atomic_memory_related_page_size: int = Field(default=DEFAULT_ATOMIC_MEMORY_RELATED_PAGE_SIZE, ge=1, le=1000)
atomic_memory_related_fts_fallback: bool = False
atomic_memory_alias_recall: bool = True
atomic_memory_alias_recall: bool = False
atomic_memory_comparison_batch_size: int = Field(default=20, ge=1)
atomic_memory_input_tokens_limit: int = Field(default=64000, ge=1)
atomic_memory_processing_mode: Literal["per_candidate", "one_pass"] = "per_candidate"
Expand Down
9 changes: 9 additions & 0 deletions tests/builtin/runtime/test_artifact_processing_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ def test_artifact_processing_configuration_rejects_invalid_bounds() -> None:
)


def test_atomic_memory_alias_recall_requires_explicit_opt_in() -> None:
assert RuntimeConfig().atomic_memory_alias_recall is False
assert AtomicMemoryProcessingConfig().alias_recall is False
assert AtomicMemoryProcessingConfig.from_runtime(RuntimeConfig()).alias_recall is False
assert (
AtomicMemoryProcessingConfig.from_runtime(RuntimeConfig(atomic_memory_alias_recall=True)).alias_recall is True
)


def test_atomic_memory_processing_config_validates_the_page_size() -> None:
assert AtomicMemoryProcessingConfig(related_page_size=60).related_page_size == 60
assert AtomicMemoryProcessingConfig(related_page_size=1000).related_page_size == 1000
Expand Down
11 changes: 7 additions & 4 deletions tests/e2e/test_atomic_memory_alias_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,17 @@ async def seed_alias(contexts):
return records, successor


@pytest.mark.parametrize("enabled", [False, True])
@pytest.mark.parametrize("enabled", [None, False, True], ids=["default", "disabled", "enabled"])
@pytest.mark.parametrize("observation", [OLD, UNRELATED])
def test_historical_vector_recall_prevents_duplicate_and_preserves_unrelated_create(tmp_path, enabled, observation):
async def scenario():
config = _config(tmp_path)
config = config.model_copy(
update={"runtime": config.runtime.model_copy(update={"atomic_memory_alias_recall": enabled})}
)
if enabled is not None:
config = config.model_copy(
update={"runtime": config.runtime.model_copy(update={"atomic_memory_alias_recall": enabled})}
)
else:
assert config.runtime.atomic_memory_alias_recall is False
recorder = RecordingReconciler()
extractor = RecordingExtractor()
pipeline = AtomicMemoryGenerationPipeline(
Expand Down
Loading