how do meat.dev werk and what do it do
meat.md
105 lines 3.7 kB view raw view rendered
1Meat turns a normal Git diff into a shorter **reading diff** containing the changes a human should focus on. 2 3It aims to remove mechanical noise—imports, repetitive plumbing, generated code, obvious field copying—while retaining behavioral changes, architecture, algorithms, data flow, compatibility concerns, and meaningful tests. 4 5```diagram 6┌──────────────────┐ 7│ Unified Git diff │ 8└────────┬─────────┘ 9 10┌──────────────────────────┐ 11│ Meat rubric + LLM │ 12│ • inspect relevant files │ 13│ • grep repository │ 14│ • propose elisions │ 15└────────┬─────────────────┘ 16 17┌──────────────────────────┐ 18│ Meat validates the plan │ 19│ against original lines │ 20└────────┬─────────────────┘ 21 22┌─────────────────────────┐ 23│ Mechanically generated │ 24│ reading diff │ 25└─────────────────────────┘ 26``` 27 28## What the model does 29 30Meat numbers the physical lines of the original diff and asks the model to submit an edit plan using three operations: 31 32- **Remove:** Completely omit an unimportant range. 33- **Fold:** Replace several similar lines with one `...` line. 34- **Replace:** Elide part of a long line with `...`. 35 36For example: 37 38```diff 39+user.Name = row.name 40+user.Email = row.email 41+user.Address = row.address 42+user.Phone = row.phone 43``` 44 45might become: 46 47```diff 48+user.Name = row.name 49+... 50``` 51 52Or: 53 54```diff 55+return fmt.Errorf("failed to update account %s for organization %s", accountID, orgID) 56``` 57 58might become: 59 60```diff 61+return fmt.Errorf(...) 62``` 63 64The model can use Meat’s read-only tools to: 65 66- Read related repository files. 67- Run `git grep`. 68- Preview its proposed reading diff. 69- Submit the final edit plan. 70 71Invalid plans are rejected with feedback so the model can correct them. 72 73## Important safety property 74 75The model **does not write the displayed diff**. It only identifies original line ranges and substrings. 76 77Meat then validates and mechanically applies that plan to the immutable input. This prevents the model from inventing code or silently rewriting retained lines. 78 79That guarantees provenance, but not judgment: Meat can still make a poor decision about which real lines are important. 80 81## Output 82 83[`meat.Abridge`](https://github.com/boldsoftware/meat/blob/main/meat/meat.go#L111-L132) returns: 84 85- `SmartDiff`: the shortened reading diff. 86- `Summary`: a one-line description of the semantic change. 87- Input and output token counts. 88 89The result looks like a unified diff, but it is **not an applicable patch**. Removed and folded lines leave the original hunk counts stale. It is designed for reading and navigation only. 90 91## Large diffs 92 93Around 400 KiB per model run, Meat splits the diff at file and hunk boundaries, processes chunks sequentially, then merges the reading diffs and summaries. Total accepted input is capped around 4 MiB. 94 95## What Meat is not 96 97Meat does not primarily: 98 99- Produce a code-review report. 100- Leave comments on individual lines. 101- Declare the change correct or incorrect. 102- Detect every bug or security issue. 103- Modify the working tree. 104 105It is best understood as an **AI-directed diff compressor**: it preserves the semantic center of a change while hiding details that are less valuable to a human reviewer.