Files
claude-mem/docs/i18n/README.th.md
T
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

19 KiB

🌐 นี่คือการแปลอัตโนมัติ ยินดีต้อนรับการแก้ไขจากชุมชน!


Claude-Mem

🇨🇳 中文🇹🇼 繁體中文🇯🇵 日本語🇧🇷 Português🇰🇷 한국어🇪🇸 Español🇩🇪 Deutsch🇫🇷 Français 🇮🇱 עברית🇸🇦 العربية🇷🇺 Русский🇵🇱 Polski🇨🇿 Čeština🇳🇱 Nederlands🇹🇷 Türkçe🇺🇦 Українська🇻🇳 Tiếng Việt🇮🇩 Indonesia🇹🇭 ไทย🇮🇳 हिन्दी🇧🇩 বাংলা🇵🇰 اردو🇷🇴 Română🇸🇪 Svenska🇮🇹 Italiano🇬🇷 Ελληνικά🇭🇺 Magyar🇫🇮 Suomi🇩🇰 Dansk🇳🇴 Norsk

ระบบการบีบอัดหน่วยความจำถาวรที่สร้างขึ้นสำหรับ Claude Code

License Version Node Mentioned in Awesome Claude Code

thedotmack/claude-mem | Trendshift


Claude-Mem Preview

เริ่มต้นอย่างรวดเร็ววิธีการทำงานเครื่องมือค้นหาเอกสารการกำหนดค่าการแก้ไขปัญหาใบอนุญาต

Claude-Mem รักษาบริบทข้ามเซสชันได้อย่างราบรื่นโดยการบันทึกผลการสังเกตจากการใช้เครื่องมือโดยอัตโนมัติ สร้างสรุปความหมาย และทำให้พร้อมใช้งานสำหรับเซสชันในอนาคต ทำให้ Claude สามารถรักษาความต่อเนื่องของความรู้เกี่ยวกับโปรเจกต์แม้หลังจากเซสชันสิ้นสุดหรือเชื่อมต่อใหม่


เริ่มต้นอย่างรวดเร็ว

เริ่มเซสชัน Claude Code ใหม่ในเทอร์มินัลและป้อนคำสั่งต่อไปนี้:

> /plugin marketplace add thedotmack/claude-mem

> /plugin install claude-mem

รีสตาร์ท Claude Code บริบทจากเซสชันก่อนหน้าจะปรากฏในเซสชันใหม่โดยอัตโนมัติ

คุณสมบัติหลัก:

  • 🧠 หน่วยความจำถาวร - บริบทยังคงอยู่ข้ามเซสชัน
  • 📊 การเปิดเผยแบบก้าวหน้า - การดึงหน่วยความจำแบบชั้นพร้อมการแสดงต้นทุนโทเค็น
  • 🔍 การค้นหาตามทักษะ - สืบค้นประวัติโปรเจกต์ของคุณด้วยทักษะ mem-search
  • 🖥️ Web Viewer UI - สตรีมหน่วยความจำแบบเรียลไทม์ที่ http://localhost:37777
  • 💻 Claude Desktop Skill - ค้นหาหน่วยความจำจากการสนทนา Claude Desktop
  • 🔒 การควบคุมความเป็นส่วนตัว - ใช้แท็ก <private> เพื่อยกเว้นเนื้อหาที่ละเอียดอ่อนจากการจัดเก็บ
  • ⚙️ การกำหนดค่าบริบท - ควบคุมบริบทที่ถูกฉีดเข้ามาได้อย่างละเอียด
  • 🤖 การทำงานอัตโนมัติ - ไม่ต้องแทรกแซงด้วยตนเอง
  • 🔗 การอ้างอิง - อ้างอิงการสังเกตในอดีตด้วย ID (เข้าถึงผ่าน http://localhost:37777/api/observation/{id} หรือดูทั้งหมดใน web viewer ที่ http://localhost:37777)
  • 🧪 Beta Channel - ลองคุณสมบัติทดลองเช่น Endless Mode ผ่านการสลับเวอร์ชัน

เอกสาร

📚 ดูเอกสารฉบับเต็ม - เรียกดูบนเว็บไซต์อย่างเป็นทางการ

เริ่มต้นใช้งาน

แนวปฏิบัติที่ดี

  • Context Engineering - หลักการปรับบริบทสำหรับเอเจนต์ AI
  • Progressive Disclosure - ปรัชญาเบื้องหลังกลยุทธ์การเตรียมบริบทของ Claude-Mem

สถาปัตยกรรม

การกำหนดค่าและการพัฒนา


วิธีการทำงาน

ส่วนประกอบหลัก:

  1. 5 Lifecycle Hooks - SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd (6 hook scripts)
  2. Smart Install - ตัวตรวจสอบการพึ่งพาที่ถูกแคช (pre-hook script, ไม่ใช่ lifecycle hook)
  3. Worker Service - HTTP API บนพอร์ต 37777 พร้อม web viewer UI และ 10 search endpoints, จัดการโดย Bun
  4. SQLite Database - จัดเก็บเซสชัน การสังเกต สรุป
  5. mem-search Skill - คิวรีภาษาธรรมชาติพร้อมการเปิดเผยแบบก้าวหน้า
  6. Chroma Vector Database - การค้นหาแบบไฮบริดทางความหมาย + คีย์เวิร์ดสำหรับการดึงบริบทอัจฉริยะ

ดู ภาพรวมสถาปัตยกรรม สำหรับรายละเอียด


Claude-Mem ให้บริการการค้นหาอัจฉริยะผ่านทักษะ mem-search ที่เรียกใช้อัตโนมัติเมื่อคุณถามเกี่ยวกับงานที่ผ่านมา:

วิธีการทำงาน:

  • เพียงถามตามธรรมชาติ: "เราทำอะไรในเซสชันที่แล้ว?" หรือ "เราแก้บั๊กนี้ไปแล้วหรือยัง?"
  • Claude เรียกใช้ทักษะ mem-search โดยอัตโนมัติเพื่อค้นหาบริบทที่เกี่ยวข้อง

การดำเนินการค้นหาที่มี:

  1. Search Observations - การค้นหาข้อความเต็มข้ามการสังเกต
  2. Search Sessions - การค้นหาข้อความเต็มข้ามสรุปเซสชัน
  3. Search Prompts - ค้นหาคำขอผู้ใช้แบบดิบ
  4. By Concept - ค้นหาตามแท็กแนวคิด (discovery, problem-solution, pattern, ฯลฯ)
  5. By File - ค้นหาการสังเกตที่อ้างอิงไฟล์เฉพาะ
  6. By Type - ค้นหาตามประเภท (decision, bugfix, feature, refactor, discovery, change)
  7. Recent Context - รับบริบทเซสชันล่าสุดสำหรับโปรเจกต์
  8. Timeline - รับไทม์ไลน์รวมของบริบทรอบจุดเวลาเฉพาะ
  9. Timeline by Query - ค้นหาการสังเกตและรับบริบทไทม์ไลน์รอบการจับคู่ที่ดีที่สุด
  10. API Help - รับเอกสาร search API

ตัวอย่างคิวรีภาษาธรรมชาติ:

"What bugs did we fix last session?"
"How did we implement authentication?"
"What changes were made to worker-service.ts?"
"Show me recent work on this project"
"What was happening when we added the viewer UI?"

ดู คู่มือเครื่องมือค้นหา สำหรับตัวอย่างโดยละเอียด


คุณสมบัติ Beta

Claude-Mem นำเสนอ beta channel พร้อมคุณสมบัติทดลองเช่น Endless Mode (สถาปัตยกรรมหน่วยความจำแบบชีวมิติสำหรับเซสชันที่ขยายออกไป) สลับระหว่างเวอร์ชันเสถียรและเบต้าจาก web viewer UI ที่ http://localhost:37777 → Settings

ดู เอกสารคุณสมบัติ Beta สำหรับรายละเอียดเกี่ยวกับ Endless Mode และวิธีการลอง


ความต้องการของระบบ

  • Node.js: 18.0.0 หรือสูงกว่า
  • Claude Code: เวอร์ชันล่าสุดพร้อมการสนับสนุนปลั๊กอิน
  • Bun: JavaScript runtime และตัวจัดการกระบวนการ (ติดตั้งอัตโนมัติหากไม่มี)
  • uv: ตัวจัดการแพ็คเกจ Python สำหรับการค้นหาเวกเตอร์ (ติดตั้งอัตโนมัติหากไม่มี)
  • SQLite 3: สำหรับการจัดเก็บถาวร (รวมอยู่)

การกำหนดค่า

การตั้งค่าจะถูกจัดการใน ~/.claude-mem/settings.json (สร้างอัตโนมัติพร้อมค่าเริ่มต้นในการรันครั้งแรก) กำหนดค่าโมเดล AI พอร์ต worker ไดเรกทอรีข้อมูล ระดับ log และการตั้งค่าการฉีดบริบท

ดู คู่มือการกำหนดค่า สำหรับการตั้งค่าทั้งหมดที่มีและตัวอย่าง


การพัฒนา

ดู คู่มือการพัฒนา สำหรับคำแนะนำการสร้าง การทดสอบ และขั้นตอนการมีส่วนร่วม


การแก้ไขปัญหา

หากพบปัญหา อธิบายปัญหาให้ Claude ฟังและทักษะ troubleshoot จะวินิจฉัยและให้การแก้ไขโดยอัตโนมัติ

ดู คู่มือการแก้ไขปัญหา สำหรับปัญหาและการแก้ไขทั่วไป


รายงานบั๊ก

สร้างรายงานบั๊กที่ครอบคลุมด้วยตัวสร้างอัตโนมัติ:

cd ~/.claude/plugins/marketplaces/thedotmack
npm run bug-report

การมีส่วนร่วม

ยินดีรับการมีส่วนร่วม! กรุณา:

  1. Fork repository
  2. สร้าง feature branch
  3. ทำการเปลี่ยนแปลงพร้อมการทดสอบ
  4. อัปเดตเอกสาร
  5. ส่ง Pull Request

ดู คู่มือการพัฒนา สำหรับขั้นตอนการมีส่วนร่วม


License

This project is licensed under the Apache License 2.0 (Apache-2.0).

Copyright (C) 2025 Alex Newman (@thedotmack). All rights reserved.

See the LICENSE file for full details.

Apache-2.0 allows broad use, modification, distribution, and commercial use, subject to its terms.

Ragtime note: The ragtime/ directory is licensed under the Apache License 2.0. See ragtime/LICENSE for details.


การสนับสนุน


สร้างด้วย Claude Agent SDK | ขับเคลื่อนโดย Claude Code | สร้างด้วย TypeScript