Skip to content

Overview

contox_compact summarizes all entries in a journal-like context (bugs, implementation journal, sessions) into a single content block. This reduces the token count of the context while preserving the key information from all entries.

Use this tool when a journal context has accumulated many entries over time and is consuming too many tokens in the brain document.

Parameters

NameTypeRequiredDefaultDescription
idstringYesThe context ID to compact

Return value

Returns a summary of the compaction operation:

FieldTypeDescription
entriesCountnumberNumber of entries that were processed
summaryLengthnumberLength of the resulting summary in characters
messagestringStatus message

Usage examples

Compacting a bugs journal

User: The bugs context has too many entries, compact it

Claude calls: contox_list_contexts()
// Finds bugs context with id "ctx_bugs123"
Claude calls: contox_compact({ id: "ctx_bugs123" })

Response:
Compaction completed for context ctx_bugs123:
- Entries processed: 47
- Summary length: 2340 chars
- All entries summarized into context content

Notes

  • Compaction is a one-way operation. Individual entries are summarized into the context's content field, and the original entries are consolidated.
  • The summary preserves key facts, dates, and references from the original entries.
  • After compaction, new entries can still be added to the context via contox_add_entry.
  • Consider compacting when a context's token count grows large (visible via contox_list_contexts).