Skip to main content

Operations Runbook

Operations Runbook

Establish the deployed image, effective configuration, database state, and operation IDs before acting. Source documentation does not establish which binary is deployed.

Startup And Readiness

The control portal exchanges the operator token for an HttpOnly browser session. A browser using a stored token from an older version must sign in again. The cookie follows the access protocol, supporting both HTTP and HTTPS; protect private HTTP traffic with the deployment's network controls. Sign-out revokes the individual session, and rotating the configured operator token invalidates sessions after each instance adopts the new token. Direct control API token headers remain supported.

This session behavior is introduced by application revision 422d9567 and takes effect when a build containing that revision is deployed.

%%{init: {"flowchart": {"curve": "linear"}}}%%
flowchart TB
  Config["Validate configuration"] --> Primary["Connect writable PostgreSQL primary"]
  Primary --> Lock["Acquire migration session lock"]
  Lock --> Migrate["Apply pending ordered migrations"]
  Migrate --> Search["Verify embedding and index contracts"]
  Search --> Compose["Attach required sinks, listeners and workers"]
  Compose --> Ready["Ready for traffic"]
DependencyRole
PostgreSQL + pgvectorRequired durable authority and search execution.
Assessment and embedding providersRequired configured clients; affected operations surface failures.
RedisRequired shared coordination for multiple instances; single-process local mode is supported.
Operation-log sinkRequired PostgreSQL diagnostic sink participates in readiness.
Prometheus/OTLPOptional telemetry according to configuration.
bash
docker compose ps
docker compose logs --tail=100 server
curl -fsS http://127.0.0.1:8080/health
curl -fsS http://127.0.0.1:8080/ready

Migrations have no overall deadline by default (POSTGRES_MIGRATION_TIMEOUT_SECONDS=0); shutdown still cancels. Structured phase/count observations and liveness heartbeats are described in Telemetry. Extend startup/healthcheck grace and rollout deadlines for a long migration instead of launching a competing migration process. See Configuration.

Before upgrading to an image that includes the pending application change #885, run the base path upgrade check. A stored MCP_PUBLIC_BASE_URL path that the change rejects stops the server from starting when a decision provider is configured.

Destructive Migration Boundary

For a database that still needs the Evidence-only cutover, use the released v2.8.0 upgrade procedure. Stop its application services and verify a matching restore-tested backup. Migration 20261110010000 removes retired graph data and resets derived organization in one transaction with inventory, hold, dependency, and retained-Evidence checks. A blocked check stops the upgrade; inspect the bounded failure before proceeding.

Before destructive commit, transaction rollback preserves the prior state. After commit, restoration requires the matching backup; after new accepted writes, use forward recovery unless separately authorized. Ordinary rolling changes must remain compatible with the previous supported binary.

For legacy attribution diagnostics and migration, use the commands and procedure shipped with released v2.8.0. Bring the database through that version before starting the current application.

Evidence-Only Cutover

%%{init: {"flowchart": {"curve": "linear"}}}%%
flowchart TB
  Backup["Stop incompatible readers/writers<br/>Verify restore-tested backup"] --> Pending{"Migration 20261110010000<br/>pending?"}
  Pending -->|"Yes"| Migrate["Apply atomic cutover<br/>Reset derived organization"]
  Pending -->|"No"| Skip["Skip reset<br/>Keep current organization"]
  Migrate --> Receipt{"Committed receipt<br/>verified?"}
  Skip --> Receipt
  Receipt -->|"No"| Stop["Stop and inspect<br/>transaction outcome"]
  Receipt -->|"Yes"| Start["Start compatible application"]
  Start --> Enabled{"Maintenance enabled<br/>and unpaused?"}
  Enabled -->|"No"| Wait["Wait for enable / resume"]
  Enabled -->|"Yes"| Rebuild["Rediscover eligible shared Evidence<br/>Rebuild within model capacity"]
  Wait -. "Enable / resume" .-> Rebuild

Topics And Organization defines the retained and reset state. The rebuild uses existing eligible Evidence without resubmission. It runs after startup under the saved maintenance settings and can produce different topics, IDs, and assignments. Migration completion does not establish rebuild completion.

Inspect the transaction outcome and retained receipt using migration observations. After a committed destructive cutover, recovery of the previous organization requires the matching backup and the restore procedure below.

Staging Deployment

%%{init: {"flowchart": {"curve": "linear"}}}%%
flowchart TB
  Select["Authorize image tag<br/>Resolve exact source revision"] --> Pin["Verify production variant<br/>Pin immutable image digest"]
  Pin --> Restore["Stop staging application<br/>Restore production copy"]
  Restore --> Migrate["Run migrations using<br/>the pinned application image"]
  Migrate -->|"Success"| Verify{"Read-only state, catalog,<br/>and Evidence checks pass?"}
  Verify -->|"Yes"| Start["Start the same pinned image<br/>Wait for health and readiness"]
  Verify -->|"No"| Stop["Leave application stopped<br/>Inspect failure and receipt"]
  Migrate -->|"Failure"| Stop

Install deploy-staging-copy.sh and its sync.sh dependency beside the staging Compose configuration before dispatching Deploy staging. The workflow runs through the protected staging-migration environment and passes the selected image revision and migration inventory to that host helper.

Validation checks migration state, catalog compatibility, and Evidence preservation. The source database must have reached v2.8.0. Validate retained attribution with its recorded fingerprints. A failed migration or deployment does not restart an older fallback image.

Prerelease publication performs its separate source-based production-copy rehearsal before publishing images. It does not start the staging application. The deployment workflow owns invocation and image selection; Development And Testing describes the verification boundaries.

Use the workflow guide to rebuild a production or demo image from an existing prerelease tag. Publish a prerelease image

Health Triage

  1. Record the image/source revision, UTC window, correlation ID, and bounded public error.
  2. Check readiness, database connectivity/locks, effective configuration, and required sink health.
  3. Open the matching control diagnostic view and inspect actual capture availability.
  4. Follow typed remediation; preserve source data and operation identity.

Console logs can contain admitted user text. Inspect within the operator boundary; collect only the authorized protected evidence needed for diagnosis.

Synchronous Remember Failure Triage

%%{init: {"flowchart": {"curve": "linear"}}}%%
flowchart TB
  Call["Remember call"] --> Receipt{"Terminal receipt received?"}
  Receipt -->|"Yes"| Inspect["Inspect processing state,<br/>Evidence outcomes, errors and warnings"]
  Receipt -->|"No"| Unknown["Unknown delivery outcome<br/>Retain complete original request/key"]
  Inspect --> Error{"Failure class"}
  Error -->|"Input / policy"| Correct["Follow bounded correction guidance"]
  Error -->|"Provider / database"| Diagnose["Join invocation and canonical attempt"]
  Unknown --> Recover["Unchanged-request recovery when permitted"]
  Diagnose --> Recover

The control Remember view links admitted invocations to canonical attempts. Execution, replay, and key-conflict calls are different invocations and can refer to one attempt. Inspect phase, request hash, validation details, retry eligibility, and provider-exchange availability.

FailureOperator action
Initial security rejectionUse content-free rule/span metadata; no rejected body was captured.
Changed request under the same keyCompare saved request identity; do not bypass conflict by rotating keys.
Stale source or generationRefresh authorized current state before an intentional revised operation.
Provider/embedding failureCheck actual endpoint/model, remaining deadline, dimensions, and returned retry action.
Commit failureCheck transaction/fence errors and database health.
Retired contractInspect retained outcome; no replay through the removed graph contract.

Staged exact intake can remain after required failure without new accepted semantic memory. A response-write observation is not proof of client delivery. See Memory Write Pipeline and Telemetry.

Search Convergence

Inspect GET /control/api/search/convergence or the control Search convergence view. Compare expected, current, drifted, pending, and failed documents with active source/embedding/index generations.

Required foreground embeddings finish before Remember success. Later source or contract changes can need bounded reconciliation. Investigate the allowlisted failure and latest reconciliation outcome; do not repair search by rewriting canonical Evidence or relabeling incompatible vectors.

Recall Latency Or Quality

ObservationInvestigate
Empty/degraded resultsPublic search states and degradations, then authorized source/lifecycle visibility.
Missing topic follow-upOrganization enablement, current memberships, dependencies, and unseen eligible counts.
Slow provider phaseModel, request/context size, concurrency, and provider diagnostics.
Slow database phaseScoped full-text/vector plans, active index definition, connection pressure, and slow-query logs.
Quality changedSame-identity deterministic comparison; see Evaluation.

Use trace for individual Evidence state. Metrics cannot establish the lifecycle or truth of a source.

Topic Maintenance

%%{init: {"flowchart": {"curve": "linear"}}}%%
flowchart LR
  Status["Inspect status"] --> Configure["Configure maintenance"]
  Configure --> Enable["Enable"]
  Enable --> Progress["Observe progress"]
  Progress --> Pause["Pause admission"]
  Pause --> Resume["Resume"]
