Complete memory graph and document value workplans

This commit is contained in:
2026-05-15 13:30:50 +02:00
parent f49ebb563b
commit 6cc44da628
25 changed files with 1546 additions and 168 deletions

View File

@@ -48,6 +48,62 @@ def test_memory_graph_validation_and_context_package_compile(tmp_path: Path):
assert package.retrieval_recipes[0].kind == "memory-graph-selection"
def test_memory_graph_example_fixtures_cover_reasoning_conversation_and_knowledge():
examples = Path("examples/memory")
profile = load_memory_profile_file(examples / "memory-profile.local.yaml")
for graph_name, selection_name, package_title, expected_node_count in [
(
"decision-graph.yaml",
"decision-graph-selection.yaml",
"Memory Contract Boundary Package",
3,
),
(
"conversation-path.yaml",
"conversation-path-selection.yaml",
"Conversation Episode Package",
4,
),
(
"knowledge-neighborhood.yaml",
"knowledge-neighborhood-selection.yaml",
"Knowledge Neighborhood Package",
6,
),
]:
graph = load_memory_graph_file(examples / graph_name)
selection = load_memory_graph_selection_file(examples / selection_name)
validation = validate_memory_graph(graph, path=examples / graph_name)
package = compile_memory_graph_selection_to_context_package(graph, selection, profile=profile)
assert validation.valid, validation.to_dict()
assert package.title == package_title
assert package.metadata["memory_graph"]["selected_nodes"] == selection.node_ids
assert len(selection.node_ids) == expected_node_count
assert package.metadata["memory_profile"]["id"] == "local-agent-memory"
def test_memory_graph_invalid_example_fixtures_emit_errors():
examples = Path("examples/memory")
graph = load_memory_graph_file(examples / "invalid-memory-graph.yaml")
profile = load_memory_profile_file(examples / "invalid-memory-profile.yaml")
graph_result = validate_memory_graph(graph, path=examples / "invalid-memory-graph.yaml")
profile_result = validate_memory_profile(profile, path=examples / "invalid-memory-profile.yaml")
graph_codes = {diagnostic.code for diagnostic in graph_result.diagnostics}
profile_codes = {diagnostic.code for diagnostic in profile_result.diagnostics}
assert not graph_result.valid
assert "memory.graph.node.unknown_kind" in graph_codes
assert "memory.graph.edge.unknown_target" in graph_codes
assert "memory.graph.event.unknown_kind" in graph_codes
assert not profile_result.valid
assert "memory.profile.unknown_kind" in profile_codes
assert "memory.profile.store_missing" in profile_codes
def test_mkt_memory_blueprint_and_graph_cli(tmp_path: Path):
_write_profile(tmp_path)
_write_graph(tmp_path)