Commit Graph

1887 Commits

Author SHA1 Message Date
Alex Newman d17b372b60 chore(release): bump claude-mem to 13.0.0
Major version bump following PR #2351 merge — server-beta runtime,
Postgres observation storage, BullMQ queue engine, and Apache 2.0
relicense are now on main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 01:21:19 -07:00
Alex Newman 36b0929fae Server-beta: Postgres storage + independent runtime + BullMQ queue (Phases 1–3) (#2351)
* Add server beta runtime foundation

* Address server beta review findings

* Resolve server beta review comments

* Tighten server beta review follow-ups

* Harden server beta auth and search

* Avoid unnecessary FTS rebuilds

* Block scoped keys from creating projects

* Release BullMQ claims best effort on close

* Address server beta review blockers

* Reset BullMQ claims best effort

* Add Postgres observation storage foundation

* feat(server-beta): add independent runtime service

Introduce src/server/runtime/ as a self-contained server-beta runtime
that owns its lifecycle, Postgres bootstrap, and HTTP boundary without
depending on WorkerService.

ServerBetaService wraps the existing Server class, exposes
/healthz and /v1/info with runtime="server-beta", and persists state
to dedicated paths (.server-beta.pid|.port|.runtime.json). The four
boundary managers (queue, generation worker, provider registry, event
broadcaster) are intentionally disabled in this phase and report their
status through /v1/info; later phases activate them.

Adds plans/2026-05-07-finish-bullmq-branch-ship-plan.md to track the
remaining work for this branch.

Phase 2 of plans/2026-05-07-server-beta-independent-bullmq-observation-runtime.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(server-beta): route CLI lifecycle and bundle separate runtime

scripts/build-hooks.js now produces plugin/scripts/server-beta-service.cjs
as a separate Node CJS bundle, alongside the existing worker-service
bundle. The server-beta runtime is now installable independently.

src/npx-cli/commands/server.ts routes start|stop|restart|status to the
server-beta lifecycle instead of the legacy worker. The worker keeps its
own start|stop|restart|status under the worker namespace; the two
runtimes can be operated independently.

src/services/worker-service.ts adds a server-* command parser branch
that delegates to the sibling server-beta-service.cjs bundle so
direct worker-service invocations still route to the right runtime.

tests/npx-cli-server-namespace.test.ts updated to expect server-beta
lifecycle routing.

Includes rebuilt plugin/scripts/*.cjs bundles produced by
build-and-sync.

Phase 2 of plans/2026-05-07-server-beta-independent-bullmq-observation-runtime.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(server-beta): add BullMQ job queue primitives

Introduce src/server/jobs/ as the queue-side primitives that Phase 3 of
the server-beta runtime needs to operate.

types.ts defines a discriminated union over the four job kinds (event,
event-batch, summary, reindex) and maps each to a per-kind BullMQ queue
name and deterministic-ID prefix.

job-id.ts builds deterministic, colon-free BullMQ jobIds from
(kind, team, project, source). The colon ban exists because BullMQ uses
':' as a Redis key separator internally; embedding ':' in jobIds
breaks scan and state lookups.

ServerJobQueue.ts is a thin wrapper over BullMQ Queue + Worker that
enforces autorun:false, default concurrency 1, and an attached error
listener — all per BullMQ docs requirements. Test seams accept queue
and worker factories so unit tests do not need Redis.

outbox.ts publishes through the Postgres ObservationGenerationJob
repository as canonical history. enqueueOutbox writes the row first,
then publishes to BullMQ; if BullMQ throws, the row is transitioned to
failed and a failed event is appended. reconcileOnStartup re-enqueues
queued + processing rows after a restart, replacing terminal BullMQ
jobs that may still be holding the deterministic ID slot. markCompleted
and markFailed wrap transitionStatus and append the matching event row.

Includes 20 unit tests covering deterministic ID stability, colon-free
output, queue lifecycle, error-listener attachment, double-start
refusal, idempotent enqueue, BullMQ failure rollback, startup
reconciliation, max-attempts skipping, and completion / failure /
retry transitions.

Phase 3 commit 1 of plans/2026-05-07-server-beta-independent-bullmq-observation-runtime.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(server-beta): activate queue boundary in runtime service

Wire ActiveServerBetaQueueManager into the server-beta runtime graph.
The active manager owns one ServerJobQueue per generation kind (event,
event-batch, summary, reindex) and surfaces lane metadata through
boundary health.

Selection is opt-in and fail-fast: if CLAUDE_MEM_QUEUE_ENGINE is set to
bullmq the active manager is constructed (and any Redis/config error
throws — no silent fallback to SQLite, per Phase 3 anti-pattern guard).
For any other engine the disabled boundary remains so worker-era and
test setups stay compatible.

Widens ServerBetaBoundaryHealth.status to a discriminated union
('disabled' | 'active' | 'errored') with optional details. The disabled
adapter still emits status='disabled', which keeps the existing
server-beta-service test green.

ServerBetaService receives the manager through a new optional
queueManager field on CreateServerBetaServiceOptions so test graphs
and Phase 4 wiring can inject custom managers.

Adds tests/server/runtime/active-queue-manager.test.ts covering bullmq
guard, active health shape, per-kind queue access, close behavior, and
post-close errored health.

Phase 3 commit 2 of plans/2026-05-07-server-beta-independent-bullmq-observation-runtime.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(server-beta): cap /v1/events/batch at 500 events

Prevents unbounded array DoS surface flagged in PR review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 01:20:07 -07:00
Alex Newman 0a43ab7632 docs: update changelog for v12.7.5 2026-05-06 21:31:29 -07:00
Alex Newman e3cc382fa2 fix: reconcile Codex marketplace source conflicts 2026-05-06 21:29:40 -07:00
Alex Newman 97f1c52de0 docs: update changelog for v12.7.4 2026-05-06 19:40:59 -07:00
Alex Newman 7a9573759e chore: bump version to 12.7.4 2026-05-06 19:39:51 -07:00
Alex Newman b89b140aa1 Merge pull request #2342 from thedotmack/fix-and-ship-codex-mem-search-access
Fix Codex mem-search MCP startup
2026-05-06 19:12:40 -07:00
Alex Newman b6115db720 Merge remote-tracking branch 'origin/codex-mode-session-start-hook-migration' into fix-and-ship-codex-mem-search-access
# Conflicts:
#	plugin/scripts/worker-service.cjs
2026-05-06 19:11:41 -07:00
Alex Newman 2e3532127a Merge remote-tracking branch 'origin/codex-version-mismatch-investigation-plan' into fix-and-ship-codex-mem-search-access 2026-05-06 19:11:10 -07:00
Alex Newman 3a000b6bc6 Merge remote-tracking branch 'origin/main' into fix-and-ship-codex-mem-search-access
# Conflicts:
#	.mcp.json
#	plugin/.mcp.json
#	plugin/scripts/mcp-server.cjs
#	plugin/scripts/worker-service.cjs
#	tests/infrastructure/plugin-distribution.test.ts
2026-05-06 19:10:49 -07:00
Alex Newman a2872dabfa docs: plan Codex plugin version mismatch fix 2026-05-06 19:08:12 -07:00
Alex Newman 7af43146e4 docs: update changelog for v12.7.3 2026-05-06 18:32:44 -07:00
Alex Newman 02c7a3dfa9 chore: bump version to 12.7.3 2026-05-06 18:30:53 -07:00
Alex Newman 65f2fd8cdd fix: harden startup and schema repair contracts
Reliability patch covering startup path resolution, install marker compatibility, export CLI request contracts, schema repair safety, hard-stop retry-loop handling, and the PR babysit status helper.
2026-05-06 18:29:26 -07:00
Alex Newman 627c484791 chore: bump version to 12.7.3 2026-05-06 14:41:15 -07:00
Alex Newman 8d65b95a59 fix: narrow legacy codex context cleanup 2026-05-06 14:39:42 -07:00
Alex Newman a64d60b9cb fix: address codex migration review feedback 2026-05-06 14:32:03 -07:00
Alex Newman 37d186e767 test: guard MCP launcher fallback distribution 2026-05-06 14:29:49 -07:00
Alex Newman 156062170d fix: migrate codex context off agents injection 2026-05-06 14:24:40 -07:00
Alex Newman c80225147f chore: bump version to 12.7.3 2026-05-06 14:23:37 -07:00
Alex Newman 938c608507 fix(codex): make mem-search MCP startup self-locating 2026-05-06 14:20:55 -07:00
Alex Newman bb3dbfdb5a docs(skill): document discord notify working directory 2026-05-06 12:11:27 -07:00
Alex Newman 4db99da432 docs: update changelog for 12.7.2 2026-05-06 03:35:09 -07:00
Alex Newman 20e98d8361 chore: bump version to 12.7.2 2026-05-06 03:34:22 -07:00
Alex Newman 65607897a8 fix(install): disable Claude Code auto-memory on every claude-code install
Disable Claude Code auto-memory during claude-code installs and harden atomic settings writes, including symlink and dangling-symlink destinations.
2026-05-06 03:32:40 -07:00
Alex Newman d31c4d2a57 docs: fix outdated references in CLAUDE.md (#2304)
- Correct hook lifecycle list: 6 hooks (Setup, SessionStart,
  UserPromptSubmit, PreToolUse, PostToolUse, Stop), not the
  fictional 'Summary' / 'SessionEnd' pair.
- Replace misleading 'src/hooks/*.ts' description with the actual
  build path from src/services/worker-service.ts via
  scripts/build-hooks.js, and list the real subcommands.
- Drop the broken link to private/context/claude-code/exit-codes.md
  (path no longer exists in the repo).
2026-05-06 03:20:15 -07:00
Alex Newman 1eaed3141f docs: update changelog for 12.7.1 2026-05-06 03:07:39 -07:00
Alex Newman 6198762f1e chore: bump version to 12.7.1 2026-05-06 03:06:20 -07:00
Alex Newman 9f2ce1754c Add babysit PR monitoring skill
Add a babysit skill for monitoring PR checks, review comments, and review threads until a PR is merge-ready.
2026-05-06 03:04:40 -07:00
Alex Newman 9e4e30a01d docs: update changelog for 12.7.0 2026-05-06 01:59:32 -07:00
Alex Newman 1667eac0be chore: bump version to 12.7.0 2026-05-06 01:57:45 -07:00
Alex Newman 56db06811e Add native Codex hooks integration (#2319)
* Add native Codex hooks integration

* Address Codex review feedback

* Use durable Codex marketplace root

* Address Codex file context review feedback

* Harden Codex installer review paths

* Report Codex legacy cleanup failures

* fix: keep MCP manifests in marketplace sync

* fix: bundle zod in MCP server

* fix: warn on Codex legacy cleanup failure

* Fix hook observation readiness timeouts

* Address Codex hook review notes

* Tighten Codex MCP file context matching

* Resolve final Codex review nits

* Add Codex marketplace version guidance

* Reset worker failure counter on API fallback

* Fix Codex cat flag file extraction
2026-05-06 01:55:27 -07:00
Alex Newman a5bb6b346a docs: document LiteLLM gateway routing 2026-05-05 15:08:09 -07:00
Alex Newman 09dcecafd0 chore: bump version to 12.6.5 2026-05-05 14:48:24 -07:00
Alex Newman b414f57edb Merge pull request #2302 from thedotmack/codex/remove-agent-pool-timeout
[codex] Remove agent pool timeout data loss
2026-05-05 14:46:28 -07:00
Alex Newman 46b59573b5 Merge remote-tracking branch 'origin/main' into codex/remove-agent-pool-timeout
# Conflicts:
#	plugin/scripts/mcp-server.cjs
#	plugin/scripts/worker-service.cjs
2026-05-05 14:45:57 -07:00
Alex Newman 89718f79b0 chore: bump version to 12.6.4 2026-05-05 14:34:55 -07:00
Alex Newman ce35bb520d chore: sync plugin artifacts for 12.6.3 2026-05-05 13:07:36 -07:00
Alex Newman 519fbe5daa 12.6.3 2026-05-05 13:05:38 -07:00
Alex Newman 92f800d49c fix: drain invalid observer responses 2026-05-05 13:00:42 -07:00
Alex Newman 9a2818fc2e docs: regenerate CHANGELOG for v12.6.2 2026-05-04 22:36:10 -07:00
Alex Newman ec97813582 chore: bump version to 12.6.2 2026-05-04 21:48:43 -07:00
Alex Newman 1981f9b2fe fix(install): revert tree-sitter grammars to devDependencies (#2300 regression) (#2305)
PR #2300 moved 21 tree-sitter grammar packages from devDependencies into
root dependencies, claiming "their .wasm files are loaded at runtime by
parser.ts." That justification is wrong for the root claude-mem npm
package: parser.ts compiles into plugin/scripts/worker-service.cjs, which
runs from the marketplace folder where plugin/package.json already lists
every grammar as a runtime dep. Nothing in dist/npx-cli/ ever loads a
grammar, and resolveGrammarPath() handles missing packages gracefully.

The regression: `npx claude-mem@12.6.1 install` now fetches all 21
grammars at npx time. tree-sitter-swift's postinstall pulls a nested
tree-sitter-cli that downloads a Rust binary from GitHub and hangs the
install. npm ignores the trustedDependencies bun-allowlist, so there's
no way to skip the postinstall scripts on a bare `npx` fetch.

Fix: move grammar packages back to root devDependencies. The marketplace
plugin install (installPluginDependencies → bun install in plugin/) still
works because plugin/package.json keeps them as deps and Bun honors
trustedDependencies: ["tree-sitter-cli"] to skip the harmful postinstalls
on every other grammar.

Keep PR #2300's --legacy-peer-deps + --omit=dev install.ts changes —
those address a separate, valid marketplace ERESOLVE.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 21:47:27 -07:00
Alex Newman a122d34ebf fix: address Greptile P1 + CodeRabbit follow-ups (cycle 9)
- waitForSlot now accepts an optional AbortSignal. When the signal
  fires (e.g. session.abortController.abort() during shutdown or
  cancel), the queued waiter is removed from slotWaiters and the
  promise rejects immediately, instead of hanging until a slot
  naturally opens. Restores the cancellation guarantee that the
  removed 60s timeout used to provide. ClaudeProvider.startSession
  now passes session.abortController.signal at the call site.
- EnvManager: a bare ANTHROPIC_BASE_URL now also short-circuits the
  OAuth lookup. Tokenless gateways (allowed by the new install flow)
  were otherwise being authenticated against api.anthropic.com via the
  injected OS-keychain OAuth token.
- install.ts: resolveClaudeAuthMethod now reads the raw stored
  CLAUDE_MEM_CLAUDE_AUTH_METHOD value via a direct settings.json read
  (readRawStoredAuthMethod), bypassing SettingsDefaultsManager's
  default backfill. Without this, getSetting() always returned
  'subscription' for unmigrated installs and the env-based fallback
  never ran — so the previous fix only addressed the optics, not
  the actual misclassification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 21:07:42 -07:00
Alex Newman 5edf1557c4 fix: address Greptile P1 security + CodeRabbit follow-ups on PR #2302
- EnvManager: add ANTHROPIC_AUTH_TOKEN to BLOCKED_ENV_VARS so a token
  inherited from the parent shell can no longer short-circuit the OAuth
  lookup at SDK spawn time. Mirrors the ANTHROPIC_API_KEY treatment
  added in issue #733. Explicit gateway tokens in
  ~/.claude-mem/.env are still re-injected by buildIsolatedEnv().
- install.ts: extract resolveClaudeAuthMethod() that returns a stored
  CLAUDE_MEM_CLAUDE_AUTH_METHOD when present and otherwise infers
  the mode from ~/.claude-mem/.env (ANTHROPIC_BASE_URL → gateway,
  ANTHROPIC_API_KEY → api-key, else subscription). persistClaudeProvider,
  the interactive Claude auth flow, and promptClaudeModel now use it,
  so older installs that pre-date the setting are no longer
  misclassified as 'subscription' (which would clear working
  credentials and disable custom gateway models).
- configureDirectApiKey: when an Anthropic API key already exists,
  prompt to keep or rotate it instead of silently re-saving — restores
  the ability to update a revoked or rotated key from the installer
  without losing the cancel-safe behaviour added in 7f3686fd.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:59:11 -07:00
Alex Newman 7f3686fd2c fix: address CodeRabbit Major findings on install.ts
- Cancel of API-key / Gateway-URL prompts no longer wipes existing
  credentials by switching to subscription auth and emptying
  ANTHROPIC_API_KEY / ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN. Cancel
  now leaves the prior config untouched.
- Empty gateway-token input preserves the existing token instead of
  clearing it. The new prompt copy explains that blank keeps the
  current token.
- Interactive install no longer hard-locks to Claude when
  --provider is unset. Prompt now asks for provider
  (claude/gemini/openrouter) up front, then runs the Claude auth flow
  only when the user picks Claude.
- Claude auth-mode prompt now seeds initialValue from the stored
  CLAUDE_MEM_CLAUDE_AUTH_METHOD setting, so reruns honor existing
  configuration instead of always defaulting to subscription.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:51:00 -07:00
Alex Newman 0cc45c6e7f fix: drop duplicate notifySlotAvailable() in SDK child exit handler
CodeRabbit flagged a duplicate slot wakeup: spawnSdkProcess's child
'exit' handler called registry.unregister(recordId) and then
notifySlotAvailable() unconditionally. Registry.unregister() already
fires notifySlotAvailable() internally when removing an SDK entry, so
the trailing call woke a second waiter for the same freed slot — both
could see count < maxConcurrent in the same synchronous tick before
either replacement registered, transiently exceeding maxConcurrent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:47:08 -07:00
Alex Newman 4e49dcf445 fix: address Greptile P1 findings on PR #2302
- process-registry.ts: skip the trailing notifySlotAvailable() when
  pruneDeadEntries() removed entries — prune already wakes one waiter
  per removed SDK process, so the unconditional call double-woke and
  could let two waiters spawn in the same synchronous tick, briefly
  exceeding maxConcurrent. Only fire the safety-net notify when nothing
  was pruned.
- install.ts: persistClaudeProvider() no longer silently rewrites
  CLAUDE_MEM_CLAUDE_AUTH_METHOD to 'subscription'. When called without
  an explicit auth method, preserve the existing setting; only fall
  back to 'subscription' when none is configured. Prevents re-running
  'claude-mem install --provider claude' from wiping a user's
  configured 'api-key' or 'gateway' auth.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:43:00 -07:00
Alex Newman 53cdccdf7a docs: regenerate CHANGELOG for v12.6.1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:32:20 -07:00
Alex Newman 1a8432fe97 chore: bump version to 12.6.1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:29:31 -07:00