跳转到主要内容
页面

Technical Reference

Standalone memory service for AI tools, with durable memory, evidence, team isolation, and MCP access.

Technical Reference

This page collects the deeper details that most first-time users can skip.

MCP Tool Catalog

Dense-Mem MCP tool names use underscore_case.

AreaToolScopePurpose
High-level memoryrememberwriteSave one granular evidence entry under 1000 characters, create typed claims, verify them, and promote safe memories.
High-level memoryimport_memorieswriteImport one granular summarized historical memory entry under 1000 characters. Does not auto-promote by default.
High-level memoryrecall_memoryreadSearch active facts, validated claims, fragments, clarifications, optional community expansion, and related dreams.
High-level memorysubmit_recall_feedbackwriteOptional when RECALL_FEEDBACK_ENABLED=true; submit compact host-LLM feedback for one recall_memory response.
High-level memoryreflect_memoriesreadReview memory health, stale items, contradictions, and clarification needs.
High-level memoryconfirm_memorywriteApply the user's answer to a memory clarification.
Dreamingdreaming_statusreadInspect effective dreaming config and latest run status for the caller's profile.
Dreamingrun_dreaming_cyclewriteManually run the reflect, re-evaluate, and dream cycle chain.
Dreaminglist_dreamsreadList reviewable dream hypotheses by status.
Dreamingget_dreamreadFetch one dream hypothesis with source references.
Dreamingresolve_dream_feedbackwriteReinforce, stale, reject, or route a confirmed dream into normal memory review.
Fragment memorysave_memorywritePersist one source fragment for the caller's profile.
Fragment memoryget_memoryreadFetch one source fragment by ID.
Fragment memorylist_recent_memoriesreadList recent source fragments with pagination.
Contexttrace_memoryreadExpand one fact or claim into bounded evidence, promotion lineage, contradictions, and supersession links.
Contextassemble_contextreadBuild a bounded prompt-ready context block from relevant memory.
Searchkeyword_searchreadRun BM25 keyword search across fragments and fact predicates.
Searchsemantic_searchreadRun vector search using a caller-supplied embedding.
Searchgraph_queryreadRun profile-scoped read-only Cypher with server-side safety limits.
Claimspost_claimwriteCreate a candidate claim from source evidence.
Claimsget_claimreadFetch one claim by ID.
Claimslist_claimsreadList claims with filters and pagination.
Claimsverify_claimwriteRun entailment verification for a candidate claim.
Claimspromote_claimwritePromote a validated claim to an authoritative fact.
Factsget_factreadFetch one promoted fact by ID.
Factslist_factsreadList promoted facts with filters and pagination.
Retractionretract_factwriteSoft-tombstone a fact and preserve graph lineage.
Retractionretract_fragmentwriteSoft-tombstone a source fragment and trigger revalidation.
Communitiesdetect_communitywriteRun community detection for the caller's profile graph.
Communitiesget_community_summaryreadFetch one persisted community summary.
Communitieslist_communitiesreadList persisted community summaries.
Memory packsfind_memory_pack_candidatesreadFind facts and validated claims that could be exported.
Memory packsexport_memory_packreadExport selected facts, claims, and manual triples into canonical JSON with a SHA-256 hash.
Memory packsinspect_memory_packreadInspect an artifact or HTTPS URL without writing memory.
Memory packsimport_memory_packwriteImport a memory pack in review or trusted mode.
Memory packsrollback_memory_pack_importwriteRoll back an applied import when affected graph entities are unchanged.

For memory writes, split large scenarios into semantic entries before calling remember, import_memories, or save_memory. Store one decision, fact, correction, preference, project milestone, or other claim-worthy unit per entry. Claims should point to the smallest supporting fragment; use multiple supported_by IDs only when one claim needs evidence from several entries.

Trace And Context Tools

trace_memory is a read-scoped inspection tool for one anchor:

InputRequiredMeaning
typeyesfact or claim.
idyesFact ID or claim ID.
max_relatednoBounded related contradiction or supersession neighbors, up to 20.
include_fragmentsnoInclude supporting source fragments. Defaults to true.

