Gralkor.Format (gralkor_ex v2.1.2)

Copy Markdown View Source

Format graphiti edge data into the canonical fact strings the LLM sees.

Pure Elixir — graphiti runs in Python, but we extract its edges into Elixir maps and format them here, never reaching back into Python for formatting.

Output shape per fact:

- {fact} (created ) (valid from ) (invalid since ) (expired )

Timestamp normalisation matches the server's pipelines/formatting.py so consumers see identical fact text from either stack.

See ex-format-fact in gralkor/TEST_TREES.md.

Summary

Functions

format_fact(m)

@spec format_fact(map()) :: String.t()

format_facts(facts)

@spec format_facts([map()]) :: String.t()

format_timestamp(ts)

@spec format_timestamp(String.t()) :: String.t()