wogiflow 1.0.37 → 1.0.38

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.
@@ -49,6 +49,17 @@ When compacting, the system automatically:
49
49
  2. Stores summaries at multiple levels (root → sections → details)
50
50
  3. Applies relevance decay to older items
51
51
  4. Enables on-demand expansion when details are needed later
52
+ 5. **Cleans up completed plan files** from `.claude/plans/`
53
+
54
+ ### Plan File Cleanup
55
+
56
+ Compaction automatically cleans up plan files that appear to be complete:
57
+ - Plans with "Complete" in the title
58
+ - Plans containing "can be deleted"
59
+ - Plans with "all completed"
60
+ - Very short/empty plan files
61
+
62
+ This prevents stale plan files from accumulating and being shown after context restoration.
52
63
 
53
64
  ## Format for Context Summary
54
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wogiflow",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "AI-powered development workflow management system with multi-model support",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -92,6 +92,65 @@ function checkPressure() {
92
92
  return expander.checkContextPressure();
93
93
  }
94
94
 
95
+ /**
96
+ * Clean up completed plan files from .claude/plans/
97
+ * Plan files that are marked complete or empty are archived or deleted
98
+ * @returns {Object} Cleanup result
99
+ */
100
+ function cleanupPlanFiles() {
101
+ const fs = require('fs');
102
+ const path = require('path');
103
+ const os = require('os');
104
+
105
+ const result = { cleaned: 0, archived: 0, files: [] };
106
+
107
+ // Get user's home directory and .claude/plans path
108
+ const homeDir = os.homedir();
109
+ const plansDir = path.join(homeDir, '.claude', 'plans');
110
+
111
+ if (!fs.existsSync(plansDir)) {
112
+ return result;
113
+ }
114
+
115
+ try {
116
+ const files = fs.readdirSync(plansDir);
117
+
118
+ for (const file of files) {
119
+ if (!file.endsWith('.md')) continue;
120
+
121
+ const filePath = path.join(plansDir, file);
122
+ let content;
123
+
124
+ try {
125
+ content = fs.readFileSync(filePath, 'utf-8');
126
+ } catch (err) {
127
+ continue; // Skip files we can't read
128
+ }
129
+
130
+ // Check if plan appears to be complete
131
+ const isComplete =
132
+ /^#\s*Plan:\s*Complete/im.test(content) ||
133
+ /can be deleted/i.test(content) ||
134
+ /all.*completed/i.test(content) ||
135
+ content.trim().length < 100; // Very short/empty plans
136
+
137
+ if (isComplete) {
138
+ try {
139
+ fs.unlinkSync(filePath);
140
+ result.cleaned++;
141
+ result.files.push(file);
142
+ } catch (err) {
143
+ // Couldn't delete - that's okay
144
+ }
145
+ }
146
+ }
147
+ } catch (err) {
148
+ // Error reading plans directory - non-critical
149
+ }
150
+
151
+ return result;
152
+ }
153
+
95
154
  /**
96
155
  * Compact the context (collapse all expansions, optionally prune tree)
97
156
  * @param {Object} options - Compaction options
@@ -100,6 +159,9 @@ function checkPressure() {
100
159
  function compact(options = {}) {
101
160
  const { pruneOldNodes = false, maxAge = 7 } = options;
102
161
 
162
+ // Clean up completed plan files
163
+ const planCleanup = cleanupPlanFiles();
164
+
103
165
  // Collapse all expansions
104
166
  const collapseResult = expander.collapseAll();
105
167
 
@@ -140,6 +202,7 @@ function compact(options = {}) {
140
202
  return {
141
203
  collapsed: collapseResult.count,
142
204
  pruned: pruneResult.pruned,
205
+ plansCleaned: planCleanup.cleaned,
143
206
  pressure: checkPressure()
144
207
  };
145
208
  }
@@ -218,6 +281,7 @@ module.exports = {
218
281
  getStats,
219
282
  clearAll,
220
283
  getSerializedTree,
284
+ cleanupPlanFiles,
221
285
 
222
286
  // Low-level modules
223
287
  summaryTree,