Skip to main content
Glama

Kintsugi Harness (kintsugi-harness · v2.3.0)

⚡ Stop burning Claude Code & Cursor context windows—and block destructive agent tool calls in 7.6 µs.

Drop-in Rust + Python PreToolUse guardrails featuring the Sovereign Tier-1 DARPA AIxCC Cyber Reasoning System (kintsugi.crs_engine v2.3.0: Microsoft Z3 5.3.3 QF_BV32/64 + Bit-Blasted Tseitin CNF, 3-TU LLVM SSA .ll IR CPG + Andersen Points-To Indirect Call Resolution, -O2 Stripped Binary Capstone 5.0 ARM64 CFG + LLDB + Z3 QF_BV8 Lifter, 10,000-Iter 0x00-Seed trace-pc-guard,trace-cmp In-Process Fuzzer & Coverage-Preserving AutoPatcher, 12x12 LLL Lattice Crypto Solver, and n=160 4-Language Held-Out Suite), the 5-Pillar Autopoietic Evolution Creed (@CREED/1), 1-Command Third-Party Harness Integration (kintsugi integrate with Joint SAT+DL verification), and 95.3% skill context compression (~3,330 → ~209 tokens).

GitHub Stars OpenSSF Scorecard 10-Arena Pareto Suite: 10/10 PASS (98.30) 4-Vendor CRS Audit: 100.0/100 (v2.3.0) SWE-bench Submission: 8/8 Verified GAIA Submission: Verified JSONL SLSA Provenance: Ready Security Policy: RFC 9116 & OpenSSF Glama MCP Server Release: v2.3.0 Kintsugi Posture: A+ Token Savings: 95.3% Rust Engine: 7.6 µs Tests: 45/45 Passing Zero Dependencies

⭐ If Kintsugi saves your context window or catches a bug before commit, please Star this repository on GitHub! Stars help more Claude Code, Cursor, Windsurf, and MCP developers discover zero-overhead guardrails.


⏱️ Try It in 10 Seconds (1-Command Safe Tryout)

Install with zero third-party dependencies (Python 3.9+ stdlib) and scan/integrate your existing .cursorrules, CLAUDE.md, or AGENTS.md without modifying your workflow:

pip install git+https://github.com/tunguyen1993/kintsugi-harness.git && kintsugi integrate --discover
# Try the reproducible benchmark + drop-in harness integrator on your repo:
$ kintsugi integrate . --mount
{
  "ok": true,
  "state": "MOUNTED",
  "verdict": "SAT_CLEAN",
  "translation_accounting": {
    "total_discovered_candidates": 4,
    "compiled_enforceable_guards": 16,
    "token_reduction_pct": 95.3
  },
  "attestation_receipt": {
    "wire": "@PROOF_DAG/1[profile=HARNESS_INTEGRATION_V180|state=MOUNTED|verdict=SAT_CLEAN|caps_granted=0]"
  }
}

# Revert cleanly at any time while preserving 100% of your manual edits:
$ kintsugi integrate --eject HARNESS-DEFAULT

Related MCP server: LeanGate

🎬 New in v1.9.0: OpenMontage Cinema Director's Cut Extension Package (@OPENMONTAGE_CINEMA/1 · kintsugi cinema)

When a user asks the agent to produce a video or short film, Kintsugi's kintsugi-openmontage-cinema extension package (src/kintsugi/cinema.py) automatically pulls and sandboxes calesthio/OpenMontage into .kintsugi/extensions/openmontage/ (-c core.hooksPath=/dev/null -c core.symlinks=false), routes shots across 9 AI Video Generators (Google Veo 3.1, Meta Muse AI, Kling 2.0, Runway Gen-3, Luma Ray2, Pika 2.2, Hailuo MiniMax, Sora, and Wan 2.1), optimizes visuals for either Photorealistic Human Cinema (--style live_action · ARRI Alexa LF + Kodak 2383 LUT) or 2D/3D Studio Animation (--style animation · Cel Vibrance LUT), enforces Mandatory 6-Gate Component Video QA before stitching, and evolves filmmaking intelligence via @CINEMA_EVOLVE/1 (CS-001..CS-012).

🎥 Watch the Full 3-Minute Director's Cut Demo Film Produced by @OPENMONTAGE_CINEMA/1

Watch Kintsugi OpenMontage Cinema Director's Cut Showcase on YouTube

▶️ Watch on YouTube: https://www.youtube.com/watch?v=tfo2QYUU-c8
3-Minute (180.0s) 24-Shot Sci-Fi Drama ("The Last Light of Station 09") — Verified 100% PASS across all 6 Component Video QA Gates.

# Auto-pull OpenMontage, run 6-Gate Script-to-Frame QA, and auto-heal via @CINEMA_EVOLVE/1:
kintsugi cinema --pull-openmontage --auto-heal --style live_action --provider veo --wire
# -> @OPENMONTAGE_CINEMA/1[v=1.9.0|provider=veo|style=live_action|healed=12->0|scars=12|verdict=PASS_DIRECTOR_CUT_READY]