Private control routePurpose
GET/PATCH /control/api/config/topic-maintenanceRead/update supported settings.
GET /control/api/topic-maintenance/statusCurrent policy, pause state, usage, and progress.
GET /control/api/topic-maintenance/runsBounded run history.
POST /control/api/topic-maintenance/runsExplicit bounded run with retained operation_key and optional max_batches.
POST /control/api/topic-maintenance/runs/{runId}/retrySupported explicit retry of the selected run.
POST /control/api/teams/{teamId}/topic-maintenance/reassessReassess 1–20 distinct, eligible, uncategorized shared Evidence IDs for this team.
POST /control/api/topic-maintenance/pause or /resumeIdempotent admission control with retained operation key.

The reassessment body contains operation_key and evidence_ids. The server resolves the team's current shared-space generation. An invalid, private, or out-of-team target rejects the whole request. Replaying the same operation key and input returns the first run; changing the input under that key conflicts. The action is audited. Ordinary run retry selects failed work from the selected run.

Inspect Topic assignment, Community placement, and Evidence-equivalence counts, failed or ambiguous outcomes, and unreconciled or unavailable usage. One-member automatic Topics do not block Community coverage. Filter structured logs by team, run, and batch to inspect candidate degradation, provider failures, stale inputs, and retry outcomes; protected payload chunks carry indexes and hashes for reconstruction. Pause stops background admission and lets dispatched work finish. Foreground assignment and Topic reads continue while enabled and paused. Disabling organization defers assignments and Topic reads. Ordinary Recall remains available.

See Configuration and Topics And Organization.

Topic Storage Upgrade

This procedure applies to images that include the relational Topics cutover and its later hybrid Topic migrations. Cutover migration

  1. Check the database version and source image. This upgrade supports v2.8.0 and later, including interrupted migrations within that range. For a database below the floor, use the released v2.8.0 upgrade procedure first.
  2. Close application ingress, pause the old worker, and drain active requests. Stop every application service and confirm that writers have disconnected. With a server image that includes migration 20261127010000, startup discards stale in-flight Topic maintenance batches and releases maintenance leases before applying pending migrations. It records orphaned provider attempts as unavailable usage and retains their attempt history. Maintenance cleanup migration
  3. Verify a PostgreSQL backup by restoring it in isolation. Record the source version, scoped counts, canonical fingerprints, legal holds, and historical receipts.
  4. Start one compatible server with ingress held. Follow the protected stdout migration events for the version, phase, batch, row count, fingerprint, and outcome. The database fences writes until the migration reconciles the copy. Startup validates the completed migration before opening listeners.
  5. Check Topic history, direct Recall, and retained settings before reopening traffic. After interruption, resume with the same version and check the new receipts. Use the verified backup for recovery before reopening writes and forward repair afterward.

After stopping the services in step 2, use a separate PostgreSQL operator session to identify any remaining application connections.

sql
SELECT pid, usename, application_name, state
FROM pg_stat_activity
WHERE datname = current_database()
  AND backend_type = 'client backend'
  AND pid <> pg_backend_pid();

Evidence Conflicts

Use the control Evidence-conflict workspace. Inspect exact positions and provenance before a version-fenced resolve/dismiss command. The current procedure and routes are in Conflicts And Corrections.

Private-Memory Erasure

Inspect the exact private target, operation state, active generation, and applicable legal holds. A queued acknowledgement is not physical completion. Let the privacy owner seal/fence and verify its catalog-complete purge. Do not unseal a target or reset generations to retry a stale writer.

Erasure includes raw intake, extraction checkpoints, retained memory, dependent projections, and applicable migration copies. Unaffected spaces remain separate. Owner-facing requests and polling are in Portals And API Keys.

MCP OAuth Connections

Release v2.9.2 introduces these controls; see implementation status.

Control portal locationPurpose
Settings → SSO runtimeOAuth status: authority mode and reason, MCP and SSO public base URLs, whether their origins match, and the active grant count.
Identity & access → OAuth connectionsActive grants by team, client, sign-in source, subject, resource, scopes, and timestamps. Revoke asks for confirmation and is audited.
Private control routePurpose
GET /control/api/oauth/statusResolved authority and origin check.
GET /control/api/oauth/grantsActive grants; optional team_id, limit, and offset.
DELETE /control/api/oauth/grants/{grantId}Revoke a grant and its tokens.

Mode meanings and repairs are in Configuration. An unavailable mode returns 503 from discovery until an operator corrects the invalid provider or base URL. origins_match=false blocks SSO consent; team-API-key consent still works.

Leaked OAuth Token Or Key

  1. Record the UTC window, correlation IDs, and suspected team, client, and grant. Find the grant in OAuth connections.
  2. For a leaked dmoa_ or dmor_ token, revoke its grant. This ends the access and refresh tokens together: the next MCP call returns 401, and a refresh attempt fails with invalid_grant. If a rotated refresh token was replayed, Dense-Mem has already revoked the family; confirm reason_code=refresh_replayed.
  3. For a leaked team API key, rotate or revoke the credential as described in Portals And API Keys. The same transaction revokes every grant approved with that key. Reconnect legitimate hosts with the new key.
  4. For a compromised SSO account, disable the identity, mapping, entitlement, or provider. Affected grants fail on the next call or refresh. Disabling the provider revokes its grants. Revoke any remaining grants for that subject explicitly.
  5. Verify: the old token returns 401, stage=oauth_revoke records the revocation_reason, and the audit log contains the revocation or key change. Connections that use another grant and an unaffected key or membership continue to work.

Diagnostic fields and reason codes are in Telemetry.

Backup

Use a PostgreSQL backup/PITR policy matching durability requirements. For a logical backup of the bundled stack:

bash
docker compose exec -T postgres sh -c 'pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" -Fc' > dense-mem.dump

Protect the dump. Record database/server versions, schema, pgvector, active search contracts, WAL coverage, checksums, and protected configuration references. Redis is not a full backup. Test restores in isolation.

Restore And Disaster Recovery

  1. Restore the selected PostgreSQL backup and WAL into an isolated environment.
  2. Restore compatible protected configuration; verify schema, pgvector, ownership, RLS, and search contracts.
  3. Check canonical counts, representative traces, private isolation, and current/temporal recall.
  4. Verify derived reconciliation and worker lease recovery.
  5. Restore traffic only through the authorized deployment procedure.

Do not restore erased private content by resetting a space generation. After incompatible migrations or new writes, retain compatible readers/writers and recover forward as required.

Pre-Cutover Custom-Format Restore

Use a new, isolated database with the source roles available. Run each pg_restore stage with --exit-on-error --single-transaction. Preserve archive ownership and grants.

  1. Restore the schema with --section=pre-data.
  2. Load public.memory_spaces with --data-only --schema=public --table=memory_spaces. Legacy inline scope checks consult this table while dependent rows are copied.
  3. Create a remaining-entries list with pg_restore --list and comment out only the TABLE DATA public memory_spaces entry. Restore with --section=data --section=post-data --use-list=<remaining-entries>.

If a stage fails, stop the rehearsal and use a fresh isolated database for the retry. After all stages succeed, verify the pre-cutover catalog and preserved history with the restricted runtime role.

PostgreSQL Statement Statistics

The example Compose files preload pg_stat_statements (Compose server tuning). Create the extension once as the database superuser; application migrations cannot, because restricted deployments migrate as a non-superuser and the extension is not trusted.

bash
docker compose exec postgres sh -c 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"'
docker compose exec postgres sh -c 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT calls, round(total_exec_time) AS total_ms, round(mean_exec_time::numeric, 2) AS mean_ms, rows, left(query, 120) AS query FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 20;"'

Compare a statement with the sql_fingerprint in slow_postgres_query_summary events (Telemetry). Reset the statistics with SELECT pg_stat_statements_reset(); before measuring a change.

Migrations 20261129020000 to 20261129020003 rewrite the memory-space row-level security policies, replace two space helper functions, check Remember partitions once per item, and replace the private-hold deletion guard. Apply them as an offline upgrade under ADR 0021: stop all application services, verify quiescence and a restore-tested backup, then start the new image so it migrates before serving. Each migration checks the exact definitions it replaces and runs in one transaction, so a failed check rolls back and leaves the previous definitions in place. The policy rewrite also stops after a 5-second lock wait; with application services stopped it does not wait.

Routine Maintenance And Shutdown

Monitor locks, slow queries, connection budget, vacuum/analyze, disk/WAL, backups, provider failures, search/organization convergence, diagnostic retention, and coordination health. More application replicas increase database/provider pressure.

Graceful shutdown stops admission and cancels request/worker contexts before closing dependencies. A forced disconnect can leave a client uncertain about delivery; retain operation identity. Keep support bundles bounded and protect operational credentials and admitted text.