To Wit (towit) is a single-user CLI tool. It runs entirely on your local machine, writes only to ~/.towit/ and ~/.claude/settings.json, makes no network requests of its own, and has no server component. The primary assets it protects are your Claude Code conversations and the metadata extracted from them (titles, summaries, topics, keywords). The database holds the full text of your messages (user and assistant turns, plus one-line tool-call stubs and truncated tool errors), not just metadata, so it may contain proprietary code, internal URLs, API usage patterns, pasted secrets that redaction missed, and other sensitive work content. It keeps that text after Claude Code deletes the original transcripts.
| Boundary | Trust Level | Notes |
|---|---|---|
| Claude Code JSONL transcripts | High | Written by Claude Code itself; may indirectly contain untrusted external data (e.g. pasted content) |
| Claude CLI responses (indexing) | Medium | Parsed with error handling; treated as structured JSON with graceful fallback |
| Hook payload (stdin JSON) | Medium | Provided by Claude Code for Stop, SessionEnd, and SessionStart; session_id format and the transcript_path filesystem path are validated before use (SessionStart uses no path from the payload) |
| Archived message text | Medium | Originates in transcripts, so it can carry tool output, web content, or terminal escape sequences; towit show strips control sequences before printing, and towit search and towit list do the same for their table output (JSON output ASCII-escapes instead; CSV is printed raw, so a cell starting with =, +, - or @ is a formula when opened in a spreadsheet); never interpreted as SQL or FTS5 syntax |
| Search terms (CLI arguments) | Medium | Escaped into quoted FTS5 phrases and bound as parameters |
| Environment variables | Medium | Used for config overrides; subprocess env is scoped to an explicit allowlist |
| SQLite database | High | Local file; no network exposure; holds full message text |
- Attacks requiring physical access to your machine or control of your user account
- Vulnerabilities in Claude Code, the Anthropic API, or the
claudeCLI itself - Issues in Python's standard library or the operating system
- The database directory (
~/.towit/) is created with mode0700; the database file is created with mode0600(owner-only, usingumask(0o077)at creation time);towit doctorwarns if either drifts - No conversation content is written outside
~/.towit/and~/.claude/ - The archive outlives Claude Code's own retention.
claude purge,claude rm, and thecleanupPeriodDaysretention sweep do not remove archived data.towit prunekeeps archived conversations unless you pass--archive, and merely reports ones whose project folder has disappeared.towit forget(by session id,--repo, or--folder) is the removal path, andtowit teardown/towit implodedelete the whole database - Secrets are redacted on a best-effort basis (see Secret Redaction); this is not a guarantee and does not reduce the sensitivity of the file itself
- Message text is scanned for secret-shaped strings (AWS key ids, GitHub, Anthropic, OpenAI, Stripe, and Slack tokens, JWTs, private-key blocks,
Bearertokens, credentials embedded in URLs, and long*_KEY/*_SECRET/*_TOKEN/*_PASSWORDassignment values) and matches are replaced with[REDACTED:<kind>]before they are written to the database. The same redaction is applied to the transcript text sent to theclaudeCLI for metadata generation and forexport --summarize. Add patterns with[ingest] extra_patterns; disable with[ingest] redact = false - Redaction is pattern-based and best effort. It will miss secrets in unfamiliar formats, and stored rows are redacted once, at ingest, and never rewritten if you change the setting later (export prompts are redacted at send time, and
towit show --redactre-applies the current patterns to what it prints, without changing the stored rows). Usetowit forgetto remove a conversation that contains a secret - Only tool-call stubs (at most 200 characters of a description, command, or path) and truncated error results (at most 300 characters) are stored; tool results and file contents are not archived. A single message is capped at 50,000 characters
towit forget <session-id>,--repo <path|name>, and--folder <path>permanently delete conversations with their messages, search-index entries, topics, and keywords, after a confirmation prompt (or--yes).--repo NAMEmatches a repo key exactly, by its final path component, or by a final component starting withNAME.(worktree directories), so it can match more than one repo; the matched repo keys (up to 10, then a count) are printed before the confirmation prompt, and before deleting even with--yes- A tombstone (the session id and a timestamp only) is kept so that
backfill, the hooks, and the catch-up scan cannot re-ingest a conversation from a transcript that is still on disk - Deletion is physical, not just logical:
PRAGMA secure_delete=ONzeroes freed pages, the FTS5 index is merged (optimize), and aVACUUMplus write-ahead-log truncate follow (towit prune --archivedeletes the same way, without a tombstone). If that cleanup cannot finish,forgetwarns on stderr andtowit forget <session-id>can be re-run to retry - The original transcripts under
~/.claude/projects/are not touched
session_idvalues are validated against a strict alphanumeric pattern (^[a-zA-Z0-9_-]{8,}\Z) before being used in path constructiontranscript_pathvalues fromStopandSessionEndhook payloads, and the path handed to the detached ingest process, are resolved withos.path.realpath()and verified to be children of~/.claude/projects/before any file is read. TheSessionStartcatch-up scan walks~/.claude/projects/itself and uses nothing from the payload- Symlinked JSONL files are excluded from backfill, the catch-up scan, and ingest to prevent traversal outside the expected directory tree
[ingest] foldersrestricts archiving (and LLM indexing) to matching project folders; subagent transcripts are skipped unlessinclude_subagentsis set
- All database queries use parameterized statements (
?placeholders) exclusively - Dynamic WHERE clauses are built only from hardcoded string literals, enforced by a runtime
assert; no user input ever enters the query structure - Full-text search input is never passed to FTS5 as-is: each search term is wrapped into a quoted phrase (embedded quotes doubled) and bound as a single parameter, so operators, column filters, and punctuation are literal and cannot cause syntax errors or alter the query
- The
claudesubprocess is invoked with a list (nevershell=True) - The subprocess environment for indexing and export (the claude calls) is scoped to an explicit prefix allowlist (
HOME,PATH,USER,TMPDIR,TERM,LANG,LC_*,CLAUDE_*,ANTHROPIC_*) to avoid leaking unrelated credentials. towit setup --skill,towit doctorandtowit imploderunclaude plugin ...(list form, user scope, 3-minute timeout, 30 seconds for queries) to install, check and remove the optional Claude Code plugin. They use the same scoped environment as indexing plus exactly these variables, matched by name and only when set:SSH_AUTH_SOCK,HTTP_PROXY,HTTPS_PROXY,ALL_PROXY,NO_PROXY(and their lowercase forms),SSL_CERT_FILEandSSL_CERT_DIR. The marketplace is agitclone from GitHub and may need them to get through an ssh agent, a proxy or a custom CA; no tokens or keys are passed. They never run from a hook. The plugin is pinned to the release tag matching the installed towit, and its skill is guidance only: it tells Claude to treat archived text as untrusted data and never to runforget,pruneorimplodeunless you ask for that actiontowit resumereplaces itself with an interactiveclaude --resumeand keeps your full environment by design; it is not a scoped subprocesstowit export --summarizesends the original transcript to theclaudeCLI at your request, with the same scoped environment as indexing. When[ingest] redactis on (the default) the text is redacted at send time with the same patterns, includingextra_patterns; with it off, the text is sent unchanged.towit export --topic <name> --summarizesends stored summaries, redacted at send time the same way, which also covers rows indexed by 0.8.2 or earlier whose summaries were generated from unredacted transcripts. Redaction is best effort (see Secret Redaction)- Ingest runs
git -C <cwd> rev-parse --git-common-dirto group worktrees of one repo. It is invoked with a list (nevershell=True), with the same scoped environment, a 5-second timeout, and any failure falls back to the working directory
- Writes to
~/.claude/settings.jsonare atomic: a temp file is written and renamed viaos.replace() - The
TOWIT_SETTINGS_PATHoverride is validated to be within~/.claude/or the system temp directory
- The hooks (
Stop,SessionEnd,SessionStart) catch all exceptions and never exit non-zero (to avoid interrupting Claude Code). Work runs in a detached background process, so a slow or failing ingest can never block a session or exceedSessionEnd's time budget; aTOWIT_INDEXINGguard stops towit's ownclaudecalls from triggering the hooks recursively - Errors are logged to
errors.lognext to the config file (default~/.towit/errors.log; followsTOWIT_CONFIG_PATH) (rotating, 100 KB max, 2 backups, owner-only0600) for post-hoc debugging
This is a personal open-source project with no bug bounty program.
Please report security vulnerabilities through GitHub Private Vulnerability Reporting. This keeps the details confidential until a fix is available. Confirmed vulnerabilities will be published as GitHub Security Advisories in the same location.
Please include:
- A description of the vulnerability and its impact
- Steps to reproduce or a minimal proof of concept
- The version or commit hash you tested against
I aim to acknowledge reports within a few days and resolve confirmed issues before the next release.