Hermes · Ollama · RAG

AI that remembers — not amnesia on every tick

Cryptrade uses local AI (Ollama, crypto-expert-hermes) together with two persistent stores: a session tape of everything that happened, and a searchable knowledge base that grows automatically from live market conditions.

Circular diagram: live feeds, session memory, RAG knowledge store, Hermes AI, trade gates and desk output in a continuous loop

The knowledge loop runs continuously — not only when you ask a question.

Two kinds of memory

Session memory (bot-memory.jsonl)

A chronological tape of the current market session:

  • Price ticks and volatility scores
  • BUY / SELL / HOLD signals — executed or skipped
  • Intel snapshots, news hits, external RSI
  • AI assessments and trade outcomes
  • Event playbook activations

memoryBrief — the last ~24 hours compressed into text injected into every AI call.

Knowledge store (market-knowledge.jsonl)

Durable facts organized by category and tags:

  • Market regime (risk-on / risk-off patterns)
  • Scenarios (when to accumulate stables into ETH)
  • Exchange context (CEX vs DEX divergence rules)
  • News chunks from verified financial sources

knowledgeBrief — relevant chunks retrieved at decision time via RAG search.

The automatic RAG loop — five steps

1

Collect

Every few minutes, collectors write fresh snapshots into the knowledge store: intel composite, macro leadership, verified news headlines, wallet state, orderbook summary, whale bias.

2

Retrieve

When the AI advisor evaluates a signal, it searches active knowledge chunks tagged for the chain, asset, and focus (e.g. accumulation). Top matches form the knowledgeBrief.

3

Reason

Hermes reads memoryBrief + knowledgeBrief + live quote context. It returns structured bias, confidence, risk flags, and invalidation levels — stored back into session memory.

4

Digest (hourly)

digestMarketKnowledge asks Hermes: “Given everything right now, what 1–3 new facts should we remember?” Valid JSON facts upsert into RAG with TTL and confidence scores.

5

Learn from outcomes

Signal outcome tracker evaluates counterfactuals — did skipped BUY signals later look like missed opportunities? Learning briefs feed back into knowledge collection.

How knowledge drives trades

The five-step RAG loop above feeds directly into buy/sell gates. For the full decision path — retrieval scoring, Hermes assessment, gate logic, and outcome feedback — see the dedicated slide.

RAG learning & trade decisions →

What AI does — and does not do

AI is used for

  • Desk commentary and intel summaries (factual templates when AI off)
  • Optional buy/sell gate when AI_GATE_BUY enabled
  • Hourly knowledge distillation into RAG
  • US session narrative summaries

AI is not used for

  • Random trade entries without strategy signal
  • Cloud LLM calls on every websocket tick (runs local Ollama)
  • Fabricated “we are buying now” desk lines without tx hash
Live automatic mode

With AI gates disabled, Hermes still enriches desk and knowledge — but EMA dip strategy executes without waiting for LLM approval each time.

Privacy & control

Models run on your machine via Ollama. Session memory and knowledge files stay on disk under data/. You control retention, digest frequency, and whether AI can block trades.