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 remaind

Requires 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 proof

Optional 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 --force
InstallFetch the published Remaind package.
PlanConfirm Basic is offline, local, and not tied to billing or accounts.
InitializeCreate a local .context workspace in the current project.
DoctorCheck local memory structure, state, and runtime readiness.
Finance demoRun the governed policy-exception proof with scoped reviewed memory.
ProofRun continuity, handoff, speed, context-engine, matrix, and agent-hook checks.

Full 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
remaind init [--path P] [--force]
What it does
Create .context/. --force backs up an existing one first.
Command
remaind validate [--path P]
What it does
Walk the v1 checklist: structure, schemas, state, handover, events, event chain, SQLite.
Command
remaind status [--path P] [--json]
What it does
Goal, status, next step, token band, event counts, compaction recommendation.
Command
remaind plan [--json]
What it does
Show the local Basic/Pro entitlement boundary. Phase 1 has no network, billing, or license checks.
Command
remaind doctor [--path P] [--json]
What it does
Read-only health check for context validity and configured model runtime detection.
Command
remaind monitor [--path P] [--json]
What it does
Scheduler-friendly alert check for context health, urgent compaction, and unhealthy deep-compaction runs.
Command
remaind init --secure
What it does
Create and seal a secure workspace with encrypted core .context storage.
Command
remaind unlock --ttl 30m
What it does
Decrypt sealed core files and open a bounded secure-handoff window.
Command
remaind lock
What it does
Reseal sensitive core files and close the secure-handoff window.
Command
remaind key rotate
What it does
Re-encrypt locked secure workspace storage with a new passphrase.
Command
remaind launch [--path P]
What it does
Primary startup flow: activate memory, prove runtime readiness, then route into ask, paste, file, resume, handover, or empty mode.
Command
remaind ask "QUESTION"
What it does
Ask the active project memory in plain language, with optional reviewed-memory scope filters.
Command
remaind chat
What it does
Stay inside an interactive Remaind memory chat for the selected workspace.
Command
remaind context inspect
What it does
Inspect the engineered memory context before a model sees it.
Command
remaind continuity scorecard
What it does
Inspect continuity scorecards, evidence links, and coding-agent exports.
Command
remaind memory ...
What it does
Agent-facing commands for plan, blocker, decision, promotion, conflict resolution, changes, and reviewed memory.
Command
remaind daemon ...
What it does
Manage the local presence daemon, workspace index, and shell hook.
Command
remaind compact [--path P]
What it does
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.
Command
remaind resume [--path P] [--next-tool T]
What it does
Build active/resume_packet.md and consult the resume gate.
Command
remaind capture [--path P]
What it does
Capture completed model/agent work into durable continuity memory from flags, stdin, or a final-output file.
Command
remaind handoff [--path P] [--to-model M]
What it does
Build a universal cross-model handoff bundle with markdown, manifest hashes, and adapter exports.
Command
remaind transfer start --from-model A --to-model B
What it does
Prepare a guided cross-LLM transfer with receiver instructions, handoff bundle, adapters, manifest, and finish command.
Command
remaind transfer finish --from-model B --from-file OUTPUT.md
What it does
Capture the receiving model's completed work back into the same local continuity memory.
Command
remaind handoff --secure --ttl 30m
What it does
Encrypt the exported handoff bundle and remove plaintext export files from the handoff folder.
Command
remaind handoff-decrypt --bundle B --out DIR
What it does
Decrypt a secure handoff bundle into an explicit receiving folder.
Command
remaind rollback [--path P] --to TS
What it does
Restore derived files from history as of TS. The raw log is never touched.
Command
remaind hermes activate --workspace P
What it does
Install the Hermes provider and context-engine plugins, then configure Hermes with a backup.
Command
remaind hermes status --require-ready
What it does
Check Hermes plugin files, config selections, and workspace readiness before opening Hermes.
Command
remaind hermes speed --checkpoint-smoke --require-ready
What it does
Measure Hermes startup context size/time and write a real fast checkpoint/reset smoke proof.
Command
remaind hermes ux-proof --require-ready
What it does
Verify the low-noise Hermes/Remaind launch path, prompt-size warnings, and checkpoint/reset proof.
Command
remaind hermes verify --force --include-live
What it does
Run the Hermes launch gate: installed readiness, low-noise UX proof, live loading, comparison, lifecycle, and long-run reset loop.
Command
remaind hermes support-bundle --out reports/hermes --force --zip
What it does
Create a redacted Hermes/Remaind evidence bundle with status, UX proof, checksums, and launch-review reports.
Command
remaind hermes support-bundle-check --bundle reports/hermes.zip
What it does
Verify bundle checksums, privacy flags, no raw memory files, and UX proof evidence before trusting it.
Command
remaind run FILE "TASK" [--path P]
What it does
Execute a task against a huge local prompt/document by building a compact evidence packet and calling the configured model.
Command
remaind large-doc ...
What it does
Index, search, slice, head, and tail huge local documents through terminal-backed access.
Command
remaind proof
What it does
Run the golden clean-install proof path: plan boundary, continuity, sovereign beyond-context, handoff, speed, context-engine, context-matrix, and agent-hook checks.
Command
remaind proof --secure
What it does
Add secure workspace checks for locked export, encrypted storage, unlock, encrypted handoff, decrypt, cleanup, key rotation, and relock.
Command
remaind demo finance-handoff [--force]
What it does
Run the finance policy-exception continuity demo through a real local .context/ ledger.
Command
remaind demo agent-continuity [--force]
What it does
Ask a configured local or private model to continue a software-agent task from a Remaind resume packet and cite source events.
Command
remaind bench sovereign [--workdir P]
What it does
Run the isolated beyond-context benchmark: distant contradiction, revocation, source links, and adversarial checks.
Command
remaind bench finance-handoff
What it does
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 outputs

Schemas

JSON Schemas are canonical — runtime data is validated against them, not the other way around. The YAML files are configuration.

File
event.schema.json
Purpose
Every line of events.jsonl — validated before append.
File
state.schema.json
Purpose
active/state.json — validated on every write.
File
memory.schema.json
Purpose
Rows in the SQLite memory index.
File
validation.schema.json
Purpose
The compaction validator's structured result.
File
thresholds.yaml
Purpose
Token-band math and the compaction budget.
File
redaction.yaml
Purpose
Regex patterns + replacement format for secret redaction.
File
tools.yaml
Purpose
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
Authority order
Purpose
latest user instruction > raw log > state > handover > derived memories.
Mechanic
Resume gate
Purpose
surfaces conflicts, missing next steps, risky planned tools, and adversarial concerns.
Mechanic
Trust labels
Purpose
marks evidence as user, verified_tool, assistant, source_linked_memory, or lower-trust raw evidence.
Mechanic
Handoff manifest
Purpose
records exported handoff files with hashes so another harness can verify what it received.
Mechanic
Event chain
Purpose
new events carry hash-chain metadata; validate reports edits, deletions, or reordering.
Mechanic
Adversarial checks
Purpose
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
0
Meaning
trace / debug
Level
1
Meaning
normal useful event
Level
2
Meaning
decision, correction, constraint, file change, blocker, meaningful result
Level
3
Meaning
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
normal
Estimated tokens
< 60,000 tokens
Recommendation
continue
Band
warning
Estimated tokens
≥ 60,000
Recommendation
mark compaction pending
Band
hard
Estimated tokens
≥ 70,000
Recommendation
compact before the next substantial step
Band
emergency
Estimated tokens
≥ 80,000
Recommendation
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
./bootstrap.sh
What it proves or does
install the starter kit, including managed local Python when needed
Starter command
remaind
What it proves or does
refresh memory and launch the configured local agent adapter
Starter command
remaind doctor
What it proves or does
readiness checklist for Remaind, runtime, model, and adapter
Starter command
remaind launch
What it proves or does
guided memory-first startup with paste, file, resume, and empty modes
Starter command
make proof
What it proves or does
fresh-process retrieval proof without private data
Starter command
remaind run FILE "TASK"
What it proves or does
direct huge-prompt execution through a compact local evidence packet
Starter command
make adversarial
What it proves or does
deterministic hostile-memory and poisoned-compaction proof
Starter command
make bench
What it proves or does
large beyond-context contradiction/revocation benchmark
Starter command
make proof-2m
What it proves or does
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.