Skip to content

Files already ignored by .gitignore are counted as context waste you could cut #5

Description

@royalpinto007

ctxtrim writes ignore files, but it never reads the ones already there. Anything covered by an existing .gitignore, .cursorignore or .claudeignore is still walked, still counted, and still reported as tokens you could save by trimming.

That inflates the headline number the whole tool is judged on. wastePct claims a percentage of context you can recover, when some of it has already been recovered. Running ctxtrim twice on the same repo reports roughly the same savings the second time, having changed nothing, which is the clearest symptom.

Proposal

Read the ignore files present at the repo root and treat matched paths as already excluded. They should either be left out of the totals entirely, or reported separately as "already ignored" so the recoverable figure is honest either way.

Worth deciding explicitly, and saying so in the README: does wastePct mean "waste present in the repo" or "waste still reaching your agent"? The second is the useful one.

Acceptance

  • A fixture with a .gitignore covering dist/ does not report dist/ as recoverable waste
  • Running the tool twice in a row reports materially less the second time
  • Which ignore files are honoured is documented

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions