Warning
Nimo is an experimental, work-in-progress research project — not a finished product.
The memory engine (PAME) and the server are implemented and pass their own test suites, but the CLI and web UI are still scaffolds, public interfaces may change without notice, and the benchmarks are self-authored regression evidence rather than independent validation. Nothing in this repository should be read as a claim that the project is complete or production-ready.
- Read the project note for scope, current status, and the roadmap: note.md
- Want to help? Start with CONTRIBUTING.md.
- The project is released under the MIT License. See License.
▶ Watch the demo (MP4, 8.5 MB, 3 min)
The clip is the whole loop in one screen: open a terminal, type nimo, and the CLI opens with the
agent ready. Say what you need — in the recording it lists the files in a project and runs a command —
and the answer streams back in the same terminal, with the thought process and tool results visible as
they happen.
The demo shows the CLI talking to a live model, so it needs a configured provider key. See Setup for the environment variables.
| What this is | An experimental memory engine for tool-using agents, plus an agent harness that exercises it. |
| Maturity | Research preview. Core memory + server work; CLI and web are not wired to the agent yet. |
| Evidence | 314/314 internal checks and 62/62 universal questions pass — but the corpora are synthetic and not blind. |
| Not claimed | State-of-the-art retrieval, AGI, autonomous learning, production readiness, or security hardening against untrusted repositories. |
| License | MIT. |
Nimo is not an AI agent. Nimo is a memory.
This repository contains both the memory engine and an agent harness that exercises it. The research claim is about the memory: an agent should not start every turn as a stranger, and it should not merely accumulate chat history. It should retain evidence, connect related knowledge, preserve contradictions, forget safely, and turn repeated procedures into reusable skills.
Large-language-model agents are usually given memory as an afterthought: a transcript is appended to a context window, or text is embedded into a vector store and retrieved by cosine similarity. Both approaches lose structure. They cannot distinguish a fact from a question, a correction from a repetition, or a supported belief from a guess. They cannot explain why a memory exists. They cannot delete one without leaving copies in indexes, edges, summaries, and audit trails. They rarely learn how to do something — only what was said.
Nimo is a memory system designed around a different unit of retention: the evidence-backed memory node, connected by typed, directional associations, governed by explicit write, retrieval, and deletion rules, and complemented by procedural skills distilled from tool-using experience. It runs in a single SQLite file, requires no external embedding service, and exposes its capabilities as typed tools that any AI-SDK-compatible agent can call.
The system is deliberately conservative. Retrieval is read-only: reading a memory does not strengthen it. Contradictions are preserved and linked, not silently resolved. Destructive operations require explicit confirmation. Owner identity is supplied by the host and is never accepted from the model. These choices trade some apparent "intelligence" for auditability, reversibility, and trust.
We report the current implementation honestly: a 6-axis universal suite passes 62/62 questions, and a retrieval benchmark passes all 18 questions in its hybrid configurations. Both corpora were authored alongside the system and are not blind, so the numbers are regression evidence, not research-grade proof. The contribution is the architecture and its verified behaviour, not a claim of state-of-the-art retrieval.
An agent without memory is a sequence of isolated guesses. An agent with a transcript is slightly better, but a transcript is not memory: it is a log. It has no notion of importance, no distinction between a user's assertion and the assistant's speculation, no links between related decisions, and no safe way to forget.
The memory problem for agents has four parts:
- What should be retained? Not every token deserves permanence. A question is not a fact. An assistant's claim is not independent evidence. A password must never be stored.
- How should it be found? Exact keyword search misses paraphrase. Dense similarity misses structure and provenance. A useful system needs several retrieval signals and a way to combine them.
- How should it change? New information may duplicate, support, contradict, or supersede an existing memory. These are different operations and must not collapse into "overwrite the row".
- How should it be removed? Deletion must reach content, embeddings, edges, revisions, indexes, and derived summaries — without destroying the audit trail that proves the deletion happened.
Nimo addresses these questions with five layers that are kept separate: experience, memory, association, index, and governance. The separation is the design. A message is an experience; a fact extracted from it is a memory; a relationship between memories is an edge; a retrieval index is a view; and a policy decides what may cross each boundary.
The system is also intended to be useful to other agents, not only to this repository's server. Its public package exports the memory service, request-scoped identity helpers, prompt-context builders, and mode-split tool sets. A host agent supplies an owner identity and a mode; Nimo supplies persistent, governed memory.
- A five-layer memory architecture with explicit boundaries between evidence, belief, association, index, and governance.
- Evidence-aware ingestion: rule-based extraction, speech-act filtering, secret detection, source attribution, and confidence derived from provenance rather than repetition.
- Conservative conflict handling: similarity, contradiction, and supersession are classified separately; contradictions are retained and linked.
- Hybrid retrieval with a bounded associative step: BM25, entity matching, and hashed char n-gram embeddings fused by Reciprocal Rank Fusion, followed by bounded spreading activation over typed edges.
- A redesigned deterministic ranking function that removes an unimplemented PageRank term and combines relevance, importance/degree, recency, and confidence with stated weights.
- Read-only recall: retrieval never writes confidence, importance, degree, access counters, or edges.
- Governed deletion: transactional forgetting that clears content, embeddings, edges, revisions, and FTS rows while preserving a non-sensitive audit record.
- Procedural memory: candidate skills distilled from tool-using turns, rehearsed through outcomes, curated by a lifecycle policy, and selected with a UCB bandit.
- A hardened coding-tool layer: sandboxed file operations, structured process execution, automatic test detection, git inspection, source outlining, dry-run refactoring, and atomic writes.
This is not a claim that Nimo is conscious, generally intelligent, or a complete cognitive architecture. It is not a claim that the graph always beats a vector baseline. It is not a claim that the current benchmark is blind or definitive. Section 8 lists the limitations explicitly.
| Principle | Consequence in the implementation |
|---|---|
| Evidence before belief | Every memory carries provenance: an experience id, source kind, quote, and observation time. Assistant output is preserved for continuity but is not treated as independent evidence. |
| One continuous stream | There are no conversation buckets. Experiences are global to an owner, and retrieval is by content, entity, embedding, and graph relation. |
| Structure over similarity alone | Typed nodes and typed edges are first-class. Similarity is one retrieval signal, not the data model. |
| Governance at the write boundary | Secret detection, speech-act filtering, and policy checks run before storage, not after retrieval. |
| Reading must not change belief | Recall is read-only. Rehearsal is an explicit write. |
| Contradictions are data | Conflicting memories are preserved with a contradicts edge. The system may lower confidence; it does not pretend the conflict never existed. |
| Deletion is a graph operation | Forgetting removes or redacts every derived representation and verifies that recall no longer returns the memory. |
| Identity belongs to the host | The model never supplies an owner id. Request-scoped context carries the authenticated identity and mode. |
| Deterministic where possible | Hashing embeddings, BM25, RRF, and ranking are local arithmetic. No hidden API, no model download, no GPU requirement. |
| The workspace is trusted code | The tool sandbox prevents traversal and shell injection; it is not a virtual machine. Do not point it at an untrusted repository. |
User turn
│
▼
┌──────────────────────────────────────────────────────────────┐
│ Agent runtime (packages/agents) │
│ runAgent(prompt, mode, model, effort, { ownerId }) │
│ ├─ establish request-scoped identity + permissions │
│ ├─ buildMemoryContext(ownerId, prompt) │
│ ├─ loadSkills(ownerId, prompt, 3) │
│ ├─ generateText(... tools from mode ...) │
│ └─ record the turn as an experience │
└──────────────────────────────────────────────────────────────┘
│ ▲
│ tool calls │ context block
▼ │
┌───────────────────────────────┐ ┌──────────────────────────┐
│ Tool layer │ │ Memory engine (PAME) │
│ filesystem · code · research │──▶│ recall · remember · │
│ memory read/write/destructive│ │ link · teach · forget │
└───────────────────────────────┘ └───────────┬──────────────┘
│
▼
┌──────────────────────────┐
│ ~/.nimo/pame.db (SQLite) │
│ experiments · memories · │
│ edges · entities · │
│ policies · revisions · │
│ audit · jobs · skills │
└──────────────────────────┘
- Experience layer — what actually happened: user messages, assistant responses, tool calls, tool results, observations, timestamps. Experiences are hashed for deduplication and retained as evidence.
- Memory layer — what Nimo believes is worth retaining: facts, preferences, decisions, events, concepts, procedures, goals, observations. Each node has confidence, importance, retention class, validity interval, and evidence.
- Association layer — typed, directional, weighted edges:
supports,contradicts,supersedes,causes,enables,observes,tests,replicates,related_to,depends_on, and others. Degree is tracked and repairable. - Index layer — how memories are found: BM25/FTS text evidence, entity names, hashed char n-gram embeddings, recency, and graph activation. Indexes are derived; they never replace the source of truth.
- Governance layer — what may be stored, changed, retrieved, shared, or forgotten. It owns secret detection, owner scoping, mode permissions, deletion, retention, and audit.
One SQLite database, WAL mode, owner-scoped queries. The default path is ~/.nimo/pame.db; PAME_DB_PATH overrides the file, and PAME_DATA_DIR overrides the root. The database resolves lazily and can be closed and reopened cleanly.
| Table | Responsibility |
|---|---|
experiences |
Original interaction evidence, hashed for deduplication |
memories |
Consolidated, typed, versioned memory nodes |
memory_edges |
Typed, directional relationships with weight and confidence |
memory_entities |
Canonical people, projects, technologies, concepts |
memory_policies |
Per-owner governance settings |
memory_revisions |
Version history; the original is never silently rewritten |
memory_audit |
Operation history without stored secrets |
memory_jobs |
Durable ingestion, embedding, and maintenance queue |
skills |
Procedures with use/success/failure counts and confidence |
There is no MongoDB or Neo4j dependency. The graph is represented in SQLite with explicit from/to edges and indexed adjacency queries.
Every turn is written as an Experience. The content is hashed so identical turns can be detected, but capture deliberately salts the hash so repeated identical turns remain distinguishable as separate experiences. Consolidation, not capture, is responsible for deciding that two turns express the same memory.
The agent loop records:
- the user's prompt as first-hand evidence;
- the assistant's final text for continuity (but extraction yields no independent facts from assistant text);
- the tools that were actually called, which are later used to decide whether a procedure is worth distilling.
This is why "Chat" and "Plan" can still learn even though their memory tools are read-only: the runtime's internal capture path is separate from the model-callable tool surface. The model cannot use a tool to write in Chat/Plan, but the host may still preserve the turn.
Extraction is deterministic and rule-based. It does not call an LLM, which makes it testable and reproducible. The pipeline distinguishes:
- Questions — not facts. "Which database did we choose?" is a retrieval cue, not a durable assertion.
- Instructions — not facts. "Fix the failing test" is a task, not a belief.
- Hedged statements — retained as
inferredwith lower confidence. "It might be SQLite" is weaker than "We chose SQLite". - User assertions — the primary source of durable facts.
- Assistant/system output — preserved as experience, but not treated as independent evidence.
- Tool/document evidence — labelled with lower confidence and source attribution.
- Identity facts — stable by policy; they do not fade like ordinary memories.
- Denials / ephemeral agent state — rejected at ingestion; a passing "I don't know" should not become a permanent belief.
Before storage, every candidate passes the governance layer:
- secret and credential detection;
- owner scoping;
- retention and visibility classification;
- duplicate and near-duplicate detection;
- evidence construction with
experienceId,kind,quote, andobservedAt.
Consolidation is intentionally conservative. Given a new candidate and an existing memory, the engine asks what kind of relationship the evidence supports:
| Situation | Action |
|---|---|
| Exact or near-exact duplicate | Attach new evidence, raise confidence/importance within policy, record a revision |
| Strong keyword overlap, same type, long content | Treat as the same memory and merge evidence |
| Logical contradiction (value-slot conflict, negation, numeric/entity change) | Keep both memories, add a contradicts edge, do not merge |
| Explicit correction or verified replacement | Mark the old memory superseded, record a revision, preserve historical content |
| Merely related | Create a typed related_to / supports / depends_on edge to the closest active memory |
| Ambiguous | Keep both; do not invent certainty |
Two rules matter more than the rest:
- Similarity is not contradiction. Two sentences can share most of their words and disagree about a value. The conflict classifier separates lexical similarity from actual value conflict.
- Repetition is not evidence. Retrieving the same memory repeatedly must not raise its confidence. Confidence is about provenance quality, not frequency of access.
The current classifier is heuristic. Nuanced prose contradictions can still be missed. There is no LLM/NLI judge. This is recorded as a partial implementation, not a solved problem.
Memories are nodes; relationships are typed edges with weight and confidence. The graph supports:
- Association — related facts surface together.
- Explanation — a retrieved memory can be followed to the evidence and related decisions that support it.
- Spreading activation — connected memories that share no query words can still surface.
- Conflict visibility — contradictions are edges, not deletions.
- Degree-aware importance — well-connected memories receive a modest ranking boost.
- Repair — dangling edges and inconsistent degree counts can be detected and fixed.
The graph is deliberately not used as a license for unbounded traversal. Activation is bounded in hops and decayed per step so a large graph cannot turn into a runaway walk.
Retrieval is a five-stage pipeline:
-
Query cues — the user's message becomes tokens, entity names, and an embedding.
-
Candidate generation — three independent ranked lists:
- BM25 keyword:
score += idf · (f·(k₁+1)) / (f + k₁(1−b+b·docLen/avgLen)), withk₁ = 1.5,b = 0.75. - Entity match: exact canonical entity names.
- Embedding cosine:
cos(u,v) = u·v/(‖u‖‖v‖)over deterministic hashed char n-gram vectors (dimension 256). Morphological relatives share buckets, so "automobile" and "automobiles" can fire together.
- BM25 keyword:
-
Fusion — Reciprocal Rank Fusion over the candidate lists:
RRF(d) = Σ 1 / (60 + rank_i(d))RRF is robust to score-scale differences between BM25 and cosine, and it rewards documents that appear in multiple lists.
-
Associative activation — bounded spreading activation from the fused seeds:
A(v) = S(v, q) + λ · Σ w(u,v) · A(u)with
λ = 0.5and a per-hop decay of0.6, bounded to at most four hops.S(v,q)is the fused seed score andw(u,v)is the edge weight. This is not Personalized PageRank; there is no PageRank computation in the engine. The legacypage_rankcolumn exists for historical data and is not read by ranking. -
Assembly — a compact prompt block is built: current activity (newest first), relevant skills, recalled memories, and evidence. The prompt never receives the whole graph.
The embedding is a dependency-free hashed char n-gram representation, not a dense neural embedding. It is deterministic, persistent in SQLite, and survives restarts. Dense embeddings and cross-encoder rerankers are explicitly out of scope.
After candidates are retrieved, the deterministic ranking function is:
score = 0.35 · relevance
+ 0.40 · (base / 2)
+ 0.15 · effectiveRecency
+ 0.10 · confidence
base = importance · (1 + ln(1 + degree))
relevanceis the normalised fused retrieval score.baserewards important and well-connected memories, normalised by 2 so the term stays in a comparable range.effectiveRecencyis1for stable memories; ephemeral memories are multiplied by0.3so temporary observations do not outrank durable knowledge.confidencereflects evidence quality and provenance, not repetition.
There is no hidden term and no non-deterministic reranker. The previous design included a PageRank weight that could never be non-zero because nothing computed it; that term was removed and the remaining weights were renormalised.
Ageing follows a forgetting curve:
s(t) = s₀ / (1 + age/τ), τ = 30 days × (1 + importance)
Age is computed from lastAccessedAt when present, falling back to updatedAt. The crucial rule is:
Retrieval is read-only. Recall never writes
lastAccessedAt, confidence, importance, degree, access counters, or edges.
This prevents a feedback loop in which repeatedly asking about a memory makes it permanently true or permanently prominent. Rehearsal must be an explicit write: a correction, a consolidation, a deliberate touch, or a skill outcome. Neglect still fades; reading alone does not refresh.
Retention has three classes:
- stable — identity facts, decisions, durable preferences; never timer-deleted.
- normal — ordinary memories; subject to decay-based ranking but not automatic deletion.
- ephemeral — temporary observations; archived when expired, with a reduced recency weight while active.
A retention worker archives expired ephemeral memories, redacts old experience bodies, and prunes old revisions. It never timer-deletes stable memories.
Facts tell an agent what is true. Skills tell it what to do. A skill is a procedure with a track record:
name, whenToUse, steps[], toolsUsed[], keywords[],
status: candidate | active | archived,
uses, successes, failures, confidence, lastAccessedAt
The lifecycle is:
-
Distillation — when a tool-using turn occurs and no loaded skill covered it, the turn can be distilled into a candidate skill. Steps come from the response, tools from the actual tool calls, and keywords from the prompt.
-
Rehearsal —
useSkill(success)increments uses and the appropriate outcome count, updates confidence, and records the rehearsal time. -
Curation — every turn with skills present runs the lifecycle:
- candidate with at least one success → promote to active;
- active with at least three failures and more failures than successes → archive;
- active with more failures than successes and confidence below
0.4→ demote to candidate; - otherwise → keep.
-
Selection — each skill is an arm of a multi-armed bandit. The posterior is
Beta(α = 1 + successes, β = 1 + failures), and selection uses:UCB = μ + sqrt(2 · ln(t) / n)where
μ = α/(α+β),tis total uses, andnis the arm's uses. This is exploration with a preference for skills that have worked. -
Composition — two active, confident skills can compose into a macro-skill when their keyword overlap is at least
0.6and both confidences are at least0.6. This is chunking: a repeated sequence becomes one reusable procedure.
Skills are stored in the same SQLite database and are owner-scoped. Policy gates apply to skill distillation, so a secret cannot be laundered into a procedure.
Identity. The host establishes an owner per request through AsyncLocalStorage. The model never supplies an owner id. In PAME_MULTI_USER=true mode, an unauthenticated request is denied with no_identity. In single-user local development, the deliberate fallback owner is local; this is a documented convenience, not an authentication mechanism.
Mode permissions. Tools enforce permissions at execution time, not only in the prompt:
Chat— memory read + memory write + research; no file writes or shell commands.Plan— read-only orientation + memory read/write + research.Auto— read/write + shell/background processes + memory read/write + research.
Memory writes are available in every mode because learning is the point of the brain; only deletion is destructive and limited to Auto with host confirmation.
Destructive memory operations additionally require destructiveConfirmed=true from the host. The model cannot set that flag.
Secrets. Detection combines patterns and assignment heuristics. It runs on create, update, teach, skill distillation, and ingestion. Talking about passwords or a "token budget" is not automatically flagged; an actual credential assignment is.
Retrieved memories are untrusted input. They are fenced and labelled as evidence. A retrieved memory must not be able to override system instructions, tool permissions, or security policy.
Deletion. Forgetting is transactional and idempotent:
find → confirm → clear content/summary/keywords/evidence/embedding
→ redact revisions
→ remove edges
→ redact exclusive experiences
→ remove FTS row
→ preserve a non-sensitive audit record
→ verify recall no longer returns the memory
Bulk deletion defaults to a preview. forgetByQuery only deletes exact direct matches after { confirm: true }; graph-only neighbours are never swept in. A partial failure must not leave a searchable deleted memory.
Ingestion, embedding, maintenance, and retention work through memory_jobs rows with attempts, backoff, claim, done/dead status, and stale-job recovery. This is a real SQLite queue, not a fake "job created" response. Failed jobs dead-letter with their error instead of retrying forever.
Nimo is packaged as a library, not only as this repository's server. A host agent can use it without adopting the agent loop, the model registry, or the UI.
| Property | Why it matters |
|---|---|
| Persistent, structured memory | Decisions, preferences, facts, events, procedures, and goals survive restarts and model changes. |
| Evidence and audit | Every memory can be traced to an experience and a quote. Mutations are audited. |
| Owner isolation | The host supplies the identity; the model cannot forge it. Concurrent requests do not share AsyncLocalStorage state. |
| Mode-aware tools | Read-only, read/write, and destructive capabilities are separated into distinct tool sets. |
| Read-only recall | Retrieval cannot silently reinforce a belief. |
| Safe forgetting | Deletion is a graph-wide operation with a verification step. |
| No external services | SQLite + deterministic arithmetic. No vector database, embedding API, Redis, or GPU. |
| Portable | PAME_DB_PATH / PAME_DATA_DIR / ~/.nimo defaults; clean reopen. |
| Agent-agnostic | The public surface is typed functions and AI-SDK tools, not a specific model or UI. |
| Procedural learning | Tool-using turns can become skills with outcomes, not just chat history. |
The host must do two things: establish a request context and choose a tool set.
import {
memoryService,
memoryReadTools,
memoryWriteTools,
memoryDestructiveTools,
buildMemoryContext,
runWithMemoryContext,
} from "@workspace/memory";
// 1. The host authenticates the user and supplies the owner.
await runWithMemoryContext(
{ ownerId: authenticatedUserId, mode: "Auto", destructiveConfirmed: false },
async () => {
// 2. Build a compact prompt block from relevant memory.
const ctx = buildMemoryContext(authenticatedUserId, userPrompt);
// 3. Give the model only the capabilities this mode allows.
const tools = {
...memoryReadTools,
...memoryWriteTools,
// ...memoryDestructiveTools, only when the host supports confirmation
};
// 4. Call the model with the memory block and tools.
const result = await generateText({ model, system: ctx.promptBlock, prompt: userPrompt, tools });
// 5. Preserve the turn. This is separate from model-callable writes.
memoryService.remember({
ownerId: authenticatedUserId,
content: userPrompt,
type: "message",
role: "user",
});
return result;
},
);The exact imports and tool names are stable; the host is free to wrap them, rename them, or expose only a subset.
- Coding agent — remembers architectural decisions, rejected approaches, project conventions, and recurring test commands. The upgraded tool layer lets it read, search, edit, run, and verify code in the workspace.
- Research assistant — retains sourced claims, contradictions, and open questions; distinguishes evidence from inference.
- Support agent — remembers a customer's preferences and prior resolutions, while enforcing owner isolation and safe deletion.
- Robotics / simulation — stores
sensor,trajectory,hypothesis, andexperimentnodes and typedcauses/enables/observes/tests/replicatesedges. The substrate is task-agnostic; embodiment and control are not implemented. - Multi-agent system — each agent gets an owner-scoped view; shared memory requires an explicit host policy, not a model decision.
A vector bag retrieves by similarity. Nimo retrieves by similarity and structure:
- a decision can surface because it is connected to the project that depends on it;
- a contradiction can surface instead of being averaged away;
- a procedure can surface because it succeeded before, not because its wording is close;
- a deleted memory actually disappears from every derived index;
- a retrieved memory carries provenance, so the agent can say why it believes it.
This is not a claim that the graph always wins. On the current synthetic retrieval benchmark, the graph configuration ties the non-graph hybrid configuration at 100% Recall / 1.000 MRR. The graph's value is explanatory and multi-hop; the benchmark does not yet demonstrate a measurable lift on this corpus.
All numbers below were produced in isolated temporary databases on 2026-11-12. The real ~/.nimo/pame.db was not used.
| Suite | Checks | Result |
|---|---|---|
| AGI | 154 | 154/154 |
| Dreamer | 28 | 28/28 |
| Formula | 23 | 23/23 |
| Capture dedup | 7 | 7/7 |
| Evolution | 20 | 20/20 |
| Hardening | 82 | 82/82 |
| Total | 314 | 314/314 |
The hardening suite covers identity, mode permissions, secret blocking, extraction, conflicts, deletion, bulk-deletion preview, read-only recall, degree/dangling-edge repair, noise gating, truncation reporting, transactions, portability, retention, jobs, and prompt-injection fencing.
18 questions, including 2 negative questions that should return no answer.
| Configuration | Recall | MRR | No-answer accuracy |
|---|---|---|---|
| Vector only (hashed n-grams) | 88.9% | 0.747 | 0% |
| Vector + keyword + entity (RRF) | 100% | 1.000 | 100% |
| Hybrid + graph activation | 100% | 1.000 | 100% |
Interpretation: the non-vector signals matter. Vector-only retrieval misses paraphrase/lexical cases and, more importantly in this corpus, answers negative questions it should reject. Adding BM25, entity matching, and the noise gate fixes both. Graph activation does not add a measured lift on this small synthetic corpus; it remains valuable for multi-hop and explanation, but that value is not demonstrated by these numbers.
62 questions across six axes, 100% pass:
| Axis | Questions | Result |
|---|---|---|
| Memory | 12 | 100% |
| Research | 10 | 100% |
| Coding | 10 | 100% |
| Robotics | 10 | 100% |
| Adaptation | 10 | 100% |
| Forgetting | 10 | 100% |
| Total | 62 | 100% |
No-answer accuracy was 100%. The suite includes negative questions, so a system that always returns something does not pass automatically.
Shows:
- The implementation passes its own regression and hardening suites.
- Hybrid retrieval beats vector-only on the authored corpus.
- Read-only recall, secret blocking, deletion, and mode permissions are enforced in code and tested.
- The universal suite exercises memory, research, coding, robotics, adaptation, and forgetting.
Does not show:
- State-of-the-art retrieval. The corpus is synthetic and was authored alongside the system.
- Blind generalization. A blind corpus written by someone who did not build the system has not been run.
- That the graph beats a simpler baseline on real-world data. On this corpus it ties the non-graph hybrid configuration.
- That hashed n-gram embeddings are competitive with dense embeddings. They are a dependency-free stand-in.
These limitations are part of the result, not a footnote to hide.
The agent harness exposes 21 non-memory tools plus 12 memory tools (33 total in Auto). The tool layer was designed around a simple question: can an agent actually do software work — read a file, find a symbol, make a targeted edit, run the tests, start a dev server, inspect the diff, and recover from failure — without giving it an unrestricted shell?
- Safe by construction — no shell interpolation, no path traversal, no secret reads, no accidental overwrite.
- Preview before destruction — destructive tools support
dryRun; refactoring is dry-run by default. - Structured output — tools return
success,exitCode,durationMs, counts, and failure lines, not an opaque text blob. - Useful truncation — large outputs keep the tail, where build and test errors usually are.
- Atomic writes — a crash cannot leave a half-written source file.
- Mode-aware permissions — enforced at execution, not just by hiding tools from the prompt.
- Local project awareness — commands see
node_modules/.bin, sotsc,eslint, andvitestresolve like they do in an npm script.
| Tool | What it does | Safety / capability |
|---|---|---|
listFiles |
List a directory, optionally recursive | Glob filters, depth limit, size/mtime metadata, sorting, hides dotfiles by default, skips node_modules/.git/build output/symlinks/secrets |
readFile |
Read a text file | Line numbers, offset/limit paging, binary detection, byte cap, nextOffset for continuation, secrets blocked |
writeFile |
Create or overwrite a file | Creates parent directories, refuses overwrite unless overwrite=true, atomic temp-file + rename |
editFile |
Exact-string replacement | Requires a unique match by default, replaceAll for deliberate global edits, CRLF/LF adaptation, dryRun preview, atomic write |
search |
Search file contents | Plain or regex, case sensitivity, whole-word, include/exclude globs, context lines, content/files/count modes, binary/secret skipping |
deleteFile |
Delete one file | Refuses directories, symlinks, .git, secrets, memory-store files; dryRun |
mkdir |
Create a directory | Recursive, idempotent, write-permission checked |
deleteDir |
Delete a directory recursively | Cannot delete the workspace root; dryRun lists entries first |
| Tool | What it does | Notable behaviour |
|---|---|---|
runCommand |
Run an allowlisted dev command | Argv or tokenised command, no shell, local .bin on PATH, scrubbed env, capped tail output. Long-running commands return { running: true, id, pid, logFile } instead of blocking or being killed |
manageProcess |
Inspect and control background commands | list, logs (stdout/stderr tail), stop, stopAll; read-only actions work in every mode, stopping requires shell permission |
runTests |
Run the project's tests or typecheck | auto detects the package manager, the test/typecheck script, tsconfig, or a Python/Go/Rust project, and fails with a clear message when nothing is configured |
gitStatus |
Inspect git state | status, diff, diff-stat, log, show, branch; staged/ref filters; read-only |
explainFile |
Outline a source file | Imports, exports, functions, classes, methods, interfaces, types, line ranges; TypeScript/JavaScript detail, Python, generic fallback |
refactor |
Cross-file find-and-replace | Dry-run by default, glob include/exclude, per-file counts and previews, atomic writes, permission checked |
benchmark |
Time a command repeatedly | Warmup runs, mean/median/min/max/p95/stddev, failure detection |
createTool |
Create or fix a workspace tool | Writes a self-contained tools/foundry/<name>.mjs, node --check syntax gate before saving, overwrite=true to repair an existing tool, returns the existing source instead of duplicating |
listWorkspaceTools |
Discover foundry tools | Name, path, description, params, format (esm vs legacy ts), size, mtime |
callWorkspaceTool |
Execute a foundry tool | Cache-busted dynamic file:// import, JSON arguments, a ctx helper API, structured error reporting |
webFetch, extractData, and summarize provide web retrieval and extraction. They are registered as research tools and are available in all three modes. They are separate from the memory engine's governance; the agent should treat fetched content as untrusted evidence.
| Read | Write | Destructive |
|---|---|---|
recall |
remember |
forgetMemory |
getRelatedMemories |
linkMemories |
|
getMemoryHistory |
updateMemory |
|
loadSkills |
teach |
|
getRecent |
teachSkill |
|
useSkill |
| Mode | Tools | Composition |
|---|---|---|
Chat |
14 | 5 memory read + 6 memory write + 3 research |
Plan |
21 | 7 read (listFiles, readFile, search, explainFile, listWorkspaceTools, callWorkspaceTool, manageProcess) + 5 memory read + 6 memory write + 3 research |
Auto |
33 | 7 read + 11 write/code + 12 memory + 3 research |
The memory split is about destruction, not learning. Every mode can read and write memory, because remembering is how the agent learns during conversation and planning as well as execution. Only forgetMemory is destructive: it requires Auto mode and an explicit host confirmation for the turn.
- Default workspace root:
~/.nimo(os.homedir()), overridable withAGENT_WORKSPACE(orNIMO_WORKSPACE, the name used byapps/server/.env). - Paths are resolved inside the root. Traversal (
../), absolute paths outside the root, NUL bytes, and symlink escapes are rejected. .env*, private keys, credentials,.npmrc,.netrc, service-account JSON, and similar files are blocked from read and write..git, the memory store, and the database files are protected from file-tool writes.- Binary files are detected by a NUL-byte sample and are not silently decoded.
- The walker skips
node_modules,.git,dist,build,.next,.turbo,.nimo-procs, coverage, virtual environments, and other generated trees.
runCommand, runTests, gitStatus, benchmark, createTool, and manageProcess share one hardened process runner:
- Allowlisted executables — git, node, npm, pnpm, yarn, bun, tsx, tsc, vitest, jest, eslint, prettier, next, vite, turbo, esbuild, webpack, rollup, Python, uv, poetry, Go, Rust, Java, .NET, docker, sqlite3, curl, tar/zip, and a few read-only shell basics. Extend with
AGENT_SHELL_ALLOW. - No shell interpolation — commands are tokenised into an argv array.
&&,||,|,;,>,>>, and<as standalone tokens are rejected. Use the dedicated search/read/write tools instead of pipelines. - Windows
.cmdshims — the runner resolves the absolute executable path and passes it tocmd.exe, so npm/pnpm shims keep their%~dp0install directory. Environment-variable expansion (%VAR%), literal quotes, NUL, and line breaks are rejected. - Scrubbed environment — API keys and credentials never reach child processes. Only PATH, home directories, temp, locale, and similar non-secret variables are kept.
- Deterministic output —
CI=1,NO_COLOR=1,FORCE_COLOR=0,GIT_PAGER=cat,PAGER=cat. - Bounded output — per-stream byte caps keep the tail, preserving the part where errors usually appear.
Long-running commands are handled explicitly, because a dev server never exits:
runCommandwaits up towaitMs(default 15s). If the command is still running it returns{ running: true, id, pid, logFile }and leaves it running instead of blocking the agent or killing the server it just started.background: true(orwaitMs: 0) detaches immediately.timeoutMsstill kills the process tree, but only applies whenwaitMsis omitted.- An identical command (same normalized argv + cwd) that is already running is reused, so the agent cannot spawn duplicate servers. The result carries
reused: trueand the sameid. manageProcessreads the captured output (list,logs), which is how the agent learns the port/URL or the crash reason without re-running anything, and stops the tree when done (stop,stopAll).- State is mirrored to
<workspace>/.nimo-procs/<id>.{json,out.log,err.log}, so processes and their logs remain inspectable after an API restart. The directory is skipped by the file walker.
Filesystem writes and shell execution are gated by the request-scoped mode:
// packages/agents/src/tools/shared/permissions.ts
canWriteFiles() // AGENT_ALLOW_WRITE=true OR active mode === "Auto"
canRunShell() // AGENT_ALLOW_SHELL=true OR active mode === "Auto"The mode comes from the memory runtime context established by runAgent(). AGENT_ALLOW_WRITE and AGENT_ALLOW_SHELL remain explicit overrides for CLI or test runs where no agent context exists. Tools call assertCanWrite() / assertCanRunShell() at execution time, so a model cannot talk its way into a write by pretending to be in Auto mode.
createTool writes a self-contained ES module under <workspace>/tools/foundry/<name>.mjs. listWorkspaceTools discovers it; callWorkspaceTool imports it through a cache-busted pathToFileURL() (required on Windows) and calls its default export.
The contract is deliberately small so the model can get it right in one shot:
// description: what it does
export default async function run(args = {}, ctx) {
// ctx.workspaceRoot absolute workspace path
// ctx.resolve(rel) async -> absolute path inside the workspace (throws on escape)
// ctx.exists(rel) / ctx.readText(rel) / ctx.readJson(rel)
// ctx.writeText(rel, content) async, requires write permission
// ctx.run(argv, { cwd, timeoutMs, waitMs }) -> { ok, exitCode, stdout, stderr }
// ctx.log(message) annotate the tool result
return { ok: true };
}- Plain JavaScript only — no type annotations, no JSX, no
import type. node:builtins are allowed;child_processandprocess.exit/process.killare rejected (usectx.run, which shares the allowlist and sandbox).- The generated file is syntax-checked with
node --checkbefore it is saved, so a broken tool never replaces a working one; the compiler output is returned so the model can fix and retry. - An existing name is never silently overwritten:
createToolreturns the existing source and a hint to passoverwrite=truewith the complete corrected module. Legacy.tsfiles in the foundry directory are listed but reported as uncallable, with instructions to recreate them as.mjs.
Important boundary: foundry tools are trusted code with Node privileges. They are not executed inside a separate VM or permission sandbox. createTool validates the module shape and syntax, but a malicious tool can still do anything the agent process can do. Only create foundry tools from trusted prompts or review the generated file before calling it.
The foundry is a convenience for capturing repeated operations, not a security boundary.
- The benchmark is not blind. The retrieval and universal corpora were authored alongside the system. The numbers are regression evidence, not an independent evaluation.
- The graph does not beat the non-graph hybrid on the current corpus. Both achieve 100% Recall / 1.000 MRR. Multi-hop value is plausible and structurally supported, but not demonstrated here.
- Embeddings are hashed char n-grams, not dense vectors. They are deterministic and dependency-free. A dense embedding model would likely improve paraphrase retrieval, at the cost of an external service or model download.
- Conflict detection is heuristic. Nuanced prose contradictions can be missed. There is no NLI judge.
- Evolution is conservative, not fully autonomous. Supersession requires an explicit correction or verified replacement. Some phrasings will not trigger it.
- PAME does not implement authentication. It consumes an identity supplied by the host.
PAME_MULTI_USER=truemakes a missing identity a hard denial, but login, sessions, and token verification are the host's responsibility. - The tool sandbox is not a VM. It blocks traversal, secrets, shell metacharacters, and dangerous commands, but the workspace and its package scripts are trusted code. Do not run it against an untrusted repository.
- Foundry tools are trusted code.
callWorkspaceToolruns them with full Node privileges. - Robotics is a substrate, not a robot.
sensor,trajectory,hypothesis, andexperimentnodes exist; there is no simulator, controller, or physical embodiment. - Working memory is approximate. There is no dedicated working-memory type; ephemeral retention plus recent experiences approximate it.
- No concurrency stress test. SQLite serialises writes in this single-process design, but an explicit two-writer timestamp test is not present.
- No dashboard. Jobs, audit, and revisions are observable through the database and tests, not through an operations UI.
# Install
pnpm install
# Typecheck all packages
pnpm typecheck
# Memory suites (AGI, Dreamer, Formula, Capture, Evolution, Hardening, retrieval)
pnpm --filter @workspace/memory test:all
# Universal 6-axis suite
pnpm --filter @workspace/memory test:universal
# Individual suites
pnpm --filter @workspace/memory test
pnpm --filter @workspace/memory test:dreamer
pnpm --filter @workspace/memory test:formula
pnpm --filter @workspace/memory test:capture
pnpm --filter @workspace/memory test:evolve
pnpm --filter @workspace/memory test:hardening
pnpm --filter @workspace/memory test:benchmarkTests use isolated temporary databases. They must never touch the real ~/.nimo/pame.db.
To point a manual run at a disposable workspace and database:
AGENT_WORKSPACE=.tmp/pame-test \
PAME_DB_PATH=.tmp/pame-test/pame.db \
pnpm --filter @workspace/server dev| Tool | Version | Notes |
|---|---|---|
| Node.js | >=20.9.0 |
engines in root package.json |
| pnpm | 11.25.0 |
packageManager in root package.json |
| Bun | >=1.3.0 |
Only for the CLI (apps/cli) |
pnpm install
pnpm build # turbo build
pnpm dev # turbo dev
pnpm lint
pnpm typecheckThe server validates its environment with Zod at startup (apps/server/src/lib/env.ts). Create apps/server/.env:
# Required: one of the model IDs in packages/agents/src/models/registry.ts
AI_MODEL=anthropic/claude-sonnet-4-5
# Provider key(s) — set only the one(s) you use
ANTHROPIC_API_KEY=
GOOGLE_GENERATIVE_AI_API_KEY=
OPENAI_API_KEY=
DEEPSEEK_API_KEY=
GROQ_API_KEY=
NVIDIA_API_KEY=
OPENROUTER_API_KEY=
# Ollama (local) needs no key
# Optional server
PORT=4000
HOST=127.0.0.1| Variable | Required | Default | Notes |
|---|---|---|---|
AI_MODEL |
Yes | — | Model used when a request omits modelId |
PORT |
No | 4000 |
Server port |
HOST |
No | 127.0.0.1 |
Server host |
| provider keys | If used | — | Only the provider you use |
PAME_OWNER_ID |
No | local |
Local-dev owner scope |
AGENT_WORKSPACE |
No | ~/.nimo |
Workspace root; also used for the default DB root. NIMO_WORKSPACE is an accepted alias |
PAME_DATA_DIR |
No | — | Fallback DB root |
PAME_DB_PATH |
No | <root>/pame.db |
Exact database file |
PAME_MULTI_USER |
No | unset | Set true to require an authenticated owner |
AGENT_ALLOW_WRITE |
No | unset | Force-enable file writes outside Auto mode |
AGENT_ALLOW_SHELL |
No | unset | Force-enable shell tools outside Auto mode |
AGENT_SHELL_ALLOW |
No | unset | Comma-separated extra allowlisted executables |
Supported model IDs are defined in packages/agents/src/models/registry.ts. Effort levels: none | low | medium | high.
pnpm --filter @workspace/server dev
# http://127.0.0.1:4000
pnpm --filter @workspace/server build
pnpm --filter @workspace/server startEndpoints:
GET /health— liveness and service name.POST /agent— run the agent.
curl -X POST http://127.0.0.1:4000/agent \
-H "Content-Type: application/json" \
-d '{"prompt":"Fix the failing test","mode":"Auto","effort":"medium"}'| Field | Type | Required | Notes |
|---|---|---|---|
prompt |
string (1–10000 chars) | Yes | |
mode |
"Chat" | "Plan" | "Auto" |
No | Default "Chat" |
modelId |
ModelId |
No | Defaults to AI_MODEL |
effort |
"none" | "low" | "medium" | "high" |
No | Default "medium" |
Response:
{ "success": true, "result": { "text": "...", "usage": { "inputTokens": 0, "outputTokens": 0 } } }Errors return { "success": false, "error": "..." } with 400 (invalid request / model not configured) or 500 (provider / execution error).
- CLI (
apps/cli) — OpenTUI terminal UI, run withpnpm --filter @workspace/cli dev(Bun). The UI shell renders, but the send path is not wired torunAgent()yet. - Web (
apps/web) — Vite + React starter shell. It is not yet wired to the agent API. - Server is the complete, working entrypoint.
The launcher configures and runs the stack:
nimo setup # write ~/.nimo/server.env + apps/server/.env (JWT_SECRET, MONGODB_URI, provider keys)
nimo doctor # check runtime, configuration, and API health
nimo # start the API if needed, then open the chat
nimo api # only the API
nimo dashboard # API + web dashboardnimo setup is safe to re-run: --check reports missing values without writing,
--yes reads values from the environment instead of prompting, and --force
rotates JWT_SECRET. Existing values are shown during setup — the full MongoDB
URI, the model, the port, and a masked preview of each provider key — and are
kept when you press Enter, so re-running it never overwrites a working
configuration by accident. Configuration lives in ~/.nimo/server.env (mode
0600, override with NIMO_SERVER_ENV) so it survives updates to an installed
CLI. From a source checkout, setup also writes the server's own
apps/server/.env so running the API directly from apps/server sees the same
values.
First run. When Nimo has never been configured, nimo offers the setup
wizard before the chat opens: answer the MongoDB URI, the port, and one
provider key, and the API starts with them. Answer n to skip — the chat
still opens, and /setup is there when you are ready. The wizard is skipped
when NIMO_API_URL points at a hosted API, because that install brings its own
configuration.
Inside the chat. The same configuration is editable without leaving the terminal:
| Command | What it does |
|---|---|
/models |
Pick the model that answers; only configured models are offered. |
/setup |
Edit the database URI, the port, the provider keys, and the model. |
/doctor |
The same report nimo doctor prints, for runtime, configuration, and API health. |
If the saved model is no longer runnable — its provider key was removed, or the model was renamed — the chat switches to the first configured model and tells you which one it picked.
apps/
cli/ # OpenTUI terminal UI (@workspace/cli)
server/ # Express API wrapping runAgent() (@workspace/server)
web/ # Vite + React app (web)
packages/
agents/ # runAgent() runtime, models, and the tool layer
memory/ # PAME memory engine, storage, retrieval, governance, workers
ui/ # Shared UI components (@workspace/ui)
eslint-config/
typescript-config/
Memory internals (packages/memory/src/):
domain/ pure types; no DB, HTTP, or SDK imports
storage/ SQLite schema, repositories, indexes
retrieval/ search, rank, rrf, activate, embed, assemble
ingestion/ capture, consolidate, extract, ingest, validate
graph/ link, traverse, evolve, conflict, planner
skills/ distill, bandit, compose
governance/ policy, forget, audit
workers/ dreamer, ingestion, maintenance, curiosity
evals/ retrieval benchmark, universal benchmark
The research lab lives in packages/memory/nimo/: neurons/, synapses/, cortex/, learning/, recall/, skills/, memory-arena/, papers/, experiments/, and benchmarks/.
| Component | Status | Notes |
|---|---|---|
| Memory engine (PAME) | Implemented and verified | SQLite, hybrid retrieval, governance, deletion, jobs, skills; 314/314 checks |
| Retrieval benchmark | Implemented, limited | 18 questions; synthetic, not blind |
| Universal benchmark | Implemented, limited | 62 questions / 6 axes; 100%; synthetic, not blind |
| Server | Working entrypoint | Express API, POST /agent |
| Agent tool layer | Upgraded | 21 non-memory tools + 12 memory tools; sandboxed file/process execution, background processes with logs, self-checking tool foundry |
| CLI | Scaffold | UI shell; send path not wired |
| Web | Scaffold | Vite + React shell; not wired |
| Dense embeddings / reranker / graph DB | Unsupported | Deliberately out of scope |
| Authentication | Host responsibility | PAME consumes host-provided identity |
| Robotics embodiment | Substrate only | Typed nodes/edges; no simulator or controller |
Project note. See note.md for the project's purpose, what is and is not finished, the current development priorities, and the long-term direction. It is the short, honest companion to this document: Nimo is still an experimental, incomplete project.
Contributing. See CONTRIBUTING.md for development setup and the pull-request process. Because the project is experimental, expect breaking changes between commits and open an issue before starting anything substantial. The CLI actually lives in apps/cli; use pnpm --filter @workspace/cli dev (the contributor guide may mention an older path).
Security. Please report vulnerabilities privately. See SECURITY.md. Do not run the agent against untrusted repositories: the tool sandbox prevents traversal and shell injection, but package scripts, foundry tools, and checked-out code are trusted code with process privileges.
License. MIT — © 2026 Himanshu Arodia. See LICENSE for the full text.
