Skip to content

feat(core): accept guidance for manual compaction - #56208

Open
rekram1-node wants to merge 10 commits into
devfrom
compact-focus
Open

rekram1-node wants to merge 10 commits into
devfrom
compact-focus

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Manual compaction gives the user no way to say what the summary should keep or drop.

Change

/compact accepts optional guidance and appends it to the summary prompt.

 POST /api/session/:sessionID/compact
-{ id?, delivery? }
+{ id?, delivery?, guidance? }

 summary prompt
   …template and rules…
+  Additional guidance for this summary:
+  <guidance>
  • TUI and ACP: /compact <text> sends the text as guidance.
  • Blank guidance is treated as absent.

Out of scope

  • Native provider compaction ignores guidance.

Verification

  • bun run check
  • Tests in packages/core, packages/tui and packages/cli (ACP)

Closes #42574

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change works as described. I drove both checkouts with the simulated model and posted {"focus": "..."} to /api/session/:id/compact. On the base the field is silently dropped. With this PR it is stored on the compaction inbox item and shows up as the <focus> section in the summary request. The core compaction, runner and execution tests pass, and type checks are clean in core, server, schema, protocol and client.

Public API changes (all additive and backwards compatible):

  • POST /api/session/:sessionID/compact body accepts an optional focus: string.
  • Session.Inbox.CompactionPayload changes from {} to { focus?: string }.
  • The client's SessionCompactInput gains focus?.

One thing to fix before merge: packages/protocol/openapi.json wasn't regenerated, so bun run check:generated in packages/protocol fails on this branch (it passes on the base), and CI runs that check. Running bun run generate in packages/protocol should fix it.

Related: #42574

Comment thread packages/protocol/src/groups/session.ts Resolved
@rekram1-node rekram1-node changed the title feat(core): accept focus guidance for manual compaction feat(core): accept instructions for manual compaction Oct 16, 2026
@rekram1-node rekram1-node changed the title feat(core): accept instructions for manual compaction feat(core): accept guidance for manual compaction Oct 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: allow user to inject custom instruction when compacting a session

1 participant