From 14d253f929a9e717eecbb111b73882c976da33f7 Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Tue, 5 May 2026 08:48:27 +0200 Subject: [PATCH] feat(session): tag opencode staging headers with '| source: opencode' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complement to the mempalace-pi-session feeder: now that a second source mines into wing_conversations, every session's synthetic header carries an explicit source tag so the LLM can discriminate at read time when searches return first-chunk content: [session: | <directory> | <YYYY-MM-DD> | source: opencode] The primary disambiguator in search results remains source_file basename (opencode: '<slug>_<id>.jsonl', pi: 'pi_<uuid>.jsonl'), which is present in every chunk's metadata regardless of where the search hit landed in the session. This header tag is a cosmetic second signal on first-chunk hits. Caveat: existing drawers keep their old header — mempalace mine dedups by source_file path, which didn't change, so old opencode sessions are not re-mined. They are implicitly opencode (the only pre-pi source). --- bin/mempalace-session | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mempalace-session b/bin/mempalace-session index 797a8b6..4781bdf 100755 --- a/bin/mempalace-session +++ b/bin/mempalace-session @@ -86,7 +86,7 @@ What gets mined: Transcript shape per session: - Synthetic header as first user turn: - [session: <title> | <directory> | <YYYY-MM-DD>] + [session: <title> | <directory> | <YYYY-MM-DD> | source: opencode] - User/assistant messages extracted from message.data + part.data - Tool calls → Claude Code `tool_use` blocks - Tool outputs → `tool_result` blocks (folded into the assistant turn by the @@ -250,7 +250,7 @@ for sess in sessions: date_str = datetime.fromtimestamp( sess["time_created"] / 1000, tz=timezone.utc ).strftime("%Y-%m-%d") - header = f"[session: {title} | {directory} | {date_str}]" + header = f"[session: {title} | {directory} | {date_str} | source: opencode]" out_lines.append({"type": "user", "message": {"content": header}}) for msg in messages: