Dokumentation

Reproduzierbarkeit - LeanCTX

Reproduzierbarkeit

Wie Agent-Runs reproduzierbar werden: stabile Inputs, explizite Policies, Session-Persistenz und Verification Gates.

Was stabil bleiben muss

Replayability beginnt bei stabilen Inputs - der Tool-Graph ist nur so deterministisch wie die Umgebung.

  • Gleicher Project Root + erlaubte Pfade
  • Gleiche Config & Memory Policy
  • Gleicher Code + Dependencies (Lockfiles)

Policies als Vertrag

Memory- und Verification-Settings definieren, was persistiert und welche Checks gelten.

# ~/.lean-ctx/config.toml
[memory]
policy = "balanced"

[verification]
enabled = true

Tipp: Policy-Änderungen versionieren und reviewen.

Session-Artefakte

Sessions halten fest, was passiert ist: Tool-Calls, Memory Writes, Relations und Outputs.

# Start a server with a fixed project root
lean-ctx serve --host 127.0.0.1 --port 8080 --project-root /path/to/repo
# Example tool calls that leave an audit trail
ctx_session("load", { id: "..." })
ctx_knowledge("remember", { category: "...", key: "...", value: "..." })

CI Gates

clippy/tests + Verification Checks als nicht-verhandelbare Qualitätsgates behandeln.

# CI gates / local checks
cd rust
cargo fmt -- --check
cargo clippy --all-features -- -D warnings

# SSOT drift gate (manifest must be up-to-date)
cargo run -q --bin gen_mcp_manifest
git diff --exit-code ../website/generated/mcp-tools.json

# Core tests (deterministic + bounded)
cargo test --all-features -- --test-threads=1

# Lightweight regression checks (stable thresholds)
cargo test -q --test savings_verification

# Proof artifact (machine-readable attestation, no secrets)
cargo run -q --bin lean-ctx -- proof --summary --no-write

Cookbook: End-to-End Beispiele

Echte Integrationen gegen laufenden Server (keine Mock-Daten).

cd cookbook
npm ci
npm run memory-playground
npm run graph-explorer