Clarify that compaction/branch details are hook-customizable
This commit is contained in:
@@ -108,7 +108,7 @@ Never cut at tool results (they must stay with their tool call).
|
|||||||
### CompactionEntry Structure
|
### CompactionEntry Structure
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface CompactionEntry {
|
interface CompactionEntry<T = unknown> {
|
||||||
type: "compaction";
|
type: "compaction";
|
||||||
id: string;
|
id: string;
|
||||||
parentId: string;
|
parentId: string;
|
||||||
@@ -116,16 +116,20 @@ interface CompactionEntry {
|
|||||||
summary: string;
|
summary: string;
|
||||||
firstKeptEntryId: string;
|
firstKeptEntryId: string;
|
||||||
tokensBefore: number;
|
tokensBefore: number;
|
||||||
fromHook?: boolean;
|
fromHook?: boolean; // true if hook provided the compaction
|
||||||
details?: CompactionDetails;
|
details?: T; // hook-specific data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default compaction uses this for details:
|
||||||
interface CompactionDetails {
|
interface CompactionDetails {
|
||||||
readFiles: string[];
|
readFiles: string[];
|
||||||
modifiedFiles: string[];
|
modifiedFiles: string[];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Hooks can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom compaction hooks can use their own structure.
|
||||||
|
```
|
||||||
|
|
||||||
## Branch Summarization
|
## Branch Summarization
|
||||||
|
|
||||||
### When It Triggers
|
### When It Triggers
|
||||||
@@ -168,23 +172,26 @@ This means nested summaries accumulate file tracking across the entire abandoned
|
|||||||
### BranchSummaryEntry Structure
|
### BranchSummaryEntry Structure
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface BranchSummaryEntry {
|
interface BranchSummaryEntry<T = unknown> {
|
||||||
type: "branch_summary";
|
type: "branch_summary";
|
||||||
id: string;
|
id: string;
|
||||||
parentId: string;
|
parentId: string;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
summary: string;
|
summary: string;
|
||||||
fromId: string; // Entry we navigated from
|
fromId: string; // Entry we navigated from
|
||||||
fromHook?: boolean;
|
fromHook?: boolean; // true if hook provided the summary
|
||||||
details?: BranchSummaryDetails;
|
details?: T; // hook-specific data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default branch summarization uses this for details:
|
||||||
interface BranchSummaryDetails {
|
interface BranchSummaryDetails {
|
||||||
readFiles: string[];
|
readFiles: string[];
|
||||||
modifiedFiles: string[];
|
modifiedFiles: string[];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Same as compaction, hooks can store custom data in `details`.
|
||||||
|
|
||||||
## Summary Format
|
## Summary Format
|
||||||
|
|
||||||
Both compaction and branch summarization use the same structured format:
|
Both compaction and branch summarization use the same structured format:
|
||||||
|
|||||||
Reference in New Issue
Block a user