Skip to content

Add AI artifact cache layer and AI.* RESP commands (embeddings/prompts/RAG/dedup/invalidation)#5

Merged
AutoCookies merged 2 commits intomainfrom
codex/upgrade-pomai-cache-to-ai-artifact-cache
Feb 11, 2026
Merged

Add AI artifact cache layer and AI.* RESP commands (embeddings/prompts/RAG/dedup/invalidation)#5
AutoCookies merged 2 commits intomainfrom
codex/upgrade-pomai-cache-to-ai-artifact-cache

Conversation

@AutoCookies
Copy link
Owner

Motivation

  • Provide a local, best-effort AI Artifact Cache layer for embeddings, prompts, RAG chunks, rerank buffers and responses with cache semantics (lossy, TTL/capacity-driven, warm restart).
  • Use deterministic canonical keys and a content-addressed blob indirection to enable deduplication and compact metadata handling.
  • Expose AI-native commands over RESP so existing clients like redis-cli can store, fetch, invalidate, and introspect AI artifacts.

Description

  • Added a new AiArtifactCache layer (include/pomai_cache/ai_cache.hpp, src/server/ai_cache.cpp) that stores typed ArtifactMeta + payloads with a blob:<content_hash> indirection, best-effort refcounts, per-epoch/model/prefix bounded indexes, and introspection (stats, top_hot, top_costly, explain).
  • Extended the RESP server (src/server/server_main.cpp) with AI commands: AI.PUT, AI.GET, AI.MGET, AI.EMB.PUT, AI.EMB.GET, AI.INVALIDATE EPOCH|MODEL|PREFIX, AI.STATS, AI.TOP HOT|COSTLY, and AI.EXPLAIN, and instantiated AiArtifactCache in the server loop.
  • Implemented deterministic canonical key helpers (emb/prm/rag/rrk/rsp) and owner TTL defaults + type-based miss_cost guidance; updated engine owner miss-cost defaults in src/engine/engine.cpp to bias policy for AI artifact owners.
  • Added AI benchmark bench/ai_artifact_bench.cpp and wired up CMake (CMakeLists.txt) plus tests (tests/test_ai_cache.cpp, extended tests/test_integration.cpp) and docs (docs/AI_CACHE.md, docs/AI_COMMANDS.md, docs/INVALIDATION.md, docs/BLOB_DEDUP.md), and updated README.md with quickstart examples and recommended AI config.

Testing

  • Built the project (cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug && cmake --build build -j) and all test targets compiled successfully. ✅
  • Ran the full test suite (ctest --test-dir build --output-on-failure), and all tests including the new AI unit and integration tests passed. ✅
  • Built and executed the AI benchmark target (pomai_cache_ai_bench) which produced a JSON summary (ops/s, p50/p95/p99/p999, hit_rate) for the embedding workload; the bench target compiles and runs but longer runs may require tuning in constrained CI environments (a longer timeout was observed during an extended run). ⚠️

Codex Task

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@AutoCookies AutoCookies merged commit 044cb65 into main Feb 11, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant