feat(session): tag opencode staging headers with '| source: opencode'

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: <title> | <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).
This commit is contained in:
2026-05-05 08:48:27 +02:00
parent 9450a45194
commit 14d253f929
+2 -2
View File
@@ -86,7 +86,7 @@ What gets mined:
Transcript shape per session: Transcript shape per session:
- Synthetic header as first user turn: - 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 - User/assistant messages extracted from message.data + part.data
- Tool calls → Claude Code `tool_use` blocks - Tool calls → Claude Code `tool_use` blocks
- Tool outputs → `tool_result` blocks (folded into the assistant turn by the - Tool outputs → `tool_result` blocks (folded into the assistant turn by the
@@ -250,7 +250,7 @@ for sess in sessions:
date_str = datetime.fromtimestamp( date_str = datetime.fromtimestamp(
sess["time_created"] / 1000, tz=timezone.utc sess["time_created"] / 1000, tz=timezone.utc
).strftime("%Y-%m-%d") ).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}}) out_lines.append({"type": "user", "message": {"content": header}})
for msg in messages: for msg in messages: