Skip to content

feat: append customInstructions from session_before_compact to summary - #56

Open
EarthChen wants to merge 1 commit into
elpapi42:masterfrom
EarthChen:feat/consume-custom-instructions
Open

feat: append customInstructions from session_before_compact to summary#56
EarthChen wants to merge 1 commit into
elpapi42:masterfrom
EarthChen:feat/consume-custom-instructions

Conversation

@EarthChen

Copy link
Copy Markdown

Summary

Append event.customInstructions (from session_before_compact) to the rendered compaction summary when present. Closes #55.

Why

session_before_compact already carries customInstructions (forwarded by ctx.compact({ customInstructions })), but the hook ignored it. Other extensions/tools can use this field to inject focus notes or task-boundary context into the compacted memory. This enables cross-extension composition without touching package internals.

Change

  • const summary -> let summary
  • After the existing "decline ownership if empty" check, append customInstructions separated by a --- divider.

Behavior is unchanged when customInstructions is absent.

Test plan

  • Compaction with no customInstructions -> summary unchanged.
  • Compaction with customInstructions set -> note appended after ---.

session_before_compact exposes customInstructions (also forwarded by
ctx.compact({ customInstructions })), but the hook ignored it. Append it
to the rendered summary so callers (other extensions/tools) can inject
focus notes or task-boundary context into the compacted memory.
@Seopril

Seopril commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Could you add unit tests to the PR? Currently there are no tests or when customInstructions is present vs not present. Otherwise I see no issue with this. @elpapi42 do you agree?

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.

Consume customInstructions from session_before_compact in the summary

2 participants