Repository navigation
feat(commands): add /compact to summarize older messages on demand - #164
Merged
Merged
Conversation
mikan compacted only automatically, and /new, the only manual way to shrink a session, is limited to DMs because it discards shared context. /compact [instructions] asks pi-durable to compact the session through its runner, in DMs and channels, and reports the estimated context size before and after; nothing is deleted from the session history. Slack apps must register /pi-compact.
Deploying mikan with
|
| Latest commit: |
978222c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://604647c4.mikan-1wv.pages.dev |
| Branch Preview URL: | https://feat-compact-command.mikan-1wv.pages.dev |
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.
/compact [instructions](/pi-compactin Slack) summarizes a session's older messages with pi-durable'sConversation.compact(), in DMs and channels.Change
compact(Slack/pi-compact, Discord, Telegram menu) andCompactCommandHandlerhandleCompactCommandleases the session's runner, as a run does, so the model binding is in place; the command already runs in the session's queue, after its own runMikanAgentSession.compact(): attach,conversation.compact(instructions), wait for the task and its placed summary; reportsNothing to compact yetwhen pi-durable finds nothing to summarize. Sizes are estimated per context message with pi-ai'sestimateMessageTokens/pi-compactadded to the example manifests, the command docs (4 languages), and the minimal guideSlack only: slash commands do not run in threads, and in a channel the reply is ephemeral, like other slash commands there. Existing Slack apps must add
/pi-compact.Eval (
.workspace/compact-eval, Slack slash command through the bot and runtime with the faux model)/pi-compact keep the question numbersVerification
/pi-compactadded to the app: a DM replied "Context compacted: about 24,528 → 13,469 tokens", and the next message still recalled a code given before the compaction.