Skip to content

feat(knowledge): add portable storage and guarded migration tools - #587

Merged
chadbyte merged 2 commits into
mainfrom
feat/knowledge-storage-adapters
Oct 13, 2026
Merged

chadbyte merged 2 commits into
mainfrom
feat/knowledge-storage-adapters

Conversation

@chadbyte

@chadbyte chadbyte commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Knowledge storage was tied directly to NeDB, and Mate migration workflows lacked guarded text writes and resumable bulk imports. This adds a replaceable persistence contract while retaining NeDB as the default and preserving existing data, IDs, revisions, history and receipts.

  • Isolate engine lifecycle, atomic conditional writes, shared serialization, recovery and compaction behind an injectable adapter. Verify domain workflows with an independent memory adapter and NeDB module loading blocked. SQLite can implement this contract later; no engine switch or capacity expansion is included.
  • Add owner-bound text document tools and typed database import/progress tools, with revision checks, durable source mappings, replay protection and reference validation.
  • Correct digest checkpoints so capped chunks do not skip unread conversation content. Document workflow, backup and migration acceptance checks.

Current application limits remain 20,000 records and 16 MiB per aggregate. Imports use batches of up to 100 rows/256 KiB, with bounded NeDB journal maintenance.

Validation: the full repository suite passed on Node 22.22.1: 3,430 passed, 2 skipped, 0 failed. Adapter contract and legacy-data compatibility tests also passed independently. GitHub checks must pass before merge. Synthetic tests cover 8,563 vocabulary rows, 537 finance rows, 20,000-row capacity, process restart/backup restore, persistence failures and concurrent recovery. No live records were migrated or server restarted.

Add session-bound Markdown editing and bounded source-row imports with
stable mappings, revision checks, multiline values, and owner isolation.
Serialize database persistence recovery and compact the NeDB journal.

Preserve unread Mate digest content with durable within-message cursors.
Cover workflows, capacity, restart, backup restore, and failure recovery.
Retain the current 20000-record and 16 MiB database limits.

Validation: 88 combined tests passed, plus syntax and diff checks.
Define an engine-neutral persistence contract and injectable factory.
Move NeDB lifecycle, paths, serialized recovery and maintenance into its
adapter while preserving aggregate data, limits and tool behavior.

Verify independent memory-backed workflows, blocked NeDB loading and
compatibility with existing stored identities, history and receipts.
SQLite implementation remains future work.
@chadbyte
chadbyte merged commit ac6c2cc into main Oct 13, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

This issue has been resolved in version 5.2.0-beta.3 (main).

To update, run:

npx clay-server@5.2.0-beta.3

-- Clay Deploy Bot

Build anything, with anyone, in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant