How it works
Project-scoped storage
Each project gets its own memory file at~/.local/share/zeroxzero/projects/<hash>/memory.json. Patterns learned in one project never bleed into another. When no project_root is provided, a global fallback is used.
Three signals
-
Accepts — when you accept a ghost-text suggestion, your editor plugin calls
POST /completion/accept. The server stores the prefix context, the accepted text, and auto-detects the category. -
Rejects — when you dismiss or overwrite a suggestion, your editor calls
POST /completion/reject. This is negative signal. -
Rules — after 3+ accepted completions share the same structural pattern (e.g.,
throw new <ErrorType>(<message>)), the server automatically extracts a learned rule. Rules are weighted by the accept/reject ratio.
Categories
Every completion is auto-tagged with a category based on the prefix context:| Category | Detected when… |
|---|---|
import | Prefix starts with import or from |
error-handling | Near try/catch, throw, or guard clause (if (!x)) |
type-annotation | After : with PascalCase response |
return | After return keyword |
variable | After const x = or let x = |
condition | After if, while, for |
argument | After ( or , |
function-body | Inside a function definition |
other | None of the above |
Rule learning
The rule extractor identifies structural patterns in accepted completions:| Accepted text | Extracted pattern |
|---|---|
throw new NotFoundError("user") | throw new <ErrorType>(<message>) |
const data = await fetchUser() | const <var> = await <fn>() |
if (!user) { throw ... } | if (!<var>) { <throw/return> } |
const { name, email } = user | const { <fields> } = <source> |
How it affects the prompt
Each completion request’s prompt is enriched with:Growth curve
| Usage | What the model sees |
|---|---|
| Day 1 | System prompt + file prefix/suffix only |
| ~10 completions | System prompt + 3 relevant accepted examples |
| ~30 completions | Examples + first learned rules |
| ~100 completions | Strong rules, high confidence, category-specific examples |
Inspecting and managing memory
Storage limits
- Max 500 accepted entries per project (oldest trimmed)
- Max 200 rejected entries per project
- Max 30 learned rules per project
- Memory files are JSON, human-readable at
~/.local/share/zeroxzero/projects/
See also
- Completion API — full endpoint reference
- Neovim Completion — editor integration that calls accept/reject