You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git add: tracking records -1300% savings (filter adds info to silent command) #89
Native `git add` produces ~0 stdout when successful.
Filter runs an extra `git diff --cached --stat --shortstat` to summarise what was staged.
Prints `"ok 7 files changed, 87 insertions(+)"` — ~14 tokens.
Tracking records `input_tokens=1, output_tokens=14, savings=(1-14)/1 = -1300%`.
The summary is genuinely useful (the agent learns what was staged) but the tracking math treats an information addition as a regression.
Fix options
Option 1 — exclude informational-addition commands from the savings %.
Add a flag on `TimedExecution::track` (or new `track_informational`) that records the row but excludes it from `SUM(savings_pct)` aggregations.
Option 2 — apples-to-apples baseline.
Treat the would-have-been output as the baseline. For `git add`: the user would have followed up with `git status` / `git diff --cached` anyway. Include that hypothetical token count in `input_tokens` so the math reflects real savings.
Option 3 (preferred for v1) — track `git add` against a synthetic baseline = output of `git status --short` had the user run it next.
```rust
let synthetic_baseline = git_cmd(global_args)
.args(["status", "--short"])
.output()
.map(|o| String::from_utf8_lossy(&o.stdout).into_owned())
.unwrap_or_default();
timer.track(
&format!("git add {}", args.join(" ")),
&format!("contextcrawler git add {}", args.join(" ")),
&synthetic_baseline, // input = what user would have asked next
&compact, // output = compact summary
);
```
This gives positive savings when the change is large, negative when trivial — which is the honest picture.
Acceptance
`git add` no longer dominates the worst-savings list.
Aggregate savings for `git add` over a busy session sits in roughly +30% to +70% range, not -1300%.
The user-visible `"ok N files…"` summary stays unchanged.
Activity
merge: C git-triad (#84 #85 #89)
fix(git): extend subcommand coverage + tracking baseline (thehoff#84, t…
fix(filters): universal no-bloat guard so filters never cost more tha…