smartcompact 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartcompact",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "Compact long agent sessions earlier, at a finished piece of work, to cut cost without losing results (Claude Code, pi, Codex)",
6
6
  "license": "MIT",
package/plugin/README.md CHANGED
@@ -19,10 +19,11 @@ All hooks live in one module, `hooks/register.ts`.
19
19
  - **`/smartcompact` command**: answers only its own command (`report`, `pause`, `resume`).
20
20
  - **Tool calls**: answers calls to its own `checkpoint` tool by recording the note. For every other tool it only looks at the result to recognize commits, tests, builds and edited files, and passes the result through unchanged.
21
21
  - **Task created / completed**: keeps the list of in-progress task names for the ledger.
22
- - **Prompt submit**: adds context to the turn, never changes the user's message. After a compaction it adds the progress ledger; once per cycle, when the context nears the allow line, it adds a one-line reminder to record progress with `checkpoint`; past the allow line, while it waits for a finished piece of work, it reminds the model to mark each finished step with `checkpoint`, again every further 100k tokens.
22
+ - **Session start after a compaction**: hands the progress ledger to the model as context the user does not see. Subagent compactions are left alone.
23
+ - **Prompt submit**: adds context to the turn, never changes the user's message. Once per cycle, when the context nears the allow line, it adds a one-line reminder to record progress with `checkpoint`; past the allow line, while it waits for a finished piece of work, it reminds the model to mark each finished step with `checkpoint`, again every further 100k tokens.
23
24
  - **Turn start**: cancels a compaction still waiting for the user to go idle; any new turn counts, including one started by a slash command.
24
- - **Turn complete**: keeps the model's final reply and decides whether to compact. When it should, it waits until the user has been idle for 3 minutes (a new turn cancels it) and then compacts the session; the reply is handed back with the ledger. Where a session cannot compact directly (headless sessions such as the desktop app), it runs the `/compact` command itself with SmartCompact's compaction instructions; it runs no other commands.
25
- - **Compaction**: never blocks or changes a compaction itself. After any compaction of the main session it appends the progress ledger to the compacted context. Subagent compactions are left alone.
25
+ - **Turn complete**: keeps the model's final reply and decides whether to compact. When it should, it waits until the user has been idle for 3 minutes (a new turn cancels it) and then compacts the session; the reply is handed back with the ledger. Where a session cannot compact directly (headless sessions such as the desktop app), it runs the `/compact` command itself, shown as `/compact by SmartCompact`, and supplies SmartCompact's compaction instructions when it runs; it runs no other commands.
26
+ - **Compaction**: records the size before and after. It changes only the `/compact` it queued itself: it fills in the instructions, and skips it if it is no longer needed (the user sent a message or the session already compacted). The user's own and native compactions run unchanged, and the result is never rewritten.
26
27
 
27
28
  ## Use
28
29
 
@@ -27,7 +27,7 @@ export const EMPTY_LEDGER: Ledger = Object.freeze({
27
27
  notes: Object.freeze({ decisions: [] }),
28
28
  }) as Ledger
29
29
 
30
- /** 笔记文本的开头,适配层据此认出上一次放入的笔记并替换。 */
30
+ /** 笔记文本的开头,让模型认出这是插件写的笔记,不是用户的话。 */
31
31
  export const LEDGER_MARKER = '[SmartCompact progress ledger]'
32
32
 
33
33
  /**
@@ -38,7 +38,7 @@ export const COMPACT_INSTRUCTIONS =
38
38
  'Preserve the current goal, decisions and their reasons, unfinished work, failed attempts, and exact file paths. ' +
39
39
  'Also keep every specific fact the user stated, verbatim, even if the current work does not need it: ' +
40
40
  'names of people and customers, dates and time windows, ticket or ID numbers, and constraints. ' +
41
- 'A SmartCompact progress ledger is attached after the summary; do not restate it.'
41
+ 'A SmartCompact progress ledger is attached after compaction; do not restate it.'
42
42
 
43
43
  const MAX_FILES = 30
44
44
  const MAX_DECISIONS = 30
@@ -216,7 +216,3 @@ function layoutLedger({ facts, notes }: Ledger, { requirements, decisions, files
216
216
  section('Files changed', [omitted(facts.filesChanged.length - files.length, 'files'), ...files.map(file => `- ${file}`)])
217
217
  return lines.join('\n')
218
218
  }
219
-
220
- export function isLedgerText(value: string): boolean {
221
- return value.startsWith(LEDGER_MARKER)
222
- }