feat(chat): /summary slash command for non-destructive session summaries

Typing /summary (optionally with a topic hint) produces a structured
summary as a normal assistant message — without compacting or mutating
session history. Reuses the existing "Start new session from this answer"
button for hand-off.

Prompts are customizable in Settings → Magic Prompts under a new Session
group. Autocomplete shows an 'openchamber' badge to distinguish our
commands from OpenCode-built-in ones.
This commit is contained in:
Bohdan Triapitsyn
2026-04-22 21:56:35 +03:00
parent f24e6de21b
commit 863be8073b
5 changed files with 108 additions and 3 deletions
@@ -123,6 +123,14 @@ const PROMPT_PAGE_MAP: Record<string, PromptPageConfig> = {
{ id: 'plan.implement.instructions', title: 'Instructions' },
],
},
'session.summary': {
title: 'Session Summary',
description: 'Prompts used by the /summary slash command: visible user message + hidden instructions. Non-destructive — does not compact session history.',
blocks: [
{ id: 'session.summary.visible', title: 'Visible Prompt' },
{ id: 'session.summary.instructions', title: 'Instructions' },
],
},
};
const hasOwn = (input: Record<string, string>, key: string) => Object.prototype.hasOwnProperty.call(input, key);
@@ -40,6 +40,12 @@ export const MagicPromptsSidebar: React.FC<MagicPromptsSidebarProps> = ({ onItem
{ id: 'plan.implement', title: 'Implement Plan' },
],
},
{
group: 'Session',
items: [
{ id: 'session.summary', title: 'Session Summary' },
],
},
] as const;
}, []);