# Switch to 2D/3D Studio Animation with Meta Muse AI ($0 Free 2B Pool) and synthesize component test clips:
kintsugi cinema --auto-heal --style animation --provider muse --synthesize-test-clips /tmp/cinema_clips

Mandatory Component Video QA Gate

What It Verifies on Every shot_01..shot_N Before Stitching

Seeded Cinema Scar

Gate 1: Script-to-Frame Discrepancy Verifier

Verifies speaker cues vs voice_role (daughter_radio vs narrator), shot title vs visual action, and paired Station / 4-Engine Aircraft / Capsule / 1.2m Titanium Pry-Bar continuity

CS-004, CS-005, CS-006, CS-009

Gate 2: Borderless Frame Hygiene

Scans top/bottom/left/right keyframe strips to reject 35mm film sprocket holes and unrequested letterbox bars

CS-003

Gate 3: Character Wardrobe & Collar DNA Lock

Enforces positive-only DNA (LONG-SLEEVED full-length sleeves buttoned at wrists, clean bare throat, plain unbranded fabric, dry matte skin) and blocks negative-token leakage (neck ring, NASA/NACA)

CS-001, CS-002, CS-010, CS-011

Gate 4: User-Selected Visual Style Fidelity

Verifies live_action (LUT_KODAK_2383_ARRI_ALEXA_LF_V4) vs animation (LUT_ANIMATION_CEL_VIBRANCE_V4) optics and LUT lock

I-S-1..4

Gate 5: Temporal & Motion Integrity

Verifies constant FPS, 1.0x realtime playback (zero slow-mo stretching), and non-zero inter-frame optical motion energy

CS-007

Gate 6: Audio-First Integer-Tick Sync & J/L-Cuts

Verifies |video_ticks - audio_ticks| <= 1 frame, strips 100% of native generator Mandarin/vocal bleed, and applies sample-exact J-cut (-0.34s / -16320 samples @ 48kHz) & L-cut (+0.45s / +21600 samples @ 48kHz) timeline bridges

CS-007, CS-008, CS-012


Why Kintsugi?

Kintsugi (金継ぎ) is the Japanese craft of repairing broken pottery with lacquer and gold—treating fractures as structural reinforcement rather than hiding them.

Existing agent harnesses and rule repositories (Superpowers, static .cursorrules, raw CLAUDE.md collections) suffer from three fundamental bottlenecks:

  1. Massive Token Bloat (3,300–8,500+ tokens/turn): Loading verbose Markdown tutorials into CLAUDE.md or AGENTS.md burns 150,000+ tokens over a single 50-turn coding session and crowds out working memory.

  2. Advisory Prose != Enforcement: Markdown instructions are merely suggestions; agents still run subprocess(..., shell=True), hardcode secrets, or execute destructive shell commands under pressure.

  3. Slow Hook Latency: Heavy linters add 300–1,500ms of overhead on every tool call.

Kintsugi v2.0.0 solves all three with a Native Rust Engine (kintsugi-rs, 7.6 µs/call), Multi-Language Zero-Dependency Structural AST-Lite (Python, JS/TS, Go, Rust), an Ultra-Compact Wire Index (KMI/1 — ~209 tokens/turn, saving 95.3% of context tokens), @CREED/1 4-Pillar Autopoietic Evolution IR, @HARNESS_BRIDGE/1 Universal Drop-In Third-Party Harness Integrator (kintsugi integrate), 3-Tier Multi-Model Co-Execution (Primary + 1..5 Free Models + BYOK Paid Frontier Council), @LOGIC/2 5-Pillar Neuro-Symbolic Verification + @PROOF_DAG/1 Signed Compliance Proofs, and Just-In-Time (JIT) PreToolUse Rule Expansion:

flowchart LR
    A["Agent Prompt Turn\n(KMI/1 Wire Index: ~209 tokens)"] --> B["Agent Emits Write / Edit / Bash"]
    B --> C{"Native Rust / Python PreToolUse Hook\n(9.6 µs scan | Git-Diff Hunk Filter)"}
    C -- "Clean Code (0 extra tokens)" --> D["Tool Executes Immediately"]
    C -- "Violation Detected" --> E["JIT Single-Rule Expansion (<95 tokens)\nBlocks Call & Injects Verified Fix"]
    E --> F["3-Agent Evolution Council\nCompiles New Failures into .kintsugi/scars.json"]

Benchmark: Kintsugi v2.0.0 vs Other Agent Harnesses

Capability / Metric

Kintsugi Harness (v2.0.0)

Static CLAUDE.md / CursorRules

Prompt-Heavy Skill Frameworks

Traditional pre-commit Linters

Per-Turn Context Cost (18 Rules)

~209 tokens (KMI/1 Wire Index)

~3,330 tokens

~4,500–9,000 tokens

0 (no agent awareness)

Tokens Saved per 50-Turn Session

~156,050 tokens (93.7% reduction)

0 (Baseline)

Negative (-225k+ tokens)

N/A

Inline PreToolUse Latency

9.6 µs (kintsugi-rs Rust) / 28 ms (Py)

N/A (Advisory only)

N/A (Advisory only)

350–1,800 ms (Post-edit only)

True-Positive / 0 False-Positive Gate

Enforced (verify-ledger invariant)

Manual / None

Manual / None

Rule-dependent

Runtime Dependencies

0 (Rust std + Python stdlib)

0

Node/Python deps

Node/Python/Go toolchains

Multi-Agent Compilation

Claude, Cursor, Copilot, Windsurf, Codex, MCP

Single IDE

1–2 agents

Git hooks only


Open-Core Architecture & Edition Matrix (v2.0.0 — Free vs Tier 1 / Tier 2 / Tier 3 Pro)

Independent evaluators can verify all 4 editions, @KML/1 compression ratios, Auto-Fix codemods, and .kpack AEAD cryptography in 1.3s with:

python3 free-skill-pack/scripts/verify_editions_and_benchmarks.py

Capability / Module

Core Guard Free ($0 OSS)

Tier 1: FinOps & Reliability Pro ($15)

Tier 2: Zero-Trust AppSec & MCP Pro ($19)

Tier 3: Enterprise Complete Pro ($29)

Native Rust Engine (kintsugi-rs v2.0.0) & Multi-Language Structural AST-Lite (py,js,ts,go,rs)

Included (100% Open Source)

Included

Included

Included

@HARNESS_BRIDGE/1 Universal Drop-In Third-Party Harness Integrator (kintsugi integrate)

Included: Discover + SAT+DL Conflict Check + 1 Active Mounted Harness

Unlocked: Multi-Harness Federation (Up to 10 Mounted Harnesses)

Unlocked: Multi-Harness Federation (Up to 10 Mounted Harnesses)

Unlocked: Enterprise Multi-Harness Federation (Up to 100 Mounted Harnesses + Signed @PROOF_DAG/1 Receipts)

Multi-Model Co-Execution Engine (--co-run)

Locked: Primary + 1 Free Model

Unlocked: Primary + 2..5 Free Models (Auto 429 Failover)

Unlocked: Primary + 2..5 Free Models (Auto 429 Failover)

Unlocked: Primary + 5 Free Models + BYOK Paid Frontier Council

BYOK Paid Frontier Agent Council (--paid-council)

— (Locked)

— (Locked)

— (Locked)

Unlocked (Claude Opus 4.6/5.5, GPT-6, Grok 4.7 Max BYOK)

@LOGIC/2 5-Pillar Neuro-Symbolic Reasoning & Login Verifier (kintsugi logic)

Included (DPLL SAT/MUS, Stratified Datalog, Difference Logic, Fallacy Guard, MHS)

Included

Included

Included (+ Adversarial Council Arena)

@PROOF_DAG/1 Signed Compliance Proofs & @ZK_AST_DIFF/1 (kintsugi verify)

Included (LOCAL_DEV_ATTESTATION)

Included (+ FinOps Controls)

Included (+ AppSec/MCP Controls)

Included (ENTERPRISE_PROVISIONED_SEAL SOC2 / ISO27001 / EU AI Act)

@EVAL_SUITE/1 Open Reproducible Benchmark & Replay (kintsugi eval)

Included (6/6 Cases + 3-Arm Ablation)

Included

Included

Included

Zero-Loss Anti-Overflow Conversation & Excel Compactor (kintsugi compact / @COMPACT/2)

Included (100% Anchor & Excel Sum Retention)

Included (+ Multi-Free Co-Verify)

Included (+ Multi-Free Co-Verify)

Included (+ Full Council Co-Verify)

Curated Core + Exclusive Pro Scars (KS-001..KS-032)

16 Core (KS-001..016)

11 FinOps/Reliability (KS-018,025,026,030,031 + Core)

21 AppSec/MCP (KS-017,019..024,027..029,032 + Core)

All 32/32 (KS-001..KS-032)

@KML/1 Symbolic Machine-Language Wire (scars.kml)

16 rules (1,726 in OSS repo)

844 @KML/1 FinOps rules

862 @KML/1 Security rules

All 1,742 @KML/1 rules

Deterministic Auto-Remediation (kintsugi autofix --apply)

Dry-Run Diff Preview (--dry-run)

4 In-Place Auto-Fix Codemods

8 In-Place Auto-Fix Codemods

All 12/12 In-Place Auto-Fix Codemods