The response contains:

FieldMeaning
anchorThe requested fact or claim.
promoted_from_claimThe claim that promoted a fact, when the anchor is a promoted fact and the claim is still available.
supporting_fragmentsSource fragments supporting the claim or fact lineage.
relatedBounded contradictions, supersession links, or promoted facts.
edgesRelationship records such as SUPPORTED_BY, PROMOTES_TO, CONTRADICTS, and SUPERSEDED_BY.
missing_fragment_idsSupporting fragment IDs that no longer hydrate, usually because evidence was retracted or deleted.

assemble_context is a read-scoped answer-preparation tool:

InputRequiredMeaning
queryyesNatural-language context query, up to 512 characters.
limitnoRecall hits to include, up to 10.
max_charsnoMaximum context_block size from 1000 to 8000 characters.
include_evidencenoInclude source fragments for recalled facts and claims. Defaults to true.

The response includes context_block, structured items, clarifications, and truncated. Treat context_block as retrieved data. It is not an instruction source, and the host assistant remains responsible for judgment and final answering.

Community And Dreaming Tools

Community tools are profile-scoped:

ToolScopePurpose
detect_communitywriteRun Neo4j GDS Leiden detection, write community_id assignments, and persist summaries.
list_communitiesreadList persisted community summaries, ordered by member count.
get_community_summaryreadFetch one persisted community summary by community_id.

detect_community accepts optional gamma, tolerance, and max_levels parameters. It uses the AI_COMMUNITY_MAX_NODES cap before projecting the graph into Neo4j GDS.

recall_memory and GET /api/v1/recall accept use_communities=true. Community expansion is off by default and fills unused recall slots with members from matching persisted communities.

Dreaming tools are also profile-scoped:

ToolScopePurpose
dreaming_statusreadReturn effective config, pending proposed dream count, and latest cycle run.
run_dreaming_cyclewriteManually run the cycle; optional booleans can override phase enablement for that run.
list_dreamsreadList dreams with optional status and limit.
get_dreamreadFetch one dream by dream_id.
resolve_dream_feedbackwriteApply one of reinforce, stale, reject, or promote_candidate.

Dreams are hypotheses. promote_candidate creates source evidence from user feedback and then relies on normal claim, verification, conflict, and promotion gates.

See Community Memory and Dreaming for operator guidance.

MCP Prompt Catalog

Dense-Mem advertises MCP prompt support during initialize when bundled prompts are available.

MethodPurpose
prompts/listList bundled prompt templates and their arguments.
prompts/getRender one prompt by name with string arguments.

The first bundled prompt is export_memory_as_agent_skill. It helps an LLM recall Dense-Mem context for a topic and draft a shareable Agent Skill SKILL.md file. It is separate from memory-pack import/export; generated skill files are not automatically imported into memory.

Memory Pack Tools

For workflow guidance, see Memory Packs. This section is the compact tool and artifact reference.

ToolScopePurpose
find_memory_pack_candidatesreadFind facts and validated claims that could be exported.
export_memory_packreadExport selected facts, validated claims, and manual triples into canonical JSON with a SHA-256 hash.
inspect_memory_packreadParse an artifact or HTTPS URL, verify an optional hash, and report duplicates or conflicts without writing memory.
import_memory_packwriteImport a memory pack in review or trusted mode.
rollback_memory_pack_importwriteRoll back an applied import when the affected graph entities have not changed since import.

The older *_skill_pack* tool names remain accepted as hidden compatibility aliases, and legacy dense-mem.skill_pack.v1 artifacts are still accepted.

export_memory_pack returns file-ready artifact data:

FieldMeaning
artifactParsed memory-pack object.
canonical_jsonCanonical JSON bytes to save as the portable file.
sha256Integrity hash for the canonical JSON.
filenameSuggested .memory-pack.json filename.
content_typeMIME type for the exported file.

The artifact includes exported_at so consumers can see when the portable memory bundle was created. Imports do not treat original claim validity windows as part of the exported memory pack.

