跳到正文
GitHub·· 9 天前AI 评分38

ChainWatch:为 AI 智能体打造的可验证飞行数据记录器

Tarunjit45/ChainWatch

AI 导读

ChainWatch 是一个面向多步自主 AI 智能体系统的飞行数据记录器,用 SHA-256 哈希将每一步决策状态加密链接,防止日志被篡改并支持完整性验证。它记录输入、LLM 思维链、工具调用、参数与返回载荷到结构化 .jsonl 文件,并提供确定性决策回放、完整性校验和审计合规报告功能。项目以 MIT 许可证开源,可通过 CLI 执行 verify、replay、report 命令。

正文

Python Architecture CLI License: MIT

ChainWatch is a flight data recorder for multi-step autonomous AI agent systems. It deterministically records every step in an agent's decision chain, links states cryptographically with SHA-256 hashes, prevents log tampering, and allows developers to verify execution integrity and replay the complete decision flow.


🌟 Key Features

  • Cryptographic Hash Chaining: Every step references the hash of the preceding decision state—forming a verifiable, tamper-evident audit ledger.
  • Flight Data Recording: Logs inputs, LLM thought chains, tool invocations, parameters, and return payloads into structured .jsonl chain files.
  • Integrity Verifier: Inspects logged decision chains and flags modified steps, truncated traces, or broken hashes.
  • Deterministic Decision Replay: Step-by-step playback utility to reproduce failure states, debug regressions, and examine agent reasoning.
  • Audit & Compliance Reports: Exports clean audit summaries for AI safety and compliance reviews.

📁 Repository Structure

ChainWatch/
├── chainwatch/
│   ├── cli.py          # Command line interface commands
│   ├── hashing.py      # Cryptographic hashing & tamper-prevention algorithms
│   ├── models.py       # Pydantic / dataclass schemas for decision nodes
│   ├── recorder.py     # Non-blocking flight data recording hooks
│   ├── replay.py       # Decision chain step-by-step replayer
│   ├── verifier.py     # Hash integrity validation engine
│   └── report.py       # Formatted audit reports generator
├── chains/             # Example recorded decision chain logs (.jsonl)
├── pyproject.toml      # Package configuration & dependencies
└── README.md           # Documentation

🚀 Quick Start

1. Installation

git clone https://github.com/Tarunjit45/ChainWatch.git
cd ChainWatch
pip install -e .

2. CLI Usage

# Verify integrity of a recorded decision chain
chainwatch verify chains/chain_001.jsonl

# Replay an agent's multi-step decision trajectory
chainwatch replay chains/chain_001.jsonl

# Generate an executive audit report
chainwatch report chains/chain_001.jsonl

📄 License

This project is open-source under the MIT License.

来源:GitHub · github.com