Privacy Policy
Relevant source files
The following files were used as context for generating this wiki page:
The Token Optimizer project operates on a "local-first" philosophy, ensuring that all data analysis, measurement, and optimization processes remain entirely within the user's local workstation. The system is designed to audit and optimize AI coding assistant context windows without transmitting sensitive information to external servers.
The scope of this policy covers the architecture of the optimization scripts, local data storage practices, and the rigorous credential redaction mechanisms employed to protect developer secrets.
Sources: SECURITY.md:3-10, plugins/token-optimizer/skills/token-optimizer/SKILL.md:1-10
Architecture and Data Flow
Token Optimizer executes as a set of local Python scripts. It does not utilize telemetry, analytics, or phone-home reporting. The primary data flow involves reading local host platform files, processing them via standard libraries, and writing results to local storage.
The diagram shows the 100% local data lifecycle where no data leaves the machine.
Sources: SECURITY.md:12-20, plugins/token-optimizer/skills/token-optimizer/SKILL.md:125-135
Local Data Handling
Data Collection and Storage
Token Optimizer reads session transcripts, configuration files (e.g., settings.json), and project metadata (CLAUDE.md, MEMORY.md) to perform audits. The following table details the types of data stored locally:
| Store | Content Type | Retention Policy |
|---|---|---|
| trends.db | Session aggregates, token counts, cost estimates. | Configurable (default: unlimited) |
| Session Store | File read records, credential-redacted content hashes. | Auto-deleted after 48 hours |
| Checkpoints | Extracted decisions, error snippets, truncated context. | 7 days / max 50 files |
| Tool Archives | Redacted tool outputs for session retrieval. | 24 hours |
| Quality Cache | Per-session quality score snapshots. | 7 days |
Sources: SECURITY.md:27-44
Credential Redaction
A critical privacy feature is the automated redaction of 23 distinct credential patterns. Before writing any data to the local session store or tool archives, the system identifies and replaces sensitive strings with a placeholder.
- Identified Patterns: AWS keys, OpenAI/Anthropic keys, GitHub PATs, Stripe keys, database URIs with passwords, and Google OAuth tokens.
- Replacement Format:
[CREDENTIAL REDACTED: <type>].
Sources: SECURITY.md:104-118
Security Controls and Permissions
The system implements strict file system access controls to ensure that local data remains private to the user account running the optimizer.
File and Directory Permissions
- Directories: Created with mode
0o700(Owner Read/Write/Execute only). - Files: Created with mode
0o600(Owner Read/Write only). - Dashboard Security: The optional dashboard binds only to the loopback address (
127.0.0.1) and requires anX-TO-Tokenheader using a 32-byte cryptographically random secret for authentication.
Sources: SECURITY.md:65-80
Opt-In and Consent Mechanisms
Token Optimizer requires explicit consent before certain data-intensive features are activated. For instance, the "Keep-Warm" feature is opt-in only, specifically targeting API-key-billed users to prevent unexpected costs.
The sequence illustrates the consent gate ensuring users are not enrolled in background features without approval.
Sources: plugins/token-optimizer/skills/token-optimizer/SKILL.md:150-180, SECURITY.md:86-90
Implementation Privacy Safeguards
During the "Phase 4: Implementation" stage, the optimizer generates diffs for user approval before modifying any local configuration files. This prevents the AI from making unvetted changes to the user's environment.
- Backup Generation: Before optimizing
CLAUDE.mdorMEMORY.md, a timestamped backup is created in~/.claude/_backups/. - Diff Presentation: Proposed changes are written to the coordination folder (
COORD_PATH) and presented as a diff. - Permissions Deny: The system encourages the use of
permissions.denyrules to prevent the AI from ever reading sensitive directories like./secrets/or.envfiles.
Sources: plugins/token-optimizer/skills/token-optimizer/references/implementation-playbook.md:10-35, skills/token-optimizer/references/optimization-checklist.md:60-85
Summary
The Token Optimizer Privacy Policy is enforced through a local-only architecture that prioritizes developer security. By utilizing rigorous credential redaction, strict file permissions, and mandatory consent gates, the project ensures that context optimization does not come at the cost of data privacy or secret exposure. All data remains within the user's control and can be completely removed using the purge command.
Sources: SECURITY.md:120-130