ChainMemory

v2.10.0
io.github.chaelynet/chainmemory Checked 1 day ago Published 1 month ago

Verifiable, portable AI memory.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

chainmemory_remember

Write a permanent memory. FEE: 0.001 AIC. Auto-tags by content; importance 1-10. Use it for decisions, learnings and milestones worth keeping, not for small talk. Pass sealed:true to encrypt it in this client before sending (needs CHAINMEMORY_SEED_PHRASE): the server then stores a blob it cannot read, and the search vector is computed on this machine so the memory can still be found. NOTE ON EVIDENCE: the event_hash of a plain memory is computed when it syncs to the chain (~30 s), not at write time, so a memory written just now CANNOT yet be cited in update_project_state — that call would be…

ParameterTypeDescription
summary *stringWhat happened (will be encrypted before chain anchoring)
categorystringMemory category
contentstringOptional alias of summary. If present it OVERRIDES summary as the stored memory text. 'summary' is the required field: send it always, and use 'content' only when you need a longer body than the summa…
importanceinteger1-10 importance (default 5)
platformstringPlatform source (e.g. claude, chatgpt). Optional.
projectstringProject to file this memory under (added as first tag)
sealedbooleanEncrypt this memory in the client before sending it (blind vault). Requires CHAINMEMORY_SEED_PHRASE. The server stores a blob it cannot read. Its search vector is computed on this machine (the first t…
tagsarrayExplicit tags; auto-tagging only used as fallback

chainmemory_new_seed

Generate a fresh 12-word BIP-39 phrase for the blind vault. Created locally, never sent anywhere and never stored by this server: write it down on paper. Losing it means losing every memory sealed with it, for you and for everyone. Free, no fee.

chainmemory_open_sealed

Read a sealed memory: fetches the encrypted blob and decrypts it locally with CHAINMEMORY_SEED_PHRASE. Only works for memories sealed with that same phrase. Free, read-only.

ParameterTypeDescription
memory_id *integerMemory number to open

chainmemory_recall

Recall the user's most recent memories, newest first. Use at conversation start for continuity. IMPORTANT: this returns an 80-character PREVIEW of each memory, not the full text — to read one in full use get_memory(#N), and to find something by meaning use search_memories.

ParameterTypeDescription
countintegerNumber of memories (default 10)

search_memories

SEMANTIC search over the user's memories (cosine similarity over cached embeddings, blended with recency and importance). Returns the FULL text of each match — unlike chainmemory_recall and list_memories_filtered, which return 80-character previews. Use this whenever you need to FIND something rather than list the latest. With the blind vault configured, the query is turned into a vector on this machine and only the vector is sent, and sealed matches are decrypted here.

ParameterTypeDescription
q *stringNatural-language query. Searched semantically, not by keyword.
limitintegerMax results (default 10, server caps at 20)

get_memory

Read ONE memory in full, decrypted from chain, with an integrity check: the server recomputes the event_hash from the plaintext and compares it against the hash anchored on-chain. Use it when a preview is not enough, or to prove a specific memory has not been altered. Requires the memory to be anchored already (freshly written memories anchor in ~30s).

ParameterTypeDescription
memory_number *integerYour memory number — the #N shown by recall/remember. Not a global id.

get_memory_proof

Get the shareable anchoring proof of one of your memories: event_hash plus its on-chain coordinates. A third party can verify that hash in the contract WITHOUT your API key, and the content is never exposed. This is the primitive behind 'verifiable without trusting the operator'. Free.

ParameterTypeDescription
memory_number *integerYour memory number (the #N shown in recall)

verify_project_state

PUBLIC verification of a Project Brain: returns every anchored version with its state_hash and on-chain coordinates (anchor id, tx, block), plus the instructions to check them independently in the ProjectStateAnchor contract. Exposes no content — only hashes that are already public on-chain. Free, and the answer does not depend on trusting this server: call it, then verify on-chain yourself.

ParameterTypeDescription
name *stringProject name, e.g. 'chainmemory'

audit_memory

Full forensic audit of ONE memory: recomputes its event_hash from the stored plaintext, compares it against the hash anchored on-chain, and reports its anchoring coordinates and seal state. COSTS 0.1 AIC unless dry_run is true. ALWAYS call it with dry_run first — the dry run returns the identical result without charging, so paying only makes sense when you need the paid receipt on record.

ParameterTypeDescription
memory_number *integerYour memory number (the #N shown in recall)
dry_runbooleantrue = validate and return the full result WITHOUT charging (default false). Prefer true.

audit_state

Full audit of a Project Brain: recomputes the state_hash of the current version with the deterministic engine, compares it against the stored one, and returns the on-chain anchor plus the version history. COSTS 5 AIC unless dry_run is true — the most expensive operation in the system. Do NOT call it without dry_run unless the user explicitly asked for the paid audit.

ParameterTypeDescription
project *stringProject name, e.g. 'chainmemory'
dry_runbooleantrue = validate and return the full result WITHOUT charging (default false). Strongly prefer true: a paid run costs 5 AIC.

quote_inject

Price an inject BEFORE paying for it: which memory ids exist, which do not, total characters, estimated tokens, the exact AIC cost with its burn/treasury split, and whether the wallet balance covers it. Free. Call it before inject_memories whenever the ids are not certain — inject charges 0.1 AIC even if you picked the wrong ones.

ParameterTypeDescription
memory_ids *array1-50 memory numbers (#N) to price

list_memories_filtered

List memories filtered by project tag and archived status, newest first. Returns metadata plus an 80-character PREVIEW of each memory — not the full text. Use get_memory(#N) to read one in full, or search_memories to find by meaning.

ParameterTypeDescription
archivedbooleanInclude archived memories (default false)
limitintegerDefault 50
projectstringFilter by project tag (use 'general' for untagged)

update_memory_tags

Replace the tags of an existing memory. Free. Tags are what keeps a memory findable by project, and the ONLY way to find a sealed one, since its content cannot be indexed. The project of a memory is stored as its first tag.

ParameterTypeDescription
memory_id *integerYour memory number (the # shown in recall/remember, e.g. 489) — personal to your api key
tags *arrayNew tag list (replaces current)

archive_memory

Archive a memory: it stops appearing in recall, listings and inject, but stays on-chain and keeps its proof. Free and reversible with unarchive_memory. This is what to use instead of deleting — nothing is ever removed from the chain.

ParameterTypeDescription
memory_id *integerYour memory number to archive (the # shown in recall)

unarchive_memory

Restore an archived memory so it shows up again in recall, listings and inject. Free. Nothing was ever deleted: archiving only hides it.

ParameterTypeDescription
memory_id *integerYour memory number to restore (the # shown in recall)

chainmemory_stats

Public network statistics: chain id, current block, registered AIs, total and episodic memories, AIC supply. Free and needs NO API key. Use it to check the network is alive — not to count your own memories, which is what chainmemory_profile is for.

chainmemory_register

Register an AI identity on-chain. Free, once per identity. Most users never need it: an identity is created automatically the first time an API key writes. Use it only if you want to register explicitly before the first write.

ParameterTypeDescription
model *stringModel name (e.g. claude-opus-4)
name *stringAI name

chainmemory_profile

Get this AI's identity and memory counters: name, model, owner wallet, reputation, active status, and four counts that mean different things — chain_memories (anchored on-chain), local_memories (written), synced_memories and pending_sync. Free, read-only. Use it to check that writes are reaching the chain: pending_sync above zero means memories exist locally but are not anchored yet.

ParameterTypeDescription
ai_idintegerAI ID (omit for own)

chainmemory_seal

Seal a memory permanently with a direct contract call. FEE: 0.001 AIC, and it is the ONLY tool that needs a wallet private key in AICHAIN_KEY. Irreversible. Most memories never need this: chainmemory_remember already anchors them through the API. Use it only when you want to seal one yourself, without trusting the server to do it.

ParameterTypeDescription
ai_id *integerAI ID owning the memory
memory_id *integerYour memory number to seal (the # shown in recall)

list_projects

List the user's projects with their numeric id, slug, keywords and colour. Free, read-only. Call it before create_project to avoid duplicates, and before delete_project, which needs the NUMERIC id from here and rejects the slug.

create_project

Create a project to group memories. Free. The project name becomes the FIRST TAG of every memory written under it, which is how list_memories_filtered finds them later — and the only way to find a sealed memory, whose content is not searchable. Call list_projects first to avoid duplicates.

ParameterTypeDescription
name *stringDisplay name
project_id *stringShort slug (e.g. 'blockchain', 'work_2026')
keywordsarrayAuto-tag keywords (optional)

delete_project

Delete a project. Free. Takes the NUMERIC id from list_projects — passing the slug returns 400 'invalid id'. Memories keep their tag and stay findable; only the project metadata disappears, so nothing is lost.

ParameterTypeDescription
project_id *stringProject ID to delete

list_project_templates

List the built-in project templates with their ids. Free. Call it before add_project_from_template: that tool needs one of these ids and they are not guessable.

add_project_from_template

Create a project from a built-in template, with its auto-tagging keywords already set. Free. Call list_project_templates first: the template id is required and cannot be guessed.

ParameterTypeDescription
template_id *stringTemplate ID (e.g. 'blockchain')

get_my_context

Retrieve the user's portable conversation history ACROSS PROVIDERS: a condensed summary plus recent memories from ChatGPT, Claude, Gemini, Perplexity and others, with their verification status. Free, read-only. Use it ONCE when starting with a model that has no history of its own, to carry context between providers. For the latest memories of a specific project, or to keep working inside a session already under way, use chainmemory_recall instead — this one is broader and slower.

ParameterTypeDescription
limitintegerMaximum memories (default 10)
verified_onlybooleanIf true, only return memories anchored on-chain (default false)

get_project_state

Get the consolidated, verifiable STATE of a project from Project Brain: a structured object (phase, current_focus, vocabulary, constraints, decisions with confidence and cited memory IDs, open_risks, next_priorities, and `environment` — where and how the owner works: hosts, services, repositories and operating rules) distilled from your atomic memories. Use it at the START of work on a known project to load its current state instead of re-deriving context. Owner-scoped (returns only your own state). Includes state_hash (SHA3-256) for integrity.

ParameterTypeDescription
name *stringProject name, e.g. 'chainmemory'
include_rolesbooleanEmbed the FULL text of every active Verifiable Role Contract in the response (default true). Set to false when you only need the state: on projects with several signed VRCs the contracts can add thous…

get_project_brief

Get a project's Brain as a ready-to-read BRIEF: plain text ordered by relevance and cut to a character budget — what changed since the last version you read, open risks (high first, with the priorities that mitigate them and a list of high risks nobody mitigates), active priorities with their full completion criterion, the owner's work rules, recent decisions with their scope, recent milestones, open questions, each constraint as a one-line rule, and items that have not been edited for a long time, headed by the state's on-chain anchor and how much of it cites evidence. Free, read-only, owne…

ParameterTypeDescription
name *stringProject name, e.g. 'chainmemory'
budgetintegerMaximum characters of the brief (default 7000). The most relevant sections are kept whole; the rest is shortened to fit.
langstringLanguage of the section headings (default en). The items themselves are returned as they were written.
levelstringpublic (default): safe to paste anywhere. full: includes infrastructure details; requires the owner's key and CHAINMEMORY_ALLOW_FULL=1, and is logged. Only when the user asked for it.
sinceintegerVersion to compare against for the WHAT CHANGED section. Default: the last version this server gave you for this project, or the previous version if there is none.
taskstringA priority id (e.g. 'pri_0015'). Returns the brief for working on that priority instead of the general one; since is ignored and nothing is remembered.

update_project_state

Apply operations to a project's consolidated state (Project Brain). FEE: 0.05 AIC plus 0.005 per applied op. Ops come from the 30-op grammar (add_decision, add_milestone, add_risk, set_focus, add_env_host...); the server validates invariants, applies them with a deterministic builder and computes the new state_hash. Use after get_project_state + list_memories_filtered to see what actually changed. EVIDENCE IS WHAT MAKES THE STATE WORTH ANYTHING: cite the memories backing each op with evidence_memory_ids. An op with no evidence is stored with evidence_root 0x000...0 — state with no provenance…

ParameterTypeDescription
ops *arrayArray of operations from the 30-op grammar. Each op has 'op' (type) + arguments. Use 'evidence_memory_ids' (array of memory IDs) instead of 'evidence' — the server resolves event_hashes automaticall…
project *stringProject name, e.g. 'chainmemory'
consolidated_until_eventintegerHighest memory ID included in this consolidation (advances the watermark)

list_role_contracts

List the roles defined for a project, with their status and version. Call this BEFORE get_role_contract or assume_role when you do not already know the role_id — role ids are not guessable and a wrong guess costs a failed call. Only roles with status 'active' (signed by the owner) can be assumed.

ParameterTypeDescription
project *stringProject name, e.g. 'chainmemory'

get_role_contract

Get a project's Verifiable Role Contract (VRC): purpose, rules with checks and severity, working protocol. Read it BEFORE working under a role. Human-authored and owner-signed; models read it, never write it.

ParameterTypeDescription
project *stringProject name
role_id *stringRole id, e.g. 'charly'
versionintegerRead a specific contract version instead of the latest. Use it to audit what a past Role Session was actually bound to.

list_role_sessions

Audit trail of a project's Role Sessions: who assumed which role, on which platform, when, how it closed (manual or auto) and the closing summary. This is the record the VRC exists to produce. Free, read-only.

ParameterTypeDescription
project *stringProject name

get_role_session

Read one Role Session in full, including the contract version and hash it was pinned to, the Brain version and state_hash at the moment it opened, and its event_hash. Use it to verify exactly what a given session was bound to. Free, read-only.

ParameterTypeDescription
session_id *integerSession id (as returned by assume_role)

assume_role

Assume a project role under its Verifiable Role Contract, opening an audited Role Session (fee 0.001 AIC). Pins contract version+hash and Brain state_hash. Only 'active' (signed) contracts are assumable; one open session per role. Call at session start; close with release_role.

ParameterTypeDescription
project *string
role_id *string
platformstringExecutor platform (e.g. claude, chatgpt, gemini)

release_role

Release an open Role Session with a closing summary (what was done, what is pending, next step). Sessions auto-release after 60 minutes.

ParameterTypeDescription
session_id *integer
summarystringClosing summary for the audit trail

get_inject_balance

Check the user's AIC balance. Selective inject costs 0.1 AIC per call (Fee Schedule v1.0; split 50/50: half burned, half to treasury).

inject_memories

Inject selected memories into the current conversation context. Costs 0.1 AIC per call (Fee Schedule v1.0; regardless of memory count, up to 50). Returns plaintexts ready to be used as context. The AIC charge is deflationary: 50% burned forever, 50% to ecosystem treasury. Optimistic mode: returns immediately, transactions confirm in background.

ParameterTypeDescription
memory_ids *array1-50 memory IDs to inject
project_filterstringOptional: tag/project context
target_platformstringOptional: target platform (claude, chatgpt, etc)

get_inject_history

History of selective injects: timestamps, how many memories, cost in AIC and transaction hashes. Free, read-only. Use it to audit what was injected and what it cost; for the current balance use get_inject_balance, and to price an injection before paying use quote_inject.

ParameterTypeDescription
limitintegerDefault 20