fix: decision record body cap 2K → 8K — proposals were truncating mid-text

User asked for full DP-00002 text, bot served it but cut off at 2000 chars
with "That's where my copy cuts off." Full proposals are 6K+. Increased
index, sanitize, and prompt caps to 8K for decision records.

Pentagon-Agent: Epimetheus <3D35839A-7722-4740-B93D-51157F7D5E70>
This commit is contained in:
m3taversal 2026-03-24 16:18:08 +00:00
parent c2ff4996e3
commit 7232755d11

View file

@ -175,11 +175,11 @@ class KBIndex:
# Extract wiki-linked claim references from body
related_claims = re.findall(r"\[\[([^\]]+)\]\]", body)
# Body excerpt — decisions get full body (typically 1-2K), entities get 500 chars
# Body excerpt — decisions get full body, entities get 500 chars
ft = fm.get("type")
if ft == "decision":
# Include full body for decision records — these are what users ask about
overview = body[:2000] if body else (summary or "")
# Full body for decision records — proposals can be 6K+
overview = body[:8000] if body else (summary or "")
elif summary:
overview = f"{summary} "
body_lines = [l for l in body.split("\n") if l.strip() and not l.startswith("#")]
@ -353,7 +353,7 @@ def retrieve_context(query: str, repo_dir: str, index: KBIndex | None = None,
path=ent["path"],
entity_type=ent["type"],
domain=ent["domain"],
overview=_sanitize_for_prompt(ent["overview"], max_len=2000),
overview=_sanitize_for_prompt(ent["overview"], max_len=8000),
tags=ent["tags"],
related_claims=ent["related_claims"],
))
@ -583,7 +583,7 @@ def format_context_for_prompt(ctx: KBContext) -> str:
sections.append(f"**{ent.name}** ({ent.entity_type}, {ent.domain})")
# Top 3 entities get full content, rest get truncated
if i < 3:
sections.append(ent.overview[:2000])
sections.append(ent.overview[:8000])
else:
sections.append(ent.overview[:500])
if ent.related_claims: