### Install and Run MCP Proxy Source: https://github.com/markhuangai/dense-mem/blob/main/packages/mcp-proxy/README.md Install and run the dense-mem-mcp-proxy using npx. This is the simplest way to get started. ```bash npx -y dense-mem-mcp-proxy ``` -------------------------------- ### Download and Start Dense-Mem Local Source: https://github.com/markhuangai/dense-mem/blob/main/README.md This snippet downloads the base compose example and environment template, sets up the .env file, and starts the Dense-Mem service locally. It also provisions a team for the server. ```bash mkdir dense-mem-local cd dense-mem-local curl -fsSLo docker-compose.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.base.yml curl -fsSLo .env.example \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/.env.example cp .env.example .env # Fill in POSTGRES_PASSWORD, NEO4J_PASSWORD, CONTROL_PORTAL_TOKEN, and AI_API_KEY. ${EDITOR:-vi} .env docker compose up -d docker compose exec server /app/provision-team --name "primary-memory" ``` -------------------------------- ### Setup Hosted Demo Telemetry Source: https://github.com/markhuangai/dense-mem/wiki/Telemetry Download the Prometheus configuration and Docker Compose overlay file for the demo telemetry. Set a random scrape token and start the services using Docker Compose. ```bash curl -fsSLo prometheus.demo.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/prometheus.demo.yml curl -fsSLo docker-compose.demo.telemetry.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.demo.telemetry.yml export TELEMETRY_SCRAPE_TOKEN="$(openssl rand -hex 32)" docker compose -f docker-compose.demo.yml -f docker-compose.demo.telemetry.yml up -d ``` -------------------------------- ### Start Redis Profile Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Start the Redis profile using Docker Compose to enable Redis services. ```bash docker compose --profile redis up -d ``` -------------------------------- ### Install Dependencies and Playwright Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Install project dependencies and Playwright browsers. Run this command from the 'tests/uat' directory. ```bash cd tests/uat npm install npx playwright install ``` -------------------------------- ### Provision Team Output Example Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Example JSON output from the provision-team command, showing team and profile details, and the generated API key. ```json { "team_id": "11111111-2222-3333-4444-555555555555", "team_name": "primary-memory", "profile_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "profile_name": "default profile", "scopes": ["read", "write"], "api_key": "dm_default-prof_..." } ``` -------------------------------- ### Example MCP Tool List Response Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients Example of tools that might be returned by the tools/list MCP method. ```text remember recall_memory trace_memory assemble_context reflect_memories confirm_memory ``` -------------------------------- ### Start Dense-Mem Containers Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Start the Dense-Mem services in detached mode using Docker Compose. ```bash docker compose up -d ``` -------------------------------- ### Install pgcrypto Extension with Docker Compose Source: https://github.com/markhuangai/dense-mem/wiki/Configuration This command executes within the Docker Compose environment to install the pgcrypto extension using the configured Postgres user and database. It's suitable for bundled compose setups. ```bash docker compose exec postgres sh -lc \ 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION IF NOT EXISTS pgcrypto;"' ``` -------------------------------- ### Example User Preference for Memory Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients Example natural language input for the assistant to remember user preferences. ```text Remember that I prefer concise explanations with concrete examples. ``` -------------------------------- ### ZITADEL Project Role Example Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys Example configuration for a ZITADEL project role used for Dense-Mem access. Dense-Mem matches the role key from the token claim. ```text Key: dense-mem-admin Display name: Dense-Mem Admin Group: dense-mem ``` -------------------------------- ### Start Traefik Service Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Start the Traefik service using Docker Compose to expose services over HTTPS. ```bash docker compose --profile traefik up -d ``` -------------------------------- ### Good Correction Prompt Example Source: https://github.com/markhuangai/dense-mem/wiki/Conflicts-And-Corrections An example of a clear and concise prompt for correcting an existing deployment note. ```text Replace the old deployment note with this new one: production now deploys from main through Docker Swarm. ``` -------------------------------- ### Example of Storing a Project Fact Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Illustrates the user prompt for saving a project-specific fact and how the assistant uses it to inform future actions. ```text Remember that the Dense-Mem local control portal should stay bound to 127.0.0.1. ``` -------------------------------- ### Start Public HTTPS and Redis Together Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Start both Traefik and Redis profiles simultaneously using Docker Compose for a combined public stack. ```bash docker compose --profile traefik --profile redis up -d ``` -------------------------------- ### User Portal SSO Callback URI Example Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys An example of the User Portal SSO callback URI when SSO_PUBLIC_BASE_URL is configured. ```text https://dense-mem.example.com/ui/api/sso/callback ``` -------------------------------- ### Required Environment Variables for Dense-Mem Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Example values for essential environment variables. Ensure you set a strong password and a long token. ```text POSTGRES_PASSWORD=choose-a-strong-postgres-password NEO4J_PASSWORD=choose-a-strong-neo4j-password CONTROL_PORTAL_TOKEN=choose-a-long-control-portal-token AI_API_KEY=your-ai-provider-api-key AI_API_URL=https://api.openai.com/v1 AI_API_EMBEDDING_MODEL=text-embedding-3-small AI_API_EMBEDDING_DIMENSIONS=1536 ``` -------------------------------- ### Example of Storing a Personal Preference Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Shows the user prompt for saving a preference and the subsequent assistant action based on that recalled memory. ```text Remember that I prefer code reviews to start with bugs and risks before style notes. ``` -------------------------------- ### Example User Query for Memory Recall Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients Example natural language query to ask the assistant about remembered information. ```text What do you remember about my explanation preferences? ``` -------------------------------- ### Install pgcrypto Extension with Admin DSN Source: https://github.com/markhuangai/dense-mem/wiki/Configuration Use this command to install the pgcrypto extension if your Postgres database is managed externally or reused and you encounter permission issues. It requires an admin connection string. ```bash psql "$ADMIN_POSTGRES_DSN" -c 'CREATE EXTENSION IF NOT EXISTS pgcrypto;' ``` -------------------------------- ### Example of Conflicting Memory Clarification Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Demonstrates a scenario where conflicting preferences are stored, leading Dense-Mem to return a clarification prompt for the assistant. ```text Remember that I want long detailed answers. ``` ```text Which preference should I keep: concise answers or long detailed answers? ``` -------------------------------- ### Dense-Mem Group Mapping Example Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys Example of a Dense-Mem group mapping configuration. The 'Group' value should match the ZITADEL role key. ```text Team: Mark Group: dense-mem-admin Permission: Not shown for Manager; manager implies read/write. Role: Manager Status: enabled ``` -------------------------------- ### ZITADEL Audience Scope Example Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys When required by your ZITADEL setup, add the project audience scope to the 'Scopes' field. This is necessary if ZITADEL does not emit role claims. ```text urn:zitadel:iam:org:project:id::aud ``` -------------------------------- ### MCP GET Method Source: https://github.com/markhuangai/dense-mem/wiki/Architecture Usage of the GET method on the /mcp endpoint for Server-to-client SSE streams. ```text GET | /mcp | Server-to-client SSE stream where supported. ``` -------------------------------- ### Start Dense-Mem with Demo Telemetry Overlay Source: https://github.com/markhuangai/dense-mem/blob/main/README.md This snippet configures Dense-Mem with a demo telemetry overlay, suitable for disposable demo images. It scrapes a demo service and sets specific Prometheus job names. ```bash curl -fsSLo prometheus.demo.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/prometheus.demo.yml curl -fsSLo docker-compose.demo.telemetry.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.demo.telemetry.yml export TELEMETRY_SCRAPE_TOKEN="$(openssl rand -hex 32)" docker compose -f docker-compose.yml -f docker-compose.demo.telemetry.yml up -d ``` -------------------------------- ### Enable Telemetry Locally Source: https://github.com/markhuangai/dense-mem/wiki/Telemetry Use these commands to download the telemetry overlay configuration and start the services with telemetry enabled. A random scrape token is generated for Prometheus. ```bash curl -fsSLo prometheus.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/prometheus.yml curl -fsSLo docker-compose.telemetry.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.telemetry.yml export TELEMETRY_SCRAPE_TOKEN="$(openssl rand -hex 32)" docker compose -f docker-compose.yml -f docker-compose.telemetry.yml up -d ``` -------------------------------- ### ZITADEL Claim Read Example Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys Example of a successful claim read log output when debug logging is enabled. It shows configured group claims and the group value matching the role key. ```json { "configured_group_claims": [ "urn:zitadel:iam:org:project::roles", "urn:zitadel:iam:org:project:roles" ], "groups": ["dense-mem-admin"], "groups_from_userinfo": true } ``` -------------------------------- ### Control Portal Authentication Headers Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys Examples of authentication headers accepted by the control portal. ```text Authorization: Bearer ``` ```text X-Control-Portal-Token: ``` -------------------------------- ### Codex Desktop MCP Server Configuration Source: https://github.com/markhuangai/dense-mem/blob/main/packages/mcp-proxy/README.md Configure the MCP server for Codex Desktop using TOML format. This example shows how to set up a primary memory server with specific environment variables. ```toml [mcp_servers.dense_mem_primary_memory] command = "npx" args = ["-y", "dense-mem-mcp-proxy"] env = { DENSE_MEM_MCP_URL = "http://127.0.0.1:8080/mcp", DENSE_MEM_API_KEY = "dm_live_..." } tool_timeout_sec = 60 enabled = true ``` -------------------------------- ### Trace Memory Tool Arguments Source: https://github.com/markhuangai/dense-mem/wiki/Conflicts-And-Corrections Example JSON arguments for the trace_memory tool, used to inspect the evidence for a specific fact. ```json { "type": "fact", "id": "fact_123", "max_related": 5, "include_fragments": true } ``` -------------------------------- ### Confirm Memory Tool Arguments Source: https://github.com/markhuangai/dense-mem/wiki/Conflicts-And-Corrections Example JSON arguments for the confirm_memory tool, specifying the claim ID and the decision. ```json { "claim_id": "claim_123", "decision": "accept_claim" } ``` -------------------------------- ### Claude Desktop MCP Server Configuration Source: https://github.com/markhuangai/dense-mem/blob/main/packages/mcp-proxy/README.md Configure the MCP server for Claude Desktop using JSON format. This example demonstrates setting up a primary memory server with environment variables for URL and API key. ```json { "mcpServers": { "dense_mem_primary_memory": { "command": "npx", "args": ["-y", "dense-mem-mcp-proxy"], "env": { "DENSE_MEM_MCP_URL": "http://127.0.0.1:8080/mcp", "DENSE_MEM_API_KEY": "dm_live_..." } } } } ``` -------------------------------- ### Generate Scrape Token and Start Telemetry Source: https://github.com/markhuangai/dense-mem/wiki/Configuration Generate a random scrape token for securing the metrics endpoint and then start the Docker Compose stack with the telemetry overlay. This enables Prometheus metrics collection. ```bash export TELEMETRY_SCRAPE_TOKEN="$(openssl rand -hex 32)" docker compose -f docker-compose.yml -f docker-compose.telemetry.yml up -d ``` -------------------------------- ### ZITADEL Issuer URL Example Source: https://github.com/markhuangai/dense-mem/wiki/Portals-And-API-Keys Use the ZITADEL instance that owns the application as the issuer URL for hosted ZITADEL. Ensure the issuer URL's OpenID configuration matches the application client ID. ```text https://.us.zitadel.cloud ``` -------------------------------- ### Example of Granular Memory Entry Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Demonstrates a concise and focused memory entry that adheres to the recommended character limit for better evidence linking. ```text Remember that the Dense-Mem MCP tools should keep each memory evidence entry under 1000 characters. ``` -------------------------------- ### Recall Endpoint GET Request Source: https://github.com/markhuangai/dense-mem/wiki/Technical-Reference Use this endpoint to perform natural-language searches against memory. Common query parameters include 'query', 'limit', 'valid_at', 'known_at', and 'include_evidence'. ```text GET /api/v1/recall ``` ```bash curl "http://localhost:8080/api/v1/recall?query=preferences" \ -H "Authorization: Bearer $DENSE_MEM_API_KEY" ``` -------------------------------- ### Assemble Context JSON Request Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Example JSON payload for the `assemble_context` function, used to prepare a bounded context block for an assistant's response. ```json { "query": "repo release process and testing expectations", "limit": 5, "max_chars": 4000, "include_evidence": true } ``` -------------------------------- ### Provisioning a Dense-Mem API Key Locally Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients Commands to provision a new team and export the Dense-Mem API key for local use. ```bash docker compose exec server /app/provision-team --name "primary-memory" export DENSE_MEM_API_KEY="dm_..." ``` -------------------------------- ### Create Dense-Mem Local Directory Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Create a directory for Dense-Mem and navigate into it. ```bash mkdir dense-mem-local cd dense-mem-local ``` -------------------------------- ### Run Live Control Portal Browser Checks Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute live browser checks against the control portal. Requires a control portal token. ```bash CONTROL_PORTAL_TOKEN= npm run test:portal-live ``` -------------------------------- ### Create Local Environment File Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Copy the environment template to create your local .env file. ```bash cp .env.example .env ``` -------------------------------- ### Follow Server Logs Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Monitor the main Dense-Mem server logs in real-time. ```bash docker compose logs -f server ``` -------------------------------- ### Access Hosted Demo URL Source: https://github.com/markhuangai/dense-mem/wiki/Hosted-Demo The URL for the hosted Dense-Mem demo. This is the entry point for testing. ```text https://demo-dense-mem.markhuang.ai ``` -------------------------------- ### Check Server Readiness Endpoint Source: https://github.com/markhuangai/dense-mem/wiki/Technical-Reference Query the '/ready' endpoint to determine if the server is ready to accept requests. ```bash curl http://localhost:8080/ready ``` -------------------------------- ### Provision Team and Profile Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Create a new team and its default profile to generate an API key. ```bash docker compose exec server /app/provision-team --name "primary-memory" ``` -------------------------------- ### Download Compose File and Env Template Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Download the base docker-compose file and the environment variable template. ```bash curl -fsSLo docker-compose.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.base.yml curl -fsSLo .env.example \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/.env.example ``` -------------------------------- ### Configure MCP Client with Codex Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Add Dense-Mem server configuration to '~/.codex/config.toml', including URL, bearer token environment variable, and timeout. ```toml [mcp_servers.dense_mem] url = "http://localhost:8080/mcp" bearer_token_env_var = "DENSE_MEM_API_KEY" tool_timeout_sec = 60 enabled = true ``` -------------------------------- ### Connect Claude Code to Dense-Mem Source: https://github.com/markhuangai/dense-mem/wiki/Hosted-Demo Add the Dense-Mem demo MCP server to Claude Code using the http transport. Provide the URL and the API key via a header. ```bash claude mcp add --transport http dense-mem-demo \ https://demo-dense-mem.markhuang.ai/mcp \ --header "Authorization: Bearer $DENSE_MEM_API_KEY" ``` -------------------------------- ### Configure MCP Proxy with Arguments Source: https://github.com/markhuangai/dense-mem/blob/main/packages/mcp-proxy/README.md Configure the MCP proxy using command-line arguments for URL and headers. This is an alternative to environment variables for configuration. ```bash npx -y dense-mem-mcp-proxy \ --url http://127.0.0.1:8080/mcp \ --header "Authorization: Bearer dm_live..." ``` -------------------------------- ### Run All Admin/Control-Plane Gaps Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute all tests related to admin and control-plane functionalities, including live portal checks. Requires team ID, API key, and control portal token. ```bash TEAM_ID= API_KEY= CONTROL_PORTAL_TOKEN= npm run test:admin ``` -------------------------------- ### Run MCP Proxy from Local Repository Source: https://github.com/markhuangai/dense-mem/blob/main/packages/mcp-proxy/README.md Run the MCP proxy directly from the repository for development or local testing. This requires specifying the path to the proxy script. ```bash DENSE_MEM_MCP_URL=http://127.0.0.1:8080/mcp \ DENSE_MEM_API_KEY=dm_live_... \ node /path/to/dense-mem/packages/mcp-proxy/bin/dense-mem-mcp-proxy.js ``` -------------------------------- ### Check MCP Tools with Curl Source: https://github.com/markhuangai/dense-mem/wiki/Hosted-Demo Use curl to query the MCP (Memory Control Plane) endpoint of the hosted demo to list available tools. Ensure the Authorization header includes your API key. ```bash curl -s "https://demo-dense-mem.markhuang.ai/mcp" \ -H "Authorization: Bearer $DENSE_MEM_API_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' ``` -------------------------------- ### Download Expert Compose File Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Download the expert Docker Compose file to enable public HTTPS and Traefik. ```bash curl -fsSLo docker-compose.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.expert.yml ``` -------------------------------- ### Run Browser Portal E2E Tests Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute end-to-end tests for the browser portal using a local Docker Compose stack. This command is run from the 'web/' directory. ```bash cd ../../web npm run playwright ``` -------------------------------- ### Mermaid Flowchart for Dense-Mem Interaction Source: https://github.com/markhuangai/dense-mem/wiki/Home Illustrates the data flow between the user, AI assistant, Dense-Mem, and the memory store. ```mermaid flowchart LR User[You] --> Assistant[AI assistant] Assistant --> DenseMem[Dense-Mem] DenseMem --> Store[(Memory store)] Store --> DenseMem DenseMem --> Assistant Assistant --> User ``` -------------------------------- ### Configure Public HTTPS Environment Variables Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Set the domain name and email for ACME certificate generation in the .env file. ```text DENSE_MEM_DOMAIN=dense-mem.example.com ACME_EMAIL=ops@example.com ``` -------------------------------- ### Download Prometheus Configuration for Telemetry Source: https://github.com/markhuangai/dense-mem/wiki/Configuration Download the Prometheus configuration file and the telemetry Docker Compose overlay file. These are necessary to enable Prometheus metrics and telemetry query APIs. ```bash curl -fsSLo prometheus.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/prometheus.yml ``` ```bash curl -fsSLo docker-compose.telemetry.yml \ https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.telemetry.yml ``` -------------------------------- ### Run All Tests Against a Live Server Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute all Playwright tests against a live dense-mem server. Ensure to replace placeholders with actual API keys and profile IDs. ```bash BASE_URL=http://localhost:8080 API_KEY= API_KEY_B= PROFILE_ID= \ npx playwright test ``` -------------------------------- ### System Map Source: https://github.com/markhuangai/dense-mem/wiki/Architecture Visual representation of the Dense-Mem system architecture and its components. ```mermaid flowchart TB subgraph Hosts["AI tools"] Claude["Claude Code"] Codex["Codex"] Other["Other MCP clients"] end subgraph DenseMem["Dense-Mem"] MCP["/mcp Streamable HTTP"] REST["REST API"] UserPortal["User portal /ui"] Portal["Control portal"] Metrics["Metrics endpoint /metrics"] Registry["Tool registry"] Memory["Memory orchestration"] Recall["Recall service"] Embeds["Embedding provider client"] end subgraph Storage["Storage"] Postgres["Postgres teams, profiles, audit"] Neo4j["Neo4j graph and vector indexes"] Redis["Redis optional shared limits"] Prometheus["Prometheus optional telemetry"] end Hosts --> MCP MCP --> Registry REST --> Registry UserPortal --> REST Portal --> REST Registry --> Memory Registry --> Recall Memory --> Embeds Recall --> Embeds Memory --> Neo4j Recall --> Neo4j REST --> Postgres REST --> Redis Metrics --> Prometheus REST --> Prometheus Portal --> Prometheus ``` -------------------------------- ### Configure Codex with Dense-Mem Source: https://github.com/markhuangai/dense-mem/wiki/Hosted-Demo Add Dense-Mem server configuration to Codex by editing the '~/.codex/config.toml' file. This includes the server URL, the environment variable for the bearer token, and tool timeout settings. ```toml [mcp_servers.dense_mem_demo] url = "https://demo-dense-mem.markhuang.ai/mcp" bearer_token_env_var = "DENSE_MEM_API_KEY" tool_timeout_sec = 60 enabled = true ``` -------------------------------- ### Memory Workflow Diagram Source: https://github.com/markhuangai/dense-mem/blob/main/README.md Illustrates the path memory takes from a source fragment to an active fact, including potential clarification tasks. ```text source fragment -> typed claim -> verification -> promotion gate -> active fact | v clarification task ``` -------------------------------- ### Import Skill Pack in Review Mode Source: https://github.com/markhuangai/dense-mem/wiki/Skill-Packs Import a skill pack in 'review' mode, where selected items are treated as reviewable claims without promoting source facts to active facts. ```json { "artifact_json": "{...}", "mode": "review" } ``` -------------------------------- ### Set Dense-Mem API Key Environment Variable Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Export the generated API key to the DENSE_MEM_API_KEY environment variable for client authentication. ```bash export DENSE_MEM_API_KEY="dm_default-prof_..." ``` -------------------------------- ### List Teams in Dense-Mem Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Use this command to list all available teams within the Dense-Mem system. ```bash docker compose exec server /app/list-teams ``` -------------------------------- ### Configure MCP Proxy with Environment Variables Source: https://github.com/markhuangai/dense-mem/blob/main/packages/mcp-proxy/README.md Configure the MCP proxy using environment variables for URL and API key. This is useful for setting up the proxy in various environments. ```bash DENSE_MEM_MCP_URL=http://127.0.0.1:8080/mcp \ DENSE_MEM_API_KEY=dm_live_... \ npx -y dense-mem-mcp-proxy ``` -------------------------------- ### List Tools via MCP HTTP Request Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients Curl command to query the available tools from the Dense-Mem MCP service. ```bash curl -s "http://127.0.0.1:8080/mcp" \ -H "Authorization: Bearer $DENSE_MEM_API_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' ``` -------------------------------- ### Export Dense-Mem API Key Source: https://github.com/markhuangai/dense-mem/wiki/Hosted-Demo Export the generated API key as an environment variable. This key is used to authenticate with the Dense-Mem demo service and lasts for 24 hours. ```bash export DENSE_MEM_API_KEY="dm_..." ``` -------------------------------- ### Check Docker Compose Services Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Verify that all Docker Compose services are running correctly. ```bash docker compose ps ``` -------------------------------- ### Configure Codex for Local Dense-Mem MCP Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients TOML configuration for Codex to connect to the local Dense-Mem MCP server. ```toml [mcp_servers.dense_mem] url = "http://127.0.0.1:8080/mcp" bearer_token_env_var = "DENSE_MEM_API_KEY" tool_timeout_sec = 60 enabled = true ``` -------------------------------- ### Export Skill Pack Source: https://github.com/markhuangai/dense-mem/wiki/Skill-Packs Configure the export of a skill pack, including its name, description, associated fact IDs, and whether to include support information. Set include_support to true unless source evidence should be intentionally omitted. ```json { "name": "blog-writing", "description": "Reusable blog-writing workflow", "fact_ids": ["fact_123"], "include_support": true } ``` -------------------------------- ### Run Profile Key Permission Checks Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute tests specifically for profile key permission checks. Requires a team ID and a read-write API key. ```bash TEAM_ID= API_KEY= npx playwright test profile-key-permissions.spec.ts ``` -------------------------------- ### Connect MCP Client with Claude Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Use the 'claude' CLI to add a Dense-Mem MCP endpoint, specifying HTTP transport and authorization headers. ```bash claude mcp add --transport http dense-mem http://localhost:8080/mcp \ --header "Authorization: Bearer $DENSE_MEM_API_KEY" ``` -------------------------------- ### Inspect Skill Pack from URL Source: https://github.com/markhuangai/dense-mem/wiki/Skill-Packs Inspect a skill pack by providing a URL to the artifact JSON. The expected_sha256 is required for remote artifact verification. ```json { "url": "https://example.com/blog-writing.skill-pack.json", "expected_sha256": "..." } ``` -------------------------------- ### Run E2E Journey with Provisioned Stack Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute the end-to-end journey tests against a running Docker Compose stack with two generated keys. This ensures cross-profile isolation checks are enforced. ```bash BASE_URL=http://localhost:8080 npm run test:e2e:provisioned ``` -------------------------------- ### List Profiles in a Team Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Use this command to list all profiles associated with a specific team. Replace '' with the actual team ID. ```bash docker compose exec server /app/list-team-profiles --team-id "" ``` -------------------------------- ### Run Container CLI Workflow Checks Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute tests for container CLI workflows (provision, list, rotate, delete). Ensure Docker Compose is running before execution. ```bash npm run test:cli ``` -------------------------------- ### Edit Environment Variables Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Open the .env file to replace placeholder values for passwords, tokens, and API keys. ```bash ${EDITOR:-vi} .env ``` -------------------------------- ### Dense-Mem Sequence Diagram Source: https://github.com/markhuangai/dense-mem/wiki/Using-Dense-Mem Illustrates the normal flow of interaction between a user, an AI assistant, and Dense-Mem for saving and recalling information. ```mermaid sequenceDiagram participant You participant Assistant participant DM as Dense-Mem You->>Assistant: Remember my review style. Assistant->>DM: remember(...) DM-->>Assistant: saved fact or clarification You->>Assistant: What should you know before editing this repo? Assistant->>DM: recall_memory(...) DM-->>Assistant: relevant memories Assistant-->>You: answer using recalled context ``` -------------------------------- ### Run Control-Plane Checks Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute tests related to the control plane, including team profile key lifecycle management. Requires a team ID and a read-write API key. ```bash TEAM_ID= API_KEY= npm run test:control-plane ``` -------------------------------- ### Create Read-Only Profile Source: https://github.com/markhuangai/dense-mem/wiki/Technical-Reference Create a new profile with read-only scopes for automation tasks that only need to search memory. This requires a manager API key for the target team. ```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}' ``` -------------------------------- ### Add Local Dense-Mem MCP Server to Claude Source: https://github.com/markhuangai/dense-mem/wiki/MCP-Clients Command to add the local Dense-Mem MCP endpoint to the Claude client configuration. ```bash claude mcp add --transport http dense-mem http://127.0.0.1:8080/mcp \ --header "Authorization: Bearer $DENSE_MEM_API_KEY" ``` -------------------------------- ### Run a Single Playwright Test Phase Source: https://github.com/markhuangai/dense-mem/blob/main/tests/uat/README.md Execute a specific Playwright test file, such as 'phase2-claim-create.spec.ts'. This is useful for focused testing. ```bash npx playwright test phase2-claim-create.spec.ts ``` -------------------------------- ### Memory Model Flow Source: https://github.com/markhuangai/dense-mem/wiki/Architecture Diagram illustrating the flow of memory from source fragments to active facts. ```mermaid flowchart LR Fragment["SourceFragment evidence"] --> Claim["Claim candidate"] Claim --> Verify["Verify claim"] Verify --> Validated["Validated claim"] Validated --> Promote["Promote claim"] Promote --> Fact["Active fact"] Fact --> Supersede["Supersede after correction"] ``` -------------------------------- ### Configure Redis Address Source: https://github.com/markhuangai/dense-mem/wiki/Public-HTTPS-And-Redis Set the Redis address in the .env file when using the Redis service. ```text REDIS_ADDR=redis:6379 ``` -------------------------------- ### Import Skill Pack in Trusted Mode with Conflict Decisions Source: https://github.com/markhuangai/dense-mem/wiki/Skill-Packs Perform a 'trusted' import of a skill pack, specifying conflict decisions to handle potential local conflicts. This mode can validate claims, promote source facts, or supersede local facts. ```json { "artifact_json": "{...}", "expected_sha256": "...", "mode": "trusted", "conflict_decisions": [ { "index": 0, "action": "demote_to_claim" } ] } ``` -------------------------------- ### Check Server Health Endpoint Source: https://github.com/markhuangai/dense-mem/wiki/Technical-Reference Query the '/health' endpoint to verify if the server is running and healthy. ```bash curl http://localhost:8080/health ``` -------------------------------- ### Stop Dense-Mem Stack Source: https://github.com/markhuangai/dense-mem/wiki/Quick-Start Shut down the Dense-Mem Docker containers. ```bash docker compose down ```