claude-token-saver 2.10.0 → 2.10.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/harness.js +7 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-token-saver",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "Save tokens on Claude Code — spike diagnosis, 1M-context detection, TTL countdown, statusline. (formerly claude-cache-monitor)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/harness.js CHANGED
@@ -125,15 +125,17 @@ export function harnessInit({ root = findProjectRoot(), force = false } = {}) {
125
125
  writeFileSync(cmPath, next);
126
126
  result.wrote.push(cmPath + ' (block updated in place)');
127
127
  } else {
128
- // Backup, then overwrite with the harness block. User-confirmed design:
129
- // single CLAUDE.md, backup-then-overwrite (not append) so a clean reset
130
- // is always one command away.
128
+ // Backup as safety net, then APPEND the harness block to existing
129
+ // content (do not clobber). Users keep all their prior CLAUDE.md content;
130
+ // the harness block is added at the end and managed in-place on re-runs
131
+ // via the BEGIN/END markers.
131
132
  const stamp = new Date().toISOString().replace(/[:.]/g, '').slice(0, 15); // YYYYMMDDTHHMMSS
132
133
  const bak = `${cmPath}.bak-${stamp}`;
133
134
  writeFileSync(bak, existing);
134
- writeFileSync(cmPath, block);
135
+ const sep = existing.endsWith('\n') ? '\n' : '\n\n';
136
+ writeFileSync(cmPath, existing + sep + block);
135
137
  result.backedUp.push(bak);
136
- result.wrote.push(cmPath);
138
+ result.wrote.push(cmPath + ' (harness block appended)');
137
139
  }
138
140
  } else {
139
141
  writeFileSync(cmPath, block);