trailmem

A guide for Trailmem, a local memory system that stores linked information in SQLite and provides tools for saving and recalling it.

In plain words
What is it for?
Use it when querying, displaying, editing, archiving, or storing persistent project memories with Trailmem.
Why use it?
It explains when to load existing project knowledge, how to scope memories, and what durable information to save between sessions.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/amitnextech/trailmem/skill
Any agent
npx skills add amitnexTech/trailmem --skill skill
Clone the repo
git clone --depth 1 https://github.com/amitnexTech/trailmem

Made for: Claude Code, Codex.

Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,237 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00069 $0.01237
Opus 5 $0.00034 $0.00619
Sonnet 5 $0.00014 $0.00247
Haiku 4.5 $0.00007 $0.00124

Measured 2d ago against content hash adcdb4b09e44, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

trailmem scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

trailmem/skill/SKILL.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

trailmem — tool usage

Local-first, graph-linked persistent memory (MCP server, SQLite). Six tools. This skill is the usage reference — never read trailmem's source code to figure out a parameter; everything an agent needs is here or in the tool docstrings.

Session workflow

  1. Start: if a trailmem briefing (pinned rules / recent activity block) is already in your context, do NOT call trailmem_welcome — a hook injected it. Otherwise call it once.
  2. During: query before assuming (trailmem_query), read in full with trailmem_show before editing.
  3. End: store this session's durable decisions/lessons/tasks with trailmem_store. Never store filler or session noise.

Parameter rules (the ones agents get wrong)

  • project — OMIT it. The server auto-fills the absolute path from its working directory. Pass "global" only for cross-project memories (tool preferences, workflow rules). Pass an absolute path only to target a different project. Bare names like "myproject" are rejected.
  • agent_type — OMIT it. Attribution comes from TRAILMEM_AGENT_TYPE pinned in the host's MCP config entry. Pass it explicitly only if store rejects with "agent_type could not be determined".
  • session_id — OMIT it on integrated hosts. For an unsupported host, set TRAILMEM_SESSION_ID or pass its stable session ID explicitly. Never use a PID; without a real ID TrailMem intentionally runs stateless.
  • session_context — host adapters may inject this versioned object into every TrailMem call. Do not construct or modify it manually. When present it is authoritative for agent, session, and project; legacy identity arguments cannot override it.
  • code_files / doc_files — BOTH are REQUIRED, comma-separated paths: code_files = source/config files the memory touches, doc_files = docs/spec pages. Pass the literal 'none' when the memory genuinely touches no files of that kind — an omitted field is rejected. List the files you actually edited this session; don't lazily write 'none'.
  • content — English only. 50+ chars. Detailed prose beats terse bullets.
  • title — 3–60 chars.
  • event_type — required on store:
    • decision — rules, tool choices, structure, enforced behavior
    • lesson — bugs/mistakes learned (include root cause)
    • error_pattern — things that failed and how they fail
    • task — pending work
    • constraint — hard rules (auto-surfaced in every welcome — use sparingly)
    • user_preference — personal choices only. Singleton: exactly one active global record exists — never store a new one, merge into the existing record via trailmem_edit (a new store returns blocked_singleton with the existing id; force=true does not bypass it)
    • session_summary, memory — summaries / plain facts

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 94 lines · 69 tokens per session scan A adcdb4b09e44

Subscribe to this mod's changes

trailmem is a skill published in the GitHub repository amitnexTech/trailmem (1 stars, last pushed 1mo ago), licensed MIT. It adds 69 tokens to every session and 1,237 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

shodh-memory

Persistent memory system for AI agents. Use this skill to remember context across conversations, recall relevant information, and build long-term knowledge. Activate when you need to store decisions, learnings, errors, or context that should persist beyond the current session.

varun29ankuS/shodh-memory · 53 tokens

uteke-memory

Persistent memory engine for AI agents via the uteke CLI — remember, recall, search, forget with semantic + FTS5 hybrid search, documents, knowledge graph, rooms, tiered memory, and multi-agent namespaces.

codecoradev/uteke · 44 tokens

gno

Search local documents, files, notes, and knowledge bases. Index directories, search with BM25/vector/hybrid, get AI answers with citations. Use when user wants to search files, find documents, query notes, look up information in local folders, index a directory, set up document search, build a knowledge base, needs…

gmickel/gno · 86 tokens

remnic-entities

Browse entities in the Remnic knowledge graph and surface their facts and relationships. Trigger phrases include "tell me about the entity", "look up", "what do we know about".

joshuaswarren/remnic · 41 tokens

remnic-recall

Search Remnic memories by natural-language query. Trigger phrases include "what do you remember about", "recall anything on", "have we discussed".

joshuaswarren/remnic · 35 tokens

remnic-remember

Store a durable memory in Remnic so every connected agent can recall it. Trigger phrases include "remember this", "save this for later", "add a note that".

joshuaswarren/remnic · 39 tokens