feat: Phase 1B channel-isolated conversation memory#40
Merged
Conversation
Each conversation source (shell, Feishu, Telegram, scheduler) now tags its messages with a channel ID. ai_memory_build() filters by channel so different sources maintain independent conversation history in the shared ring buffer. New API: - ai_set_channel() / ai_get_channel() — set active channel - ai_memory_add() — add message with channel tag - ai_memory_build() — build messages for a specific channel - ai_memory_clear_channel() — clear one channel only - ai_memory_count_channel() — count messages per channel - AI_CHANNEL_SHELL/FEISHU/TELEGRAM/SCHED constants Old API (ai_memory_add_message, ai_memory_build_messages) kept as backward-compatible wrappers defaulting to SHELL. Callers updated: feishu.c, telegram.c, tool_sched.c now set their channel ID before ai_chat() and reset to SHELL after. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ai_memory_build(channel)filters by channel so different sources maintain independent conversation history in the shared 20-slot ring bufferai_set_channel()/ai_get_channel(),ai_memory_add()with channel param,ai_memory_clear_channel(),ai_memory_count_channel()ai_chat()and reset to SHELL afterdrop_oldest_pair_for(channel)prefers evicting same-channel pairs when the buffer is fullTest plan
meson compilepasses on vexpress-a9 (zero warnings)make build-esp32c3-qemupasses (zero warnings)scripts/check-patch.sh --stagedpasses🦞 Generated with Claude Code