Migrating from v1.x to v2.0
Per ADR-001, the canonical version line of stigmem begins at v0.9.0a1 (2026-05-09). The version markers v1.x and v2.0 referenced in this document labeled internal development checkpoints, not tagged public releases — there is no installed v1.x or v2.0 to migrate from. This document is preserved as historical record of an announced-but-withdrawn migration path.
Migrating from v1.x to v2.0
What this document is
Historical step-by-step upgrade guide for Stigmem v1.x to v2.0 — federation trust, recall, lazy instructions, security hardening, RTBF, time-travel, CIDs. Preserved as the record of an announced but withdrawn migration path.
Audience: Operators and developers running a stigmem node on v1.0 or pre-reset draft who want to upgrade to v2.0. Spec reference: v2.0 promotes §19–§25 from draft to normative. §1–§18 are unchanged.
v2.0 introduces new database migrations, mandatory mTLS for federation, and new wire-format fields. Read the full guide before upgrading a production node.
Upgrade overview
recall_instruction tool.as_of parameter on recall and facts endpoints.Suggested cutover order
- Security hardening (§22) — enable mTLS and audit logging first; all subsequent features depend on it.
- Federation trust (§19) — publish your org manifest and set up transparency log integration.
- Recall & graph (§20) — run the embedding backfill; enable the recall pipeline.
- Lazy instruction discovery (§21) — migrate instruction files if applicable.
- RTBF tombstones (§23) — enable the tombstone API and federation route.
- Time-travel queries (§24) — available immediately after §23 migrations.
- Content-addressed IDs (§25) — run
stigmem backfill-cidslast (non-blocking).
Experimental features
Operator warnings (GA features with non-obvious risks)
STIGMEM_TRUST_CACHE_BACKEND=redis for production multi-worker.trust_mode=strict.Database migrations
013a013c# Docker Compose (recommended)
git pull
docker compose up --build -d
# Verify migrations
curl -s http://localhost:8787/v1/admin/status | jq '.migrations'
Rolling back after tombstones have been issued will lose RTBF compliance state.
Take a backup before upgrading.
Federation trust (§19)
/.well-known/stigmem-manifest.json.federate verb tokens for each peer.Migration steps:
- Generate an Ed25519 keypair for your node:
stigmem keygen --out /etc/stigmem/node-key.pem - Publish your org manifest:
stigmem manifest publish --entity-uri "stigmem://your-org/node-1" --key /etc/stigmem/node-key.pem - Issue capability tokens for each federation peer via
POST /v1/federation/tokens. - Configure trust mode:
STIGMEM_FEDERATION_TRUST_MODE=strictfor production,relaxedfor development.
Recall & graph (§20)
entity_edges materialized at startupvec_facts)GET /v1/recall replaces ad-hoc queries# Default: Ollama with nomic-embed-text (local, Apache-2.0)
ollama pull nomic-embed-text
# Or use a cloud provider
export STIGMEM_EMBED_PROVIDER=openai
export STIGMEM_EMBED_MODEL=text-embedding-3-small
Allow time for initial embedding backfill.
For large stores (100k+ facts), this may take several minutes.
Lazy instruction discovery (§21)
If you are not using lazy instructions, no action is required — the feature is opt-in. If migrating from file-based instructions:
stigmem instruction migrate \
--role engineer \
--skill coding \
--input ./instructions/ \
--db stigmem.db
5-stage deprecation path ensures no instruction loss:
- Shadow — instructions loaded from both file and stigmem; mismatches logged.
- Flip — primary source switches to stigmem; file is fallback.
- File-off — file loading disabled; stigmem-only.
- Cleanup — file removed from deployment.
- Archive — original files preserved in audit storage.
Security hardening (§22)
Default quotas (per principal per minute):
fact_writefact_readtoken_issuerecallgraph_querysubscription_createadmin_actionKey rotation: Ed25519 signing keys SHOULD be rotated every 90 days (capability issuer) or 365 days (node signing).
stigmem key rotate --entity-uri "stigmem://your-org/node-1"
RTBF / tombstones (§23)
POST /v1/tombstonestombstone:read capability tokens to peers.# Issue a tombstone (admin key required)
curl -X POST http://localhost:8787/v1/tombstones \
-H "Authorization: Bearer $ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"entity_uri": "user:test-entity", "scope": "*", "reason": "test"}'
Tombstones use RFC 8785 (JCS) canonical JSON.
"signature" and "reason" fields are excluded before
canonicalization. The key_id field identifies the signing key
without trial-verification.
Time-travel / as-of queries (§24)
# What did we know about Alice on Jan 1, 2025?
resp = httpx.post("http://localhost:8787/v1/recall", json={
"intent": "Alice preferences",
"as_of": "2025-01-01T00:00:00Z",
"scope": "company",
})
Tombstone interaction:
legal_hold: false(default) — entity is suppressed from ALL queries including historical.legal_hold: true— entity is suppressed from live queries but visible inas_ofqueries for admin keys only.
Content-addressed fact IDs (§25)
cid field on all new facts# Run CID backfill for existing facts
stigmem backfill-cids --batch-size 1000 --rate-limit 500
# Monitor progress
curl http://localhost:8787/v1/admin/cid-backfill/status \
-H "Authorization: Bearer $ADMIN_KEY"
# Verify integrity on a sample
curl -X POST http://localhost:8787/v1/facts/fact_01J.../verify-cid \
-H "Authorization: Bearer $AGENT_KEY"
CID format:
CID = "sha256:" + hex_lowercase(SHA-256(RFC8785(canonical_body)))
The canonical body includes exactly six fields: entity, relation, value, scope, source, confidence — in lexicographic key order per RFC 8785.
Environment variable summary (new in v2.0)
STIGMEM_EMBED_PROVIDER / _MODEL / _DIMENSIONSSTIGMEM_CARD_MAX_AGE_SSTIGMEM_SUBSCRIPTION_REPLAY_SSTIGMEM_LAZY_INSTRUCTIONSSTIGMEM_TOMBSTONE_CACHE_TTL_SPre-upgrade checklist
- Back up your database.
- Verify NTP clock sync on all nodes (±5 min tolerance for replay protection).
- Ensure Ollama or alternative embedding provider is available.
- Provision mTLS certificates for each federation peer.
- Generate Ed25519 keypair and prepare org manifest content.
- Coordinate upgrade timing with federation peers (mixed v1/v2 federation is not supported).
- Plan for initial embedding backfill time (proportional to fact count).
- Allocate admin API keys for compliance operators (tombstone management).