MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _write_raw_doc

Function _write_raw_doc

tests/test_reflect.py:114–124  ·  view source on GitHub ↗

Write a memory doc with a controlled date so ordering is deterministic to assert.

(mem: Path, filename: str, date: str, *, outcome="dead_end",
                   question="q", nodes=None)

Source from the content-addressed store, hash-verified

112
113
114def _write_raw_doc(mem: Path, filename: str, date: str, *, outcome="dead_end",
115 question="q", nodes=None):
116 """Write a memory doc with a controlled date so ordering is deterministic to assert."""
117 mem.mkdir(parents=True, exist_ok=True)
118 nodes = nodes or []
119 lines = ["---", 'type: "query"', f'date: "{date}"', f'question: "{question}"',
120 'contributor: "graphify"', f'outcome: "{outcome}"']
121 if nodes:
122 lines.append("source_nodes: [" + ", ".join(f'"{n}"' for n in nodes) + "]")
123 lines += ["---", "", f"# Q: {question}", ""]
124 (mem / filename).write_text("\n".join(lines), encoding="utf-8")
125
126
127def test_load_memory_docs_orders_by_date_then_filename(tmp_path):

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected