Skip to content

Add redact-history for the store written before masking - #63

Merged
gengwg merged 1 commit into
mainfrom
feat/redact-history
Sep 7, 2026
Merged

gengwg merged 1 commit into
mainfrom
feat/redact-history

Conversation

@gengwg

@gengwg gengwg commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Masking guards writes, so anything stored before it existed is still in the clear: event bodies from before v0.10.0, session titles and turn errors from before v0.12.4.

agentlens redact-history reports what is left; --apply masks it after copying the database first.

Safe to run over every row, repeatedly, which is what makes it usable without tracking which rows are old. Masking is idempotent: a mask literal contains no pattern, so re-masking returns the text byte for byte. Verified for all twenty-two. The one case that looks like it should bite does not — [REDACTED:bearer-token] contains "earer" and trips the cheap hint gate, but the bearer pattern needs whitespace after it and finds a hyphen.

seq is deliberately left alone. A shipper has already sent these events with their content stripped, so there is nothing for a shared server to catch up on, and bumping it would resend tens of thousands of rows to no purpose. A test pins that.

Run against the real local store: 17 events, no titles, no errors; integrity check clean, row counts identical, second pass finds nothing.

The backup is named <db>-bak-before-redact so the existing *.db-* ignore rule covers it — a database backup should not be commit-able by accident. .gitignore also gains *.db.bak* and *.bak-*.

96 tests pass.

https://claude.ai/code/session_01NZDHk4yVYP4jMZkTUMQ1Lw

Masking guards writes, so event bodies from before v0.10.0 and titles and
turn errors from before v0.12.4 are still in the clear. agentlens
redact-history reports what is left; --apply masks it after copying the
database.

Safe over every row, repeatedly: masking is idempotent, verified for all
twenty-two patterns. [REDACTED:bearer-token] trips the hint gate, since it
contains "earer", but the pattern needs whitespace and finds a hyphen.

seq is left alone. A shipper already sent these events without content, so
bumping it would resend tens of thousands of rows for nothing.

On the local store: 17 events, no titles, no errors, integrity clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZDHk4yVYP4jMZkTUMQ1Lw
@gengwg
gengwg merged commit 7ee6f6c into main Sep 7, 2026
1 check passed
@gengwg
gengwg deleted the feat/redact-history branch September 7, 2026 23:31
gengwg added a commit that referenced this pull request Sep 8, 2026
Add redact-history for the store written before masking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant