@@ -783,7 +783,7 @@ def _write_summary(wiki_dir: Path, doc_name: str, summary: str,
783783 if description :
784784 fm_lines .append (_yaml_kv_line ("description" , description ))
785785 fm_lines .append (f"doc_type: { doc_type } " )
786- fm_lines .append (f "full_text: sources/{ doc_name } .{ ext } " )
786+ fm_lines .append (_yaml_kv_line ( "full_text" , f" sources/{ doc_name } .{ ext } ") )
787787 frontmatter = "---\n " + "\n " .join (fm_lines ) + "\n ---\n \n "
788788 (summaries_dir / f"{ doc_name } .md" ).write_text (frontmatter + summary , encoding = "utf-8" )
789789
@@ -917,7 +917,7 @@ def _write_entity(
917917
918918 def _build_frontmatter (sources : list [str ]) -> str :
919919 fm_lines = [_yaml_list_line ("sources" , sources )]
920- fm_lines .append (_yaml_kv_line ("type" , (type_ or "other" ).capitalize ()))
920+ fm_lines .append (_yaml_kv_line ("type" , (type_ or "other" ).title ()))
921921 if brief :
922922 fm_lines .append (_yaml_kv_line ("description" , brief ))
923923 if aliases :
@@ -932,7 +932,7 @@ def _build_frontmatter(sources: list[str]) -> str:
932932 if end != - 1 :
933933 fm = existing [:end + 3 ]
934934 fm = _set_fm_line (fm , "description" , brief ) if brief else fm
935- fm = _set_fm_line (fm , "type" , type_ .capitalize ()) if type_ else fm
935+ fm = _set_fm_line (fm , "type" , type_ .title ()) if type_ else fm
936936 # Drop any legacy ``brief:`` key (migrated to ``description:``),
937937 # mirroring _write_concept's update path.
938938 fm = re .sub (r"^brief:.*\n?" , "" , fm , flags = re .MULTILINE )
@@ -2055,17 +2055,21 @@ async def compile_long_doc(
20552055 schema_md = get_agents_md (wiki_dir )
20562056 summary_content = summary_path .read_text (encoding = "utf-8" )
20572057
2058- # Backfill OKF fields on the indexer-written summary (idempotent).
2058+ # Backfill OKF fields on the indexer-written summary. Idempotent: set
2059+ # description before type so that when both keys are missing the prepends
2060+ # leave `type` first (canonical order); only rewrite when content changed.
20592061 if summary_content .startswith ("---" ):
20602062 fm_end = summary_content .find ("---" , 3 )
20612063 if fm_end != - 1 :
20622064 fm = summary_content [:fm_end + 3 ]
20632065 body = summary_content [fm_end + 3 :]
2064- fm = _set_fm_line (fm , "type" , "Summary" )
20652066 if doc_description :
20662067 fm = _set_fm_line (fm , "description" , doc_description )
2067- summary_content = fm + body
2068- summary_path .write_text (summary_content , encoding = "utf-8" )
2068+ fm = _set_fm_line (fm , "type" , "Summary" )
2069+ updated = fm + body
2070+ if updated != summary_content :
2071+ summary_content = updated
2072+ summary_path .write_text (summary_content , encoding = "utf-8" )
20692073
20702074 # Base context A. cache_control marker on the doc message creates a
20712075 # cache breakpoint covering (system + doc) for every concept call.
0 commit comments