All work

libs/tact

inTact

Self-Healing File Edits for Agents

intact is a reconciliation ladder that heals stale or drifted file edits instead of failing them, shipping as a library, a CLI, and an MCP server.

Open repository Version 0.8.1Apache-2.0
A drifted line is reconciled by fuzzy context, then the corrected file is shown.
Read command transcript
                        $ cat /tmp/intact-portfolio-demo.txt
panel = canvas — warm

$ uv run tact --json check /tmp/intact-portfolio-demo.txt --old 'panel = canva - warm' --new 'panel = trellis - warm' | jq '{matched: .results[0].ok, rung: .results[0].rung, similarity: .results[0].fuzz}'
{
  "matched": true,
  "rung": "FUZZY",
  "similarity": 0.8695652173913043
}

$ uv run tact --json edit /tmp/intact-portfolio-demo.txt --old 'panel = canva - warm' --new 'panel = trellis - warm' | jq '{applied, rung: .results[0].rung}'
{
  "applied": true,
  "rung": "FUZZY"
}

$ cat /tmp/intact-portfolio-demo.txt
panel = trellis - warm
                    

What it shows

What it is and what it demonstrates.

inTact is a reconciliation ladder that fixes the most common failure mode of automated code editing — a stale anchor — by healing the edit in place instead of aborting. It ships as a Python library, a CLI, and an MCP server, so the same healing logic serves a script, a terminal, and an LLM agent.

The problem

File-editing agents fail constantly when the surrounding context has drifted even a few characters from what the agent expected. The usual answer is to abort and re-read the file, which wastes a round-trip and often loses the agent's place. There was no shared primitive that could climb from an exact match through fuzzy context to an anchored structural resolution, apply the edit at the first rung that succeeds, and report which rung matched.

The approach

The core is a pure, side-effect-free ladder: exact, whitespace-tolerant, fuzzy, regex, and structural-anchor rungs, each tried in order and short-circuited on the first hit. The library, CLI, and MCP server are thin surfaces over the same resolver, so behavior is identical across a Python import, a shell command, and a tool call from an LLM. An undo journal and LSP-backed rename and diagnostics keep every edit reversible and navigable. The 88-test suite and CI gate every rung.

What it demonstrates

Maintaining a published 0.8.x package with 88 tests, 15 documentation pages, CI, pre-commit hooks, and full type annotations shows the discipline a shared primitive demands: the contract has to hold for every caller, human or model, or the agent layer above it silently corrupts files.

Repository evidence

Observable facts.

Documentation
15 documentation files
Test surface
88 test files
Continuous integration
Configured
Pre-commit hooks
Configured
Typed source
Configured
Visual evidence
Reproducible CLI demonstration
Technologies
py · pypi