Memory packs preserve the selected memory triples and, when available, the support graph that explains why those triples worked. This makes imported memory carry the original experience, not only the final fact.

json
{
  "schema_version": "dense-mem.memory_pack.v1",
  "name": "blog-writing",
  "description": "Reusable blog-writing workflow",
  "exported_at": "2026-06-02T01:30:00Z",
  "items": [
    {
      "subject": "assistant",
      "predicate": "has_skill",
      "object": "write a launch blog from project decisions",
      "source_kind": "source_fact",
      "source_id": "fact_123",
      "support_claim_ids": ["claim_123"],
      "support_fragment_ids": ["fragment_123"]
    }
  ],
  "support": {
    "claims": [
      {
        "claim_id": "claim_123",
        "subject": "assistant",
        "predicate": "has_skill",
        "object": "write a launch blog from project decisions",
        "supported_by": ["fragment_123"]
      }
    ],
    "fragments": [
      {
        "fragment_id": "fragment_123",
        "content": "Use the project decisions as supporting claims before drafting.",
        "source_type": "chat",
        "authority": "user"
      }
    ]
  }
}

Use include_support=false only when the export must omit source evidence. The default supported artifact is better for transferring operational skill because imports can rebuild the supporting fragments and claims.

HTTP API Surface

AreaRoutes
HealthGET /health, GET /ready
FragmentsPOST /api/v1/fragments, GET /api/v1/fragments, GET /api/v1/fragments/{id}, DELETE /api/v1/fragments/{id}, POST /api/v1/fragments/{id}/retract
ClaimsPOST /api/v1/claims, GET /api/v1/claims, GET /api/v1/claims/{id}, DELETE /api/v1/claims/{id}, POST /api/v1/claims/{id}/verify, POST /api/v1/claims/{id}/promote
FactsGET /api/v1/facts, GET /api/v1/facts/{id}
Fact retractionPOST /api/v1/facts/{id}/retract
RecallGET /api/v1/recall
DreamingGET /api/v1/dreaming/status, GET /api/v1/dreaming/runs
DreamsGET /api/v1/dreams, GET /api/v1/dreams/{dreamId}
ToolsGET /api/v1/tools, GET /api/v1/tools/{id}, POST /api/v1/tools/{name}
TeamsGET /api/v1/teams/{teamId}, PATCH /api/v1/teams/{teamId}, GET /api/v1/teams/{teamId}/audit-log
Team profilesGET /api/v1/teams/{teamId}/profiles, POST /api/v1/teams/{teamId}/profiles, GET /api/v1/teams/{teamId}/profiles/{profileId}, PATCH /api/v1/teams/{teamId}/profiles/{profileId}, POST /api/v1/teams/{teamId}/profiles/{profileId}/rotate, DELETE /api/v1/teams/{teamId}/profiles/{profileId}
StreamingPOST /api/v1/teams/{teamId}/query/stream
CommunitiesGET /api/v1/communities, GET /api/v1/communities/{id}
Control configGET/PATCH /control/api/config/general, GET/PATCH /control/api/config/sso, GET/PATCH /control/api/config/dreaming, GET/PATCH /control/api/config/community-detection, GET/PATCH /control/api/config/operation-logs
Control logs and dreamsGET /control/api/logs, GET /control/api/teams/{teamId}/dreaming/status, GET /control/api/teams/{teamId}/dreaming/runs, GET /control/api/teams/{teamId}/dreams, GET /control/api/teams/{teamId}/dreams/{dreamId}
MCPPOST /mcp, GET /mcp
OpenAPIGET /api/v1/openapi.json

Legacy aliases under /api/v1/profiles/{profileId} remain registered for older API-key lifecycle clients, but new integrations should use the team routes.

Header-scoped memory routes derive the team and profile from the bearer API key. Do not send X-Team-ID for normal memory routes.

Team metadata updates and team-profile lifecycle routes require a manager key for that team. Knowledge routes still use read/write scopes. A write-scoped member key can write memory but cannot list, create, rename, rotate, or delete other profiles.