Interactive Slash Commands (.claude/commands/*.md)

Manual CLI

5 Slash Workflows

5 Slash Workflows

5 Slash Workflows (/kintsugi-audit, /kintsugi-autofix, /kintsugi-mcp-shield, /kintsugi-release-gate, /kintsugi-multi-model-council)

Frontier Collective Pool (collective_pool_lessons.json)

Included (collective-pool/)

41 Pre-Bundled Frontier Lessons

41 Pre-Bundled Frontier Lessons

41 Pre-Bundled Frontier Lessons

Delivery Formats

.zip (free-skill-pack/)

.zip + AEAD .kpack

.zip + AEAD .kpack

.zip + AEAD .kpack

IMPORTANT

New in v1.5.0–v1.7.0 — @LOGIC/2 5-Pillar Logical Reasoning, @PROOF_DAG/1 Signed Compliance Proofs, @COMPACT/2 Excel Compactor & 3-Tier Multi-Model Co-Execution:

  • Always-On Co-Execution & Autonomous $0 DeepSeek Free Token Harvester: Your Primary Model never runs alone — Kintsugi automatically discovers available $0 Free Co-Runner models and includes a 6-Step Zero-Touch DeepSeek Free Token Harvester (kintsugi swarm --register-deepseek-free) that autonomously creates a disposable mail.tm inbox, verifies the signup magic link, mints a real tj_... API key for deepseek-ai/DeepSeek-V4.1-Flash-1017 (262K context window, $0 Unlimited Free, no credit card), verifies HTTP 200 OK live chat completion, and stores it in .kintsugi/free_agent_pool.json (0600).

  • Tier 0 ($0 Free / OSS): Locked to Primary + 1 Free Model ($0) (max_free_co_runners = 1). Passing --free-runners 2..5 automatically clamps to 1 and displays the upgrade path.

  • Tier 1 & Tier 2 ($15 FinOps Pro / $19 AppSec Pro): Unlocks Primary + up to 5 Parallel Free Models ($0) (max_free_co_runners = 5) with automatic HTTP 429 / timeout round-robin failover and 12.5x Byzantine-Fault-Tolerant (BFT) error reduction.

  • Tier 3 ($29 Enterprise Complete Pro): Unlocks Primary + 5 Free Models ($0) + 6-Seat Paid Frontier Council (BYOK) (Claude Opus 4.6, GPT-5.4 Thinking, Grok 4, Gemini 2.5 Pro, DeepSeek R1, OpenRouter Frontier).

  • How the Agent Guides Users (BYOK — Bring Your Own Key): Paid Frontier Council seats require users to supply their own API keys (stored strictly locally at .kintsugi/paid_council_pool.json with chmod 0600 permissions). Run kintsugi swarm --guide (or slash command /kintsugi-multi-model-council, or MCP tool kintsugi_multi_model_guide) at any time for an interactive bilingual (EN/VI) setup walkthrough.

  • Zero-Loss Anti-Overflow Conversation Compactor (@COMPACT/1 — kintsugi compact): When a long coding conversation fills up (>=70% soft / >=85% hard watermark), kintsugi compact --inject-agents (and MCP tool kintsugi_compact_context) automatically strips 4 classes of conversation noise (verbose build/test logs, duplicate polling loops, superseded file reads, and exploratory monologue) while locking 100% of Hard Anchors (@USER_INTENTS, file:line anchors, git SHAs/tags, rule IDs, pinned IPs/ports, active daemons, and @ERRORS_AND_FIXES) into .kintsugi/context_checkpoints/latest_checkpoint.md and a <180-token @COMPACT/1 symbolic wire capsule in CLAUDE.md / AGENTS.md.


Quick Start

1. Install (Python SDK + Optional Native Rust Binary)

git clone https://github.com/tunguyen1993/kintsugi-harness.git
cd kintsugi-harness
pip install -e .

# Optional: Build the zero-dependency native Rust engine (compiles in ~1.5s)
cargo build --release
./target/release/kintsugi-rs bench

2. Initialize & Compile Ultra-Low-Token KMI/1 Agent Governance

# Compile with --compact to emit the ~209-token KMI/1 wire header (>93% token savings)
kintsugi init --compact
kintsugi compile --targets all --compact

3. Benchmark Token Savings & Run Posture Audit (Grade A+)

# Measure exact KMI/1 token savings vs verbose Markdown skills
kintsugi token-report

# Generate a repository Security & Agent Readiness Scorecard (Grade A+ to F)
kintsugi audit . --format markdown

4. Scan Code, Staged Git Diffs & Preview Auto-Fixes

# Sub-millisecond native Rust scan or staged git-diff scan
./target/release/kintsugi-rs scan .
./target/release/kintsugi-rs scan . --staged

# Python AST + Regex scan with unified diff patch preview
kintsugi scan . --staged --patch-preview

# Preview or apply deterministic auto-remediation codemods
kintsugi autofix .

5. Install External or Pro Skill Packs (kintsugi install-pack)

# Install an encrypted .kpack or standalone .zip Skill Pack (e.g., from Agensi.io or GitHub Releases)
kintsugi install-pack kintsugi-enterprise-complete-pro-v2.0.0.kpack --license-key <YOUR_LICENSE_KEY>
kintsugi list-packs

# Run unlocked in-place auto-remediation codemods
kintsugi autofix . --apply

5A. @LOGIC/2 5-Pillar Logical Reasoning, @PROOF_DAG/1 Signed Compliance Proofs & @EVAL_SUITE/1 (v1.6.0–v1.7.0)

# 1. Run the 5-Pillar Neuro-Symbolic Reasoning Benchmark (DPLL SAT/MUS, Stratified Datalog, Difference Logic, Fallacy Guard, Reiter MHS)
kintsugi logic --benchmark --wire

# 2. Verify Formal Login / OAuth2 / MFA Step-Up / Session Revocation / OTP Replay State Machines
kintsugi logic --login-verify

# 3. Export & Verify a Cryptographically Signed Compliance Bundle (.kintsugi/audit.proof — SOC2 / ISO27001 / EU AI Act)
kintsugi verify --export-audit .kintsugi/audit.proof --wire
kintsugi verify --verify-proof .kintsugi/audit.proof

# 4. Run the Open Reproducible 6-Case Evaluation & 3-Arm Ablation Suite
kintsugi eval --wire
kintsugi eval --replay EVAL-AUTH-001

5B. Tier-Gated Multi-Model Co-Execution & BYOK Paid Frontier Council (kintsugi swarm --guide)

Kintsugi guarantees your Primary Anchor Model always runs alongside dynamically discovered $0 Free Co-Runners (and optional user-supplied BYOK Paid Frontier Council seats):

# 1. Inspect active tier & Bilingual Agent Onboarding Guide
kintsugi swarm --guide

# 2. Free Tier ($0): Auto-register a live $0 DeepSeek-V4.1-Flash (262K) API key & run Primary + 1 Free Model
kintsugi swarm --register-deepseek-free
kintsugi swarm . --co-run

# 3. Pro Tier ($15 / $19): Unlocks 2..5 parallel $0 Free Co-Runners with automatic 429 failover
kintsugi swarm --authorize-auto-provision
kintsugi swarm . --co-run --free-runners 4

# 4. Enterprise Complete Pro ($29): Add your own BYOK Paid Frontier Council API keys (stored locally 0600)
kintsugi swarm --add-paid-key anthropic_opus <YOUR_ANTHROPIC_KEY>
kintsugi swarm --add-paid-key openai_frontier <YOUR_OPENAI_KEY>
kintsugi swarm --add-paid-key xai_grok_paid <YOUR_XAI_KEY>
kintsugi swarm --paid-council-status
kintsugi swarm . --co-run --free-runners 3 --paid-council

# 5. Zero-Loss Anti-Overflow Conversation Compaction (@COMPACT/1 — strips noise & locks 100% of main points):
kintsugi compact --inject-agents
kintsugi compact --wire

6. Human-Like Cognitive Learning, Zero-GitHub-Account Relay & GitHub Skill Harvester (kintsugi learn)

Unlike bloated harnesses that dump noisy chat transcripts into memory, Kintsugi distills mistakes across 15 Universal Domains (7 Engineering Pillars: ai-agents-mcp, backend-api, security-zerotrust, fintech-web3, devops-cloud, frontend-ts, data-ml + 8 Real-Life & Business Pillars: finance-capital, business-negotiation, psychology-relationships, legal-contracts, health-longevity, decision-strategy, research-epistemology, growth-marketing) into causal CognitiveLesson records (cognitive_trap + mental_model + executable guardrail):

# Option 1 (Default — Privacy-First Local-Only + Pull by Engineering / Real-Life Domain):
# Keep self-learned lessons strictly in .kintsugi/lessons_local.json (gitignored)
# and pull curated Frontier lessons for your engineering & life domains from GitHub or Relay:
kintsugi learn config --mode local-only --domains ai-agents-mcp,finance-capital,business-negotiation,decision-strategy
kintsugi learn pull --domains ai-agents-mcp,finance-capital,business-negotiation --relay

# Option 2 (Federated Collective Pool Sync + Zero-GitHub-Account Relay — Tier-1 Frontier Models Only):
# Publish newly distilled lessons to collective-pool/<domain>/<model_family>/<id>.json
# AND broadcast to the Zero-GitHub-Account Public Relay (KINTSUGI-RELAY/1) so agents without
# a GitHub account can contribute directly after passing the 4-Stage Frontier Epistemic Gate:
#   1. Tier-1 Frontier Model Provenance (claude-opus/sonnet-4, gpt-6, deepseek-r1, gemini-3.8-pro, qwen3.8-max, grok-4)
#      -> Low-tier models (mini, flash-lite, haiku, 8b) are strictly blocked from syncing upstream.
#   2. Deterministic TP/FP Self-Verification (`scan(bad) >= 1` & `scan(good) == 0`)
#   3. Structural & Semantic Anti-Duplicate Check (duplicates merge into reinforcement_count)
#   4. Zero-Leak DLP Sanitization
kintsugi learn config --mode federated-sync
kintsugi learn push-relay
kintsugi learn sync-relay --since 48h

# Option 3 (Autonomous GitHub Skill & Guardrail Repo Harvester):
# Scan external GitHub skill repositories (anthropics/skills, patrickjs/awesome-cursorrules, etc.)
# and merge Frontier-verified guardrails into the shared Collective Pool:
kintsugi learn harvest-github
kintsugi learn pool-status

7. Neuro-Symbolic 3-State AST Symbol Grounding Gate (kintsugi ground — <5ms Anti-Hallucination)

Prevent AI agents from hallucinating non-existent functions, variables, or line numbers during security audits and automated code edits:

# Build a deterministic SHA-256 manifest, AST symbol table, and cross-boundary seam index:
kintsugi ground src/

# Verify an agent's hypothesis against real AST symbols & line anchors in <5ms (VERIFIED / REFUTED / UNKNOWN):
kintsugi ground src/ --verify-anchor kintsugi/scanner.py:42 --verify-symbols KintsugiScanner,scan_path

8. Autopoietic Self-Generation, Metacognitive Self-Awareness & 3-Horizon Causal Foresight (kintsugi foresight)

Give your coding agent human-like metacognitive self-awareness, autonomous rule synthesis, and a 3-Horizon predictive world model (T+1 Immediate Direct Risk, T+2 Second-Order Call-Graph Cascade, T+3 Epistemic & Concurrency Tail-Risk):

# 1. Forecast T+1 / T+2 / T+3 failure horizons and generate a Q-ranked Pre-Emptive Action Queue:
kintsugi foresight src/

# 2. Emit ultra-compact <90-token @FORESIGHT/1 + @META/1 wire headers for agent context injection:
kintsugi foresight src/ --wire

# 3. Inspect Beta-Bernoulli domain competence, surprise index, and epistemic blind spots:
kintsugi foresight --metacognition

# 4. Autonomously synthesize & counterfactually verify new CognitiveLessons from unguarded code seams:
kintsugi foresight src/ --self-generate

# 5. Run Counterfactual Sandbox Dreamer (@DREAM/1) — apply S3 guards in-memory & prove 100% risk reduction without touching disk:
kintsugi foresight src/ --dream

# 6. Run Cross-Domain Analogical Transfer Engine — map scientific conservation laws to Distributed Systems, FinTech & Strategy invariants:
kintsugi foresight src/ --transfer

9. Shadow-Clone Parallel Epistemic Swarm & BFT Experience Consolidation (kintsugi swarm — v1.0.0)

Inspired by parallel Shadow Clone (Kage Bunshin) exploration: when encountering an unfamiliar codebase or task, the Central Brain spawns K = 4 isolated orthogonal Shadow Clones (K = 3f + 1 Byzantine Fault Tolerance) with zero inter-clone communication during execution so clones never collapse into groupthink:

  • Clone 1 (TRACK_1_AST_BOUNDARY_SEAMS): Maps AST symbol tables, function/class boundaries, and structural seams.

  • Clone 2 (TRACK_2_ADVERSARIAL_RED_TEAM): Probes S0 -> S1 -> S2 exploit chains, edge cases, and adversarial hallucination traps.

  • Clone 3 (TRACK_3_COUNTERFACTUAL_S3_SYNTHESIS): Synthesizes candidate S3 guards and replays them in the isolated Counterfactual Sandbox.

  • Clone 4 (TRACK_4_ANALOGICAL_LAW_MAPPER): Maps cross-domain physical/mathematical conservation laws and 3-Horizon (T+1/T+2/T+3) cascade priorities.

Each clone reaches its own independent, cryptographically signed CloneEpisodicReport. Upon completion, all K = 4 clones merge back into the single Central Brain via a Byzantine-Fault-Tolerant Quorum (s_p >= 3), quarantining refuted/hallucinated paths into the Negative Tabu List while distilling verified truths into a single deterministic Step-by-Step Right Playbook (Cách Làm Đúng):

# 1. Spawn K=4 orthogonal Shadow Clones in parallel and merge their conclusions into 1 Verified Right Playbook:
kintsugi swarm src/

# 2. Emit the ultra-compact <45-token @SWARM/1 wire header:
kintsugi swarm src/ --wire

# 3. Verify Byzantine Fault Tolerance (inject a corrupted/hallucinating clone and prove 3/4 honest quorum still holds):
kintsugi swarm src/ --byzantine-test

# 4. Consent-Gated Free-Agent Pool (@POOL/1 — 12.5x BFT Error Reduction across 4+ Independent Free Model Families):
#    Silence is NEVER consent: inspect the Consent Request, supply your own free key, or explicitly authorize $0 no-card auto-provisioning:
kintsugi swarm --request-consent
kintsugi swarm --add-free-key groq_free gsk_your_free_key
kintsugi swarm --authorize-auto-provision
kintsugi swarm --pool-status
kintsugi swarm --revoke-consent

Empirical Proofs & Hard Scientific Literature Verification (v1.2.0)

Beyond software security and API governance, Kintsugi's Neuro-Symbolic Brain (RepoAstGroundingEngine + AutopoieticSynthesizer + DisjointScarHoldoutVerifier + ScientificLiteratureVerifier) has been empirically validated against 5 Hard Scientific Paper Domains & Universal Conservation Laws (kintsugi foresight --scientific-corpus, 500 simulation steps, $\Delta t = 0.05\text{ s}$). Full details and reproducible commands are documented in docs/EMPIRICAL_PROOFS_AND_BENCHMARKS.md:

#

Scientific Law & Invariant

Unguarded Seam (S0/S1 — VERIFIED)

Runtime Violation Measurement

S3 Guarded Implementation (REFUTED — 0 FP)

Runtime S3 Measurement

1

1st Law of Thermodynamics & Symplectic Liouville Theorem ($\det(J) = 1$)

NON_SYMPLECTIC_ENERGY_DRIFT_SEAM (Forward Euler $\det(J) > 1$)

Energy explodes 2.0 J $\to$ 289.55 J (+14,377.28% drift)

Symplectic Velocity-Verlet (v_half)

1.9997 J (0.0147% bounded)

2

Buckingham $\Pi$ Dimensional Homogeneity & Radian Invariance

DIMENSIONAL_UNIT_MISMATCH_SEAM (Pa + m/s + mm, raw math.sin(deg))

Bernoulli head corrupted to -100,610.27 ($10^4\times$ error)

SI base-unit normalization [m] + math.radians()

11.3980 m (exact SI head)

3

Conservation of Mass / Continuity & Positivity ($\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{u}) = 0$)

MASS_CONTINUITY_VIOLATION_SEAM (unbalanced flux + unclipped sink)

Unphysical negative density -1.70 kg/m³ ($\rho < 0$)

Pairwise antisymmetric flux ($\Delta m_A = -\Delta m_B$) + positivity limiter

0.0 kg mass drift (< 1e-15), $\rho \ge 0$

4

Relativistic Causal Light-Cone ($t_{\text{cause}} \le t_{\text{effect}}$) & Jarzynski / 2nd Law ($\Delta S \ge 0$)

CAUSAL_ARROW_LOOKAHEAD_SEAM (reading future series[idx_t + 1], $\Delta S < 0$, naive exp(-W))

Future spike leak (50.5 vs 0.5), $\Delta S = -0.25 < 0$, exp(-800) = 0.0

Strictly causal past window (<= idx_t), shifted logsumexp, & $\Delta S \ge 0$

0.5 causal estimate, exact $\beta \Delta F = 800.26$, $\Delta S \ge 0$

5

Floating-Point Catastrophic Cancellation & Kahan Summation

CATASTROPHIC_CANCELLATION_SEAM (gamma**2 - 1.0 at $v \ll c$, naive sum())

344.09% relative error & 100% micro-flux loss (0.0 J)

Algebraic $\frac{v^2/c^2}{1 - v^2/c^2}$ + math.fsum()

0.0% error, full +100.0 J preserved

  • 3-State Grounding Gate & Alpha-Normalized AST Quotient (ASTQ/1): 5/5 (100%) True Violations VERIFIED · 5/5 (100%) S3 Safe Counterexamples REFUTED (0 false positives) · 3/3 (100%) Hallucinated Symbols & Docstring Traps REFUTED in <0.1ms · 100% Alpha-Rename Semantic Equivalence verified via De Bruijn index AST quotient hashing.

  • Disjoint Scar Holdout Verifier (T_gen != T_ver): Enforces holdout_precision >= 0.95, recall_drop <= 0.05, and 0 paraphrase-mutated negative false positives before admitting any synthesized GoldenScar.

  • Shadow-Clone Covariance-Aware BFT Swarm (@SWARM/1) & Consent-Gated Free Pool (@POOL/1): Discounts correlated votes via Equicorrelation Inverse Log-Odds ($N_{\text{eff}} = \frac{K}{1 + (K-1)\hat{\rho}} = 3.40$ across 4 distinct free model families), verifies 0.0% sycophancy via Blinded Contrary Probes, and reduces BFT false-accept errors by 12.5x (98.80% consensus accuracy).

  • Automated Verification Suite: 26/26 Python unittest (OK) + 3/3 Rust cargo test (OK) + 40/40 Frontier Pool Lessons Verified.


Author & Official AI Security Competitions / Benchmark Registry (Tu Nguyen · tundfb@gmail.com)

  • Principal Researcher & Architect: Tu Nguyen (Nguyễn Đức Tú) · Email: tundfb@gmail.com · GitHub: @tunguyen1993

  • Official Competition & Benchmark Registry: docs/AI_SECURITY_COMPETITIONS_AND_TRAINING_REGISTRY.md & benchmarks/frontier_ai_security_competitions_tundfb.json

  • Verified Multi-File Security Gauntlet Qualification (Brain v10.7 / Suites 29..43):

    • 112 / 112 Multi-File Repositories Solved (472 interdependent source files) · 231 / 231 (100.0%) Zero-Hint First-Attempt Blind Exams · 0.0% False Positive Rate across 5 Anti-False-Positive Reality Gates · 4,000 / 4,000 Adversarial Red-vs-Blue Fuzz Runs (Suite 43).

    • 6 Registered Frontier Tracks: SLOT-GS-ED913A (Gray Swan AI Security Arena / UK AISI IPI), SLOT-CY-913A45 (Stanford Cybench & UK AISI Inspect), SLOT-SW-3A45E7 (SWE-bench Security Remediation), SLOT-OW-45E7EB (OWASP GenAI & MCP Security Initiative), SLOT-HT-ED9105 (Protect AI Huntr AI/ML/MCP Research), and SLOT-CT-D913A4 (Cantina / Spearbit Web3 & AI Security Track).


Wire into Claude Code (PreToolUse) & MCP

kintsugi install-hooks --git

Or use the native Rust binary in .claude/settings.json for < 0.5ms PreToolUse enforcement:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit|Bash",
        "hooks": [
          {
            "type": "command",
            "command": "kintsugi-rs hook claude-pre-tool --block-on HIGH"
          }
        ]
      }
    ]
  }
}

Contributing & License

Contributions—especially new AST/Regex Golden Scars that pass kintsugi verify-ledger and cargo test—are warmly welcome! See CONTRIBUTING.md for guidelines.

Licensed under the Apache License 2.0.

Available Tools

4 tools
kintsugi_compile_skillsC

Compile .kintsugi/scars.json into .claude/skills/*/SKILL.md, CLAUDE.md, AGENTS.md, and .cursor/rules/.

Inputs: targets, workspace_root.

kintsugi_list_scarsB

List verified Golden Scars (❌ Anti-Pattern vs ✅ Verified Fix) filtered by language, tag, or minimum severity.

Inputs: tag, language, min_severity.

kintsugi_record_failureC

Compile a runtime/test failure into a new self-verified Golden Scar and persist it into .kintsugi/scars.json.

Inputs: raw_trace (required), error_summary (required), language, fixed_snippet, +1 more.

kintsugi_scan_codeB

Deterministically scan a source snippet or file path against verified Kintsugi Golden Scars (AST + Regex) before writing or committing.

Inputs: code, language, file_path.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool owns a distinct stage of the scar lifecycle: scanning code (kintsugi_scan_code), browsing the catalog (kintsugi_list_scars), authoring a new scar (kintsugi_record_failure), and exporting to skill files (kintsugi_compile_skills). The scan-vs-list boundary is clearly separated by input (code snippet/path vs catalog filters), so an agent can pick correctly without ambiguity.

    Naming Consistency5/5

    All four tools use the identical `kintsugi_` namespace plus a verb_noun pattern (scan_code, list_scars, record_failure, compile_skills). No casing or verb-style deviation anywhere in the set.

    Tool Count5/5

    Four tools is a tight, well-scoped surface for a scar knowledge-base server, and each one maps to a distinct workflow step with no filler or redundancy. Nothing feels missing at the count level; the gaps are lifecycle operations, not volume.

    Completeness3/5

    The create (record_failure) → read (list_scars) → apply (scan_code) → distribute (compile_skills) pipeline is coherent, but there is no way to update, deprecate, or delete an existing scar once persisted to scars.json. An agent that records a bad or stale scar has no dead-end-free path to correct it.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables agents to capture observable workflows, distill successful techniques and failure lessons into evidence-linked versioned skills, evaluate and approve them through review gates, and distribute approved instructions and portable resources through MCP for reuse across tasks.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables coding agents to check whether a repository already provides the helper they are about to reimplement, surface bloat, missing error handling and security findings after each edit, and block task completion until blocking issues are fixed.
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to compile polyglot repositories into architectural mipmap containers and use stateful pre-edit guardrails, fog-of-war resolution gating, blast-radius analysis, and compact Markdown packets to inspect code and prevent unsafe edits.
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to turn human-verified development failures into reusable bug knowledge and executable acceptance standards, then generate graded verification plans and record structured evidence for human review.
      MIT