Commit Graph

172 Commits

Author SHA1 Message Date
lukaszraczylo b38ecee4da refactor(embedding): drop init(), build default registry eagerly
Replace the import-time init() that mutated the DefaultRegistry global with a constructor that returns a ready registry, removing mutate-after-init global state. Exported API unchanged.
2026-06-19 14:26:35 +01:00
lukaszraczylo 406b539c84 fix(db): check rows.Close error in observation store 2026-06-19 14:26:35 +01:00
lukaszraczylo a23b8c4936 fix(models): handle cleanup errors and add download tests
Explicitly discard best-effort cleanup errors (os.Remove/Close) to satisfy errcheck; add hermetic table-driven tests for checksum mismatch, version-bump cache invalidation, and retry exhaustion.
2026-06-19 14:26:35 +01:00
lukaszraczylo 98e9a2d59c build(lint): migrate golangci-lint config to v2 schema
Installed golangci-lint v2 rejected the v1 config (unsupported version), silently disabling the lint gate. Migrate to v2 (version, formatters section, linters.exclusions) preserving the same linter selection so the gate runs again.
2026-06-19 14:26:35 +01:00
lukaszraczylo af19b6a798 refactor: remove dead internal/chunking package
The chunking Manager had zero production callers (only its own tests). Removed the package and ran go mod tidy, dropping the now-orphaned go-tree-sitter dependency.
2026-06-19 14:26:34 +01:00
lukaszraczylo 11ee9a4f1f fix(update): fail-closed release signature verification
When a signature bundle is present, abort the self-update before replacing binaries if cosign verification fails or is unavailable, instead of logging a warning and proceeding. Prevents a malicious/MITM'd release from achieving binary replacement.
2026-06-19 14:26:34 +01:00
lukaszraczylo 70a6eb2e52 refactor(worker): lazy-init embedded static assets via sync.OnceValues
Remove package-level init() and globals; resolve the embedded sub-FS once on first use, preserving handler behavior.
2026-06-19 14:26:34 +01:00
lukaszraczylo 86ee0e28ed fix(worker): harden HTTP server (loopback bind, token auth, constant-time compare)
Bind 127.0.0.1 instead of all interfaces; wire the previously-unused TokenAuth middleware behind opt-in CLAUDE_MNEMONIC_AUTH_TOKEN (unset = unauthenticated, default-preserving); compare tokens with subtle.ConstantTimeCompare. Also drops the dead contextCache field/type (zero readers).
2026-06-19 14:26:34 +01:00
lukaszraczylo 1b5697b316 refactor(mcp): reduce exposed tools 42->4 via action dispatch
Collapse 9 search/timeline sugar tools into search/timeline and multiplex the obs-management and admin/analytics tools behind two action-dispatch tools (observation, memory_admin). Underlying HTTP-proxy handlers and callTool routing preserved; only the advertised tool surface shrinks, cutting per-session context cost. README + tools/list tests updated.
2026-06-19 14:26:33 +01:00
github-actions[bot] a8a8c532c4 chore: update marketplace for v0.14.17 2026-06-19 04:41:52 +00:00
lukaszraczylo e057f121eb Update go.mod and go.sum (#53) v0.14.17 2026-06-19 05:33:35 +01:00
github-actions[bot] 7d1998e975 chore: update marketplace for v0.14.13 2026-06-09 04:36:55 +00:00
lukaszraczylo af8e6f44cd Update go.mod and go.sum (#52) v0.14.13 2026-06-09 05:27:34 +01:00
github-actions[bot] cf4161d459 chore: update marketplace for v0.14.9 2026-06-06 04:33:01 +00:00
lukaszraczylo 910aabda22 Update go.mod and go.sum (#51) v0.14.9 2026-06-06 05:25:16 +01:00
github-actions[bot] 6115ea8a44 chore: update marketplace for v0.14.5 2026-06-05 04:39:49 +00:00
lukaszraczylo 93446d1437 Update go.mod and go.sum (#50) v0.14.5 2026-06-05 05:32:20 +01:00
github-actions[bot] 1d1807da9e chore: update marketplace for v0.14.1 2026-06-01 22:48:13 +00:00
lukaszraczylo 7bdb523106 fix(ci): sync ui/package.json.tpl with upgraded frontend deps
GoReleaser (.goreleaser.yaml before-hook) and the Makefile regenerate
ui/package.json from ui/package.json.tpl at build time, then run npm ci.
The deps upgrade updated ui/package.json and the lockfile but not the
template, so the release hook regenerated package.json with the old deps
and npm ci failed against the new lockfile. Sync the template to the
upgraded versions (Vite 8, Tailwind 4, vis-network 10, FontAwesome 7,
TypeScript 6, ...). Verified by replaying the hook locally: regenerate
from the template then npm ci + build both pass.
v0.14.1
2026-06-01 23:41:32 +01:00
lukaszraczylo abd34c9629 fix(ci): resolve @fortawesome/fontawesome-free from public npm registry
The frontend deps bump regenerated ui/package-lock.json with the
@fortawesome/fontawesome-free tarball resolved from npm.fontawesome.com
(per the developer's scoped ~/.npmrc), which requires auth. CI has no
FontAwesome token, so `npm ci` failed with E401.

The free package is also published to the public registry with an
identical tarball/integrity, so pin @fortawesome to registry.npmjs.org
via ui/.npmrc and repoint the lockfile. Verified `npm ci` + build now
succeed with no token.
2026-06-01 16:48:19 +01:00
lukaszraczylo 5fe25e9328 chore: upgrade ui and docs frontend dependencies to latest
ui: Vite 8, vue-tsc 3, TypeScript 6, @vitejs/plugin-vue 6, vis-network 10,
vis-data 8, FontAwesome 7, @types/node 25. docs: Vite 8, plugin-vue 6.
Both migrated to Tailwind CSS v4.

- Tailwind v3 -> v4: @import "tailwindcss" with @theme/@config, switch to
  @tailwindcss/postcss, drop autoprefixer (bundled via Lightning CSS).
- docs: move theme into @theme, delete tailwind.config.js, remove stale
  pnpm-lock.yaml (npm/package-lock.json is authoritative).
- ui: TypeScript 6 removes deprecated tsconfig baseUrl; no code changes
  needed for vis-network 10 / FontAwesome 7.
- Bump CI Node 20 -> 22 (Vite 8 requires Node ^20.19 || >=22.12).

0 npm audit vulnerabilities; ui type-check and both production builds pass.
2026-06-01 16:40:27 +01:00
lukaszraczylo b7b82ce22f fix: bound SQLite WAL growth and prevent worker hangs (#49)
The worker's SQLite WAL could grow unbounded (observed 19MB) and wedge the
DB, hanging Claude Code on every prompt. No checkpoint ever truncated the
WAL (only PASSIVE auto-checkpoint, which cannot reclaim the file), the
connection-scoped pragmas were set via a single Exec so only one pooled
connection received them (e.g. busy_timeout=0 on the rest), and the
maintenance service that would optimize/checkpoint was never wired up.

- Register a sqlite3 ConnectHook driver so all pragmas (busy_timeout,
  journal_mode, synchronous, cache_size, foreign_keys, journal_size_limit)
  apply to every pooled connection; enable safe connection recycling.
- Add Store.Checkpoint (TRUNCATE), checkpoint-on-Close, and a periodic
  size-gated checkpoint loop with configurable interval/threshold.
- Wire up the previously-dead maintenance service; make trigger_maintenance
  actually run DB maintenance instead of only recalculating scores.
- Harden the user-prompt hook to honor its deadline and fail open so a
  slow worker can never stall a prompt.
- Add regression tests for WAL truncation, checkpoint-on-close, and
  per-connection pragmas.
2026-06-01 16:40:27 +01:00
github-actions[bot] f78370a531 chore: update marketplace for v0.13.17 2026-05-31 04:41:38 +00:00
lukaszraczylo 5f89559842 Update go.mod and go.sum (#48) v0.13.17 2026-05-31 05:33:00 +01:00
github-actions[bot] 794eacf02a chore: update marketplace for v0.13.13 2026-05-30 04:32:51 +00:00
lukaszraczylo 6fc752abb1 Update go.mod and go.sum (#47) v0.13.13 2026-05-30 05:24:21 +01:00
github-actions[bot] 9ce29ac7b1 chore: update marketplace for v0.13.9 2026-05-27 04:40:51 +00:00
lukaszraczylo a0d0e856f5 Update go.mod and go.sum (#46) v0.13.9 2026-05-27 05:32:37 +01:00
lukaszraczylo 549fefc675 deslopify docs website 2026-05-26 19:22:47 +01:00
github-actions[bot] c5967c3eaa chore: update marketplace for v0.13.3 2026-05-26 17:56:36 +00:00
lukaszraczylo dbe89f37c8 fix: remove duplicate else block in workflow-prepare.sh v0.13.3 2026-05-26 18:51:02 +01:00
lukaszraczylo 1a4fea5c17 refactor: replace Git LFS with runtime model download from Hugging Face
Remove ~170MB of model files from the repository (LFS + committed).
Models are now downloaded at runtime from Hugging Face on first use
and cached to the OS cache directory with progress reporting and retries.

- Add internal/models/download.go: runtime downloader with retry, progress bar, checksums
- Remove go:embed for ONNX models (keep tokenizers embedded)
- Use file-based ONNX session loading instead of byte-slice
- Add scripts/download-models.sh for dev/CI model setup
- Update Makefile with setup-models target
- Update workflow-prepare.sh to download models in CI
- Set lfs: false in all CI workflows
- SHA256: bge=828e14..., cross-encoder=5d3e70...
2026-05-26 17:53:30 +01:00
github-actions[bot] c8b462aaec chore: update marketplace for v0.12.21 2026-05-26 13:53:19 +00:00
lukaszraczylo a5b18140d3 fix: use build tags for Setpgid (Unix-only) to fix Windows build v0.12.21 2026-05-26 14:46:36 +01:00
lukaszraczylo a81482d06a fix: address 15 additional hang vectors found during deep audit (#45)
MCP server (5 fixes):
- Move semaphore acquisition inside goroutine so main loop stays
  responsive when all slots are taken
- Add 10s write timeout to sendResponse to prevent pipe deadlock
  when Claude Code pauses reading stdout
- Send fallback JSON-RPC error when json.Marshal fails instead of
  silently swallowing the error and leaving caller waiting forever
- Silence unknown notification methods (req.ID == nil) instead of
  sending unsolicited error responses that may desync the host
- Return MCP isError content for tool failures instead of top-level
  JSON-RPC error, matching the MCP specification

Vector/embedding (3 fixes):
- Move EmbedBatchWithContext call before writeMu.Lock in AddDocuments
  so ONNX inference runs outside the write lock
- Replace singleflight.Do with DoChan + ctx select in both
  getOrComputeEmbedding and UnifiedSearch so callers can bail out
  independently when their context expires
- Add activeQueries atomic counter; skip cache warming when user
  queries are in-flight; reduce warming timeout from 5s to 2s

Hooks (4 fixes):
- Cap EnsureWorkerRunning to 15s hard deadline with context; reduce
  StartupTimeout from 30s to 10s; reduce port-in-use retries
- Fix nil dereference panic in user-prompt hook when initResult is
  nil (non-JSON worker response); use comma-ok assertions
- Use package-level hookClient/healthClient with DisableKeepAlives
  to prevent FD leaks in short-lived hook processes
- Set SysProcAttr{Setpgid: true} to detach worker from hook process
  group, preventing kill-cascade from Claude Code

Worker/DB (3 fixes):
- Replace os.Exit(0) in MCP config watcher with context cancellation
  for clean protocol shutdown
- Add 60s context.WithTimeout around ProcessObservation calls in
  processAllSessions to prevent hung CLI subprocesses from blocking
  the queue processor forever
- Set explicit PRAGMA wal_autocheckpoint=1000 and add PASSIVE WAL
  checkpoint to Optimize() to prevent checkpoint stalls

Adds 20+ regression tests across all fix areas.
2026-05-26 14:29:34 +01:00
lukaszraczylo de5796bbe6 test: add regression tests for #45 hang fixes
- MCP server: 4 tests verifying concurrent dispatch, slow-request
  isolation, semaphore limiting, and graceful drain on cancel
- Embedding: 4 tests verifying context-aware mutex cancellation,
  uncontended success, batch cancellation, and cleanup after cancel
- Vector client: 3 tests for acquireRLockWithContext cancel, success,
  and cleanup goroutine correctness
- Worker handlers: 1 test verifying handleSearchByPrompt inherits
  request context cancellation (skips without FTS5)

12 regression tests total covering the four fix areas.
2026-05-26 14:29:34 +01:00
lukaszraczylo 29d57857ff fix: prevent MCP server hanging by adding concurrency, timeouts, and context propagation (#45)
Root cause: synchronous MCP request processing combined with missing
context propagation to the embedding layer caused indefinite hangs when
ONNX inference was slow or the database was contended.

Changes:
- MCP server: dispatch each request in its own goroutine with semaphore
  (cap 10) and WaitGroup for clean shutdown drain
- Embedding: add context-aware mutex acquisition (acquireMutex) so
  callers can bail out instead of blocking forever on a stuck ONNX model
- Vector client: propagate context through getOrComputeEmbedding and
  replace bare RLock() calls with context-aware acquireRLockWithContext
- Worker handlers: add 15s request-scoped timeouts to all search/context
  handlers (handleSearchByPrompt, handleContextInject, handleFileContext,
  handleContextCount, handleGetObservations/Summaries/Prompts)
- Worker HTTP server: set WriteTimeout=60s (was 0); SSE endpoint extends
  deadline per-request via http.ResponseController

Fixes #45
2026-05-26 14:29:34 +01:00
github-actions[bot] 56616d0616 chore: update marketplace for v0.12.11 2026-05-24 04:39:28 +00:00
lukaszraczylo 90803a4885 Update go.mod and go.sum (#44) v0.12.11 2026-05-24 05:30:05 +01:00
github-actions[bot] e2dd736e38 chore: update marketplace for v0.12.3 2026-05-24 02:13:16 +00:00
github-actions[bot] a9677881df chore: update marketplace for v0.12.1 2026-05-24 02:11:59 +00:00
github-actions[bot] 620d538f23 chore: update marketplace for v0.11.118 2026-05-24 02:07:29 +00:00
lukaszraczylo a59b9b1622 chore: remove hand-rolled telemetry pkg; ignore build binaries
- delete internal/telemetry (replaced by oss-telemetry library in prev commit)
- gitignore root /mcp and /worker build artifacts
v0.12.3
2026-05-24 03:03:57 +01:00
lukaszraczylo 00d8871f5e refactor: use oss-telemetry library instead of hand-rolled ping v0.12.1 2026-05-24 03:02:16 +01:00
lukaszraczylo 28b6582dac feat: add OSS analytics ping on MCP server startup v0.11.118 2026-05-24 03:01:15 +01:00
github-actions[bot] dc010fe57d chore: update marketplace for v0.11.113 2026-05-24 01:10:04 +00:00
github-actions[bot] 7e1f6efe3c chore: update marketplace for v0.11.109 2026-05-24 01:05:29 +00:00
lukaszraczylo eab3b58e0f fix: data race in maintenance totalOptimizeRun counter v0.11.113 2026-05-24 02:04:53 +01:00
lukaszraczylo 720a14cd65 chore: fix npm audit vulnerabilities (rollup, vite, uuid, postcss) 2026-05-24 01:58:20 +01:00
lukaszraczylo f07875ee82 fix: plugin no longer vanishes after Claude Code updates
Root cause: plugin registered as directory source in known_marketplaces.json,
which gets wiped on CLI updates. Now registers in extraKnownMarketplaces
(settings.json) as a GitHub source — same mechanism caveman/context-mode use.

Binaries install to ~/.claude-mnemonic/bin/ instead of the Claude-managed
plugins directory. Thin wrapper scripts in the repo let the marketplace
clone find them. Nothing gets cleaned up when Claude refreshes its cache.

Also fixed along the way:
- ONNX Runtime 1.24.3 → 1.26.0 (API v25 mismatch broke all embedding tests)
- Vector client leaked on DB reinit, processQueue had a race on sessionManager
- reloadConfig called os.Exit(0) bypassing graceful shutdown
- Removed dead QueryRowWithTimeout that leaked contexts
- Added tests for graph/watcher/maintenance/update (all were at 0%)
v0.11.109
2026-05-24 01:56:54 +01:00