Skip to main content

Decision-Evidence Graph: traceable, challengeable, temporal decision provenance for AI agents

Project description

DEG — Decision-Evidence Graph

Persistent decision memory for AI agents. DEG records WHY decisions were made, WHAT alternatives were rejected, and WHEN to reconsider — across sessions, with full provenance. It integrates as a Claude Code skill (via MCP + hooks) so decisions are captured and queried automatically, with zero manual documentation maintenance.

Quick Start

pip install deg[mcp]
cd my-project
deg init --goal "Build a fraud detector" --phase "Research"
deg setup
# Restart Claude Code — DEG is now active

What Happens After Setup

Claude Code will automatically:

  • Record decisions with evidence, alternatives, and reconsider-if triggers
  • Surface stale decisions when triggers fire (time-based, metric drift, dependency changes)
  • Trace provenance chains when you ask "why did we choose X?"
  • Challenge decisions when new evidence contradicts them
  • Hand off session state so the next session starts with full context

You don't invoke DEG manually. It runs reflexively via hooks and MCP tools.

Core Operations

Operation Description
status() Project state, stale alerts, and next actions
decide() Record a decision with evidence, alternatives, and reconsider_if
evidence() Record a finding with source, confidence, and temporal validity
search(query) Hybrid semantic + keyword + graph-walk retrieval
trace(id) Full upstream provenance chain (BFS)
challenge(id) Check validity, triggers, evidence health, and alternatives
impact(id) Downstream cascade — all affected nodes
continue_research(id) Next searches, open questions, and look_for directives
close_session() Save state for the next session
compile() Incremental YAML-to-JSONL+FAISS compilation

CLI Commands

deg init          Initialize a DEG project (creates decisions/, evidence/, .deg/)
deg setup         Configure Claude Code skill (CLAUDE.md + MCP + hooks)
deg status        Show project state and stale alerts
deg decide        Record a decision interactively
deg evidence      Record evidence interactively
deg search        Search the decision graph
deg trace         Trace provenance for a node
deg challenge     Challenge a decision's validity
deg impact        Show downstream impact of a node
deg continue      Show next steps for a research thread
deg close         Close session and save state
deg compile       Force recompilation of all sources
deg export        Export graph as JSON/DOT/Mermaid
deg serve         Start MCP server (for non-Claude clients)

MCP Tools

DEG exposes 9 tools via MCP for any compatible AI client:

Tool Purpose
deg_status Get project state and alerts
deg_decide Record a decision
deg_evidence Record evidence
deg_search Query the decision graph
deg_trace Get provenance chain
deg_challenge Challenge a decision
deg_impact Get downstream cascade
deg_continue_research Get next research steps
deg_close_session Save session state

How It Works

decisions/         YAML frontmatter markdown (human-readable, git-friendly)
evidence/          Same format for findings, measurements, sources
.deg/
  index.jsonl      Compiled node index
  graph.jsonl      Edge list
  embeddings.faiss IDMap2(FlatL2) vector index
  state.yaml       Session handoff state

Architecture:

  1. Decisions and evidence are stored as markdown files with YAML frontmatter
  2. deg compile incrementally hashes and indexes them into .deg/ (content-hash dedup, ~100x embedding savings)
  3. Claude accesses the graph via MCP tools during conversation
  4. Hooks auto-fire deg status on session start and deg close on session end
  5. Retrieval is hybrid: semantic (FAISS) + keyword (BM25-like) + graph walk (Personalized PageRank)
  6. DEG itself makes zero LLM calls — all intelligence comes from the host agent

Latency: status 0.6ms, decide/evidence 22ms, search 6ms, trace/impact <1ms.

Ecosystem

DEG handles decision provenance. For full agent context, pair with:

  • Understand-Anything — code structure graph (replaces architecture docs)
  • TinyFish — web research with source tracking
  • Probe-Ratchet — deterministic experiment loops with automatic evidence capture
  • ML-Intern — deep literature research agent (feeds evidence into DEG)

Together with DEG, these replace all manually-maintained .md files except a minimal CLAUDE.md.

Install Options

pip install deg[mcp]    # Recommended: MCP server + CLI + hooks
pip install deg         # Minimal: CLI only, no MCP
pip install deg[all]    # Full: adds local FAISS semantic search

Requirements

  • Python 3.10+
  • Claude Code (or any MCP-compatible client)
  • No API keys needed — DEG makes zero external calls

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

degraph-1.0.0.tar.gz (174.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

degraph-1.0.0-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file degraph-1.0.0.tar.gz.

File metadata

  • Download URL: degraph-1.0.0.tar.gz
  • Upload date:
  • Size: 174.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for degraph-1.0.0.tar.gz
Algorithm Hash digest
SHA256 12c6eed2a4adb07af18d00d63b5935719e9f5157423e5ee7614fca3a906a20ec
MD5 605a3795ebac017e66da0c46baa27289
BLAKE2b-256 79653fe5eb807bc191a202276ef1368584bf825cd2412a8ba87d35859e5f7542

See more details on using hashes here.

File details

Details for the file degraph-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: degraph-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for degraph-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cdde56d93cbc55ca8d09d684cda999a97512a422acbfcb9c9f3cf7f6cb9f3a6
MD5 b10a6739a375756246fc1653fe8e4549
BLAKE2b-256 ac31941cd15b4537db701718a1a41e6ce682e07fdc76804ce0ce125e24c56ce7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page