Files
yvgude--lean-ctx/docs/contracts/workflow-evidence-ledger-v1.md
T
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

1.9 KiB

Workflow Evidence Ledger v1 (EvidenceLedgerV1)

GitLab: #2315

LeanCTX Workflows können Transitions an Evidence Keys koppeln (evidence-gated transitions). Evidence Ledger v1 standardisiert, wie Evidence Items gespeichert, gehasht und für Gates ausgewertet werden.

Ziele

  • Deterministisch: gleiche Inputs → gleiche Evidence IDs/Keys.
  • Auditierbar: Evidence ist content-addressed (MD5) und bounded.
  • Privacy-first: keine Secrets; Values werden redacted und nur als Hash + kurzer Excerpt gespeichert.
  • Kompatibel: bestehendes Workflow-Verhalten bleibt nutzbar; Ledger ergänzt/vereinheitlicht.

Speicherort

  • Global (local-first): ~/.lean-ctx/workflows/evidence-ledger-v1.json

Schema (v1)

  • schema_version (SSOT: leanctx.contract.workflow_evidence_ledger_v1.schema_version=1)
  • items[] mit:
    • kind: tool_receipt|manual|proof_artifact|ci_receipt
    • key: Evidence Key (z.B. tool:ctx_shell)
    • id: deterministic content hash
    • optional: input_md5, output_md5, agent_id, client_name
    • optional: value_md5, value_excerpt (redacted + bounded)
    • optional: artifact_name (basename only)

Gating semantics

  • Ein Transition Requirement (requires_evidence) ist erfüllt, wenn mindestens ein Ledger Item mit identischem key existiert.
  • Default Workflows verwenden Tool-Receipts (z.B. tool:ctx_read, tool:ctx_shell) als Evidence.

Automatic evidence

  • Tool calls erzeugen automatisch tool:{tool} und tool:{tool}:{action} Evidence Keys (z.B. tool:ctx_read:full).
  • ctx_workflow evidence_add schreibt manual Evidence in den Ledger.
  • ctx_proof schreibt Proof-Artefakte als proof:* Evidence (basename + md5).

Relevanter Code

  • Ledger: rust/src/core/evidence_ledger.rs
  • Workflow Tool: rust/src/tools/ctx_workflow.rs
  • Tool receipts boundary: rust/src/server/mod.rs
  • Proof export wiring: rust/src/tools/ctx_proof.rs