Documentation
¶
Index ¶
- Constants
- Variables
- func CollapsePreview(path string, commitPointUUID string) (int, error)
- func CountSeparatorTokens(entries []jsonl.Entry) int
- func DeduplicateSections(sections []UniteSection) map[int]int
- func ExportBranchesPreview(entries []jsonl.Entry, branches []analyzer.Branch, selectedIndices []int) (int, float64)
- func IsIdle(path string, threshold time.Duration) (bool, time.Time, error)
- func MarkerPath(sessionPath string) string
- func PatchParentUUID(path string, indices map[int]bool) (int, error)
- func RenderVector(snap *VectorSnapshot, outputPath string) error
- func SaveMarkers(sessionPath string, mf *MarkerFile) error
- type Bookmark
- type BookmarkType
- type CleanAllOpts
- type CleanAllResult
- type CleanLiveOpts
- type CleanLiveResult
- type CleanMegaBlocksResult
- type CleanSystemRemindersResult
- type CleanThinkingResult
- type CoalesceResult
- type CollapseResult
- type CommitPoint
- type ContentSurgeryResult
- type DedupResult
- type DeleteResult
- type DistillOpts
- type DistillResult
- type ExportResult
- type MarkerFile
- func (mf *MarkerFile) AddCommitPoint(cp CommitPoint)
- func (mf *MarkerFile) Clear(uuid string)
- func (mf *MarkerFile) ClearBookmark(uuid string)
- func (mf *MarkerFile) ClearPhase(uuid string)
- func (mf *MarkerFile) Get(uuid string) MarkerType
- func (mf *MarkerFile) GetBookmark(uuid string) (Bookmark, bool)
- func (mf *MarkerFile) GetCommitPoint(uuid string) *CommitPoint
- func (mf *MarkerFile) GetPhase(uuid string) PhaseType
- func (mf *MarkerFile) HasCommitPoint(uuid string) bool
- func (mf *MarkerFile) IsKeep(uuid string) bool
- func (mf *MarkerFile) IsNoise(uuid string) bool
- func (mf *MarkerFile) RemoveCommitPoint(uuid string)
- func (mf *MarkerFile) Set(uuid string, marker MarkerType)
- func (mf *MarkerFile) SetBookmark(uuid string, typ BookmarkType, label string)
- func (mf *MarkerFile) SetPhase(uuid string, phase PhaseType)
- func (mf *MarkerFile) Toggle(uuid string, marker MarkerType)
- func (mf *MarkerFile) TogglePhase(uuid string, phase PhaseType)
- type MarkerType
- type OrphanedToolUse
- type PhaseType
- type PreserveResult
- type ReconnectResult
- type RepairResult
- type ReplaceImagesResult
- type RetryCleanResult
- type RewireResult
- type SplitResult
- type StreamStripResult
- type StripResult
- type TombstoneResult
- type TruncateResult
- type UniteOpts
- type UniteResult
- type UniteSection
- type VectorItem
- type VectorMarkerInput
- type VectorSnapshot
- type VectorSourceType
Constants ¶
const DefaultIdleThreshold = 2 * time.Second
DefaultIdleThreshold is the minimum time since last modification before a live edit is considered safe.
const MegaBlockThreshold = 100 * 1024 // 100KB
MegaBlockThreshold is the size in bytes above which a content block is truncated.
Variables ¶
var ErrRaceDetected = errors.New("race detected: file modified during live edit")
ErrRaceDetected is returned when the JSONL file changes during a live edit, indicating Claude Code wrote between operations.
var ErrSessionNotIdle = errors.New("session not idle: mtime too recent")
ErrSessionNotIdle is returned when the session mtime is too recent to safely edit.
Functions ¶
func CollapsePreview ¶ added in v0.4.6
CollapsePreview returns the count of CANDIDATE entries above a commit point without modifying anything (dry-run).
func CountSeparatorTokens ¶ added in v0.3.0
CountSeparatorTokens estimates the token cost of separators in entries.
func DeduplicateSections ¶ added in v0.8.0
func DeduplicateSections(sections []UniteSection) map[int]int
DeduplicateSections returns a map of index → duplicate-of-index for sections with identical headings. The earlier occurrence wins.
func ExportBranchesPreview ¶ added in v0.4.7
func ExportBranchesPreview(entries []jsonl.Entry, branches []analyzer.Branch, selectedIndices []int) (int, float64)
ExportBranchesPreview returns token and cost totals without writing a file.
func IsIdle ¶ added in v0.3.0
IsIdle returns true if the file's mtime is older than threshold. Also returns the current mtime for subsequent race detection.
func MarkerPath ¶ added in v0.4.5
MarkerPath returns the sidecar file path for a given session JSONL path.
func PatchParentUUID ¶ added in v0.40.4
PatchParentUUID clears the parentUuid of entries at the given indices, making them chain roots. This fixes missing-parent chain breaks without deleting entries (which would cascade into more broken chains).
It also expands the patch set: if any flagged entry references a missing parent UUID, ALL other entries referencing the same UUID are patched too. This ensures sidechains sharing a missing parent converge in one pass.
func RenderVector ¶ added in v0.9.0
func RenderVector(snap *VectorSnapshot, outputPath string) error
RenderVector writes the snapshot to a compact markdown file.
func SaveMarkers ¶ added in v0.4.5
func SaveMarkers(sessionPath string, mf *MarkerFile) error
SaveMarkers writes the marker file to disk.
Types ¶
type Bookmark ¶ added in v0.30.0
type Bookmark struct {
Type BookmarkType `json:"type"`
Label string `json:"label,omitempty"`
}
Bookmark is a user-defined positional anchor with optional label.
type BookmarkType ¶ added in v0.30.0
type BookmarkType string
BookmarkType is a non-destructive navigational anchor type.
const ( BookmarkCheckpoint BookmarkType = "checkpoint" BookmarkMilestone BookmarkType = "milestone" )
type CleanAllOpts ¶ added in v0.38.5
type CleanAllOpts struct {
Tombstone bool // replace orphans with placeholders instead of deleting
}
CleanAllOpts configures a CleanAll run.
type CleanAllResult ¶ added in v0.3.0
type CleanAllResult struct {
ProgressRemoved int
SnapshotsRemoved int
SidechainsRemoved int
TangentsRemoved int
FailedRetries int
StaleReadsRemoved int
OrphansRemoved int
OrphansTombstoned int
ImagesReplaced int
SeparatorsStripped int
OutputsTruncated int
ThinkingRemoved int
SignaturesRemoved int
RemindersDeduped int
MegaBlocksTruncated int
CoalesceMerged int
CoalesceOrphans int
TotalTokensSaved int
KeepSkipped int
BytesBefore int64
BytesAfter int64
}
CleanAllResult holds the combined results of all cleanup operations.
func CleanAll ¶ added in v0.3.0
func CleanAll(path string, opts CleanAllOpts) (*CleanAllResult, error)
CleanAll runs all cleanup operations in optimal order with a single backup. Order: entry deletions first, then content surgery.
type CleanLiveOpts ¶ added in v0.3.0
type CleanLiveOpts struct {
Aggressive bool // include Tier 4-5 (images, separators, truncation)
Tier3 bool // include stale reads + failed retries
Threshold time.Duration // idle threshold (default: DefaultIdleThreshold)
DryRun bool // report what would be cleaned, do not write
}
CleanLiveOpts configures a live cleanup pass.
type CleanLiveResult ¶ added in v0.3.0
type CleanLiveResult struct {
ProgressRemoved int
SnapshotsRemoved int
CoalesceMerged int // Tier 2.5, always runs
CoalesceOrphans int // Tier 2.5, always runs
StaleReadsRemoved int // Tier 3, only with Tier3
FailedRetries int // Tier 3, only with Tier3
ImagesReplaced int // Tier 4, only with Aggressive
SeparatorsStripped int // Tier 4, only with Aggressive
OutputsTruncated int // Tier 5, only with Aggressive
TotalTokensSaved int
BytesBefore int64
BytesAfter int64
}
CleanLiveResult holds the combined results of live cleanup operations.
func CleanLive ¶ added in v0.3.0
func CleanLive(path string, opts CleanLiveOpts) (*CleanLiveResult, error)
CleanLive runs safe cleanup operations on a potentially active session.
Tier 1: progress removal (streaming) Tier 2: snapshot removal (streaming) Tier 2.5: coalesce adjacent same-role entries With Aggressive: Tier 4: image replacement, separator stripping Tier 5: bash output truncation
Between each sub-operation, the file mtime is checked. If it changed (meaning Claude Code wrote to it), the operation aborts and restores from the original backup.
Tier 6-7 operations (sidechains, tangents, retries, dedup) are NEVER available in live mode regardless of flags.
type CleanMegaBlocksResult ¶ added in v0.47.0
CleanMegaBlocksResult holds the result of mega block truncation.
func CleanMegaBlocks ¶ added in v0.47.0
func CleanMegaBlocks(path string) (*CleanMegaBlocksResult, error)
CleanMegaBlocks truncates individual content blocks exceeding MegaBlockThreshold.
type CleanSystemRemindersResult ¶ added in v0.47.0
CleanSystemRemindersResult holds the result of system reminder dedup.
func CleanSystemReminders ¶ added in v0.47.0
func CleanSystemReminders(path string) (*CleanSystemRemindersResult, error)
CleanSystemReminders deduplicates repeated system-reminder blocks across user messages. Keeps the last occurrence of each unique reminder, removes earlier duplicates.
type CleanThinkingResult ¶ added in v0.47.0
type CleanThinkingResult struct {
ThinkingRemoved int
SignaturesRemoved int
BytesBefore int64
BytesAfter int64
}
CleanThinkingResult holds the result of thinking block cleanup.
func CleanThinking ¶ added in v0.47.0
func CleanThinking(path string) (*CleanThinkingResult, error)
CleanThinking removes thinking blocks and signature fields from assistant entries. These are extended-thinking artifacts that are never re-sent to the API.
type CoalesceResult ¶ added in v0.39.1
type CoalesceResult struct {
GroupsMerged int
EntriesRemoved int
OrphansStripped int
BytesBefore int64
BytesAfter int64
}
CoalesceResult holds the result of a coalesce operation.
func Coalesce ¶ added in v0.39.1
func Coalesce(path string) (*CoalesceResult, error)
Coalesce merges adjacent same-role entries into single entries, combining their content blocks. This fixes API errors where tool_result blocks don't match the immediately preceding assistant's tool_use blocks (common in Claude for Mac sessions that split multi-tool calls).
Rules:
- Only merges entries with same message.role (user+user, assistant+assistant)
- Non-message entries (system, queue-operation, progress) break merge groups
- Content blocks from later entries are appended to the first entry
- First entry's uuid/parentUuid/timestamp are preserved
- Next entry after a merged group gets reparented to the group's uuid
type CollapseResult ¶ added in v0.4.6
type CollapseResult struct {
EntriesRemoved int
ChainRepairs int
BytesBefore int64
BytesAfter int64
}
CollapseResult holds the result of a collapse operation.
type CommitPoint ¶ added in v0.4.6
type CommitPoint struct {
UUID string `json:"uuid"`
Timestamp time.Time `json:"timestamp"`
Goal string `json:"goal"`
Decisions []string `json:"decisions"`
Constraints []string `json:"constraints,omitempty"`
Questions []string `json:"questions,omitempty"`
Files []string `json:"files,omitempty"`
}
CommitPoint represents a user-marked decision boundary in a session.
func ExtractCanonicalState ¶ added in v0.4.6
func ExtractCanonicalState(entries []jsonl.Entry, cursorIdx int) CommitPoint
ExtractCanonicalState scans entries[0..cursorIdx] and builds a CommitPoint with extracted decisions, constraints, questions, and file references.
type ContentSurgeryResult ¶ added in v0.39.9
type ContentSurgeryResult struct {
FailedRetries int
StaleReadsRemoved int
EntriesRemoved int
BlocksRemoved int
ChainRepairs int
}
ContentSurgeryResult holds the combined results of merged content surgery.
func ContentSurgery ¶ added in v0.39.9
func ContentSurgery(path string, retryResult *analyzer.RetryResult, dupResult *analyzer.DuplicateReadResult) (*ContentSurgeryResult, error)
ContentSurgery performs block-level removal for both failed retries and stale reads in a single ParseRaw pass. This replaces separate RemoveFailedRetries + DeduplicateReads calls in CleanAll, halving the I/O for phases 1e+1f.
type DedupResult ¶ added in v0.3.0
type DedupResult struct {
StaleReadsRemoved int
EntriesRemoved int
BlocksRemoved int
ChainRepairs int
BytesBefore int64
BytesAfter int64
}
DedupResult holds the result of a duplicate read deduplication operation.
func DeduplicateReads ¶ added in v0.3.0
func DeduplicateReads(path string, dupResult *analyzer.DuplicateReadResult) (*DedupResult, error)
DeduplicateReads removes stale file read tool_use/tool_result pairs. For each stale read:
- If assistant message has only that tool_use → delete entire entry
- If assistant message has other blocks → remove just that tool_use block
- Remove the corresponding tool_result block from user message
- If user message only has that tool_result → delete entire entry
Always creates a backup before modifying.
type DeleteResult ¶
type DeleteResult struct {
EntriesRemoved int
ChainRepairs int
KeepSkipped int
BytesBefore int64
BytesAfter int64
}
DeleteResult holds the result of a delete operation.
func Delete ¶
func Delete(path string, toDelete map[int]bool) (*DeleteResult, error)
Delete removes selected entries from a JSONL file, repairing parentUuid chains. Always creates a backup before modifying.
func DeleteWithMarkers ¶ added in v0.4.5
func DeleteWithMarkers(path string, toDelete map[int]bool, markers *MarkerFile) (*DeleteResult, error)
DeleteWithMarkers removes selected entries, skipping any marked as KEEP.
func RemoveProgress ¶
func RemoveProgress(path string) (*DeleteResult, error)
RemoveProgress removes all progress messages from a JSONL file. Always creates a backup before modifying.
type DistillOpts ¶ added in v0.7.0
DistillOpts controls distillation output.
type DistillResult ¶ added in v0.7.0
type DistillResult struct {
TopicsIncluded int
SessionsSpanned int
TotalTokens int
TotalCost float64
OutputPath string
}
DistillResult holds the output of a distill operation.
func DistillToMarkdown ¶ added in v0.7.0
func DistillToMarkdown(ts *analyzer.TopicSet, selectedIndices []int, opts DistillOpts) (*DistillResult, error)
DistillToMarkdown renders selected topics to a markdown file.
type ExportResult ¶ added in v0.4.7
type ExportResult struct {
BranchesExported int
EntriesExtracted int
TokenCost int
DollarCost float64
OutputPath string
}
ExportResult holds the result of a branch export operation.
func ExportBranches ¶ added in v0.4.7
func ExportBranches(entries []jsonl.Entry, branches []analyzer.Branch, selectedIndices []int, sessionID, outputPath string) (*ExportResult, error)
ExportBranches writes selected branches to a markdown file. selectedIndices are branch indices (0-based) into the branches slice. If selectedIndices is empty, all branches are exported.
type MarkerFile ¶ added in v0.4.5
type MarkerFile struct {
Version int `json:"version"`
Markers map[string]MarkerType `json:"markers"`
Phases map[string]PhaseType `json:"phases,omitempty"`
CommitPoints []CommitPoint `json:"commit_points,omitempty"`
Bookmarks map[string]Bookmark `json:"bookmarks,omitempty"`
}
MarkerFile holds persisted markers in a sidecar file alongside a session JSONL.
func LoadMarkers ¶ added in v0.4.5
func LoadMarkers(sessionPath string) (*MarkerFile, error)
LoadMarkers reads the sidecar marker file. Returns an empty MarkerFile if missing.
func (*MarkerFile) AddCommitPoint ¶ added in v0.4.6
func (mf *MarkerFile) AddCommitPoint(cp CommitPoint)
AddCommitPoint appends a commit point.
func (*MarkerFile) Clear ¶ added in v0.4.5
func (mf *MarkerFile) Clear(uuid string)
Clear removes a marker from a UUID.
func (*MarkerFile) ClearBookmark ¶ added in v0.30.0
func (mf *MarkerFile) ClearBookmark(uuid string)
ClearBookmark removes a bookmark from a UUID.
func (*MarkerFile) ClearPhase ¶ added in v0.4.7
func (mf *MarkerFile) ClearPhase(uuid string)
ClearPhase removes a phase from a UUID.
func (*MarkerFile) Get ¶ added in v0.4.5
func (mf *MarkerFile) Get(uuid string) MarkerType
Get returns the marker for a UUID, or "" if unset.
func (*MarkerFile) GetBookmark ¶ added in v0.30.0
func (mf *MarkerFile) GetBookmark(uuid string) (Bookmark, bool)
GetBookmark returns the bookmark for a UUID, if any.
func (*MarkerFile) GetCommitPoint ¶ added in v0.4.6
func (mf *MarkerFile) GetCommitPoint(uuid string) *CommitPoint
GetCommitPoint returns the commit point for a UUID, or nil if not found.
func (*MarkerFile) GetPhase ¶ added in v0.4.7
func (mf *MarkerFile) GetPhase(uuid string) PhaseType
GetPhase returns the phase for a UUID, or "" if unset.
func (*MarkerFile) HasCommitPoint ¶ added in v0.4.6
func (mf *MarkerFile) HasCommitPoint(uuid string) bool
HasCommitPoint returns true if a commit point exists at the given UUID.
func (*MarkerFile) IsKeep ¶ added in v0.4.5
func (mf *MarkerFile) IsKeep(uuid string) bool
IsKeep returns true if the UUID is marked as KEEP.
func (*MarkerFile) IsNoise ¶ added in v0.4.5
func (mf *MarkerFile) IsNoise(uuid string) bool
IsNoise returns true if the UUID is marked as NOISE.
func (*MarkerFile) RemoveCommitPoint ¶ added in v0.4.6
func (mf *MarkerFile) RemoveCommitPoint(uuid string)
RemoveCommitPoint removes a commit point by UUID.
func (*MarkerFile) Set ¶ added in v0.4.5
func (mf *MarkerFile) Set(uuid string, marker MarkerType)
Set assigns a marker to a UUID.
func (*MarkerFile) SetBookmark ¶ added in v0.30.0
func (mf *MarkerFile) SetBookmark(uuid string, typ BookmarkType, label string)
SetBookmark assigns or updates a bookmark on a UUID.
func (*MarkerFile) SetPhase ¶ added in v0.4.7
func (mf *MarkerFile) SetPhase(uuid string, phase PhaseType)
SetPhase assigns a phase to a UUID.
func (*MarkerFile) Toggle ¶ added in v0.4.5
func (mf *MarkerFile) Toggle(uuid string, marker MarkerType)
Toggle sets the marker if unset or different, clears it if same.
func (*MarkerFile) TogglePhase ¶ added in v0.4.7
func (mf *MarkerFile) TogglePhase(uuid string, phase PhaseType)
TogglePhase sets the phase if unset or different, clears it if same.
type MarkerType ¶ added in v0.4.5
type MarkerType string
MarkerType represents an explicit user intent label for a session entry.
const ( MarkerKeep MarkerType = "keep" MarkerCandidate MarkerType = "candidate" MarkerNoise MarkerType = "noise" )
type OrphanedToolUse ¶ added in v0.46.0
type OrphanedToolUse struct {
EntryIndex int
ToolUseID string
ToolName string
ParentUUID string // UUID of the assistant entry containing this tool_use
}
OrphanedToolUse describes a tool_use block without a matching tool_result.
func FindOrphanedToolUses ¶ added in v0.46.0
func FindOrphanedToolUses(entries []jsonl.Entry) []OrphanedToolUse
FindOrphanedToolUses scans entries and returns tool_use blocks without matching tool_results.
type PhaseType ¶ added in v0.4.7
type PhaseType string
PhaseType represents a reasoning phase label for a session entry.
type PreserveResult ¶ added in v0.39.3
PreserveResult holds the outcome of a preserve operation.
func Preserve ¶ added in v0.39.3
func Preserve(sessionPath string, entries []jsonl.Entry, toDelete map[int]bool) (*PreserveResult, error)
Preserve extracts decisions, findings, user questions, and file references from entries about to be deleted and writes them to a sidecar markdown file. toDelete is the set of entry indices that will be removed by the next operation.
type ReconnectResult ¶ added in v0.30.0
type ReconnectResult struct {
EntriesReconnected int
}
ReconnectResult holds reconnect-sidechains outcome.
func ReconnectSidechains ¶ added in v0.30.0
func ReconnectSidechains(path string, report *analyzer.SidechainReport) (*ReconnectResult, error)
ReconnectSidechains rewrites missing parentUuid references to nearest surviving ancestors for sidechain entries classified as repairable.
type RepairResult ¶ added in v0.3.0
type RepairResult struct {
IssuesFixed int
EntriesRemoved int
EntriesTombstoned int
ImagesReplaced int
ChainRepairs int
ParentPatches int
}
RepairResult holds the outcome of a repair operation.
type ReplaceImagesResult ¶
ReplaceImagesResult holds the result of an image replacement operation.
func ReplaceImages ¶
func ReplaceImages(path string) (*ReplaceImagesResult, error)
ReplaceImages replaces all base64 image blocks with text placeholders. Always creates a backup before modifying.
type RetryCleanResult ¶ added in v0.3.0
type RetryCleanResult struct {
FailedRemoved int
EntriesRemoved int
BlocksRemoved int
ChainRepairs int
BytesBefore int64
BytesAfter int64
}
RetryCleanResult holds the result of a failed retry cleanup operation.
func RemoveFailedRetries ¶ added in v0.3.0
func RemoveFailedRetries(path string, retryResult *analyzer.RetryResult) (*RetryCleanResult, error)
RemoveFailedRetries removes failed tool attempts that were superseded by retries. For each failed sequence:
- Remove the tool_use block from the assistant message (or whole entry if only block)
- Remove the error tool_result block from the user message (or whole entry)
Always creates a backup before modifying.
type RewireResult ¶ added in v0.46.0
RewireResult holds the result of a rewire operation.
func Rewire ¶ added in v0.46.0
func Rewire(path string) (*RewireResult, error)
Rewire injects synthetic tool_result entries for orphaned tool_use blocks. Groups orphaned tool_uses by their parent assistant entry and injects one user entry per assistant entry, placed immediately after it.
type SplitResult ¶ added in v0.4.3
type SplitResult struct {
EntriesExtracted int
TokenCost int
DollarCost float64
TargetRepo string
ReExplFiles []string
OutputPath string
}
SplitResult holds the result of a split-to-markdown operation.
func SplitToMarkdown ¶ added in v0.4.3
func SplitToMarkdown(entries []jsonl.Entry, from, to int, meta *analyzer.RangeMetadata, sessionID, outputPath string) (*SplitResult, error)
SplitToMarkdown extracts entries[from:to+1] into a markdown file.
type StreamStripResult ¶ added in v0.39.9
type StreamStripResult struct {
LinesRemoved int
}
StreamStripResult holds the result of a streaming strip operation.
func StreamStripType ¶ added in v0.39.9
func StreamStripType(path string, entryType string) (*StreamStripResult, error)
StreamStripType removes JSONL lines matching a given type marker without full JSON deserialization. It scans line-by-line, checking for the raw byte pattern `"type":"<entryType>"` (with and without spaces), and writes non-matching lines to a temp file, then atomic-renames.
type StripResult ¶ added in v0.3.0
StripResult holds the outcome of separator stripping.
func StripSeparators ¶ added in v0.3.0
func StripSeparators(path string) (*StripResult, error)
StripSeparators removes decorative separator lines from assistant messages. Only modifies assistant entries. Creates a backup before writing.
type TombstoneResult ¶ added in v0.38.5
TombstoneResult holds the result of a tombstone operation.
func Tombstone ¶ added in v0.38.5
func Tombstone(path string, toTombstone map[int]bool) (*TombstoneResult, error)
Tombstone replaces the content of selected entries with a text placeholder, preserving the entry's uuid and parentUuid chain position. Used instead of Delete when entry removal would create visible gaps (Claude for Mac).
type TruncateResult ¶ added in v0.3.0
type TruncateResult struct {
OutputsTruncated int
TokensSaved int
BytesBefore int64
BytesAfter int64
}
TruncateResult holds the result of an output truncation operation.
func TruncateOutputs ¶ added in v0.3.0
func TruncateOutputs(path string, threshold, keepLines int) (*TruncateResult, error)
TruncateOutputs truncates large Bash tool_result content to first+last keepLines lines. threshold is the minimum byte size to trigger truncation. keepLines is the number of lines to keep at the start and end.
type UniteResult ¶ added in v0.8.0
type UniteResult struct {
SectionsIncluded int
SourceFileCount int
TotalTokens int
OutputPath string
}
UniteResult holds the output of a unite operation.
func UniteSections ¶ added in v0.8.0
func UniteSections(sections []UniteSection, selectedIndices []int, opts UniteOpts) (*UniteResult, error)
UniteSections merges selected sections into a single markdown file.
type UniteSection ¶ added in v0.8.0
type UniteSection struct {
SourceFile string
SourceModTime int64
Heading string
Summary string
MetadataLines []string
Content string
TokenEstimate int
}
UniteSection represents a single ## section parsed from a markdown file.
func ParseMarkdownSections ¶ added in v0.8.0
func ParseMarkdownSections(path string) ([]UniteSection, string, error)
ParseMarkdownSections parses a markdown file into sections split on "## " headings. Returns sections, project name extracted from # heading, and any error.
type VectorItem ¶ added in v0.9.0
type VectorItem struct {
Text string
Source string
SourceType VectorSourceType
Epoch int
}
VectorItem is a single extracted decision, constraint, or question.
func DeduplicateItems ¶ added in v0.9.0
func DeduplicateItems(items []VectorItem) []VectorItem
DeduplicateItems removes items with identical normalized text. First occurrence wins, preserving source priority ordering.
type VectorMarkerInput ¶ added in v0.9.0
type VectorMarkerInput struct {
SessionLabel string
Markers *MarkerFile
}
VectorMarkerInput pairs a session label with its loaded markers.
type VectorSnapshot ¶ added in v0.9.0
type VectorSnapshot struct {
ProjectName string
SnapshotDate time.Time
Decisions []VectorItem
Constraints []VectorItem
Questions []VectorItem
Files []string
SessionsScanned int
}
VectorSnapshot holds the aggregated project vector.
func CollectVector ¶ added in v0.9.0
func CollectVector(ts *analyzer.TopicSet, markers []VectorMarkerInput) *VectorSnapshot
CollectVector extracts decisions, constraints, and questions from topics and commit points.
type VectorSourceType ¶ added in v0.9.0
type VectorSourceType string
VectorSourceType identifies where a vector item was extracted from.
const ( VectorSourceCommitPoint VectorSourceType = "commit_point" VectorSourceArchaeology VectorSourceType = "archaeology" )