@aiwayds/dsh-topics-memory 0.24.0 → 0.24.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.
package/lib/service.js CHANGED
@@ -307,10 +307,10 @@ export class TopicsService {
307
307
  let lines = [];
308
308
  try {
309
309
  const st = statSync(file);
310
- if (st.size > 512 * 1024) {
311
- const all = readFileSync(file, 'utf8').split('\n').filter((l) => l !== '');
312
- lines = all.slice(Math.floor(all.length / 4));
313
- }
310
+ const all = readFileSync(file, 'utf8').split('\n').filter((l) => l !== '');
311
+ // Append, never clobber: existing lines are always carried forward;
312
+ // compaction (keep newest 3/4) only bites past the 512KB cap.
313
+ lines = st.size > 512 * 1024 ? all.slice(Math.floor(all.length / 4)) : all;
314
314
  }
315
315
  catch { /* first write */ }
316
316
  lines.push(JSON.stringify(entry));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-topics-memory",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "dsh-plugin: quality-first topic memory for dsh — a topic keeps the starting question, conclusion, impact and dependencies, not the process; local-first git-traced OKF bundle, budgeted LLM-free injection",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
package/src/service.ts CHANGED
@@ -393,10 +393,10 @@ export class TopicsService {
393
393
  let lines: string[] = []
394
394
  try {
395
395
  const st = statSync(file)
396
- if (st.size > 512 * 1024) {
397
- const all = readFileSync(file, 'utf8').split('\n').filter((l) => l !== '')
398
- lines = all.slice(Math.floor(all.length / 4))
399
- }
396
+ const all = readFileSync(file, 'utf8').split('\n').filter((l) => l !== '')
397
+ // Append, never clobber: existing lines are always carried forward;
398
+ // compaction (keep newest 3/4) only bites past the 512KB cap.
399
+ lines = st.size > 512 * 1024 ? all.slice(Math.floor(all.length / 4)) : all
400
400
  } catch { /* first write */ }
401
401
  lines.push(JSON.stringify(entry))
402
402
  writeFileSync(file, lines.join('\n') + '\n')