Module: RubynCode::Context::ManualCompact
- Defined in:
- lib/rubyn_code/context/manual_compact.rb
Overview
LLM-driven summarization triggered explicitly by the user or agent via the /compact command. Identical to AutoCompact but supports an optional custom focus prompt so the user can steer what gets preserved.
Constant Summary collapse
- BASE_INSTRUCTION =
<<~PROMPT You are a context compaction assistant. Summarize the following conversation transcript for continuity. Cover exactly three areas: 1) **What was accomplished** - completed tasks, files changed, problems solved 2) **Current state** - what the user/agent is working on right now, any pending actions 3) **Key decisions made** - architectural choices, user preferences, constraints established Be concise but preserve all details needed to continue the work seamlessly. Use bullet points. PROMPT
- MAX_TRANSCRIPT_CHARS =
80_000
Class Method Summary collapse
-
.call(messages, llm_client:, transcript_dir: nil, focus: nil) ⇒ Array<Hash>
Compacts the conversation by summarizing it through the LLM.
Class Method Details
.call(messages, llm_client:, transcript_dir: nil, focus: nil) ⇒ Array<Hash>
Compacts the conversation by summarizing it through the LLM.
31 32 33 34 35 36 37 38 39 |
# File 'lib/rubyn_code/context/manual_compact.rb', line 31 def self.call(, llm_client:, transcript_dir: nil, focus: nil) save_transcript(, transcript_dir) if transcript_dir transcript_text = serialize_tail(, MAX_TRANSCRIPT_CHARS) instruction = build_instruction(focus) summary = request_summary(transcript_text, instruction, llm_client) [{ role: 'user', content: "[Context compacted — manual]\n\n#{summary}" }] end |