SmartAssist How it works

How a correction becomes useful context.

You explain how your project works. SmartAssist keeps the useful lesson and the correction behind it, then finds relevant context for a later task.

Follow one correction

The learning loop, made visible

A little context.
Carried forward.

Explore the steps, then separate the layers to see what each kind of memory contributes.

Your project memory
You

“Please use our theme tokens instead of hardcoded colors.”

Illustrative example. This page reads and stores no project memory.

Step 1 of 4

Start with a useful correction.

You give feedback in the conversation. The shared feedback workflow checks for a reusable project lesson and looks for existing guidance that overlaps.

“Please use our theme tokens instead of hardcoded colors.”

A repeated rule can reinforce an existing lesson. A new lesson can be created when the guidance is distinct.

Step 2 of 4

Keep the rule and the history.

The reusable instruction becomes a project rule. Past corrections retain the concrete experience behind the guidance. They remain distinguishable when retrieved.

Rule: use theme tokens.
History: hardcoded colors needed correcting.

This is semantic memory and episodic memory. SQLite is the canonical store for the project’s memory.

Step 3 of 4

Find what fits the next task.

A later request, such as building a settings screen, gives retrieval a new query. SmartAssist finds matching guidance and uses per-lesson feedback to help rank the candidates.

“Build the settings screen for this project.”

Keyword-based retrieval works by default. Optional semantic retrieval helps with paraphrased requests.

Step 4 of 4

Bring relevant context into the work.

The task gets a small mix of relevant rules and past corrections. That prompt-time mix is working memory. Later feedback can influence future lesson ranking.

For this settings screen: use the theme’s color tokens, with the earlier correction as context.

Claude Code hooks inject context automatically. Other agents retrieve through their instructions and MCP tools.

Three names, three jobs

What it remembers.
What it brings along.

Two stored memory types contribute to one task’s context. Each has a different purpose.

Semantic memory

The project’s durable guidance.

Rules and lessons that can help again, such as the preferred test style or a design-system convention.

Use semantic color tokens from the theme.

Episodic memory

The experience behind the rule.

Concrete feedback events, corrections, and failures that give the guidance project-specific context.

A previous component used hardcoded colors and needed a correction.

Working memory

A relevant mix for the task.

A small prompt-time assembly of useful rules and past corrections. It changes with the current request.

Theme guidance and its history, ready for the settings-screen task.

Two separate learning loops

Learning what helps.
Seeing where to improve.

SmartAssist uses Thompson sampling in two places. One ranks individual lessons; the other tracks reliability across areas of work.

Per-lesson ranking

Which specific guidance should show up first?

SmartAssist records which lessons were injected. Later feedback provides evidence for their future ranking, while allowing exploration of newer lessons.

Category reliability

Which areas of work need more attention?

A separate loop tracks categories such as testing, Git, and code changes. It powers reliability views, weak-category guidance, and boundary packs.

Feedback updates the memory system’s evidence and ranking. It does not retrain the underlying AI model.

Under the hood

Local memory.
Clear responsibilities.

The memory model, ranking, storage, and delivery work together, while keeping their different jobs intact.

SQLite holds the canonical memory.

Each project keeps its data in .claude/smartassist/data/. The SQLite database holds lessons, feedback events, scores, and the canonical search projection.

The optional LanceDB vector cache is derived data. It is not a second source of truth.

Retrieval starts with the words.

Lexical retrieval is the default. Opt-in semantic retrieval adds a local embedding service using BAAI/bge-small-en-v1.5 and combines semantic similarity with lexical matching.

If the semantic service is unavailable, retrieval falls back to the lexical path.

Claude Code gets automatic delivery.

Five lifecycle hooks cover session start, prompt submission, tool use, and session end. Prompt hooks inject context; rag_search also lets the agent retrieve it on demand.

The hook and MCP retrieval paths preserve project rules, past corrections, and per-lesson ranking.

Other agents use their native surfaces.

Codex uses MCP tools and global agent instructions, with setup and targeted validation in this repository. Gemini, ChatGPT, Amp, and OpenCode have adapters for the shared feedback workflow.

Claude Code has the deepest validation. The other adapters still need broader runtime validation.

Go deeper in the source documentation

Read the canonical documentation for implementation details, supported setup, and the architecture’s protected invariants.

Architecture in the READMEMemory model and learning-loop invariantsOptional semantic retrievalCanonical storage and the vector cache

Bring your project’s
context to the next task.

Start with a real correction. Keep the guidance useful as the project changes.

Set up SmartAssist