Using Nicia alongside RAG, agent memory, and CLAUDE.md
A support agent can remember that a customer prefers email, look up the product manual, and check the current refund policy before promising a refund. Each input has a different owner and reason to change.
Decide where it belongs
Section titled “Decide where it belongs”| Input | Where it fits | Example |
|---|---|---|
| Static Markdown | Version CLAUDE.md and repo conventions alongside the code. |
The test command, repository layout, or where to open a PR. |
| Retrieval-augmented generation (RAG) | Retrieve relevant passages from a large, unstructured collection. | Search manuals, transcripts, and support articles for background. |
| Agent memory (Mem0, Zep, or Letta) | Use memory for conversational continuity and per-user preferences. | This customer prefers email and short summaries. |
| Nicia | Keep shared operational facts and rules that change, need human review, and should reopen when their cited grounds move. | The approved refund window, its source passage, and a receipt for each read. |
Read personal preferences and shared policy
Section titled “Read personal preferences and shared policy”Install @nicia-ai/client@0.2.0. Use a read key for a space with a cited
refund rule, following the quickstart. Adapt
PreferenceMemory to your existing memory client. Pass the last receipt for
this task to see what changed since the previous read.
import { NiciaSpaceClient } from "@nicia-ai/client";
type PreferenceMemory = { preferencesFor(userId: string): Promise<readonly string[]>;};
const spaceKey = process.env.NICIA_SPACE_KEY;if (!spaceKey) throw new Error("Set NICIA_SPACE_KEY");const space = new NiciaSpaceClient({ baseUrl: "https://api.nicia.ai", handle: "tenant:acme", spaceKey,});
export async function refundInputs( memory: PreferenceMemory, userId: string, previousReceipt?: string,) { const [preferences, policy] = await Promise.all([ memory.preferencesFor(userId), space.getContext({ prompt: "What refund window is in effect?", format: "items" }), ]); const needsReview = (policy.items ?? []).some( (item) => item.kind === "record" && item.validity?.state === "needs_review", ); const changes = previousReceipt ? await space.getReceiptChanges(previousReceipt) : undefined; const { text, citations, receipt } = policy; return { preferences, policy: text, citations, receipt, needsReview, changes };}Use the preference when choosing how to respond. Use the accepted policy to
decide what the agent can promise. If a new version of the cited source
drops the quoted passage, the dependent rule reopens. A returned reopened
record carries needs_review. Route that case to a person, and keep the new
receipt with the draft. The receipt records which version and citations
Nicia served. The application decides what to send.
Replay six fact changes across plain RAG, agent memory, and Nicia. Agent Drift Arena
Check a public repo’s CLAUDE.md and skills for broken references and oversized
instructions. The web audit caps its server-side scan at six seconds.
Skill-Rot Audit