Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mempalace/convo_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _chunk_by_exchange(lines: list) -> list:
ai_lines.append(next_line.strip())
i += 1

ai_response = " ".join(ai_lines[:8])
ai_response = " ".join(ai_lines)
content = f"{user_turn}\n{ai_response}" if ai_response else user_turn

if len(content.strip()) > MIN_CHUNK_SIZE:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_convo_miner_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def test_short_content_skipped(self):
# Too short to produce chunks (below MIN_CHUNK_SIZE)
assert isinstance(chunks, list)

def test_long_ai_response_not_truncated(self):
"""AI responses longer than 8 lines must be stored in full (verbatim principle)."""
lines = [f"Step {i}: important detail that must be stored" for i in range(1, 14)]
content = "> How do I implement authentication?\n" + "\n".join(lines)
chunks = chunk_exchanges(content)
assert len(chunks) >= 1
stored = chunks[0]["content"]
# All 13 lines must be present — none silently dropped
for i in range(1, 14):
assert f"Step {i}:" in stored, f"Step {i} was truncated and not stored"


class TestDetectConvoRoom:
def test_technical_room(self):
Expand Down