opencode-claude-memory 1.3.1 → 1.4.0

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/README.md CHANGED
@@ -110,6 +110,7 @@ The shell hook defines an `opencode()` function that delegates to `opencode-memo
110
110
  6. It evaluates the auto-dream gate (default: at least 24h since last consolidation and 5 touched sessions)
111
111
  7. If the gate passes, it runs a background consolidation pass to merge/prune memories
112
112
  8. Maintenance runs **in the background** unless `OPENCODE_MEMORY_FOREGROUND=1`
113
+ 9. Terminal maintenance logs are shown in foreground mode by default, or can be forced on/off with `OPENCODE_MEMORY_TERMINAL_LOG=1|0`
113
114
 
114
115
  ### Compatibility details
115
116
 
@@ -156,6 +157,7 @@ Yes. Set `OPENCODE_MEMORY_AUTODREAM=0`. You can also tune gates with:
156
157
 
157
158
  - `OPENCODE_MEMORY_EXTRACT` (default `1`): set `0` to disable automatic memory extraction
158
159
  - `OPENCODE_MEMORY_FOREGROUND` (default `0`): set `1` to run maintenance in foreground
160
+ - `OPENCODE_MEMORY_TERMINAL_LOG` (default `foreground-only`): set `1` to force terminal logs on, `0` to force them off
159
161
  - `OPENCODE_MEMORY_MODEL`: override model used for extraction
160
162
  - `OPENCODE_MEMORY_AGENT`: override agent used for extraction
161
163
  - `OPENCODE_MEMORY_AUTODREAM` (default `1`): set `0` to disable auto-dream consolidation
@@ -170,6 +172,8 @@ Logs are written to `$TMPDIR/opencode-memory-logs/`:
170
172
  - `extract-*.log`: automatic memory extraction
171
173
  - `dream-*.log`: auto-dream consolidation
172
174
 
175
+ By default, terminal log lines are only printed when maintenance runs in foreground (`OPENCODE_MEMORY_FOREGROUND=1`). Background runs stay quiet unless you explicitly set `OPENCODE_MEMORY_TERMINAL_LOG=1`.
176
+
173
177
  ### Concurrency safety
174
178
 
175
179
  Lock files prevent concurrent extraction/consolidation runs per project root. Stale locks are cleaned up automatically.
@@ -26,6 +26,7 @@
26
26
  # Environment variables:
27
27
  # OPENCODE_MEMORY_EXTRACT=0 — Disable post-session extraction
28
28
  # OPENCODE_MEMORY_FOREGROUND=1 — Run maintenance in foreground (debug)
29
+ # OPENCODE_MEMORY_TERMINAL_LOG=1|0 — Force-enable/disable terminal logs (default: foreground only)
29
30
  # OPENCODE_MEMORY_MODEL=... — Extraction model override
30
31
  # OPENCODE_MEMORY_AGENT=... — Extraction agent override
31
32
  # OPENCODE_MEMORY_AUTODREAM=0 — Disable auto-dream consolidation
@@ -164,6 +165,7 @@ REAL_OPENCODE="$(find_real_opencode)"
164
165
 
165
166
  EXTRACT_ENABLED="${OPENCODE_MEMORY_EXTRACT:-1}"
166
167
  FOREGROUND="${OPENCODE_MEMORY_FOREGROUND:-0}"
168
+ LOG_ENABLED="${OPENCODE_MEMORY_TERMINAL_LOG:-}"
167
169
  EXTRACT_MODEL="${OPENCODE_MEMORY_MODEL:-}"
168
170
  EXTRACT_AGENT="${OPENCODE_MEMORY_AGENT:-}"
169
171
 
@@ -295,7 +297,17 @@ EOF
295
297
  # Helper Functions
296
298
  # ============================================================================
297
299
 
300
+ should_log() {
301
+ if [ -n "$LOG_ENABLED" ]; then
302
+ [ "$LOG_ENABLED" = "1" ]
303
+ return $?
304
+ fi
305
+
306
+ [ "$FOREGROUND" = "1" ]
307
+ }
308
+
298
309
  log() {
310
+ should_log || return 0
299
311
  echo "[opencode-memory] $*" >&2
300
312
  }
301
313
 
@@ -303,6 +315,15 @@ is_positive_int() {
303
315
  [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -gt 0 ]
304
316
  }
305
317
 
318
+ is_bool_flag() {
319
+ [ "$1" = "0" ] || [ "$1" = "1" ]
320
+ }
321
+
322
+ if [ -n "$LOG_ENABLED" ] && ! is_bool_flag "$LOG_ENABLED"; then
323
+ echo "[opencode-memory] Invalid OPENCODE_MEMORY_TERMINAL_LOG=$LOG_ENABLED, expected 0 or 1; defaulting to foreground-only logging" >&2
324
+ LOG_ENABLED=""
325
+ fi
326
+
306
327
  if ! is_positive_int "$AUTODREAM_MIN_HOURS"; then
307
328
  log "Invalid OPENCODE_MEMORY_AUTODREAM_MIN_HOURS=$AUTODREAM_MIN_HOURS, using default 24"
308
329
  AUTODREAM_MIN_HOURS=24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-claude-memory",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "description": "Claude Code-compatible memory compatibility layer for OpenCode — zero config, local-first, no migration",
6
6
  "main": "src/index.ts",