### Quickstart: Install and run Fidelis Memory Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md One-time setup: install Ollama and pull the embedder, then install Fidelis Memory, initialize the service, watch a directory, and run the MCP server over stdio. Restart your agent client after running these commands. ```bash # 0. one-time: Ollama + the local embedder (~280 MB) brew install ollama && ollama serve & ollama pull nomic-embed-text # 1. install Fidelis Memory from PyPI python3 -m pip install "fidelis-memory==0.1.0" fidelis init # background service (launchd / systemd) fidelis watch ~/notes # auto-ingests markdown fidelis mcp install --client codex # or omit for Claude Code fidelis mcp serve # runs the MCP server over stdio # Restart your agent client. Memory is on. ``` -------------------------------- ### Install dev dependencies and run tests Source: https://github.com/hermes-labs-ai/fidelis/blob/main/CONTRIBUTING.md Install the package in editable mode with dev dependencies and run the test suite verbosely. Tests in tests/ are server-free and do not require Ollama or ChromaDB. ```bash pip install -e ".[dev]" python -m pytest tests/ -v ``` -------------------------------- ### Install and configure Fidelis Memory via CLI Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Install the fidelis-memory package and run the CLI commands to initialize the service, watch a notes directory, and install MCP integrations for various clients. The final comment reminds to restart Claude Code after setup. ```bash python3 -m pip install "fidelis-memory==0.1.0" fidelis init # installs + starts the service (launchd/systemd) fidelis watch ~/notes # auto-ingests markdown/text, polls for new files fidelis mcp install # wires Claude Code MCP integration fidelis mcp install --client codex # wires Codex MCP integration fidelis mcp install --client copilot # wires GitHub Copilot CLI MCP integration fidelis mcp install --client gemini # wires Gemini CLI via `gemini mcp add` fidelis mcp install --client openclaw # wires OpenClaw via `openclaw mcp add` # Done. Restart Claude Code. Memory is on. ``` -------------------------------- ### Start the Fidelis server Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Start the Fidelis server using the fidelis-server command or the fidelis server alias. ```bash fidelis-server # or: fidelis server ``` -------------------------------- ### Install Gemini CLI extension Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Install the native v0.1.0 Gemini CLI extension after local prerequisites and 'fidelis init'. The extension launches the released MCP package through uvx and includes the GEMINI.md context file. ```bash gemini extensions install https://github.com/hermes-labs-ai/fidelis --ref=v0.1.0 ``` -------------------------------- ### Install Ollama and pull nomic-embed-text Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Installs Ollama via Homebrew, starts the server in the background, and pulls the nomic-embed-text model (~280 MB). Required before running any Fidelis command. ```bash brew install ollama && ollama serve & ollama pull nomic-embed-text # ~280 MB, one-time ``` -------------------------------- ### Install and uninstall fidelis MCP for GitHub Copilot (bash) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Commands to install, verify, and uninstall the fidelis MCP server for GitHub Copilot CLI. The install writes to ~/.copilot/mcp-config.json atomically, backing up existing files. Use --settings to target a different config file. The copilot binary is not required at install time; the equivalent registration is shown. Copilot does not expose a hook, so recall happens via the fidelis_recall, fidelis_orient, or fidelis_health tools. ```bash fidelis mcp install --client copilot # writes ~/.copilot/mcp-config.json copilot # restart, then /mcp list shows "fidelis" # /mcp show fidelis lists its tools fidelis mcp uninstall --client copilot # removes only the fidelis entry ``` -------------------------------- ### Install and manage Gemini CLI extension Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Installs the Fidelis Gemini CLI extension, lists it, and uninstalls it. Requires uv on PATH and a running Fidelis server; the first launch may show Disconnected due to a 5-second timeout, so warm the cache with uvx --from fidelis-memory==0.1.0 fidelis --help. ```bash gemini extensions install https://github.com/hermes-labs-ai/fidelis gemini extensions list # fidelis, with its GEMINI.md and MCP server gemini extensions uninstall fidelis ``` -------------------------------- ### Reproduce Ollama boot dependency Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Creates a clean virtual environment, installs fidelis-memory 0.1.0, verifies the import works without Ollama, then attempts to start the server with an unreachable Ollama URL to show the boot failure. ```bash python3 -m venv /tmp/fv && source /tmp/fv/bin/activate pip install "fidelis-memory==0.1.0" python3 -c 'import fidelis; print(fidelis.__version__)' # 0.1.0 — installs and imports fine, no Ollama needed for this step COGITO_OLLAMA_URL=http://127.0.0.1:1 fidelis-server # Ollama unreachable on purpose ``` -------------------------------- ### Verify installed release and local service Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Check the installed Fidelis version and confirm the local service is healthy. Expect version 0.1.0 and a health output starting with 'status: ok | memories:'. ```bash python3 -c 'import fidelis; print(fidelis.__version__)' # expected: 0.1.0 fidelis health # expected prefix: status: ok | memories: ``` -------------------------------- ### Install fidelis-memory and configure hybrid recall environment Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Install the optional hybrid dependency and set up filter and flagship tier endpoints via environment variables. The flagship tier can auto-configure if DASHSCOPE_API_KEY is set. Then run the recall-hybrid CLI command. ```bash # Optional dependency for best BM25 fusion (zero deps fallback if absent) python3 -m pip install "fidelis-memory[hybrid]==0.1.0" # Opt-in: set a filter endpoint (any OpenAI-compatible API) export COGITO_FILTER_ENDPOINT=https://dashscope-intl.aliyuncs.com/compatible-mode/v1 export COGITO_FILTER_TOKEN=sk-your-key export COGITO_FILTER_MODEL=qwen-turbo # Optional: flagship tier (stronger model, 4x larger context window) export COGITO_FLAGSHIP_ENDPOINT=https://dashscope-intl.aliyuncs.com/compatible-mode/v1 export COGITO_FLAGSHIP_TOKEN=sk-your-key export COGITO_FLAGSHIP_MODEL=qwen-max # Or simpler — if DASHSCOPE_API_KEY is set, the flagship tier auto-configures export DASHSCOPE_API_KEY=sk-your-key fidelis recall-hybrid "auth architecture decisions" --tier filter ``` -------------------------------- ### Install fidelis-memory package Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Install the fidelis-memory package version 0.1.0 using pip. Requires Python 3 and pip. ```bash python3 -m pip install "fidelis-memory==0.1.0" ``` -------------------------------- ### Session start pattern for agent integration Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Use this pattern at the start of an agent session to load the memory snapshot into context and set up per-message querying and writing. It requires the fidelis server running locally on port 19420. ```python # 1. Load snapshot into context once at session start import urllib.request, json resp = urllib.request.urlopen("http://127.0.0.1:19420/snapshot") snapshot = json.loads(resp.read())["snapshot"] # inject snapshot into system prompt or first user message # 2. Query per-message via /recall # 3. Write new facts via /store (agent-curated) or /add (extraction) ``` -------------------------------- ### Install and manage Fidelis MCP with Gemini CLI Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Commands to install, restart, list, and uninstall the Fidelis MCP server via Gemini CLI. Requires Gemini CLI v0.1.19 or newer and an already configured auth method. The --scope project flag targets ./.gemini/settings.json instead of the default user scope. ```bash fidelis mcp install --client gemini # gemini mcp add → ~/.gemini/settings.json gemini # restart, or run /mcp reload in a live session gemini mcp list # shows "fidelis" and whether it connects fidelis mcp uninstall --client gemini # gemini mcp remove, verified ``` -------------------------------- ### GET /snapshot Source: https://github.com/hermes-labs-ai/fidelis/blob/main/agents.md Retrieves a compressed index snapshot for context injection. Returns a compressed index of approximately 741 tokens. ```APIDOC ## GET /snapshot ### Description Get compressed index for context injection. ### Method GET ### Endpoint /snapshot ### Response #### Success Response (200) - Compressed index data (~741 tokens) #### Response Example (Compressed index content) ``` -------------------------------- ### Install and manage Fidelis MCP with OpenClaw Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Commands to install, reload, verify, and uninstall the Fidelis MCP server via OpenClaw's CLI. The openclaw binary is required because it owns the write to the JSON5 config. Use --settings to target a different config file. ```bash fidelis mcp install --client openclaw # openclaw mcp add fidelis --command … --arg … openclaw mcp reload # pick up the new server openclaw mcp status --verbose # confirm the saved config openclaw mcp doctor fidelis --probe # verify it connects fidelis mcp uninstall --client openclaw # removes only the fidelis entry ``` -------------------------------- ### Python API usage for recall functions Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Shows how to configure Fidelis memory and use the three recall functions: recall (two-stage), recall_b (zero-LLM), and recall_hybrid (BM25+dense+RRF+tiered LLM). The example prints the method returned and assumes a loaded config with user_id. ```python from fidelis.recall import recall from fidelis.recall_b import recall_b from fidelis.recall_hybrid import recall_hybrid from fidelis.config import load, mem0_config from mem0 import Memory cfg = load() # reads .cogito.json + env vars memory = Memory.from_config(mem0_config(cfg)) # Two-stage recall (recommended default) memories, method = recall(memory, "auth architecture", user_id=cfg["user_id"], cfg=cfg) for m in memories: print(m["text"]) # verbatim stored text, never rephrased # Zero-LLM recall (fast path) memories, method = recall_b(memory, "auth architecture", user_id=cfg["user_id"], cfg=cfg) # Hybrid recall (BM25 + dense + RRF + tiered LLM; 96.4% R@1 on LongMemEval_S) memories, method = recall_hybrid( memory, "auth architecture", user_id=cfg["user_id"], cfg=cfg, tier="filter", # "zero_llm" | "filter" | "flagship" ) print(method) # e.g. "filter", "decompose_4_v", "hybrid_12_bm25|filter" ``` -------------------------------- ### Structured Atomic Data Example (JSON blob) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/GENERALIZABILITY_SKEPTIC.md Example of a structured memory that breaks both retrieval paths. Path A treats it as unstructured text, and Path B's BM25+dense hybrid tokenizes keys/values separately, hurting match quality. This is a test case for the dispatcher's lack of handling for structured data. ```json {"auth_flow": "JWT→session", "ttl_sec": 3600, "rotation_policy": "on_login"} ``` -------------------------------- ### Example output of regrade summary Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/REGRADE_README.md Shows the printed summary after running the regrade script. It includes total entries, original vs regraded accuracy, delta, improved/degraded counts, grading method breakdown, and per-category accuracy. ```text ====================================================================== REGRADE SUMMARY ====================================================================== Total entries: 8 Original accuracy: 1/8 (12.5%) Regraded accuracy: 2/8 (25.0%) Delta: +12.5% Improved: 1, Degraded: 0 Grading methods: exact: 6 (75.0%) llm: 2 (25.0%) By category: single-session-preference: total: 8 original: 12.5% (1/8) regraded: 25.0% (2/8) ``` -------------------------------- ### Python helper for direct Fidelis integration Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Python example using the augment function from fidelis.augment with an Anthropic Claude model. Requires the anthropic package and a configured client; the llm_call lambda must return the text content from the model response. ```python from fidelis.augment import augment from anthropic import Anthropic client = Anthropic() answer = augment( question="What did I say about Sarah?", qtype="single-session-user", llm_call=lambda system, user: client.messages.create( model="claude-haiku-4-5", # any current Claude Messages model works system=system, messages=[{"role": "user", "content": user}], max_tokens=512, ).content[0].text, ) ``` -------------------------------- ### Install Claude Code session ingestion (no new dependencies) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md No new dependencies are required for Claude Code session ingestion; it uses existing chromadb and Ollama (nomic-embed-text). ```bash # No new dependencies — uses existing chromadb + Ollama (nomic-embed-text) ``` -------------------------------- ### Legacy Compatibility Warning Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/DISPATCHER_DESIGN.md The warning message displayed on server start when a legacy single-collection store is detected. ```text [cogito] Legacy single-collection store detected. Running in compatibility mode. Run `cogito migrate-dispatch` to split into typed indexes. ``` -------------------------------- ### GET /snapshot Source: https://github.com/hermes-labs-ai/fidelis/blob/main/llms.txt Retrieves the generated snapshot of the corpus. ```APIDOC ## GET /snapshot ### Description Returns the current snapshot as structured markdown. Returns 404 if the snapshot has not been built. ### Method GET ### Endpoint /snapshot ### Response #### Success Response (200) - **snapshot** (string) - The snapshot content in markdown format - **path** (string) - File path where the snapshot is stored #### Response Example { "snapshot": "# Snapshot\n...", "path": "/path/to/snapshot.md" } #### Error Response (404) - **error** (string) - Snapshot not built ``` -------------------------------- ### GET /health Source: https://github.com/hermes-labs-ai/fidelis/blob/main/agents.md Checks server status, memory count, calibration state, and queue depth. Returns a JSON object with status, count, queued, version, calibrated, and snapshot fields. ```APIDOC ## GET /health ### Description Check server status, memory count, calibration state, and queue depth. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - Server status - **count** (integer) - Memory count - **queued** (integer) - Queue depth - **version** (string) - Server version - **calibrated** (boolean) - Calibration state - **snapshot** (boolean) - Snapshot availability #### Response Example { "status": "ok", "count": 1484, "queued": 0, "version": "0.0.9", "calibrated": true, "snapshot": true } ``` -------------------------------- ### Use augment() for programmatic memory retrieval Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Use the augment() function from the fidelis.augment module to retrieve memory and invoke an LLM in one call. The example passes a question, a query type, and a lambda that calls the Anthropic API with the claude-opus-4-5 model. ```python from fidelis.augment import augment from anthropic import Anthropic client = Anthropic() answer = augment( question="What did I say about Sarah?", qtype="single-session-user", llm_call=lambda system, user: client.messages.create( model="claude-opus-4-5", system=system, messages=[{"role": "user", "content": user}], max_tokens=512, ).content[0].text, ) ``` -------------------------------- ### Run MCP server via uvx from PyPI Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Launch the MCP stdio process directly from PyPI using uvx. Run 'fidelis init' first if the local Fidelis service and store are not already configured. ```bash uvx --from "fidelis-memory==0.1.0" fidelis mcp serve ``` -------------------------------- ### Recommended scaffold for qtype=knowledge-update Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_results.md Recommended scaffold for knowledge-update qtype is s0-minimal-baseline, which fixed 2 out of 2 failures. ```text qtype=knowledge-update → s0-minimal-baseline (2/2 failures fixed) ``` -------------------------------- ### Recommended scaffold for qtype=multi-session Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_results.md Recommended scaffold for multi-session qtype is s0-minimal-baseline, which fixed 1 out of 2 failures. ```text qtype=multi-session → s0-minimal-baseline (1/2 failures fixed) ``` -------------------------------- ### Recommended scaffold for qtype=single-session-preference Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_results.md Recommended scaffold for single-session-preference qtype is s1-temporal-sysprefix, which fixed 3 out of 3 failures. ```text qtype=single-session-preference → s1-temporal-sysprefix (3/3 failures fixed) ``` -------------------------------- ### Recommended scaffold for qtype=single-session-assistant Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_results.md Recommended scaffold for single-session-assistant qtype is s1-temporal-sysprefix, which fixed 1 out of 1 failures. ```text qtype=single-session-assistant → s1-temporal-sysprefix (1/1 failures fixed) ``` -------------------------------- ### GET /health Source: https://github.com/hermes-labs-ai/fidelis/blob/main/llms.txt Health check endpoint for the Fidelis server. ```APIDOC ## GET /health ### Description Returns the current health status of the Fidelis server, including version, calibration state, and snapshot availability. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - Overall server status - **count** (integer) - Number of stored memories - **queued** (integer) - Number of items in the graceful-degradation queue - **version** (string) - Server version - **calibrated** (boolean) - Whether vocabulary calibration has been performed - **snapshot** (boolean) - Whether a snapshot has been built #### Response Example { "status": "ok", "count": 123, "queued": 0, "version": "1.0.0", "calibrated": true, "snapshot": true } ``` -------------------------------- ### Run QA eval with OpenAI backend Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/RESULTS-SUMMARY.md Run the QA evaluation with OpenAI backend using gpt-4o-mini for a fair comparison with Mastra. Requires an OpenAI API key and the LongMemEval data directory. Estimated cost is ~$1.24 for the full 470-question evaluation. ```bash OPENAI_API_KEY=sk-... python3 bench/qa_eval_v2.py \ --run-id runP-v35 --backend openai --top-k 1 \ --data-dir ~/Documents/projects/LongMemEval/data ``` -------------------------------- ### Wrap and preflight a Fidelis scaffold system prompt Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Use this to generate a scaffolded system prompt for a specific question type and verify it passes static safety checks. The scaffold is versioned, bounded to 200 tokens, and idempotent. Pass the returned `system` as the system prompt to your LLM. ```python from fidelis.scaffold import wrap_system_prompt, preflight system = wrap_system_prompt("temporal-reasoning", top_score=0.65) assert preflight(system).passed # 8 static safety checks # Hand `system` as the system prompt to your LLM (Claude / GPT / qwen-local / anything). ``` -------------------------------- ### Reproduce full pipeline with LLM filter (runP-v35) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/WRITEUP-LONGMEMEVAL-20260423.md Run the combined pipeline script with the `--filter-model qwen-turbo` flag. Requires `DASHSCOPE_API_KEY` for the LLM filter. This reproduces the reported R@1 = 96.4%. ```bash cd ~/Documents/projects/cogito-ergo python3 bench/longmemeval_combined_pipeline_v35.py \ --data-dir ~/Documents/projects/LongMemEval/data \ --run-id runP-v35-repro \ --filter-model qwen-turbo # requires DASHSCOPE_API_KEY ``` -------------------------------- ### Recommended scaffold for qtype=temporal-reasoning Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_results.md Recommended scaffold for temporal-reasoning qtype is s2-temporal-inline, which fixed 8 out of 12 failures. ```text qtype=temporal-reasoning → s2-temporal-inline (8/12 failures fixed) ``` -------------------------------- ### Optimal K Routing Configuration (JSON) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/experiments/E0-baseline/receipt.md JSON configuration specifying the optimal K value for each question type, to be used in all subsequent experiments. This routing is based on the per-qtype analysis showing K=1 is better for single-session and knowledge-update types, while K=5 is better for multi-session and temporal-reasoning. ```json { "single-session-user": 1, "single-session-assistant": 1, "single-session-preference": 1, "multi-session": 5, "temporal-reasoning": 5, "knowledge-update": 1 } ``` -------------------------------- ### Query Claude Code sessions and atomic facts with Python Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Use query_sessions to search session history only, or query_both to get atomic facts and session history side-by-side without auto-merge. Both functions are imported from fidelis.recall_sessions. ```python from fidelis.recall_sessions import query_sessions, query_both # Session history only results = query_sessions("what did we discuss about LPCI last week?", top_k=3) # Atomic facts + session history side-by-side (no auto-merge) both = query_both("fidelis architecture decisions") ``` -------------------------------- ### Run bench evaluation with python bench/eval.py Source: https://github.com/hermes-labs-ai/fidelis/blob/main/CONTRIBUTING.md Run the combined evaluation for bench cases. Bench cases are JSON files in bench/ with query, expected_ids, and optional notes. ```bash python bench/eval.py ``` -------------------------------- ### Run regrade script with DASHSCOPE_API_KEY Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/REGRADE_README.md Sets the DASHSCOPE_API_KEY environment variable and runs the regrade script on a QA evaluation JSON file. The --input flag is required and points to a qa_eval_v2_*.json file. ```bash export DASHSCOPE_API_KEY=sk-... python3 regrade_qa.py --input qa_eval_v2_runP-v35_qwen-max_top5.json ``` -------------------------------- ### Use recall_hybrid from Python Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Import the recall_hybrid function and configuration helpers, initialize the memory store, and call recall_hybrid with a query. The tier parameter controls fallback behavior: 'filter' falls back to 'zero_llm' if not configured, and 'flagship' falls back to 'filter'. ```python from fidelis.recall_hybrid import recall_hybrid from fidelis.config import load, mem0_config from mem0 import Memory cfg = load() mem = Memory.from_config(mem0_config(cfg)) hits, method = recall_hybrid(mem, "auth tokens", user_id="agent", cfg=cfg, tier="filter") ``` -------------------------------- ### Import fidelis.scaffold public API Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/scaffold.md Import the public API of the fidelis.scaffold module. The constants SCAFFOLD_VERSION, SCAFFOLD_OPEN, and SCAFFOLD_CLOSE are versioned markers; wrap_system_prompt and wrap_idempotent build scaffolds; is_scaffolded and strip_scaffold detect/remove markers; preflight and preflight_or_raise run an 8-check static validator returning a PreflightReport dataclass. ```python from fidelis.scaffold import ( SCAFFOLD_VERSION, # "v0.1.0" SCAFFOLD_OPEN, # "[FIDELIS-SCAFFOLD-v0.1.0]" SCAFFOLD_CLOSE, # "[/FIDELIS-SCAFFOLD-v0.1.0]" wrap_system_prompt, # build a scaffold for a given qtype + retrieval-confidence score wrap_idempotent, # idempotent variant: wrap(wrap(x)) == wrap(x) is_scaffolded, # detect any version of the Fidelis scaffold in arbitrary text strip_scaffold, # remove all Fidelis scaffold markers from text preflight, # 8-check static validator → PreflightReport preflight_or_raise, # raises RuntimeError on failure PreflightReport, # dataclass: .passed / .failures / .warnings / .metrics ) ``` -------------------------------- ### Run E2a ablation command for temporal reasoning Source: https://github.com/hermes-labs-ai/fidelis/blob/main/experiments/DECISIONS.md Use this command to run the E2a ablation experiment, isolating the temporal-reasoning prompt effect with gpt-4o-mini. It specifies the run ID, experiment ID, qtype, data directory, and output directory. The absence of --gpt4o-for-multi ensures gpt-4o-mini is used for TR by default. ```bash python3 bench/qa_eval_v3_routing.py \ --run-id runP-v35 \ --experiment-id E2a \ --qtypes temporal-reasoning \ --data-dir ~/Documents/projects/LongMemEval/data \ --out-dir experiments/E2a-tr-ablation ``` -------------------------------- ### SCAFFOLD_DISPATCHER configuration mapping Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/SCAFFOLD_DISPATCHER_V031.md A dictionary mapping query types to their respective scaffold strategies for runtime dispatching. ```python SCAFFOLD_DISPATCHER = { "temporal-reasoning": "s2-temporal-inline", # +8/12 on failures, inline date block in user msg "single-session-preference": "s4-declarative-preference", # +3/3 on failures, declarative-statement focus "knowledge-update": "s0-minimal-baseline", # arena: scaffolds don't help here "multi-session": "s0-minimal-baseline", # arena: all scaffolds tie at 1/2 "single-session-assistant": "s2-temporal-inline", # arena: 1/1 with s2 "single-session-user": "s0-minimal-baseline", # already 100% in runC-guard } ``` -------------------------------- ### Generalizability Scorecard (README) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/DISPATCHER_DESIGN.md Public scorecard table showing retrieval performance across workloads. Format rule: every row shows benchmark source, no aggregate, no cherry-picking. ```text COGITO RETRIEVAL SCORECARD R@1 hit@any Latency Workload /recall 75% 96% 1197ms atomic paraphrase /recall_hybrid 96.4% — 3500ms session multi-turn (runP-v35) /recall_hybrid (filter) 90%+ — 1300ms session multi-turn /recall_b 56% 96% 127ms atomic (zero-LLM) Benchmark sources: cogito 31-case eval (internal), LongMemEval_S (Xiao et al. 2024) ``` -------------------------------- ### Verify zero-LLM claim with recall-hybrid Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Unsets LLM API keys, optionally drops network, then runs the recall-hybrid command with the zero_llm tier and tails the server log. The zero_llm tier never makes an outbound LLM call; optional filter and flagship tiers call an LLM only to select integer pointers. ```bash # Unset any LLM API keys for this shell unset OPENAI_API_KEY ANTHROPIC_API_KEY DASHSCOPE_API_KEY # Optional: drop your network. Ollama runs on 127.0.0.1:11434 (loopback). # `recall-hybrid` is the explicit-tier command. zero_llm is the default. fidelis recall-hybrid "what did the user say about Sarah" --tier zero_llm tail ~/.fidelis/server.log ``` -------------------------------- ### CI Regression Gates Configuration (bench/ci_gates.yaml) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/DISPATCHER_DESIGN.md YAML configuration for CI regression gates. Each gate specifies a benchmark, metric, path, floor value, and whether to block PR if below. Floors are set to current performance minus measurement noise (3pp for 31-case, 2pp for LongMemEval). A PR fails if any floor is breached. ```yaml gates: - benchmark: cogito_31case metric: recall_at_1 path: A # /recall floor: 0.72 # current 75%, allow 3pp measurement noise block_pr_if_below: true - benchmark: cogito_31case metric: recall_at_1 path: E # /recall_hybrid floor: 0.50 # current 54%; any improvement must not regress block_pr_if_below: true - benchmark: longmemeval_s metric: recall_at_1 path: hybrid_flagship floor: 0.944 # current 96.4%, allow 2pp measurement noise block_pr_if_below: true - benchmark: cogito_31case metric: hit_at_any path: E floor: 0.93 # current 96.4%; must not regress even if R@1 improves block_pr_if_below: true ``` -------------------------------- ### Lossless vs. lossy memory retrieval (text) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Shows the exact text stored in fidelis and the lossy output of other systems. Use to illustrate that fidelis returns the original notes verbatim, preserving qualifiers like 'non-configurable'. ```text auth tokens expire after 3600 seconds. The 3600s window is non-configurable in our current contract. ``` ```text authentication has a configurable timeout ``` ```text auth tokens expire after 3600 seconds. The 3600s window is non-configurable in our current contract. ``` -------------------------------- ### First recall via CLI Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Perform a first recall query using the fidelis recall command with a natural language question. ```bash fidelis recall "what did we decide about the auth architecture" ``` -------------------------------- ### POST /add Source: https://github.com/hermes-labs-ai/fidelis/blob/main/agents.md Writes via mem0 extraction LLM (for raw/unstructured text). Accepts raw text and returns the count and extracted memories. ```APIDOC ## POST /add ### Description Write via mem0 extraction LLM (for raw/unstructured text). ### Method POST ### Endpoint /add ### Parameters #### Request Body - **text** (string) - Required - Raw unstructured text for extraction ### Request Example { "text": "raw unstructured text for extraction" } ### Response #### Success Response (200) - **count** (integer) - Number of extracted memories - **memories** (array) - List of extracted memory texts #### Response Example { "count": 3, "memories": [ "fact 1", "fact 2", "fact 3" ] } ``` -------------------------------- ### Dual Reporting Output Format for cogito bench Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/DISPATCHER_DESIGN.md Required output format for every 'cogito bench' run. It shows a workload coverage matrix with Path A and Path B recall metrics for each benchmark. Cells for unrun benchmarks must show '[skipped]' instead of being blank, and any regression must be acknowledged with a comment in the PR. ```text WORKLOAD COVERAGE MATRIX /recall (Path A) /recall_hybrid (Path B) cogito 31-case R@1 75% 54% cogito 31-case hit@any 96% 96% LongMemEval_S R@1 [not measured] 96.4% (runP-v35) LOCOMO R@1 [pending] [pending] MemoryBench R@1 [pending] [pending] ``` -------------------------------- ### Variant 3: Inline Temporal Context (Replace System-Prefix) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/sweep_underperformance_diagnosis.md Shows the format for inlining temporal context directly into candidate text, integrating dates rather than using a separate scaffold block. Expected gain: +1.0pp. ```text Candidate memories (with temporal context): [1] [2023/05/20] [2] [2023/06/15] [3] [2023/08/02] ``` -------------------------------- ### SCAFFOLD_DISPATCHER configuration (unchanged from R1) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_round2_results.md Defines the dispatcher mapping categories to scaffold names with comments explaining choices. Use as the canonical dispatcher configuration; no R2 scaffold replaces it. ```python SCAFFOLD_DISPATCHER = { # R1 winners unchanged — no R2 scaffold beats them per category "knowledge-update": "s2-temporal-inline", # 2/2 (s2, s3, s7, s10 all tie at 2/2 — s2 chosen for temporal consistency) "multi-session": "s0-minimal-baseline", # 1/2 (ceiling hit — 6d550036 is retrieval-layer failure) "single-session-assistant": "s1-temporal-sysprefix", # 1/1 (s2s8-preference-v2 misses this category) "single-session-preference": "s1-temporal-sysprefix", # 3/3 (s2s8 also 3/3 but misses single-session-assistant) "temporal-reasoning": "s2-temporal-inline", # 8/12 (R2 best: r2s8-preference-v2 at 8/12, same score) } ``` -------------------------------- ### Verify real retrieval with a test note Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Create a test note, watch the directory once, and query for a phrase. Success is indicated when the query result contains 'Fidelis verification phrase: amber heron.'. ```bash mkdir -p /tmp/fidelis-verify printf '%s\n' 'Fidelis verification phrase: amber heron.' > /tmp/fidelis-verify/note.md fidelis watch /tmp/fidelis-verify --once fidelis query 'amber heron' # success: the result contains "Fidelis verification phrase: amber heron." ``` -------------------------------- ### SCAFFOLD_DISPATCHER configuration for v0.3.1 Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/scaffold_arena_results.md Defines the dispatcher mapping for query types to scaffold versions. Use this to select a scaffold at query-time before calling the LLM reranker. The comments indicate the number of failures fixed by each scaffold. ```python SCAFFOLD_DISPATCHER = { "knowledge-update": "s0-minimal-baseline", # 2/2 failures fixed "multi-session": "s0-minimal-baseline", # 1/2 failures fixed "single-session-assistant": "s1-temporal-sysprefix", # 1/1 failures fixed "single-session-preference": "s1-temporal-sysprefix", # 3/3 failures fixed "temporal-reasoning": "s2-temporal-inline", # 8/12 failures fixed } ``` -------------------------------- ### Variant 1: Move Scaffold into System Instruction Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/sweep_underperformance_diagnosis.md Defines a system instruction string that includes temporal weighting logic, applying it only when the query asks about timing. Expected gain: +1.5pp by fixing instruction hierarchy. ```python _FILTER_SYSTEM = ( "Execute this procedure...\n" "TEMPORAL WEIGHTING (if dates provided):\n" " If query asks about timing (before/after/when/order):\n" " Increase score for temporally-aligned candidates\n" " If query asks about counts/facts:\n" " Ignore temporal ordering; match by content\n" "..." ) ``` -------------------------------- ### Fidelis CLI quick reference commands Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Shows the primary Fidelis CLI commands: recall, query, add, health, and seed. Use these for everyday memory operations and service health checks. ```bash fidelis recall "what did the user say about Sarah" fidelis query "Sarah" --limit 5 fidelis add "raw text to extract into memories" fidelis health fidelis seed ~/memory/ ~/notes/ ``` -------------------------------- ### Calibrate for domain-specific vocabulary Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Run this command to build a plain-English to technical term bridge for your corpus. It writes a vocab_map to .cogito.json, and the server must be restarted to pick up the new vocabulary map. ```bash fidelis calibrate # reads your corpus, writes vocab_map to .cogito.json # then restart server to pick up new vocab_map ``` -------------------------------- ### Call /recall_hybrid via HTTP Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Send a POST request to the local /recall_hybrid endpoint with a JSON body containing the query text, tier, and limit. The tier can be 'filter' or 'flagship'. ```bash curl -X POST http://127.0.0.1:19420/recall_hybrid \ -H "Content-Type: application/json" \ -d '{"text": "how many auth migrations have we done", "tier": "flagship", "limit": 10}' ``` -------------------------------- ### POST /store Source: https://github.com/hermes-labs-ai/fidelis/blob/main/agents.md Writes verbatim memory (preferred write path). Accepts text and an optional id, and returns the stored id and text. ```APIDOC ## POST /store ### Description Write verbatim memory (preferred write path). ### Method POST ### Endpoint /store ### Parameters #### Request Body - **text** (string) - Required - Verbatim text to store - **id** (string) - Optional - UUID for the memory ### Request Example { "text": "verbatim text to store", "id": "" } ### Response #### Success Response (200) - **id** (string) - Stored memory ID - **text** (string) - Stored memory text #### Response Example { "id": "abc123", "text": "..." } ``` -------------------------------- ### Queue entry format Source: https://github.com/hermes-labs-ai/fidelis/blob/main/bench/REVIEW-QUEUE.md Format for each review queue entry: `- [ ] | phase-N | | `. The main session appends entries in this format, and the reviewer marks them as reviewed after auditing. ```markdown - [ ] | phase-N | | ``` -------------------------------- ### Configure filter LLM via environment variables Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Set the filter LLM configuration using environment variables. Option A uses a direct Anthropic key; Option B uses an OpenAI-compatible gateway with COGITO_FILTER_ENDPOINT, COGITO_FILTER_TOKEN, and COGITO_FILTER_MODEL. ```bash # Option A: direct Anthropic key export ANTHROPIC_API_KEY=sk-ant-... # Option B: any OpenAI-compatible gateway (local LM Studio, OpenClaw, etc.) export COGITO_FILTER_ENDPOINT=http://your-gateway/ export COGITO_FILTER_TOKEN=your-token export COGITO_FILTER_MODEL=anthropic/claude-haiku-4-5 ``` -------------------------------- ### Fidelis data flow diagram Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md ASCII diagram showing the flow from notes through local storage and retrieval to the agent. Use to understand the zero-LLM pipeline: notes → ~/.cogito/ → BM25+dense+RRF → verbatim passages → agent. ```text your notes / sessions ↓ local memory store (~/.cogito/, fully local) ↓ fidelis retrieval (BM25 + dense + RRF, no LLM) ↓ original passages (verbatim, never rephrased) ↓ Codex / Claude Code / your agent ``` -------------------------------- ### Query dispatch flow for /recall and /recall_hybrid Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/DISPATCHER_DESIGN.md Flow diagram for the query-time dispatch logic. It shows how the query type is classified and how the mem_types parameter selects between the atomic index (Path A), the session index (Path B), or both (default) with parallel fetch and score-based merge. ```text /recall (or /recall_hybrid) │ ├─ query_type = classify_query(query) [existing, from recall_hybrid.py] │ ├─ if user passes mem_types=["atomic"] → run Path A on atomic index only ├─ if user passes mem_types=["session"] → run Path B on session index only └─ if mem_types=["atomic","session"] (default) → parallel fetch from both paths → merge by score (cosine-normalized), deduplicate → return top N ``` -------------------------------- ### Current _QA_SYS_TEMPORAL guidance ending Source: https://github.com/hermes-labs-ai/fidelis/blob/main/experiments/E3-temporal-fix/PLAN.md The existing guidance text that ends the _QA_SYS_TEMPORAL prompt. It instructs the model on date format and calendar arithmetic, and forgives off-by-one errors for day counts. ```text "Guidance: Dates appear in session headers as 'YYYY/MM/DD (Day)'. " "If computing days between dates, use calendar arithmetic. " "Off-by-one is forgiven for day counts." ``` -------------------------------- ### Ollama connection error output Source: https://github.com/hermes-labs-ai/fidelis/blob/main/README.md Shows the ConnectionError raised by mem0's Ollama embedder when Ollama is unreachable, indicating the server cannot boot without it. ```text ConnectionError: Failed to connect to Ollama. Please check that Ollama is downloaded, running and accessible. https://ollama.com/download File ".../mem0/embeddings/ollama.py", line 30, in _ensure_model_exists local_models = self.client.list()["models"] ``` -------------------------------- ### Dispatcher Configuration Keys Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/DISPATCHER_DESIGN.md The JSON configuration structure for defining dispatch modes and collection names. ```json { "dispatch_mode": "auto", "atomic_collection": "cogito_memory_atomic", "session_collection": "cogito_memory_session" } ``` -------------------------------- ### POST /query Source: https://github.com/hermes-labs-ai/fidelis/blob/main/llms.txt Narrow vector search endpoint for direct similarity queries without LLM processing. ```APIDOC ## POST /query ### Description Performs a narrow vector search without any LLM involvement. Returns the most relevant memories based on vector similarity. ### Method POST ### Endpoint /query ### Parameters #### Request Body - **text** (string) - Required - The query text - **limit** (integer) - Optional - Maximum number of memories to return (default 5) ### Request Example { "text": "query", "limit": 5 } ### Response #### Success Response (200) - **memories** (array) - List of memory objects - **text** (string) - The memory text - **score** (number) - Relevance score #### Response Example { "memories": [ {"text": "...", "score": 0.95} ] } ``` -------------------------------- ### Reproduce zero-LLM stage (83.2% R@1) Source: https://github.com/hermes-labs-ai/fidelis/blob/main/WRITEUP-LONGMEMEVAL-20260423.md Run the pipeline without the LLM filter by setting the `--no-llm-filter` flag in the pipeline script, or use `bench/longmemeval_hybrid.py` directly. No API key needed. ```bash # Set --no-llm-filter flag in the pipeline script (or use bench/longmemeval_hybrid.py directly) ``` -------------------------------- ### Configure filter LLM via .cogito.json Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Alternative configuration for the filter LLM using a .cogito.json file in the working directory. Provides filter_endpoint, filter_token, and filter_model. ```json { "filter_endpoint": "http://your-gateway/", "filter_token": "your-token", "filter_model": "anthropic/claude-haiku-4-5" } ``` -------------------------------- ### First recall via curl Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Perform a first recall query using curl to POST to the /recall endpoint with a JSON body containing the text to recall. ```bash curl -X POST http://127.0.0.1:19420/recall \ -H "Content-Type: application/json" \ -d '{"text": "auth architecture decisions"}' ``` -------------------------------- ### Pull Ollama models Source: https://github.com/hermes-labs-ai/fidelis/blob/main/docs/full-reference.md Pull the required Ollama models: mistral:7b and nomic-embed-text. Requires a running Ollama instance. ```bash ollama pull mistral:7b ollama pull nomic-embed-text ```