Docs
Reference for the Remaind CLI, the .context/ directory it manages, and the trust mechanics that make project memory useful beyond one model window. To wire Remaind into an agent, see Integrate.
Install
python3 -m pip install --upgrade remaindRequires Python 3.11+. Remaind is local-first: no hosted Remaind memory service is required, and project continuity lives in your .context/ directory.
Model-backed compaction can use Ollama automatically, or any OpenAI-compatible endpoint through REMAIND_OPENAI_BASE_URL. If no runtime is reachable, deterministic rule-based bookkeeping keeps the system safe. If you point Remaind at an external API endpoint, that provider receives the compact prompt you send it.
Five-minute proof path
One copy-paste path from claim to local proof.
This path installs the published package, creates local memory, checks the offline plan boundary, verifies readiness, runs the finance handoff proof, and then runs the golden continuity and handoff proof suite. remaind launch, remaind capture, and remaind handoff are the work commands after the proof path is trusted.
python3 -m pip install --upgrade remaind
remaind plan
remaind init
remaind doctor
remaind demo finance-handoff \
--force
remaind proofOptional real local-model proof after a local or private OpenAI-compatible model is configured:
export REMAIND_OPENAI_BASE_URL="<your-openai-compatible-model-url>"
export REMAIND_OPENAI_MODEL="<your-model-id>"
export REMAIND_OPENAI_API_KEY="<optional-local-or-private-key>"
export REMAIND_OPENAI_API=auto
remaind demo agent-continuity --forceFull command output includes local workspace paths and detailed evidence tables. Those paths vary by machine; the PASS lines below are the stable checks to look for. See the Demo page for the interactive reset comparison.
Expected finance demo output
# Finance Policy-Exception Continuity Demo
- Status: PASS
- Customer validation walkthrough: .../finance_handoff_artifacts/customer-validation-walkthrough.md
- Fixture readiness: PASS
- Packet Recall: 5/5 (100.0%)
- False Application Rate: 0/5 (0.0%)
- Honor Rate: 5/5 (100.0%)
- Reviewed Decision Retention: 5/5 (100.0%)Expected golden proof output
# Remaind Golden Proof
- Status: PASS
- Plan boundary: PASS
- Project continuity: PASS
- Sovereign beyond-context: PASS
- Universal handoff: PASS
- Fast handoff: PASS
- Hot packet speed: PASS
- Context engine: PASS
- Context matrix: PASS
- Agent hooks: PASS
## Expected Result
A healthy install prints Status: PASS plus the continuity,
handoff, speed, context-engine, context-matrix, and agent-hook
checks as PASS.Expected local-model proof output
# Agent Continuity Local-Model Demo
- Status: PASS
- Model: configured local/private OpenAI-compatible model
- Source events: 5
Checks: action, next step, decision, constraint, blocker,
source evidence, and packet source events all PASS.CLI reference
These commands cover the public lifecycle. Every state-mutating command snapshots the prior version before writing.
| Command | What it does |
|---|---|
| remaind init [--path P] [--force] | Create .context/. --force backs up an existing one first. |
| remaind validate [--path P] | Walk the v1 checklist: structure, schemas, state, handover, events, event chain, SQLite. |
| remaind status [--path P] [--json] | Goal, status, next step, token band, event counts, compaction recommendation. |
| remaind plan [--json] | Show the local Basic/Pro entitlement boundary. Phase 1 has no network, billing, or license checks. |
| remaind doctor [--path P] [--json] | Read-only health check for context validity and configured model runtime detection. |
| remaind monitor [--path P] [--json] | Scheduler-friendly alert check for context health, urgent compaction, and unhealthy deep-compaction runs. |
| remaind init --secure | Create and seal a secure workspace with encrypted core .context storage. |
| remaind unlock --ttl 30m | Decrypt sealed core files and open a bounded secure-handoff window. |
| remaind lock | Reseal sensitive core files and close the secure-handoff window. |
| remaind key rotate | Re-encrypt locked secure workspace storage with a new passphrase. |
| remaind launch [--path P] | Primary startup flow: activate memory, prove runtime readiness, then route into ask, paste, file, resume, handover, or empty mode. |
| remaind ask "QUESTION" | Ask the active project memory in plain language, with optional reviewed-memory scope filters. |
| remaind chat | Stay inside an interactive Remaind memory chat for the selected workspace. |
| remaind context inspect | Inspect the engineered memory context before a model sees it. |
| remaind continuity scorecard | Inspect continuity scorecards, evidence links, and coding-agent exports. |
| remaind memory ... | Agent-facing commands for plan, blocker, decision, promotion, conflict resolution, changes, and reviewed memory. |
| remaind daemon ... | Manage the local presence daemon, workspace index, and shell hook. |
| remaind compact [--path P] | Run the compaction pipeline, gated by structured validation. Uses a configured model endpoint when available (Ollama auto-detected; OpenAI-compatible endpoints via REMAIND_OPENAI_BASE_URL), else the rule-based fallback. |
| remaind resume [--path P] [--next-tool T] | Build active/resume_packet.md and consult the resume gate. |
| remaind capture [--path P] | Capture completed model/agent work into durable continuity memory from flags, stdin, or a final-output file. |
| remaind handoff [--path P] [--to-model M] | Build a universal cross-model handoff bundle with markdown, manifest hashes, and adapter exports. |
| remaind transfer start --from-model A --to-model B | Prepare a guided cross-LLM transfer with receiver instructions, handoff bundle, adapters, manifest, and finish command. |
| remaind transfer finish --from-model B --from-file OUTPUT.md | Capture the receiving model's completed work back into the same local continuity memory. |
| remaind handoff --secure --ttl 30m | Encrypt the exported handoff bundle and remove plaintext export files from the handoff folder. |
| remaind handoff-decrypt --bundle B --out DIR | Decrypt a secure handoff bundle into an explicit receiving folder. |
| remaind rollback [--path P] --to TS | Restore derived files from history as of TS. The raw log is never touched. |
| remaind hermes activate --workspace P | Install the Hermes provider and context-engine plugins, then configure Hermes with a backup. |
| remaind hermes status --require-ready | Check Hermes plugin files, config selections, and workspace readiness before opening Hermes. |
| remaind hermes speed --checkpoint-smoke --require-ready | Measure Hermes startup context size/time and write a real fast checkpoint/reset smoke proof. |
| remaind hermes ux-proof --require-ready | Verify the low-noise Hermes/Remaind launch path, prompt-size warnings, and checkpoint/reset proof. |
| remaind hermes verify --force --include-live | Run the Hermes launch gate: installed readiness, low-noise UX proof, live loading, comparison, lifecycle, and long-run reset loop. |
| remaind hermes support-bundle --out reports/hermes --force --zip | Create a redacted Hermes/Remaind evidence bundle with status, UX proof, checksums, and launch-review reports. |
| remaind hermes support-bundle-check --bundle reports/hermes.zip | Verify bundle checksums, privacy flags, no raw memory files, and UX proof evidence before trusting it. |
| remaind run FILE "TASK" [--path P] | Execute a task against a huge local prompt/document by building a compact evidence packet and calling the configured model. |
| remaind large-doc ... | Index, search, slice, head, and tail huge local documents through terminal-backed access. |
| remaind proof | Run the golden clean-install proof path: plan boundary, continuity, sovereign beyond-context, handoff, speed, context-engine, context-matrix, and agent-hook checks. |
| remaind proof --secure | Add secure workspace checks for locked export, encrypted storage, unlock, encrypted handoff, decrypt, cleanup, key rotation, and relock. |
| remaind demo finance-handoff [--force] | Run the finance policy-exception continuity demo through a real local .context/ ledger. |
| remaind demo agent-continuity [--force] | Ask a configured local or private model to continue a software-agent task from a Remaind resume packet and cite source events. |
| remaind bench sovereign [--workdir P] | Run the isolated beyond-context benchmark: distant contradiction, revocation, source links, and adversarial checks. |
| remaind bench finance-handoff | Run the deterministic finance policy-exception proof metrics without creating a demo workspace. |
The .context/ directory
One directory per project. Files under active/ are derived and atomically replaced; events.jsonl is append-only and authoritative; schemas/ is the contract. Runtime files (resume_packet.md, history/, db/, artifacts/) are git-ignored.
.context/
├── README.md local operating guide
├── CONTRACT.md the binding contract — read this first
├── active/
│ ├── state.json derived working state (atomic replace)
│ ├── handover.md compact continuity document (atomic replace)
│ ├── resume_packet.md runtime — assembled fresh-context packet
│ ├── run_packet.md runtime — evidence packet from remaind run
│ ├── run_answer.md runtime — latest answer from remaind run
│ └── history/ runtime — snapshots of every prior version
├── logs/
│ └── events.jsonl append-only raw timeline + event chain
├── large-docs/ runtime — manifests for huge local documents
├── handoffs/ runtime — universal cross-model handoff bundles
├── schemas/
│ ├── event.schema.json JSON Schema Draft 2020-12
│ ├── state.schema.json
│ ├── memory.schema.json
│ ├── validation.schema.json
│ ├── thresholds.yaml token-band math
│ ├── redaction.yaml secret patterns redacted before logging
│ ├── tools.yaml mechanical tool-risk flags
│ └── migrations/{state,events}/ future schema migration hooks
├── db/context.sqlite runtime — memory index + FTS5
└── artifacts/ runtime — large + binary outputsSchemas
JSON Schemas are canonical — runtime data is validated against them, not the other way around. The YAML files are configuration.
| File | Purpose |
|---|---|
| event.schema.json | Every line of events.jsonl — validated before append. |
| state.schema.json | active/state.json — validated on every write. |
| memory.schema.json | Rows in the SQLite memory index. |
| validation.schema.json | The compaction validator's structured result. |
| thresholds.yaml | Token-band math and the compaction budget. |
| redaction.yaml | Regex patterns + replacement format for secret redaction. |
| tools.yaml | Per-tool mutates / spends_money / external_side_effect flags. |
Trust and safety
Remaind is built for continuity, but it does not treat old memory as an instruction source. Retrieved memory is evidence. The latest user instruction and raw event log remain higher authority.
| Mechanic | Purpose |
|---|---|
| Authority order | latest user instruction > raw log > state > handover > derived memories. |
| Resume gate | surfaces conflicts, missing next steps, risky planned tools, and adversarial concerns. |
| Trust labels | marks evidence as user, verified_tool, assistant, source_linked_memory, or lower-trust raw evidence. |
| Handoff manifest | records exported handoff files with hashes so another harness can verify what it received. |
| Event chain | new events carry hash-chain metadata; validate reports edits, deletions, or reordering. |
| Adversarial checks | hostile memory, fake tool-result claims, superseded memories, and poisoned compaction output are quarantined. |
Importance levels
Every event carries an importance 0–3. Compaction must preserve all importance ≥ 2 events; importance = 3 items must be explicitly represented in state or handover.
| Level | Meaning |
|---|---|
| 0 | trace / debug |
| 1 | normal useful event |
| 2 | decision, correction, constraint, file change, blocker, meaningful result |
| 3 | remember-instruction, active next step, active blocker, critical user instruction |
Threshold bands
The token estimate drives a band. Defaults below — all configurable in thresholds.yaml.
| Band | Estimated tokens | Recommendation |
|---|---|---|
| normal | < 60,000 tokens | continue |
| warning | ≥ 60,000 | mark compaction pending |
| hard | ≥ 70,000 | compact before the next substantial step |
| emergency | ≥ 80,000 | compact immediately |
Proofs and starter kit
The Sovereign Memory starter kit packages Remaind into a complete local operator workflow: bootstrap, profiles, readiness checks, Qwen Code and console adapters, and executable product proofs. Model profiles include API-backed models, local runtimes, and custom model servers. Starter profiles use local project folders that the operator controls.
| Starter command | What it proves or does |
|---|---|
| ./bootstrap.sh | install the starter kit, including managed local Python when needed |
| remaind | refresh memory and launch the configured local agent adapter |
| remaind doctor | readiness checklist for Remaind, runtime, model, and adapter |
| remaind launch | guided memory-first startup with paste, file, resume, and empty modes |
| make proof | fresh-process retrieval proof without private data |
| remaind run FILE "TASK" | direct huge-prompt execution through a compact local evidence packet |
| make adversarial | deterministic hostile-memory and poisoned-compaction proof |
| make bench | large beyond-context contradiction/revocation benchmark |
| make proof-2m | terminal-visible local-model A/B test with and without memory |
The 2M proof is an A/B demonstration, not a claim of one-shot full attention: direct raw prompt fails or loses distant facts; the compact, source-linked Remaind packet fits the current window and recovers the tested facts.
The finance proof path is separate from the starter kit: remaind demo finance-handoff shows reviewed exceptions moving through a real local ledger, while remaind bench finance-handoff prints the compact deterministic scorecard.
For a real local-model proof, run remaind demo agent-continuity --force after pointingREMAIND_OPENAI_BASE_URL and REMAIND_OPENAI_MODELat a local or private OpenAI-compatible model server. That proof is separate from the golden proof because it measures model honor behavior, not only Remaind's deterministic packet machinery.
For the Hermes launch path, run remaind hermes status --require-ready, remaind hermes speed --checkpoint-smoke --require-ready, then remaind hermes verify --force --include-live. The launch gate checks installed readiness, low-noise UX, provider comparison, live Hermes loading, and the 500k-token reset loop.
Next
Integrate — wire Remaind into your agent loop: the public API, event logging, compaction, capture, and handoff, with runnable code. How it works — the mechanics behind the commands. The full binding contract ships as .context/CONTRACT.md after remaind init.