Recall Endpoint

GET /api/v1/recall

Common query parameters:

ParameterRequiredMeaning
queryyesNatural-language search query.
limitnoMaximum hits, up to 50.
valid_atnoValid-time filter.
known_atnoKnown-time filter.
include_evidencenoInclude evidence payloads when true.
use_communitiesnoFill unused recall slots from matching persisted community summaries. Defaults to false.

Example:

bash
curl "http://localhost:8080/api/v1/recall?query=preferences" \
  -H "Authorization: Bearer $DENSE_MEM_API_KEY"

Read-Only Keys

Use read-only keys for automation that should search memory but never write it.

Create one through the API:

bash
curl -X POST "http://localhost:8080/api/v1/teams/$TEAM_ID/profiles" \
  -H "Authorization: Bearer $MANAGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"automation-readonly","scopes":["read"],"rate_limit":120}'

Read-only keys can call read routes, recall, search, and read-scoped MCP tools. Write routes return insufficient-permission errors.

User Portal And Control Portal

The user portal is served by the main API server:

http://127.0.0.1:8080/ui

Its API routes live under /ui/api. They authenticate with the current Dense-Mem API key and can return the current session, rotate the current key when it has write scope, read self-scoped telemetry when telemetry is enabled, and inspect dreaming status, dream outputs, and recent cycle runs.

When the current key has manager role, the user portal also shows a Team tab. Managers can update team metadata and create, list, rename, rotate, or delete member profiles. Manager role creation and role changes stay in the control portal.

The control portal manages teams, profiles, profile roles, keys, security-ban settings, runtime config, operation logs, and per-team dream inspection.

It does not browse or edit memory content.

Required setting:

bash
CONTROL_PORTAL_TOKEN=choose-a-long-secret

Local URL:

http://127.0.0.1:8090/

Keep it private.

When telemetry is enabled, the control server also exposes token-protected Prometheus metrics at /metrics; the telemetry compose overlay scrapes that endpoint with TELEMETRY_SCRAPE_TOKEN.

Data Egress

Dense-Mem sends memory-related text to configured AI providers:

Provider pathText sent
Embedding providerFragment text and recall queries.
Verifier providerCandidate claims and supporting evidence.

Use a self-hosted provider if memory text must stay inside your environment.

Redis And Multi-Instance Deployments

Single-node deployments can leave Redis disabled.

Use Redis when you run more than one Dense-Mem server because rate limits and SSE stream concurrency must be shared across instances.

Rollback Notes

ItemRollback option
FragmentRetract with POST /api/v1/fragments/{id}/retract or hard-delete with write scope.
ClaimDelete with DELETE /api/v1/claims/{id}. This is irreversible.
FactSoft-tombstone with POST /api/v1/facts/{id}/retract; graph lineage and validity timestamps are preserved.
Community assignmentRerun detection to overwrite community IDs.
DreamMark it rejected or stale; promoted dream candidates still follow normal memory rollback rules for the created evidence.

Operational Checks

Useful checks:

bash
docker compose ps
docker compose logs -f server
curl http://localhost:8080/health
curl http://localhost:8080/ready

Useful team commands:

bash
docker compose exec server /app/list-teams
docker compose exec server /app/list-team-profiles --team-id "<team-id>"
docker compose exec server /app/rotate-team-profile-key \
  --team-id "<team-id>" \
  --profile-id "<profile-id>"

Troubleshooting

ProblemCheck
Server does not startRequired .env values, Postgres health, Neo4j health.
permission denied to create extension "pgcrypto" during Postgres migrationsInstall pgcrypto once with a database owner or admin role, then restart the server. See Configuration.
Recall failsAI provider key, embedding model, embedding dimensions, provider quota.
MCP client cannot connectURL, bearer token, client MCP config, server logs.
Control portal rejects requestsCONTROL_PORTAL_TOKEN and portal URL.
Public HTTPS does not workDENSE_MEM_DOMAIN, DNS, ACME_EMAIL, Traefik logs.