Files
g3/crates/g3-core/Cargo.toml
Dhanji R. Prasanna abfac197ab Add datalog-based invariant verification system
Implement a new datalog verification layer using datafrog that:

- Compiles rulespec to datalog on plan_approve
- Extracts facts from action envelope using selectors
- Executes datalog rules on plan_verify
- Writes evaluation results to datalog_evaluation.txt (shadow mode)

Key components:
- crates/g3-core/src/tools/datalog.rs: Full datalog module with:
  - compile_rulespec(): Validates and compiles rulespec
  - extract_facts(): Extracts facts from envelope YAML
  - execute_rules(): Runs datafrog iteration
  - 23 comprehensive tests

- crates/g3-core/src/tools/plan.rs:
  - execute_plan_approve(): Now compiles rulespec on approval
  - shadow_datalog_verify(): Runs datalog and writes to eval file

Results are written to .g3/sessions/<id>/datalog_evaluation.txt
for inspection, NOT injected into context window (shadow mode).
2026-02-06 13:50:54 +11:00

58 lines
1.4 KiB
TOML

[package]
name = "g3-core"
version = "0.1.0"
edition = "2021"
description = "Core engine for G3 AI coding agent"
[features]
test-support = []
[dependencies]
g3-providers = { path = "../g3-providers" }
g3-config = { path = "../g3-config" }
g3-execution = { path = "../g3-execution" }
g3-computer-control = { path = "../g3-computer-control" }
tokio = { workspace = true }
reqwest = { workspace = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
uuid = { workspace = true }
async-trait = "0.1"
tokio-stream = "0.1"
tokio-util = "0.7"
futures-util = "0.3"
chrono = { version = "0.4", features = ["serde"] }
rand = "0.8"
regex = "1.0"
shellexpand = "3.1"
serde_yaml = "0.9"
# tree-sitter for embedded code search
tree-sitter = "0.24"
tree-sitter-rust = "0.23"
tree-sitter-python = "0.23"
tree-sitter-javascript = "0.23"
tree-sitter-typescript = "0.23"
tree-sitter-go = "0.23"
tree-sitter-java = "0.23"
tree-sitter-c = "0.23"
tree-sitter-cpp = "0.23"
# tree-sitter-kotlin = "0.3" # Temporarily disabled - incompatible with tree-sitter 0.24
tree-sitter-haskell = { git = "https://github.com/tree-sitter/tree-sitter-haskell" }
tree-sitter-scheme = "0.24"
tree-sitter-racket = "0.24"
streaming-iterator = "0.1"
walkdir = "2.4"
# Datalog engine for invariant verification
datafrog = "2.0.1"
base64 = "0.22.1"
[dev-dependencies]
tempfile = "3.8"
serial_test = "3.0"