reduce

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package reduce strips code fence markers from journal content to eliminate nesting conflicts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanToolOutputJSON

func CleanToolOutputJSON(content string) string

CleanToolOutputJSON extracts plain text from Tool Output turns whose body is raw JSON from the Claude API (e.g. [{"type":"text","text":"..."}]). The JSON text field's \n escapes become real newlines.

Parameters:

  • content: Journal entry content with potential JSON tool output

Returns:

  • string: Content with JSON tool output replaced by plain text

func StripFences

func StripFences(content string, fencesVerified bool) string

StripFences removes all code fence markers from content, leaving the inner text as-is. This eliminates fence nesting conflicts entirely. Files whose fences have been verified (fencesVerified=true) are returned unchanged.

The result is plain text with structural markers preserved (turn headers, tool calls, section breaks). Serves as a readable baseline without AI reconstruction, or as input for the ctx-journal-normalize skill.

Parameters:

  • content: Raw Markdown content of a journal entry
  • fencesVerified: Whether the file's fences have been verified via state

Returns:

  • string: Content with code fence markers removed

func StripSystemReminders

func StripSystemReminders(content string) string

StripSystemReminders removes internal Claude Code blocks from journal content. Handles:

  • XML-style system reminders: <system-reminder>...</system-reminder>
  • Bold-style system reminders: **System Reminder**: ... (paragraph until blank line)
  • Context compaction summaries: multi-line <summary>...</summary> blocks (standalone <summary> on its own line - see config.TagCompactionSummaryOpen)
  • Compaction continuation boilerplate: "If you need specific details from before compaction..." paragraph

The authoritative JSONL transcripts retain them; the exported Markdown doesn't need them.

Parameters:

  • content: Journal entry content with potential internal blocks

Returns:

  • string: Content with all internal blocks removed

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL