feat: compaction-tool-session-summarization — semantic session summarization tool - #361
Merged
Merged
Conversation
…for compaction tool
…ol with session summarization - Add src/tools/compaction.js with parseCompactionOutput(), spawnCompactionProcess(), and createCompactionTool() - Add compaction tool registration to src/tools/index.js - Add comprehensive unit tests for compaction tool - Add compaction spec to openspec/specs/compaction/
- Move openspec/changes/compaction-tool-session-summarization/ to archive/2026-06-21-compaction-tool-session-summarization/ - All implementation tasks complete
- Update empty-permissions test to expect 6 tools (added compaction) - Update maxReadSize test to expect 6 tools (added compaction)
Owner
Author
PR Audit: compaction-tool-session-summarizationCompared against: OpenSpec proposal, design, tasks (archived as 2026-06-21-compaction-tool-session-summarization) Task Completion
Spec ComplianceProposal "What Changes":
Design Decisions — Implemented as Specified:
Design Risks — Mitigations in Place:
Findings
VerdictAll proposed tasks implemented. Spec compliance: complete. Recommendation: Approve and merge. Audit performed against archived change: openspec/changes/archive/2026-06-21-compaction-tool-session-summarization/ |
Load COMPACTION.md from prompts/ at module init and escape newlines for proper embedding in the spawned command string. This makes the compaction structure a single source of truth — edit the markdown, the tool picks it up automatically.
The marker in compaction.js is '# Compaction' — the template header must match exactly for the split() parser to work correctly.
…mmand - Remove 'latest' fallback from threadID in command string - Update schema description to reflect current threadId default - Remove redundant '# Compaction' header instruction (now in template)
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
Add a
compactiontool that produces semantic summarization of conversation sessions, enabling sub-agents to receive curated context about prior work.Why
When delegating to a sub-agent, the parent needs a clean summary of what was discussed — not a full session dump, not a mechanical token-budget reducer, but a semantic distillation of the conversation's key points. This tool provides that capability, enabling sub-agents to receive curated context about prior work.
What Changes
compactiontool that produces semantic summarization of conversation sessions# Compactionmarker to separate thinking/reasoning from the final summarysrc/tools/index.jsCapabilities
New Capabilities
compaction: Semantic session summarization tool that distills conversation history into core decisions, key design points, open questions, and next stepsImpact
src/tools/index.js(registration), newsrc/tools/compaction.js(implementation)@langchain/core/tools,zod(already present)memory/sessions/directoryWhat Changed
src/tools/compaction.jswith:parseCompactionOutput()— splits stdout on# Compactionmarker, returns{ ok, summary, error? }spawnCompactionProcess()— spawns node process with 60s timeout, captures stdout/stderrcreateCompactionTool()— factory returning LangChain Tool with zod schema (optional threadID, maxMessages)src/tools/index.js(import, TOOL_PERMISSIONS, TOOL_FACTORIES)tests/unit/tools_compaction.test.js:openspec/specs/compaction/spec.mdTesting